diff --git a/base_transaction_id/models/__init__.py b/base_transaction_id/models/__init__.py index df7f9be0..e7f82dba 100644 --- a/base_transaction_id/models/__init__.py +++ b/base_transaction_id/models/__init__.py @@ -4,3 +4,4 @@ from . import invoice from . import sale from . import account_move +from . import account_bank_statement_line diff --git a/base_transaction_id/models/account_bank_statement_line.py b/base_transaction_id/models/account_bank_statement_line.py new file mode 100644 index 00000000..bfe96543 --- /dev/null +++ b/base_transaction_id/models/account_bank_statement_line.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# © 2016 Yannick Vaucher +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).- +from openerp import api, models + + +class AccountBankStatementLine(models.Model): + + _inherit = 'account.bank.statement.line' + + @api.multi + def get_reconciliation_proposition(self, excluded_ids=None): + """ Look for transaction_ref to give them as proposition move line """ + if self.name: + # If the transaction has no partner, look for match in payable and + # receivable account anyway + overlook_partner = not self.partner_id + domain = [('transaction_ref', 'ilike', self.name)] + match_recs = self.get_move_lines_for_reconciliation( + excluded_ids=excluded_ids, limit=2, additional_domain=domain, + overlook_partner=overlook_partner) + if match_recs and len(match_recs) == 1: + return match_recs + _super = super(AccountBankStatementLine, self) + return _super.get_reconciliation_proposition(excluded_ids=excluded_ids)