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
1=== modified file 'account_banking/banking_import_transaction.py'
2--- account_banking/banking_import_transaction.py 2013-06-03 09:39:56 +0000
3+++ account_banking/banking_import_transaction.py 2013-06-05 08:37:47 +0000
4@@ -1196,7 +1196,7 @@
5 not(transaction.move_currency_amount is False)):
6 res[transaction.id] = (
7 transaction.move_currency_amount -
8- transaction.transferred_amount
9+ transaction.statement_line_id.amount
10 )
11 return res
12
13@@ -1739,10 +1739,14 @@
14 (statement_line_data['name'] or '') + _(' (split)'))
15 statement_line_data['import_transaction_id'] = transaction_id
16 statement_line_data['parent_id'] = this.id
17+ statement_line_id = self.create(
18+ cr, uid, statement_line_data, context=context)
19
20- child_statement_ids.append(
21- self.create(cr, uid, statement_line_data,
22- context=context))
23+ child_statement_ids.append(statement_line_id)
24+ transaction_pool.write(
25+ cr, uid, transaction_id, {
26+ 'statement_line_id': statement_line_id,
27+ }, context=context)
28 this.write({'amount': this.amount - amount})
29
30 return child_statement_ids
31
32=== modified file 'account_banking/static/src/js/account_banking.js'
33--- account_banking/static/src/js/account_banking.js 2013-04-24 14:36:15 +0000
34+++ account_banking/static/src/js/account_banking.js 2013-06-05 08:37:47 +0000
35@@ -2,27 +2,17 @@
36 #
37 # Copyright (C) 2013 Therp BV (<http://therp.nl>).
38 #
39-# All other contributions are (C) by their respective contributors
40-#
41-# All Rights Reserved
42-#
43-# WARNING: This program as such is intended to be used by professional
44-# programmers who take the whole responsability of assessing all potential
45-# consequences resulting from its eventual inadequacies and bugs
46-# End users who are looking for a ready-to-use solution with commercial
47-# garantees and support are strongly adviced to contract EduSense BV
48-#
49 # This program is free software: you can redistribute it and/or modify
50-# it under the terms of the GNU General Public License as published by
51-# the Free Software Foundation, either version 3 of the License, or
52-# (at your option) any later version.
53+# it under the terms of the GNU Affero General Public License as
54+# published by the Free Software Foundation, either version 3 of the
55+# License, or (at your option) any later version.
56 #
57 # This program is distributed in the hope that it will be useful,
58 # but WITHOUT ANY WARRANTY; without even the implied warranty of
59 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
60-# GNU General Public License for more details.
61+# GNU Affero General Public License for more details.
62 #
63-# You should have received a copy of the GNU General Public License
64+# You should have received a copy of the GNU Affero General Public License
65 # along with this program. If not, see <http://www.gnu.org/licenses/>.
66 #
67 ############################################################################*/
68
69=== modified file 'account_banking/wizard/banking_transaction_wizard.py'
70--- account_banking/wizard/banking_transaction_wizard.py 2013-05-01 14:25:04 +0000
71+++ account_banking/wizard/banking_transaction_wizard.py 2013-06-05 08:37:47 +0000
72@@ -96,8 +96,6 @@
73 # The following fields get never written
74 # they are just triggers for manual matching
75 # which populates regular fields on the transaction
76- manual_invoice_id = vals.pop('manual_invoice_id', False)
77- manual_move_line_id = vals.pop('manual_move_line_id', False)
78 manual_invoice_ids = vals.pop('manual_invoice_ids', [])
79 manual_move_line_ids = vals.pop('manual_move_line_ids', [])
80
81@@ -171,17 +169,17 @@
82 _("No entry found for the selected invoice. " +
83 "Try manual reconciliation."))
84
85- if manual_move_line_id or manual_invoice_id \
86- or manual_move_line_ids or manual_invoice_ids:
87+ if manual_move_line_ids or manual_invoice_ids:
88 move_line_obj = self.pool.get('account.move.line')
89 invoice_obj = self.pool.get('account.invoice')
90 statement_line_obj = self.pool.get('account.bank.statement.line')
91- manual_invoice_ids = (
92- ([manual_invoice_id] if manual_invoice_id else []) +
93+ # Rewrite *2many directive notation
94+ if manual_invoice_ids:
95+ manual_invoice_ids = (
96 [i[1] for i in manual_invoice_ids if i[0]==4] +
97 [j for i in manual_invoice_ids if i[0]==6 for j in i[2]])
98- manual_move_line_ids = (
99- ([manual_move_line_id] if manual_move_line_id else []) +
100+ if manual_move_line_ids:
101+ manual_move_line_ids = (
102 [i[1] for i in manual_move_line_ids if i[0]==4] +
103 [j for i in manual_move_line_ids if i[0]==6 for j in i[2]])
104 for wiz in self.browse(cr, uid, ids, context=context):
105@@ -228,7 +226,7 @@
106
107 if len(todo) > 0:
108 statement_line_id = wiz.statement_line_id.split_off(
109- move_line.credit or move_line.debit)[0]
110+ move_line.debit or -move_line.credit)[0]
111 transaction_id = statement_line_obj.browse(
112 cr,
113 uid,
114@@ -292,7 +290,12 @@
115 account_id = setting.default_debit_account_id and setting.default_debit_account_id.id
116 statement_pool.write(cr, uid, wiz.statement_line_id.id, {'account_id':account_id})
117
118- wiz.write({'partner_id': False})
119+ # Restore partner id from the bank account or else reset
120+ partner_id = False
121+ if (wiz.statement_line_id.partner_bank_id and
122+ wiz.statement_line_id.partner_bank_id.partner_id):
123+ partner_id = wiz.statement_line_id.partner_bank_id.partner_id.id
124+ wiz.write({'partner_id': partner_id})
125
126 if wiz.statement_line_id:
127 #delete splits causing an unsplit if this is a split
128@@ -391,22 +394,15 @@
129 'match_type': fields.related(
130 'import_transaction_id', 'match_type',
131 type="char", size=16, string='Match type', readonly=True),
132- 'manual_invoice_id': fields.many2one(
133- 'account.invoice', 'Match this invoice',
134- domain=[('reconciled', '=', False)]),
135- 'manual_move_line_id': fields.many2one(
136- 'account.move.line', 'Or match this entry',
137- domain=[('account_id.reconcile', '=', True),
138- ('reconcile_id', '=', False)]),
139 'manual_invoice_ids': fields.many2many(
140 'account.invoice',
141 'banking_transaction_wizard_account_invoice_rel',
142- 'wizard_id', 'invoice_id', string='Match following invoices',
143+ 'wizard_id', 'invoice_id', string='Match one or more invoices',
144 domain=[('reconciled', '=', False)]),
145 'manual_move_line_ids': fields.many2many(
146 'account.move.line',
147 'banking_transaction_wizard_account_move_line_rel',
148- 'wizard_id', 'move_line_id', string='Or match this entries',
149+ 'wizard_id', 'move_line_id', string='Or match one or more entries',
150 domain=[('account_id.reconcile', '=', True),
151 ('reconcile_id', '=', False)]),
152 'payment_option': fields.related('import_transaction_id','payment_option', string='Payment Difference', type='selection', required=True,
153
154=== modified file 'account_banking/wizard/banking_transaction_wizard.xml'
155--- account_banking/wizard/banking_transaction_wizard.xml 2013-04-24 14:36:15 +0000
156+++ account_banking/wizard/banking_transaction_wizard.xml 2013-06-05 08:37:47 +0000
157@@ -82,35 +82,9 @@
158 name="trigger_match"
159 type="object"
160 string="Match again"/>
161- <!-- Manual selection -->
162 </page>
163+ <!-- Manual selection -->
164 <page string="Manual match">
165- <field name="manual_invoice_id"
166- context="{'search_default_partner_id': partner_id}"
167- />
168- <!--
169- Specify alternative tree_view_ref as a
170- workaround for lp:1073521 in OpenERP 6.1
171- Need to also define 'view_mode' to prevent
172- an instant editable tree view
173- reconstruction by account.move.line's
174- fields_view_get().
175- Both are not needed in OpenERP 6.0 or 7.0.
176- -->
177- <field name="manual_move_line_id"
178- context="{
179- 'search_default_partner_id': partner_id,
180- 'tree_view_ref': 'account.view_move_line_tax_tree',
181- 'view_mode': 'yes'
182- }"
183- />
184- <newline/>
185- <button colspan="1"
186- name="trigger_write"
187- type="object"
188- string="Match"/>
189- </page>
190- <page string="Multiple manual matches" attrs="{'invisible': ['|', ('match_type', '!=', False), ('statement_line_parent_id', '!=', False)]}">
191 <field name="manual_invoice_ids" colspan="4"
192 context="{'search_default_partner_id': partner_id}"
193 />
194@@ -146,7 +120,7 @@
195 </notebook>
196 <group colspan="2">
197 <separator/>
198- <button icon="gtk-ok" string="Done" special="cancel"/>
199+ <button icon="gtk-ok" string="Close" special="cancel"/>
200 </group>
201 </group>
202 </form>

Subscribers

People subscribed via source and target branches

to status/vote changes: