Update rent_payment.py

This commit is contained in:
zainab2097 2024-08-04 17:18:47 +03:00 committed by GitHub
parent 52cf144531
commit dc301d306c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -57,11 +57,13 @@ class RentPayment(models.Model):
for rec in self:
if rec.invoice_id.payment_state in ['paid', 'in_payment']:
rec.write({'state': 'paid'})
rec.paid_date = rec.invoice_id.payment_id.date or False
payment_obj = self.env['account.payment'].search([('ref','=',invoice_id.name)],limit=1)
rec.paid_date=payment_obj.date
return res
@api.depends('invoice_id', 'invoice_id.state', 'invoice_id.amount_residual')
@api.depends('invoice_id', 'invoice_id.state','invoice_id.payment_state', 'invoice_id.amount_residual')
def get_invoice_state(self):
self.paid = False
for rec in self:
@ -70,6 +72,8 @@ class RentPayment(models.Model):
rec.paid = True
if rec.invoice_id.payment_state in ['paid','in_payment']:
rec.write({'state': 'paid'})
payment_obj = self.env['account.payment'].search([('ref','=',invoice_id.name)],limit=1)
rec.paid_date=payment_obj.date
def _prepare_invoice_values(self, payment, amount):