From 219f9c8603d91cc61abe70e062005e3e4a339199 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Wed, 5 Jun 2013 14:34:24 +0200 Subject: [PATCH 01/37] [FIX] Adapt sizes of partner fields on link partner wizard [IMP] Show transaction info in partner link wizard [IMP] Show message on transaction wizard [FIX] Properly handle stringified address list in link partner wizard [FIX] Transfer city from transaction in link partner wizard [FIX] Allow user to set is_company in link partner wizard [FIX] Remove void statement to get partner's columns --- account_banking/banking_import_transaction.py | 6 +-- .../wizard/banking_transaction_wizard.py | 4 ++ .../wizard/banking_transaction_wizard.xml | 3 +- account_banking/wizard/link_partner.py | 39 +++++++++++++++---- account_banking/wizard/link_partner.xml | 15 +++++-- 5 files changed, 53 insertions(+), 14 deletions(-) diff --git a/account_banking/banking_import_transaction.py b/account_banking/banking_import_transaction.py index 75572b689..d157c5161 100644 --- a/account_banking/banking_import_transaction.py +++ b/account_banking/banking_import_transaction.py @@ -1314,9 +1314,9 @@ class banking_import_transaction(orm.Model): 'exchange_rate': fields.float('exchange_rate'), 'transferred_amount': fields.float('transferred_amount'), 'message': fields.char('message', size=1024), - 'remote_owner': fields.char('remote_owner', size=24), - 'remote_owner_address': fields.char('remote_owner_address', size=24), - 'remote_owner_city': fields.char('remote_owner_city', size=24), + 'remote_owner': fields.char('remote_owner', size=128), + 'remote_owner_address': fields.char('remote_owner_address', size=256), + 'remote_owner_city': fields.char('remote_owner_city', size=128), 'remote_owner_postalcode': fields.char('remote_owner_postalcode', size=24), 'remote_owner_country_code': fields.char('remote_owner_country_code', size=24), 'remote_owner_custno': fields.char('remote_owner_custno', size=24), diff --git a/account_banking/wizard/banking_transaction_wizard.py b/account_banking/wizard/banking_transaction_wizard.py index 9c9c283c7..bc667f179 100644 --- a/account_banking/wizard/banking_transaction_wizard.py +++ b/account_banking/wizard/banking_transaction_wizard.py @@ -352,6 +352,10 @@ class banking_transaction_wizard(orm.TransientModel): 'ref': fields.related( 'statement_line_id', 'ref', type='char', size=32, string="Reference", readonly=True), + 'message': fields.related( + 'statement_line_id', 'import_transaction_id', 'message', + type='char', size=1024, + string="Message", readonly=True), 'partner_id': fields.related( 'statement_line_id', 'partner_id', type='many2one', relation='res.partner', diff --git a/account_banking/wizard/banking_transaction_wizard.xml b/account_banking/wizard/banking_transaction_wizard.xml index a59861d39..e1d0638b7 100644 --- a/account_banking/wizard/banking_transaction_wizard.xml +++ b/account_banking/wizard/banking_transaction_wizard.xml @@ -18,8 +18,9 @@ - + + diff --git a/account_banking/wizard/link_partner.py b/account_banking/wizard/link_partner.py index c4d9108f6..fc4f83acd 100644 --- a/account_banking/wizard/link_partner.py +++ b/account_banking/wizard/link_partner.py @@ -22,6 +22,7 @@ from openerp.osv import orm, fields from openerp.tools.translate import _ from openerp.addons.account_banking.wizard import banktools +import ast class link_partner(orm.TransientModel): _name = 'banking.link_partner' @@ -37,6 +38,16 @@ class link_partner(orm.TransientModel): 'statement_line_id': fields.many2one( 'account.bank.statement.line', 'Statement line', required=True), + 'amount': fields.related( + 'statement_line_id', 'amount', type='float', + string="Amount", readonly=True), + 'ref': fields.related( + 'statement_line_id', 'ref', type='char', size=32, + string="Reference", readonly=True), + 'message': fields.related( + 'statement_line_id', 'import_transaction_id', 'message', + type='char', size=1024, + string="Message", readonly=True), 'remote_account': fields.char( 'Account number', size=24, readonly=True), # Partner values @@ -50,6 +61,11 @@ class link_partner(orm.TransientModel): 'phone': fields.char('Phone', size=64), 'fax': fields.char('Fax', size=64), 'mobile': fields.char('Mobile', size=64), + 'is_company': fields.boolean('Is a Company'), + } + + _defaults = { + 'is_company': True, } def create(self, cr, uid, vals, context=None): @@ -79,9 +95,19 @@ class link_partner(orm.TransientModel): if 'customer' not in vals and statement_line.amount > 0: vals['customer'] = True - if not vals.get('street'): - vals['street'] = transaction.remote_owner_address - if not vals.get('street'): + address_list = [] + try: + address_list = ast.literal_eval( + transaction.remote_owner_address or []) + except ValueError: + pass + if address_list and not vals.get('street'): + vals['street'] = address_list.pop(0) + if address_list and not vals.get('street2'): + vals['street2'] = address_list.pop(0) + if transaction.remote_owner_postalcode and not vals.get('zip'): + vals['zip'] = transaction.remote_owner_postalcode + if transaction.remote_owner_city and not vals.get('city'): vals['city'] = transaction.remote_owner_city if not vals.get('country_id'): vals['country_id'] = banktools.get_country_id( @@ -101,10 +127,12 @@ class link_partner(orm.TransientModel): :param wizard: read record of wizard (with load='_classic_write') :param values: the dictionary of partner values that will be updated """ - for field in ['name', + for field in ['is_company', + 'name', 'street', 'street2', 'zip', + 'city', 'country_id', 'state_id', 'phone', @@ -126,10 +154,7 @@ class link_partner(orm.TransientModel): else: wiz_read = self.read( cr, uid, ids[0], context=context, load='_classic_write') - partner_fields = self.pool.get( - 'res.partner')._columns.keys() partner_vals = { - 'is_company': True, 'type': 'default', } self.update_partner_values( diff --git a/account_banking/wizard/link_partner.xml b/account_banking/wizard/link_partner.xml index c9c2d21c9..bf0c46a67 100644 --- a/account_banking/wizard/link_partner.xml +++ b/account_banking/wizard/link_partner.xml @@ -7,15 +7,24 @@ banking.link_partner
- + + + + + + + - + + + + attrs="{'invisible': [('partner_id', '!=', False)]}" + col="4"> From e7f414e38a14d9812511efb8f082236ae31efd9f Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Wed, 24 Jul 2013 16:52:03 +0200 Subject: [PATCH 02/37] [FIX] Fixed migration scripts after testing --- .../post-set-statement-line-state.py | 0 .../migrations/7.0.0.1/pre-migration.py | 33 ++++++++++++++++ .../post-fill-ir_model_id.py | 0 .../post-set-payment-order-type.py | 0 .../migrations/7.0.2/post-migration.py | 38 +++++++++++++++++++ .../migrations/7.0.2/pre-migration.py | 14 ++----- 6 files changed, 75 insertions(+), 10 deletions(-) rename account_banking/migrations/{0.1.81 => 6.1.0.1.81}/post-set-statement-line-state.py (100%) create mode 100644 account_banking/migrations/7.0.0.1/pre-migration.py rename account_banking_nl_clieop/migrations/{0.63 => 6.1.0.63}/post-fill-ir_model_id.py (100%) rename account_banking_nl_clieop/migrations/{0.64 => 6.1.0.64}/post-set-payment-order-type.py (100%) create mode 100644 account_direct_debit/migrations/7.0.2/post-migration.py diff --git a/account_banking/migrations/0.1.81/post-set-statement-line-state.py b/account_banking/migrations/6.1.0.1.81/post-set-statement-line-state.py similarity index 100% rename from account_banking/migrations/0.1.81/post-set-statement-line-state.py rename to account_banking/migrations/6.1.0.1.81/post-set-statement-line-state.py diff --git a/account_banking/migrations/7.0.0.1/pre-migration.py b/account_banking/migrations/7.0.0.1/pre-migration.py new file mode 100644 index 000000000..e12284d0e --- /dev/null +++ b/account_banking/migrations/7.0.0.1/pre-migration.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Therp BV (). +# All Rights Reserved +# +# 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 . +# +############################################################################## + +def migrate(cr, version): + if not version: + return + + # workflow state moved to another, new module + cr.execute( + """ + UPDATE ir_model_data + SET module = 'account_banking_payment' + WHERE name = 'trans_done_sent' + AND module = 'account_direct_debit' + """) diff --git a/account_banking_nl_clieop/migrations/0.63/post-fill-ir_model_id.py b/account_banking_nl_clieop/migrations/6.1.0.63/post-fill-ir_model_id.py similarity index 100% rename from account_banking_nl_clieop/migrations/0.63/post-fill-ir_model_id.py rename to account_banking_nl_clieop/migrations/6.1.0.63/post-fill-ir_model_id.py diff --git a/account_banking_nl_clieop/migrations/0.64/post-set-payment-order-type.py b/account_banking_nl_clieop/migrations/6.1.0.64/post-set-payment-order-type.py similarity index 100% rename from account_banking_nl_clieop/migrations/0.64/post-set-payment-order-type.py rename to account_banking_nl_clieop/migrations/6.1.0.64/post-set-payment-order-type.py diff --git a/account_direct_debit/migrations/7.0.2/post-migration.py b/account_direct_debit/migrations/7.0.2/post-migration.py new file mode 100644 index 000000000..a6ec3af59 --- /dev/null +++ b/account_direct_debit/migrations/7.0.2/post-migration.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Therp BV (). +# +# All other contributions are (C) by their respective contributors +# +# All Rights Reserved +# +# 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 . +# +############################################################################## + +def migrate(cr, version): + if not version: + return + cr.execute( + """ + UPDATE payment_line + SET transit_move_line_id = banking_addons_61_debit_move_line_id + """) + cr.execute( + """ + ALTER TABLE "payment_line" + DROP COLUMN "banking_addons_61_debit_move_line_id" + """ + ) diff --git a/account_direct_debit/migrations/7.0.2/pre-migration.py b/account_direct_debit/migrations/7.0.2/pre-migration.py index 3dd113401..a167bca53 100644 --- a/account_direct_debit/migrations/7.0.2/pre-migration.py +++ b/account_direct_debit/migrations/7.0.2/pre-migration.py @@ -22,6 +22,9 @@ # ############################################################################## +import logging +logger = logging.getLogger() + def rename_columns(cr, column_spec): """ Rename table columns. Taken from OpenUpgrade. @@ -41,17 +44,8 @@ def migrate(cr, version): if not version: return - # workflow state moved to another module - cr.execute( - """ - UPDATE ir_model_data - SET module = 'account_banking_payment' - WHERE name = 'trans_done_sent' - AND module = 'account_direct_debit' - """) - # rename field debit_move_line_id rename_columns(cr, { 'payment_line': [ - ('debit_move_line_id', 'transit_move_line_id'), + ('debit_move_line_id', 'banking_addons_61_debit_move_line_id'), ]}) From f8f0ae56ef960f26a56c47551885a3cbf8f2ed17 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Wed, 24 Jul 2013 16:57:44 +0200 Subject: [PATCH 03/37] [ADD] Module base_iban_bic_not_required --- base_iban_bic_not_required/__init__.py | 1 + base_iban_bic_not_required/__openerp__.py | 44 +++++++++++++++++++ base_iban_bic_not_required/model/__init__.py | 1 + .../model/res_partner_bank.py | 37 ++++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 base_iban_bic_not_required/__init__.py create mode 100644 base_iban_bic_not_required/__openerp__.py create mode 100644 base_iban_bic_not_required/model/__init__.py create mode 100644 base_iban_bic_not_required/model/res_partner_bank.py diff --git a/base_iban_bic_not_required/__init__.py b/base_iban_bic_not_required/__init__.py new file mode 100644 index 000000000..16e8b082f --- /dev/null +++ b/base_iban_bic_not_required/__init__.py @@ -0,0 +1 @@ +import model diff --git a/base_iban_bic_not_required/__openerp__.py b/base_iban_bic_not_required/__openerp__.py new file mode 100644 index 000000000..76497fccc --- /dev/null +++ b/base_iban_bic_not_required/__openerp__.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Therp BV (). +# All Rights Reserved +# +# 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 . +# +############################################################################## + +{ + 'name': 'IBAN - Bic not required', + 'version': '0.1', + 'license': 'AGPL-3', + 'author': 'Banking addons community', + 'website': 'https://launchpad.net/banking-addons', + 'category': 'Banking addons', + 'depends': [ + 'base_iban', + ], + 'description': ''' +The account_iban module in OpenERP 6.1 mandates the presence of a BIC +code on an IBAN account number through a constraint. However, as of +Februari 2012 there is a resolution from the EU that drops this requirement +(see section 8 of [1]). This module reverts the constraint on BICs from the +base_iban module. + +See also https://bugs.launchpad.net/openobject-addons/+bug/933472 + +[1] http://www.europarl.europa.eu/sides/getDoc.do?pubRef=-//EP//TEXT+TA+P7-TA-2012-0037+0+DOC+XML+V0//EN&language=EN#BKMD-9 + ''', + 'installable': True, +} diff --git a/base_iban_bic_not_required/model/__init__.py b/base_iban_bic_not_required/model/__init__.py new file mode 100644 index 000000000..3f2925496 --- /dev/null +++ b/base_iban_bic_not_required/model/__init__.py @@ -0,0 +1 @@ +import res_partner_bank diff --git a/base_iban_bic_not_required/model/res_partner_bank.py b/base_iban_bic_not_required/model/res_partner_bank.py new file mode 100644 index 000000000..c1018c6c3 --- /dev/null +++ b/base_iban_bic_not_required/model/res_partner_bank.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Therp BV (). +# All Rights Reserved +# +# 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 res_partner_bank(orm.Model): + _inherit = 'res.partner.bank' + + def _check_bank(self, cr, uid, ids, context=None): + #suppress base_iban's constraint to enforce BICs for IBANs + #workaround for lp:933472 + return True + + _constraints = [ + # Cannot have this as a constraint as it is rejecting valid numbers from GB and DE + # It works much better without this constraint! + #(check_iban, _("The IBAN number doesn't seem to be correct"), ["acc_number"]) + (_check_bank, '\nPlease define BIC/Swift code on bank for bank type IBAN Account to make valid payments', ['bic']) + ] From eadab75188d90eb0310bff187d5ff5959ac043d4 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Wed, 24 Jul 2013 20:34:44 +0200 Subject: [PATCH 04/37] [FIX] OpenERP version --- base_iban_bic_not_required/__openerp__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base_iban_bic_not_required/__openerp__.py b/base_iban_bic_not_required/__openerp__.py index 76497fccc..08695e9da 100644 --- a/base_iban_bic_not_required/__openerp__.py +++ b/base_iban_bic_not_required/__openerp__.py @@ -30,10 +30,10 @@ 'base_iban', ], 'description': ''' -The account_iban module in OpenERP 6.1 mandates the presence of a BIC +The account_iban module in OpenERP mandates the presence of a BIC code on an IBAN account number through a constraint. However, as of Februari 2012 there is a resolution from the EU that drops this requirement -(see section 8 of [1]). This module reverts the constraint on BICs from the +(see section 8 of [1]). This module reverts the constraint on BICs in the base_iban module. See also https://bugs.launchpad.net/openobject-addons/+bug/933472 From a45933120bec59c5d1541687219ce03fb77423c5 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Wed, 24 Jul 2013 23:12:42 +0200 Subject: [PATCH 05/37] [FIX] Left-over field references from former refactoring --- account_banking/banking_import_transaction.py | 2 -- account_banking/wizard/banking_transaction_wizard.py | 7 ------- .../view/banking_transaction_wizard.xml | 2 +- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/account_banking/banking_import_transaction.py b/account_banking/banking_import_transaction.py index 79801c84e..d01dd1df8 100644 --- a/account_banking/banking_import_transaction.py +++ b/account_banking/banking_import_transaction.py @@ -1211,8 +1211,6 @@ class banking_import_transaction(orm.Model): 'match_type', 'move_line_id', 'invoice_id', - 'manual_invoice_id', - 'manual_move_line_id', ]] + [(x, [(6, 0, [])]) for x in [ 'move_line_ids', diff --git a/account_banking/wizard/banking_transaction_wizard.py b/account_banking/wizard/banking_transaction_wizard.py index 0fc71677c..d65d03d03 100644 --- a/account_banking/wizard/banking_transaction_wizard.py +++ b/account_banking/wizard/banking_transaction_wizard.py @@ -363,13 +363,6 @@ class banking_transaction_wizard(orm.TransientModel): ('payment_order_manual', 'Payment order (manual)'), ], string='Match type', readonly=True), - 'manual_invoice_id': fields.many2one( - 'account.invoice', 'Match this invoice', - domain=[('reconciled', '=', False)]), - 'manual_move_line_id': fields.many2one( - 'account.move.line', 'Or match this entry', - domain=[('account_id.reconcile', '=', True), - ('reconcile_id', '=', False)]), 'manual_invoice_ids': fields.many2many( 'account.invoice', 'banking_transaction_wizard_account_invoice_rel', diff --git a/account_banking_payment/view/banking_transaction_wizard.xml b/account_banking_payment/view/banking_transaction_wizard.xml index 708158c95..f9c376493 100644 --- a/account_banking_payment/view/banking_transaction_wizard.xml +++ b/account_banking_payment/view/banking_transaction_wizard.xml @@ -26,7 +26,7 @@ domain="[('id', 'in', payment_order_ids[0][2])]" /> - + From 2cf8b07d2d413cdd140e0553173ce54355413265 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Wed, 24 Jul 2013 23:17:51 +0200 Subject: [PATCH 06/37] [FIX] View error when installing direct debit module --- account_direct_debit/view/account_payment.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_direct_debit/view/account_payment.xml b/account_direct_debit/view/account_payment.xml index 05797f0b1..74c6bc5a1 100644 --- a/account_direct_debit/view/account_payment.xml +++ b/account_direct_debit/view/account_payment.xml @@ -32,13 +32,13 @@ - {'invisible':['|',('state','!=','draft'),('payment_order_type', '!=', 'payment')]} -