Merge lp:~therp-nl/banking-addons/ba7.0-manual_multi_match into lp:banking-addons

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merged at revision: 170
Proposed branch: lp:~therp-nl/banking-addons/ba7.0-manual_multi_match
Merge into: lp:banking-addons
Prerequisite: lp:~therp-nl/banking-addons/ba7.0-MIG-import
Diff against target: 202 lines (+30/-66)
4 files modified
account_banking/banking_import_transaction.py (+8/-4)
account_banking/static/src/js/account_banking.js (+5/-15)
account_banking/wizard/banking_transaction_wizard.py (+15/-19)
account_banking/wizard/banking_transaction_wizard.xml (+2/-28)
To merge this branch: bzr merge lp:~therp-nl/banking-addons/ba7.0-manual_multi_match
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) Approve
Review via email: mp+160669@code.launchpad.net

Commit message

[IMP] Allow multiple entries when manually selecting invoices or entries

Description of the change

Reconcile multiple manually selected entries by splitting up the bank statement line.

Forward port of https://code.launchpad.net/~therp-nl/banking-addons/6.1-match_multiple_invoices_split/+merge/159348 by Holger Brunn but for 7.0

To post a comment you must log in.
203. By Stefan Rijnhart (Opener)

[FIX] Update the split off statement line's transaction id

204. By Stefan Rijnhart (Opener)

[FIX] Calculation of residual in the case of split transactions
[FIX] Transaction amount when credit amounts are split
[FIX] Restore bank account's partner when disabling match

Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve
205. By Stefan Rijnhart (Opener)

