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.
 
 
 
 
 

22 lines
789 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})
if self.payment_id and self.payment_id.state == 'reconciled':
self.payment_id.state = 'posted'
elif vals.get("statement_date"):
vals.update({"reconciled": True})
if self.payment_id:
self.payment_id.state = 'reconciled'
res = super(AccountMoveLine, self).write(vals)
return res