From e7550d2226295128481c904d1997d33bde609e55 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Jan 2013 13:04:05 +0100 Subject: [PATCH 1/8] [FIX] common onchange with voucher --- account_statement_ext/__openerp__.py | 3 ++- account_statement_ext/statement.py | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/account_statement_ext/__openerp__.py b/account_statement_ext/__openerp__.py index 0cac0b66..0ca3951b 100644 --- a/account_statement_ext/__openerp__.py +++ b/account_statement_ext/__openerp__.py @@ -27,7 +27,8 @@ 'complexity': 'normal', 'depends': [ 'account', - 'report_webkit' + 'report_webkit', + 'account_voucher' ], 'description': """ Improve the basic bank statement, by adding various new features, diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index b77e77ca..6940d16a 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -549,7 +549,7 @@ class AccountBankSatementLine(Model): res['account_id'] = receiv_account return res - def onchange_partner_id(self, cr, uid, ids, partner_id, profile_id, context=None): + def onchange_partner_id(self, cr, uid, ids, partner_id, profile_id=None, context=None): """ Override of the basic method as we need to pass the profile_id in the on_change_type call. @@ -569,8 +569,9 @@ class AccountBankSatementLine(Model): type = 'customer' res_type = self.onchange_type(cr, uid, ids, partner_id, type, profile_id, context=context) # Chg if res_type['value'] and res_type['value'].get('account_id', False): - return {'value': {'type': type, 'account_id': res_type['value']['account_id']}} - return {'value': {'type': type}} + return {'value': {'type': type, 'account_id': res_type['value']['account_id'], + 'voucher_id': False}} + return {'value': {'type': type}} def onchange_type(self, cr, uid, line_id, partner_id, type, profile_id, context=None): """ From bd1438f301d4d10c29dc43e778103286c0a08913 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Fri, 1 Feb 2013 08:30:39 +0100 Subject: [PATCH 2/8] [REF] small reindent of patch --- account_statement_ext/statement.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index 6940d16a..965957bd 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -569,9 +569,10 @@ class AccountBankSatementLine(Model): type = 'customer' res_type = self.onchange_type(cr, uid, ids, partner_id, type, profile_id, context=context) # Chg if res_type['value'] and res_type['value'].get('account_id', False): - return {'value': {'type': type, 'account_id': res_type['value']['account_id'], + return {'value': {'type': type, + 'account_id': res_type['value']['account_id'], 'voucher_id': False}} - return {'value': {'type': type}} + return {'value': {'type': type}} def onchange_type(self, cr, uid, line_id, partner_id, type, profile_id, context=None): """ From c348eb31e30a7bf0ceccd27054ef538f298cd171 Mon Sep 17 00:00:00 2001 From: Joel Grand-Guillaume Date: Fri, 1 Feb 2013 09:44:05 +0100 Subject: [PATCH 3/8] [IMP] Added the voucher period computation in the account_statement_ext module while it know depends on the account_voucher module. [MIGR] Mark the account_statement_ext_voucher as deprecated is it is no more used. --- account_statement_ext/__init__.py | 1 + account_statement_ext/__openerp__.py | 2 ++ account_statement_ext_voucher/__init__.py | 2 -- account_statement_ext_voucher/__openerp__.py | 10 +++++++--- .../statement_voucher_view.xml | 17 ----------------- 5 files changed, 10 insertions(+), 22 deletions(-) delete mode 100644 account_statement_ext_voucher/statement_voucher_view.xml diff --git a/account_statement_ext/__init__.py b/account_statement_ext/__init__.py index a2a4b3ca..7194652a 100644 --- a/account_statement_ext/__init__.py +++ b/account_statement_ext/__init__.py @@ -22,3 +22,4 @@ import statement import report import account +import voucher \ No newline at end of file diff --git a/account_statement_ext/__openerp__.py b/account_statement_ext/__openerp__.py index 0ca3951b..6e6bcbb1 100644 --- a/account_statement_ext/__openerp__.py +++ b/account_statement_ext/__openerp__.py @@ -63,6 +63,8 @@ all the erronous line in a same popup instead of raising and crashing on every step. 4) Remove the period on the bank statement, and compute it for each line based on their date instead. + It also add this feature in the voucher in order to compute the period correctly. + 5) Cancelling a bank statement is much more easy and will cancel all related entries, unreconcile them, and finally delete them. diff --git a/account_statement_ext_voucher/__init__.py b/account_statement_ext_voucher/__init__.py index 3ddc934d..50fd0bc5 100644 --- a/account_statement_ext_voucher/__init__.py +++ b/account_statement_ext_voucher/__init__.py @@ -18,5 +18,3 @@ # along with this program. If not, see . # ############################################################################## - -import statement_voucher diff --git a/account_statement_ext_voucher/__openerp__.py b/account_statement_ext_voucher/__openerp__.py index 059e4163..e0a22552 100644 --- a/account_statement_ext_voucher/__openerp__.py +++ b/account_statement_ext_voucher/__openerp__.py @@ -30,8 +30,12 @@ 'account_voucher' ], 'description': """ - This module is only needed when using account_bank_statement_ext with voucher in order to compute the period + This module is deprecated. It was only needed when using account_bank_statement_ext with voucher in order to compute the period correctly. This is mainly because with account_bank_statement_ext, the period is computed for each line. + + Now, we include this in the account_statement_ext module and added a dependencies on account_voucher (mainly cause we can't get + rid of the voucher in version 7.0). + """, 'website': 'http://www.camptocamp.com', 'init_xml': [], @@ -40,9 +44,9 @@ ], 'demo_xml': [], 'test': [], - 'installable': True, + 'installable': False, 'images': [], - 'auto_install': True, + 'auto_install': False, 'license': 'AGPL-3', } diff --git a/account_statement_ext_voucher/statement_voucher_view.xml b/account_statement_ext_voucher/statement_voucher_view.xml deleted file mode 100644 index 25160599..00000000 --- a/account_statement_ext_voucher/statement_voucher_view.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - account.bank.statement.invoice.form.inherit - account.bank.statement - form - - - - - - - - - From 1510eb48a5a31eb4c4ef8d08d86463a7381dc68f Mon Sep 17 00:00:00 2001 From: Joel Grand-Guillaume Date: Fri, 1 Feb 2013 10:22:30 +0100 Subject: [PATCH 4/8] [ADD] Missing voucher.py file... Better with it, sorry. --- account_statement_ext/voucher.py | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 account_statement_ext/voucher.py diff --git a/account_statement_ext/voucher.py b/account_statement_ext/voucher.py new file mode 100644 index 00000000..2aeee0ac --- /dev/null +++ b/account_statement_ext/voucher.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Joel Grand-Guillaume +# Copyright 2011-2012 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.orm import Model + + +class AccountVoucher(Model): + + _inherit = 'account.voucher' + + def _get_period(self, cr, uid, context=None): + """If period not in context, take it from the move lines""" + if context is None: + context = {} + if not context.get('period_id') and context.get('move_line_ids'): + res = self.pool.get('account.move.line').browse( + cr, uid, context.get('move_line_ids'), context=context)[0].period_id.id + context['period_id'] = res + elif context.get('date'): + periods = self.pool.get('account.period').find( + cr, uid, dt=context['date'], context=context) + if periods: + context['period_id'] = periods[0] + return super(AccountVoucher, self)._get_period(cr, uid, context) + + def create(self, cr, uid, values, context=None): + """If no period defined in values, ask it from moves.""" + if context is None: + context = {} + if not values.get('period_id'): + ctx = dict(context, date=values.get('date')) + values['period_id'] = self._get_period(cr, uid, ctx) + return super(AccountVoucher, self).create(cr, uid, values, context) From 263bdc65f593699e1b7985b0039d1145aaac21b7 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 4 Feb 2013 15:58:11 +0100 Subject: [PATCH 5/8] [TYPO] --- account_statement_ext/__openerp__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_statement_ext/__openerp__.py b/account_statement_ext/__openerp__.py index 6e6bcbb1..fb8456be 100644 --- a/account_statement_ext/__openerp__.py +++ b/account_statement_ext/__openerp__.py @@ -63,8 +63,8 @@ all the erronous line in a same popup instead of raising and crashing on every step. 4) Remove the period on the bank statement, and compute it for each line based on their date instead. - It also add this feature in the voucher in order to compute the period correctly. - + It also adds this feature in the voucher in order to compute the period correctly. + 5) Cancelling a bank statement is much more easy and will cancel all related entries, unreconcile them, and finally delete them. From 85c16d0ba9ec533f6bf2f404422fd3f307b0492a Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 4 Feb 2013 16:00:18 +0100 Subject: [PATCH 6/8] [FIX] version number --- account_statement_ext/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_statement_ext/__openerp__.py b/account_statement_ext/__openerp__.py index fb8456be..ef3f0743 100644 --- a/account_statement_ext/__openerp__.py +++ b/account_statement_ext/__openerp__.py @@ -20,7 +20,7 @@ ############################################################################## {'name': "Bank statement extension and profiles", - 'version': '1.1', + 'version': '1.2.0', 'author': 'Camptocamp', 'maintainer': 'Camptocamp', 'category': 'Finance', From 6d085182ebe1153ce35766642754effde1d7b849 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 4 Feb 2013 16:12:37 +0100 Subject: [PATCH 7/8] [IMP] dead code --- account_statement_ext/voucher.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/account_statement_ext/voucher.py b/account_statement_ext/voucher.py index 2aeee0ac..493b0409 100644 --- a/account_statement_ext/voucher.py +++ b/account_statement_ext/voucher.py @@ -28,8 +28,6 @@ class AccountVoucher(Model): def _get_period(self, cr, uid, context=None): """If period not in context, take it from the move lines""" - if context is None: - context = {} if not context.get('period_id') and context.get('move_line_ids'): res = self.pool.get('account.move.line').browse( cr, uid, context.get('move_line_ids'), context=context)[0].period_id.id From ad315ae4c8efc0b9dcde37cae36f56a1147deb82 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 4 Feb 2013 16:16:28 +0100 Subject: [PATCH 8/8] [FIX] copyright year --- account_statement_ext/__openerp__.py | 2 +- account_statement_ext/voucher.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/account_statement_ext/__openerp__.py b/account_statement_ext/__openerp__.py index ef3f0743..f6b31497 100644 --- a/account_statement_ext/__openerp__.py +++ b/account_statement_ext/__openerp__.py @@ -2,7 +2,7 @@ ############################################################################## # # Author: Nicolas Bessi, Joel Grand-Guillaume -# Copyright 2011-2012 Camptocamp SA +# Copyright 2011-2013 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 diff --git a/account_statement_ext/voucher.py b/account_statement_ext/voucher.py index 493b0409..9c66140c 100644 --- a/account_statement_ext/voucher.py +++ b/account_statement_ext/voucher.py @@ -2,7 +2,7 @@ ############################################################################## # # Author: Joel Grand-Guillaume -# Copyright 2011-2012 Camptocamp SA +# Copyright 2011-2013 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