You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

24 lines
880 B

# -*- coding: utf-8 -*-
from odoo import api, fields, models, _
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
bank_statement_id = fields.Many2one('bank.statement', 'Bank Statement', copy=False)
statement_date = fields.Date('Bank.St Date', copy=False)
@api.multi
def write(self, vals):
if not vals.get("statement_date"):
vals.update({"reconciled": False})
for record in self:
if record.payment_id and record.payment_id.state == 'reconciled':
record.payment_id.state = 'posted'
elif vals.get("statement_date"):
vals.update({"reconciled": True})
for record in self:
if record.payment_id:
record.payment_id.state = 'reconciled'
res = super(AccountMoveLine, self).write(vals)
return res