From f8563c1667d66cb7cd6904447134cd8e6699b5b0 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 17 Sep 2019 11:28:54 +0200 Subject: [PATCH] account_usability: add ability to search by account code in the bank statement work intf --- account_usability/account.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/account_usability/account.py b/account_usability/account.py index c195aac..f90ef6d 100644 --- a/account_usability/account.py +++ b/account_usability/account.py @@ -6,6 +6,7 @@ from odoo import models, fields, api, _ from odoo.tools import float_compare, float_is_zero from odoo.tools.misc import formatLang from odoo.exceptions import UserError, ValidationError +from odoo.osv import expression from odoo import SUPERUSER_ID import logging @@ -659,3 +660,17 @@ class AccountIncoterms(models.Model): for rec in self: res.append((rec.id, '[%s] %s' % (rec.code, rec.name))) return res + + +class AccountReconciliation(models.AbstractModel): + _inherit = 'account.reconciliation.widget' + + # Add ability to filter by account code in the work interface of the + # bank statement + @api.model + def _domain_move_lines(self, search_str): + str_domain = super(AccountReconciliation, self)._domain_move_lines( + search_str) + account_code_domain = [('account_id.code', '=ilike', search_str + '%')] + str_domain = expression.OR([str_domain, account_code_domain]) + return str_domain