Update rent_payment.py
This commit is contained in:
parent
d1e339ca0b
commit
69fac13684
|
|
@ -58,6 +58,13 @@ class RentPayment(models.Model):
|
|||
for rec in self:
|
||||
if rec.contract_id:
|
||||
rec.renter_id = rec.contract_id.partner_id.id
|
||||
@api.depends('invoice_id')
|
||||
def _compute_renter(self):
|
||||
for rec in self:
|
||||
if rec.invoice_id and rec.invoice_id.payment_state in ['paid', 'in_payment']:
|
||||
rec.write({'state': 'paid','paid_date':rec.invoice_id.payment_id.date})
|
||||
payment_obj = self.env['account.payment'].search([('ref','=',rec.invoice_id.name)],limit=1)
|
||||
rec.paid_date=payment_obj.date
|
||||
|
||||
def read(self, records):
|
||||
res = super(RentPayment, self).read(records)
|
||||
|
|
|
|||
Loading…
Reference in New Issue