From 1b38e23d8285017b074e513db37b4e08e24a2fc1 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Fri, 10 Oct 2014 16:31:51 +0200 Subject: [PATCH 1/2] Allow the new bank statement reconciliation to search in transaction_ref Require https://github.com/odoo/odoo/pull/3025 to be merged to work! --- base_transaction_id/__init__.py | 1 + base_transaction_id/account_bank_statement.py | 61 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 base_transaction_id/account_bank_statement.py diff --git a/base_transaction_id/__init__.py b/base_transaction_id/__init__.py index ef5622e1..7241064a 100644 --- a/base_transaction_id/__init__.py +++ b/base_transaction_id/__init__.py @@ -23,3 +23,4 @@ from . import invoice from . import sale from . import stock from . import account_move +from . import account_bank_statement diff --git a/base_transaction_id/account_bank_statement.py b/base_transaction_id/account_bank_statement.py new file mode 100644 index 00000000..c1ad0c74 --- /dev/null +++ b/base_transaction_id/account_bank_statement.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Guewen Baconnier +# Copyright 2014 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.osv import orm + + +class account_bank_statement_line(orm.Model): + + _inherit = 'account.bank.statement.line' + + def _domain_move_lines_for_reconciliation(self, cr, uid, st_line, + excluded_ids=None, str=False, + additional_domain=None, + context=None): + _super = super(account_bank_statement_line, self) + _get_domain = _super._domain_move_lines_for_reconciliation + domain = _get_domain(cr, uid, st_line, excluded_ids=excluded_ids, + str=str, additional_domain=additional_domain, + context=context) + if not str and str != '/': + return domain + domain = domain[:] + domain.insert(-1, '|') + domain.append(('transaction_ref', 'ilike', str)) + return domain + + def _domain_reconciliation_proposition(self, cr, uid, st_line, + excluded_ids=None, context=None): + _super = super(account_bank_statement_line, self) + _get_domain = _super._domain_reconciliation_proposition + domain = _get_domain(cr, uid, st_line, excluded_ids=excluded_ids, + context=context) + new_domain = [] + for criterium in domain: + if len(criterium) == 3: + field, op, value = criterium + if (field, op) == ('ref', '='): + new_domain += [ + '|', + ('transaction_ref', '=', value), + ] + new_domain.append(criterium) + return new_domain From 842c3ddabc4a70372b1da15ea5328552134b1deb Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Wed, 3 Dec 2014 14:14:44 +0100 Subject: [PATCH 2/2] Singular of criteria: criterion --- base_transaction_id/account_bank_statement.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/base_transaction_id/account_bank_statement.py b/base_transaction_id/account_bank_statement.py index c1ad0c74..e9d6346b 100644 --- a/base_transaction_id/account_bank_statement.py +++ b/base_transaction_id/account_bank_statement.py @@ -49,13 +49,13 @@ class account_bank_statement_line(orm.Model): domain = _get_domain(cr, uid, st_line, excluded_ids=excluded_ids, context=context) new_domain = [] - for criterium in domain: - if len(criterium) == 3: - field, op, value = criterium + for criterion in domain: + if len(criterion) == 3: + field, op, value = criterion if (field, op) == ('ref', '='): new_domain += [ '|', ('transaction_ref', '=', value), ] - new_domain.append(criterium) + new_domain.append(criterion) return new_domain