diff --git a/account_banking/banking_import_transaction.py b/account_banking/banking_import_transaction.py index 75572b689..cdbd34704 100644 --- a/account_banking/banking_import_transaction.py +++ b/account_banking/banking_import_transaction.py @@ -1196,7 +1196,7 @@ class banking_import_transaction(orm.Model): not(transaction.move_currency_amount is False)): res[transaction.id] = ( transaction.move_currency_amount - - transaction.transferred_amount + transaction.statement_line_id.amount ) return res @@ -1739,10 +1739,14 @@ class account_bank_statement_line(orm.Model): (statement_line_data['name'] or '') + _(' (split)')) statement_line_data['import_transaction_id'] = transaction_id statement_line_data['parent_id'] = this.id + statement_line_id = self.create( + cr, uid, statement_line_data, context=context) - child_statement_ids.append( - self.create(cr, uid, statement_line_data, - context=context)) + child_statement_ids.append(statement_line_id) + transaction_pool.write( + cr, uid, transaction_id, { + 'statement_line_id': statement_line_id, + }, context=context) this.write({'amount': this.amount - amount}) return child_statement_ids diff --git a/account_banking/static/src/js/account_banking.js b/account_banking/static/src/js/account_banking.js index 93ef30a41..65b472760 100644 --- a/account_banking/static/src/js/account_banking.js +++ b/account_banking/static/src/js/account_banking.js @@ -2,27 +2,17 @@ # # Copyright (C) 2013 Therp BV (). # -# All other contributions are (C) by their respective contributors -# -# All Rights Reserved -# -# WARNING: This program as such is intended to be used by professional -# programmers who take the whole responsability of assessing all potential -# consequences resulting from its eventual inadequacies and bugs -# End users who are looking for a ready-to-use solution with commercial -# garantees and support are strongly adviced to contract EduSense BV -# # This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# 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 General Public License for more details. +# GNU Affero General Public License for more details. # -# You should have received a copy of the GNU General Public License +# You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # ############################################################################*/ diff --git a/account_banking/wizard/banking_transaction_wizard.py b/account_banking/wizard/banking_transaction_wizard.py index 9c9c283c7..dc6077469 100644 --- a/account_banking/wizard/banking_transaction_wizard.py +++ b/account_banking/wizard/banking_transaction_wizard.py @@ -96,8 +96,6 @@ class banking_transaction_wizard(orm.TransientModel): # The following fields get never written # they are just triggers for manual matching # which populates regular fields on the transaction - manual_invoice_id = vals.pop('manual_invoice_id', False) - manual_move_line_id = vals.pop('manual_move_line_id', False) manual_invoice_ids = vals.pop('manual_invoice_ids', []) manual_move_line_ids = vals.pop('manual_move_line_ids', []) @@ -171,17 +169,17 @@ class banking_transaction_wizard(orm.TransientModel): _("No entry found for the selected invoice. " + "Try manual reconciliation.")) - if manual_move_line_id or manual_invoice_id \ - or manual_move_line_ids or manual_invoice_ids: + if manual_move_line_ids or manual_invoice_ids: move_line_obj = self.pool.get('account.move.line') invoice_obj = self.pool.get('account.invoice') statement_line_obj = self.pool.get('account.bank.statement.line') - manual_invoice_ids = ( - ([manual_invoice_id] if manual_invoice_id else []) + + # Rewrite *2many directive notation + if manual_invoice_ids: + manual_invoice_ids = ( [i[1] for i in manual_invoice_ids if i[0]==4] + [j for i in manual_invoice_ids if i[0]==6 for j in i[2]]) - manual_move_line_ids = ( - ([manual_move_line_id] if manual_move_line_id else []) + + if manual_move_line_ids: + manual_move_line_ids = ( [i[1] for i in manual_move_line_ids if i[0]==4] + [j for i in manual_move_line_ids if i[0]==6 for j in i[2]]) for wiz in self.browse(cr, uid, ids, context=context): @@ -228,7 +226,7 @@ class banking_transaction_wizard(orm.TransientModel): if len(todo) > 0: statement_line_id = wiz.statement_line_id.split_off( - move_line.credit or move_line.debit)[0] + move_line.debit or -move_line.credit)[0] transaction_id = statement_line_obj.browse( cr, uid, @@ -292,7 +290,12 @@ class banking_transaction_wizard(orm.TransientModel): account_id = setting.default_debit_account_id and setting.default_debit_account_id.id statement_pool.write(cr, uid, wiz.statement_line_id.id, {'account_id':account_id}) - wiz.write({'partner_id': False}) + # Restore partner id from the bank account or else reset + partner_id = False + if (wiz.statement_line_id.partner_bank_id and + wiz.statement_line_id.partner_bank_id.partner_id): + partner_id = wiz.statement_line_id.partner_bank_id.partner_id.id + wiz.write({'partner_id': partner_id}) if wiz.statement_line_id: #delete splits causing an unsplit if this is a split @@ -391,22 +394,15 @@ class banking_transaction_wizard(orm.TransientModel): 'match_type': fields.related( 'import_transaction_id', 'match_type', type="char", size=16, 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', - 'wizard_id', 'invoice_id', string='Match following invoices', + 'wizard_id', 'invoice_id', string='Match one or more invoices', domain=[('reconciled', '=', False)]), 'manual_move_line_ids': fields.many2many( 'account.move.line', 'banking_transaction_wizard_account_move_line_rel', - 'wizard_id', 'move_line_id', string='Or match this entries', + 'wizard_id', 'move_line_id', string='Or match one or more entries', domain=[('account_id.reconcile', '=', True), ('reconcile_id', '=', False)]), 'payment_option': fields.related('import_transaction_id','payment_option', string='Payment Difference', type='selection', required=True, diff --git a/account_banking/wizard/banking_transaction_wizard.xml b/account_banking/wizard/banking_transaction_wizard.xml index a59861d39..cbcc3cf18 100644 --- a/account_banking/wizard/banking_transaction_wizard.xml +++ b/account_banking/wizard/banking_transaction_wizard.xml @@ -82,35 +82,9 @@ name="trigger_match" type="object" string="Match again"/> - + - - - - -