[FIX] Index error

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account_banking/banking_import_transaction.py'
--- account_banking/banking_import_transaction.py 2013-06-03 09:39:56 +0000
+++ account_banking/banking_import_transaction.py 2013-06-05 08:37:47 +0000
@@ -1196,7 +1196,7 @@
1196 not(transaction.move_currency_amount is False)):1196 not(transaction.move_currency_amount is False)):
1197 res[transaction.id] = (1197 res[transaction.id] = (
1198 transaction.move_currency_amount -1198 transaction.move_currency_amount -
1199 transaction.transferred_amount1199 transaction.statement_line_id.amount
1200 )1200 )
1201 return res1201 return res
1202 1202
@@ -1739,10 +1739,14 @@
1739 (statement_line_data['name'] or '') + _(' (split)'))1739 (statement_line_data['name'] or '') + _(' (split)'))
1740 statement_line_data['import_transaction_id'] = transaction_id1740 statement_line_data['import_transaction_id'] = transaction_id
1741 statement_line_data['parent_id'] = this.id1741 statement_line_data['parent_id'] = this.id
1742 statement_line_id = self.create(
1743 cr, uid, statement_line_data, context=context)
17421744
1743 child_statement_ids.append(1745 child_statement_ids.append(statement_line_id)
1744 self.create(cr, uid, statement_line_data,1746 transaction_pool.write(
1745 context=context))1747 cr, uid, transaction_id, {
1748 'statement_line_id': statement_line_id,
1749 }, context=context)
1746 this.write({'amount': this.amount - amount})1750 this.write({'amount': this.amount - amount})
17471751
1748 return child_statement_ids1752 return child_statement_ids
17491753
=== modified file 'account_banking/static/src/js/account_banking.js'
--- account_banking/static/src/js/account_banking.js 2013-04-24 14:36:15 +0000
+++ account_banking/static/src/js/account_banking.js 2013-06-05 08:37:47 +0000
@@ -2,27 +2,17 @@
2#2#
3# Copyright (C) 2013 Therp BV (<http://therp.nl>).3# Copyright (C) 2013 Therp BV (<http://therp.nl>).
4# 4#
5# All other contributions are (C) by their respective contributors
6#
7# All Rights Reserved
8#
9# WARNING: This program as such is intended to be used by professional
10# programmers who take the whole responsability of assessing all potential
11# consequences resulting from its eventual inadequacies and bugs
12# End users who are looking for a ready-to-use solution with commercial
13# garantees and support are strongly adviced to contract EduSense BV
14#
15# This program is free software: you can redistribute it and/or modify5# This program is free software: you can redistribute it and/or modify
16# it under the terms of the GNU General Public License as published by6# it under the terms of the GNU Affero General Public License as
17# the Free Software Foundation, either version 3 of the License, or7# published by the Free Software Foundation, either version 3 of the
18# (at your option) any later version.8# License, or (at your option) any later version.
19#9#
20# This program is distributed in the hope that it will be useful,10# This program is distributed in the hope that it will be useful,
21# but WITHOUT ANY WARRANTY; without even the implied warranty of11# but WITHOUT ANY WARRANTY; without even the implied warranty of
22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23# GNU General Public License for more details.13# GNU Affero General Public License for more details.
24#14#
25# You should have received a copy of the GNU General Public License15# You should have received a copy of the GNU Affero General Public License
26# along with this program. If not, see <http://www.gnu.org/licenses/>.16# along with this program. If not, see <http://www.gnu.org/licenses/>.
27#17#
28############################################################################*/18############################################################################*/
2919
=== modified file 'account_banking/wizard/banking_transaction_wizard.py'
--- account_banking/wizard/banking_transaction_wizard.py 2013-05-01 14:25:04 +0000
+++ account_banking/wizard/banking_transaction_wizard.py 2013-06-05 08:37:47 +0000
@@ -96,8 +96,6 @@
96 # The following fields get never written96 # The following fields get never written
97 # they are just triggers for manual matching97 # they are just triggers for manual matching
98 # which populates regular fields on the transaction98 # which populates regular fields on the transaction
99 manual_invoice_id = vals.pop('manual_invoice_id', False)
100 manual_move_line_id = vals.pop('manual_move_line_id', False)
101 manual_invoice_ids = vals.pop('manual_invoice_ids', [])99 manual_invoice_ids = vals.pop('manual_invoice_ids', [])
102 manual_move_line_ids = vals.pop('manual_move_line_ids', [])100 manual_move_line_ids = vals.pop('manual_move_line_ids', [])
103101
@@ -171,17 +169,17 @@
171 _("No entry found for the selected invoice. " +169 _("No entry found for the selected invoice. " +
172 "Try manual reconciliation."))170 "Try manual reconciliation."))
173171
174 if manual_move_line_id or manual_invoice_id \172 if manual_move_line_ids or manual_invoice_ids:
175 or manual_move_line_ids or manual_invoice_ids:
176 move_line_obj = self.pool.get('account.move.line')173 move_line_obj = self.pool.get('account.move.line')
177 invoice_obj = self.pool.get('account.invoice')174 invoice_obj = self.pool.get('account.invoice')
178 statement_line_obj = self.pool.get('account.bank.statement.line')175 statement_line_obj = self.pool.get('account.bank.statement.line')
179 manual_invoice_ids = (176 # Rewrite *2many directive notation
180 ([manual_invoice_id] if manual_invoice_id else []) +177 if manual_invoice_ids:
178 manual_invoice_ids = (
181 [i[1] for i in manual_invoice_ids if i[0]==4] +179 [i[1] for i in manual_invoice_ids if i[0]==4] +
182 [j for i in manual_invoice_ids if i[0]==6 for j in i[2]])180 [j for i in manual_invoice_ids if i[0]==6 for j in i[2]])
183 manual_move_line_ids = (181 if manual_move_line_ids:
184 ([manual_move_line_id] if manual_move_line_id else []) +182 manual_move_line_ids = (
185 [i[1] for i in manual_move_line_ids if i[0]==4] +183 [i[1] for i in manual_move_line_ids if i[0]==4] +
186 [j for i in manual_move_line_ids if i[0]==6 for j in i[2]])184 [j for i in manual_move_line_ids if i[0]==6 for j in i[2]])
187 for wiz in self.browse(cr, uid, ids, context=context):185 for wiz in self.browse(cr, uid, ids, context=context):
@@ -228,7 +226,7 @@
228226
229 if len(todo) > 0:227 if len(todo) > 0:
230 statement_line_id = wiz.statement_line_id.split_off(228 statement_line_id = wiz.statement_line_id.split_off(
231 move_line.credit or move_line.debit)[0]229 move_line.debit or -move_line.credit)[0]
232 transaction_id = statement_line_obj.browse(230 transaction_id = statement_line_obj.browse(
233 cr,231 cr,
234 uid,232 uid,
@@ -292,7 +290,12 @@
292 account_id = setting.default_debit_account_id and setting.default_debit_account_id.id290 account_id = setting.default_debit_account_id and setting.default_debit_account_id.id
293 statement_pool.write(cr, uid, wiz.statement_line_id.id, {'account_id':account_id})291 statement_pool.write(cr, uid, wiz.statement_line_id.id, {'account_id':account_id})
294 292
295 wiz.write({'partner_id': False})293 # Restore partner id from the bank account or else reset
294 partner_id = False
295 if (wiz.statement_line_id.partner_bank_id and
296 wiz.statement_line_id.partner_bank_id.partner_id):
297 partner_id = wiz.statement_line_id.partner_bank_id.partner_id.id
298 wiz.write({'partner_id': partner_id})
296299
297 if wiz.statement_line_id:300 if wiz.statement_line_id:
298 #delete splits causing an unsplit if this is a split301 #delete splits causing an unsplit if this is a split
@@ -391,22 +394,15 @@
391 'match_type': fields.related(394 'match_type': fields.related(
392 'import_transaction_id', 'match_type', 395 'import_transaction_id', 'match_type',
393 type="char", size=16, string='Match type', readonly=True),396 type="char", size=16, string='Match type', readonly=True),
394 'manual_invoice_id': fields.many2one(
395 'account.invoice', 'Match this invoice',
396 domain=[('reconciled', '=', False)]),
397 'manual_move_line_id': fields.many2one(
398 'account.move.line', 'Or match this entry',
399 domain=[('account_id.reconcile', '=', True),
400 ('reconcile_id', '=', False)]),
401 'manual_invoice_ids': fields.many2many(397 'manual_invoice_ids': fields.many2many(
402 'account.invoice',398 'account.invoice',
403 'banking_transaction_wizard_account_invoice_rel',399 'banking_transaction_wizard_account_invoice_rel',
404 'wizard_id', 'invoice_id', string='Match following invoices',400 'wizard_id', 'invoice_id', string='Match one or more invoices',
405 domain=[('reconciled', '=', False)]),401 domain=[('reconciled', '=', False)]),
406 'manual_move_line_ids': fields.many2many(402 'manual_move_line_ids': fields.many2many(
407 'account.move.line',403 'account.move.line',
408 'banking_transaction_wizard_account_move_line_rel',404 'banking_transaction_wizard_account_move_line_rel',
409 'wizard_id', 'move_line_id', string='Or match this entries',405 'wizard_id', 'move_line_id', string='Or match one or more entries',
410 domain=[('account_id.reconcile', '=', True),406 domain=[('account_id.reconcile', '=', True),
411 ('reconcile_id', '=', False)]),407 ('reconcile_id', '=', False)]),
412 'payment_option': fields.related('import_transaction_id','payment_option', string='Payment Difference', type='selection', required=True,408 'payment_option': fields.related('import_transaction_id','payment_option', string='Payment Difference', type='selection', required=True,
413409
=== modified file 'account_banking/wizard/banking_transaction_wizard.xml'
--- account_banking/wizard/banking_transaction_wizard.xml 2013-04-24 14:36:15 +0000
+++ account_banking/wizard/banking_transaction_wizard.xml 2013-06-05 08:37:47 +0000
@@ -82,35 +82,9 @@
82 name="trigger_match"82 name="trigger_match"
83 type="object"83 type="object"
84 string="Match again"/>84 string="Match again"/>
85 <!-- Manual selection -->
86 </page>85 </page>
86 <!-- Manual selection -->
87 <page string="Manual match">87 <page string="Manual match">
88 <field name="manual_invoice_id"
89 context="{'search_default_partner_id': partner_id}"
90 />
91 <!--
92 Specify alternative tree_view_ref as a
93 workaround for lp:1073521 in OpenERP 6.1
94 Need to also define 'view_mode' to prevent
95 an instant editable tree view
96 reconstruction by account.move.line's
97 fields_view_get().
98 Both are not needed in OpenERP 6.0 or 7.0.
99 -->
100 <field name="manual_move_line_id"
101 context="{
102 'search_default_partner_id': partner_id,
103 'tree_view_ref': 'account.view_move_line_tax_tree',
104 'view_mode': 'yes'
105 }"
106 />
107 <newline/>
108 <button colspan="1"
109 name="trigger_write"
110 type="object"
111 string="Match"/>
112 </page>
113 <page string="Multiple manual matches" attrs="{'invisible': ['|', ('match_type', '!=', False), ('statement_line_parent_id', '!=', False)]}">
114 <field name="manual_invoice_ids" colspan="4"88 <field name="manual_invoice_ids" colspan="4"
115 context="{'search_default_partner_id': partner_id}"89 context="{'search_default_partner_id': partner_id}"
116 />90 />
@@ -146,7 +120,7 @@
146 </notebook>120 </notebook>
147 <group colspan="2">121 <group colspan="2">
148 <separator/>122 <separator/>
149 <button icon="gtk-ok" string="Done" special="cancel"/>123 <button icon="gtk-ok" string="Close" special="cancel"/>
150 </group>124 </group>
151 </group>125 </group>
152 </form>126 </form>

Subscribers

People subscribed via source and target branches

to status/vote changes: