Allow the new bank statement reconciliation to search in transaction_ref
Require https://github.com/odoo/odoo/pull/3025 to be merged to work!pull/524/head
parent
26ac1f9401
commit
80a2bc9635
|
@ -23,3 +23,4 @@ from . import invoice
|
||||||
from . import sale
|
from . import sale
|
||||||
from . import stock
|
from . import stock
|
||||||
from . import account_move
|
from . import account_move
|
||||||
|
from . import account_bank_statement
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
'category': 'Hidden/Dependency',
|
'category': 'Hidden/Dependency',
|
||||||
'complexity': 'easy',
|
'complexity': 'easy',
|
||||||
'depends': [
|
'depends': [
|
||||||
|
'account',
|
||||||
'stock_account',
|
'stock_account',
|
||||||
'sale_stock',
|
'sale_stock',
|
||||||
],
|
],
|
||||||
|
@ -46,6 +47,7 @@
|
||||||
'invoice_view.xml',
|
'invoice_view.xml',
|
||||||
'sale_view.xml',
|
'sale_view.xml',
|
||||||
'account_move_line_view.xml',
|
'account_move_line_view.xml',
|
||||||
|
'views/base_transaction_id.xml',
|
||||||
],
|
],
|
||||||
'test': [],
|
'test': [],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
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 criterion in domain:
|
||||||
|
if len(criterion) == 3:
|
||||||
|
field, op, value = criterion
|
||||||
|
if (field, op) == ('ref', '='):
|
||||||
|
new_domain += [
|
||||||
|
'|',
|
||||||
|
('transaction_ref', '=', value),
|
||||||
|
]
|
||||||
|
new_domain.append(criterion)
|
||||||
|
return new_domain
|
|
@ -35,3 +35,22 @@ class account_move_line(orm.Model):
|
||||||
default['transaction_ref'] = False
|
default['transaction_ref'] = False
|
||||||
_super = super(account_move_line, self)
|
_super = super(account_move_line, self)
|
||||||
return _super.copy_data(cr, uid, id, default=default, context=context)
|
return _super.copy_data(cr, uid, id, default=default, context=context)
|
||||||
|
|
||||||
|
def prepare_move_lines_for_reconciliation_widget(self, cr, uid, lines,
|
||||||
|
target_currency=False,
|
||||||
|
target_date=False,
|
||||||
|
context=None):
|
||||||
|
_super = super(account_move_line, self)
|
||||||
|
prepare = _super.prepare_move_lines_for_reconciliation_widget
|
||||||
|
prepared_lines = []
|
||||||
|
for line in lines:
|
||||||
|
# The super method loop over the lines and returns a list of
|
||||||
|
# prepared lines. Here we'll have 1 line per call to super.
|
||||||
|
# If we called super on the whole list, we would need to
|
||||||
|
# browse again the lines, or match the 'lines' vs
|
||||||
|
# 'prepared_lines' to update the transaction_ref.
|
||||||
|
vals = prepare(cr, uid, [line], target_currency=target_currency,
|
||||||
|
target_date=target_date, context=context)[0]
|
||||||
|
vals['transaction_ref'] = line.transaction_ref
|
||||||
|
prepared_lines.append(vals)
|
||||||
|
return prepared_lines
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
openerp.base_transaction_id = function (instance) {
|
||||||
|
|
||||||
|
instance.web.account.bankStatementReconciliationLine.include({
|
||||||
|
decorateMoveLine: function(line, currency_id) {
|
||||||
|
this._super(line, currency_id);
|
||||||
|
if (line.transaction_ref) {
|
||||||
|
line.q_label += ' (' + line.transaction_ref + ')';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
<template id="assets_backend" name="account assets" inherit_id="web.assets_backend">
|
||||||
|
<xpath expr="." position="inside">
|
||||||
|
<script type="text/javascript" src="/base_transaction_id/static/src/js/account_widgets.js"></script>
|
||||||
|
</xpath>
|
||||||
|
</template>
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
|
|
Loading…
Reference in New Issue