diff --git a/account_banking/banking_import_transaction.py b/account_banking/banking_import_transaction.py index 79801c84e..5c0cd1faf 100644 --- a/account_banking/banking_import_transaction.py +++ b/account_banking/banking_import_transaction.py @@ -193,6 +193,10 @@ class banking_import_transaction(orm.Model): iname = invoice.name.upper() if iname in ref or iname in msg: return True + if invoice.supplier_invoice_number and len(invoice.supplier_invoice_number) > 2: + supp_ref = invoice.supplier_invoice_number.upper() + if supp_ref in ref or supp_ref in msg: + return True elif invoice.type.startswith('out_'): # External id's possible and likely inum = invoice.number.upper() @@ -1211,8 +1215,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', @@ -1299,9 +1301,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/data/account_banking_data.xml b/account_banking/data/account_banking_data.xml index 3d47ad718..14ae6eafe 100644 --- a/account_banking/data/account_banking_data.xml +++ b/account_banking/data/account_banking_data.xml @@ -13,12 +13,5 @@ - - - - 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/security/ir.model.access.csv b/account_banking/security/ir.model.access.csv index 5e9d5f05b..8444747b9 100644 --- a/account_banking/security/ir.model.access.csv +++ b/account_banking/security/ir.model.access.csv @@ -3,4 +3,3 @@ "access_account_banking_settings_user","account.banking.account.settings user","model_account_banking_account_settings","account.group_account_user",1,0,0,0 "access_account_banking_import","account.bankimport","model_account_banking_imported_file","account.group_account_user",1,1,1,1 "access_banking_import_transaction","Banking addons - Bank import transaction","model_banking_import_transaction","account.group_account_user",1,1,1,1 -"access_banking_transaction_wizard","Banking addons - Transaction wizard","model_banking_transaction_wizard","account.group_account_user",1,1,1,1 diff --git a/account_banking/sepa/iban.py b/account_banking/sepa/iban.py index 7d16840d9..817b043b1 100644 --- a/account_banking/sepa/iban.py +++ b/account_banking/sepa/iban.py @@ -190,7 +190,7 @@ class IBAN(str): BBAN_formats = { 'AL': BBANFormat('CCBBBBVAAAAAAAAAAAAAAAAAA', '%B%A'), 'AD': BBANFormat('CCCCBBBBAAAAAAAAAAAA', '%A'), - 'AT': BBANFormat('BBBBBAAAAAAAAAAA', '%A BLZ %C'), + 'AT': BBANFormat('BBBBBAAAAAAAAAAA', '%A BLZ %B'), 'BE': BBANFormat('CCCAAAAAAAVV', '%C-%A-%V'), 'BA': BBANFormat('BBBCCCAAAAAAAA', '%I'), 'BG': BBANFormat('BBBBCCCCAAAAAAAAAA', '%I'), diff --git a/account_banking/wizard/banking_transaction_wizard.py b/account_banking/wizard/banking_transaction_wizard.py index 0fc71677c..255d7979c 100644 --- a/account_banking/wizard/banking_transaction_wizard.py +++ b/account_banking/wizard/banking_transaction_wizard.py @@ -314,6 +314,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', @@ -363,13 +367,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/wizard/banking_transaction_wizard.xml b/account_banking/wizard/banking_transaction_wizard.xml index 1e970eb7e..018b87210 100644 --- a/account_banking/wizard/banking_transaction_wizard.xml +++ b/account_banking/wizard/banking_transaction_wizard.xml @@ -17,8 +17,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"> 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_banking_nl_girotel/girotel.py b/account_banking_nl_girotel/girotel.py index 792770f19..5fe48c49f 100644 --- a/account_banking_nl_girotel/girotel.py +++ b/account_banking_nl_girotel/girotel.py @@ -249,6 +249,10 @@ class transaction(models.mem_bank_transaction): for i in range(0, len(self.message), 32) ] self.reference = self.remote_owner + + if not parts: + return + if self.reference.startswith('KN: '): self.reference = self.reference[4:] if parts[0] == self.reference: diff --git a/account_banking_payment/__openerp__.py b/account_banking_payment/__openerp__.py index af1ecab2e..a0984398f 100644 --- a/account_banking_payment/__openerp__.py +++ b/account_banking_payment/__openerp__.py @@ -32,17 +32,14 @@ 'category': 'Banking addons', 'depends': [ 'account_banking', - 'account_payment', + 'account_banking_payment_export', ], 'data': [ 'view/account_payment.xml', 'view/banking_transaction_wizard.xml', 'view/payment_mode.xml', 'view/payment_mode_type.xml', - 'view/bank_payment_manual.xml', - 'data/payment_mode_type.xml', 'workflow/account_payment.xml', - 'security/ir.model.access.csv', ], 'description': ''' This addon adds payment infrastructure to the Banking Addons. diff --git a/account_banking_payment/model/__init__.py b/account_banking_payment/model/__init__.py index 9908c8e01..e7ae81724 100644 --- a/account_banking_payment/model/__init__.py +++ b/account_banking_payment/model/__init__.py @@ -5,5 +5,4 @@ import payment_mode_type import payment_order_create import banking_import_transaction import banking_transaction_wizard -import bank_payment_manual import banking_import_line diff --git a/account_banking_payment/model/account_payment.py b/account_banking_payment/model/account_payment.py index b238cbeef..6153b662e 100644 --- a/account_banking_payment/model/account_payment.py +++ b/account_banking_payment/model/account_payment.py @@ -115,49 +115,6 @@ class payment_order(orm.Model): 'payment_order_type': 'payment', } - def launch_wizard(self, cr, uid, ids, context=None): - """ - Search for a wizard to launch according to the type. - If type is manual. just confirm the order. - Previously (pre-v6) in account_payment/wizard/wizard_pay.py - """ - if context == None: - context = {} - result = {} - orders = self.browse(cr, uid, ids, context) - order = orders[0] - # check if a wizard is defined for the first order - if order.mode.type and order.mode.type.ir_model_id: - context['active_ids'] = ids - wizard_model = order.mode.type.ir_model_id.model - wizard_obj = self.pool.get(wizard_model) - wizard_id = wizard_obj.create(cr, uid, {}, context) - result = { - 'name': wizard_obj._description or _('Payment Order Export'), - 'view_type': 'form', - 'view_mode': 'form', - 'res_model': wizard_model, - 'domain': [], - 'context': context, - 'type': 'ir.actions.act_window', - 'target': 'new', - 'res_id': wizard_id, - 'nodestroy': True, - } - else: - # should all be manual orders without type or wizard model - for order in orders[1:]: - if order.mode.type and order.mode.type.ir_model_id: - raise orm.except_orm( - _('Error'), - _('You can only combine payment orders of the same type') - ) - # process manual payments - wf_service = netsvc.LocalService('workflow') - for order_id in ids: - wf_service.trg_validate(uid, 'payment.order', order_id, 'sent', cr) - return result - def _write_payment_lines(self, cr, uid, ids, **kwargs): ''' ORM method for setting attributes of corresponding payment.line objects. @@ -301,7 +258,7 @@ class payment_order(orm.Model): 'journal_id': order.mode.transfer_journal_id.id, 'name': '%s %s' % (labels[order.payment_order_type], line.move_line_id.move_id.name), - 'reference': '%s%s' % (order.payment_order_type[:3].upper(), + 'ref': '%s%s' % (order.payment_order_type[:3].upper(), line.move_line_id.move_id.name), }, context=context) diff --git a/account_banking_payment/model/payment_line.py b/account_banking_payment/model/payment_line.py index 3abae5ff0..7b5345ecf 100644 --- a/account_banking_payment/model/payment_line.py +++ b/account_banking_payment/model/payment_line.py @@ -151,8 +151,8 @@ class payment_line(orm.Model): if torec_move_line.reconcile_partial_id: line_ids = [ x.id for x in - transit_move_line.reconcile_partial_id.line_partial_ids - ] + [torec_move_line.id] + torec_move_line.reconcile_partial_id.line_partial_ids + ] + [transit_move_line.id] total = move_line_obj.get_balance(cr, uid, line_ids) vals = { diff --git a/account_banking_payment/model/payment_mode.py b/account_banking_payment/model/payment_mode.py index f93acec8e..6237593b6 100644 --- a/account_banking_payment/model/payment_mode.py +++ b/account_banking_payment/model/payment_mode.py @@ -27,28 +27,9 @@ from openerp.osv import orm, fields class payment_mode(orm.Model): - ''' Restoring the payment type from version 5, - used to select the export wizard (if any) ''' _inherit = "payment.mode" - def suitable_bank_types(self, cr, uid, payment_mode_id=None, context=None): - """ Reinstates functional code for suitable bank type filtering. - Current code in account_payment is disfunctional. - """ - res = [] - payment_mode = self.browse( - cr, uid, payment_mode_id, context) - if (payment_mode and payment_mode.type and - payment_mode.type.suitable_bank_types): - res = [type.code for type in payment_mode.type.suitable_bank_types] - return res - _columns = { - 'type': fields.many2one( - 'payment.mode.type', 'Payment type', - required=True, - help='Select the Payment Type for the Payment Mode.' - ), 'transfer_account_id': fields.many2one( 'account.account', 'Transfer account', domain=[('type', '=', 'other'), diff --git a/account_banking_payment/model/payment_mode_type.py b/account_banking_payment/model/payment_mode_type.py index 51de7ca66..572cce869 100644 --- a/account_banking_payment/model/payment_mode_type.py +++ b/account_banking_payment/model/payment_mode_type.py @@ -27,30 +27,9 @@ from openerp.osv import orm, fields class payment_mode_type(orm.Model): - _name = 'payment.mode.type' - _description = 'Payment Mode Type' + _inherit = 'payment.mode.type' + _columns = { - 'name': fields.char( - 'Name', size=64, required=True, - help='Payment Type' - ), - 'code': fields.char( - 'Code', size=64, required=True, - help='Specify the Code for Payment Type' - ), - # Setting suitable_bank_types to required pending - # https://bugs.launchpad.net/openobject-addons/+bug/786845 - 'suitable_bank_types': fields.many2many( - 'res.partner.bank.type', - 'bank_type_payment_type_rel', - 'pay_type_id','bank_type_id', - 'Suitable bank types', required=True), - 'ir_model_id': fields.many2one( - 'ir.model', 'Payment wizard', - help=('Select the Payment Wizard for payments of this type. ' - 'Leave empty for manual processing'), - domain=[('osv_memory', '=', True)], - ), 'payment_order_type': fields.selection( [('payment', 'Payment'),('debit', 'Direct debit')], 'Payment order type', required=True, diff --git a/account_banking_payment/model/payment_order_create.py b/account_banking_payment/model/payment_order_create.py index 68a0d22f4..c7ac88790 100644 --- a/account_banking_payment/model/payment_order_create.py +++ b/account_banking_payment/model/payment_order_create.py @@ -23,9 +23,7 @@ # ############################################################################## -from datetime import datetime from openerp.osv import orm, fields -from openerp.tools import DEFAULT_SERVER_DATE_FORMAT from openerp.tools.translate import _ diff --git a/account_banking_payment/view/account_payment.xml b/account_banking_payment/view/account_payment.xml index 4f7601332..c26847abf 100644 --- a/account_banking_payment/view/account_payment.xml +++ b/account_banking_payment/view/account_payment.xml @@ -17,10 +17,6 @@ 'invisible':[('state','!=','draft')] } - - launch_wizard - diff --git a/account_banking_payment/view/bank_payment_manual.xml b/account_banking_payment/view/bank_payment_manual.xml deleted file mode 100644 index 538862ca3..000000000 --- a/account_banking_payment/view/bank_payment_manual.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Form for manual payment wizard - payment.manual - - -