Merge lp:~therp-nl/banking-addons/ba7.0-manual_multi_match into lp:banking-addons
- ba7.0-manual_multi_match
- Merge into banking-addons-70
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 |
Related bugs: |
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:/
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 | 1196 | not(transaction.move_currency_amount is False)): | 1196 | not(transaction.move_currency_amount is False)): |
6 | 1197 | res[transaction.id] = ( | 1197 | res[transaction.id] = ( |
7 | 1198 | transaction.move_currency_amount - | 1198 | transaction.move_currency_amount - |
9 | 1199 | transaction.transferred_amount | 1199 | transaction.statement_line_id.amount |
10 | 1200 | ) | 1200 | ) |
11 | 1201 | return res | 1201 | return res |
12 | 1202 | 1202 | ||
13 | @@ -1739,10 +1739,14 @@ | |||
14 | 1739 | (statement_line_data['name'] or '') + _(' (split)')) | 1739 | (statement_line_data['name'] or '') + _(' (split)')) |
15 | 1740 | statement_line_data['import_transaction_id'] = transaction_id | 1740 | statement_line_data['import_transaction_id'] = transaction_id |
16 | 1741 | statement_line_data['parent_id'] = this.id | 1741 | statement_line_data['parent_id'] = this.id |
17 | 1742 | statement_line_id = self.create( | ||
18 | 1743 | cr, uid, statement_line_data, context=context) | ||
19 | 1742 | 1744 | ||
23 | 1743 | child_statement_ids.append( | 1745 | child_statement_ids.append(statement_line_id) |
24 | 1744 | self.create(cr, uid, statement_line_data, | 1746 | transaction_pool.write( |
25 | 1745 | context=context)) | 1747 | cr, uid, transaction_id, { |
26 | 1748 | 'statement_line_id': statement_line_id, | ||
27 | 1749 | }, context=context) | ||
28 | 1746 | this.write({'amount': this.amount - amount}) | 1750 | this.write({'amount': this.amount - amount}) |
29 | 1747 | 1751 | ||
30 | 1748 | return child_statement_ids | 1752 | return child_statement_ids |
31 | 1749 | 1753 | ||
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 | 2 | # | 2 | # |
37 | 3 | # Copyright (C) 2013 Therp BV (<http://therp.nl>). | 3 | # Copyright (C) 2013 Therp BV (<http://therp.nl>). |
38 | 4 | # | 4 | # |
39 | 5 | # All other contributions are (C) by their respective contributors | ||
40 | 6 | # | ||
41 | 7 | # All Rights Reserved | ||
42 | 8 | # | ||
43 | 9 | # WARNING: This program as such is intended to be used by professional | ||
44 | 10 | # programmers who take the whole responsability of assessing all potential | ||
45 | 11 | # consequences resulting from its eventual inadequacies and bugs | ||
46 | 12 | # End users who are looking for a ready-to-use solution with commercial | ||
47 | 13 | # garantees and support are strongly adviced to contract EduSense BV | ||
48 | 14 | # | ||
49 | 15 | # This program is free software: you can redistribute it and/or modify | 5 | # This program is free software: you can redistribute it and/or modify |
53 | 16 | # it under the terms of the GNU General Public License as published by | 6 | # it under the terms of the GNU Affero General Public License as |
54 | 17 | # the Free Software Foundation, either version 3 of the License, or | 7 | # published by the Free Software Foundation, either version 3 of the |
55 | 18 | # (at your option) any later version. | 8 | # License, or (at your option) any later version. |
56 | 19 | # | 9 | # |
57 | 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, |
58 | 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
59 | 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
61 | 23 | # GNU General Public License for more details. | 13 | # GNU Affero General Public License for more details. |
62 | 24 | # | 14 | # |
64 | 25 | # You should have received a copy of the GNU General Public License | 15 | # You should have received a copy of the GNU Affero General Public License |
65 | 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/>. |
66 | 27 | # | 17 | # |
67 | 28 | ############################################################################*/ | 18 | ############################################################################*/ |
68 | 29 | 19 | ||
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 | 96 | # The following fields get never written | 96 | # The following fields get never written |
74 | 97 | # they are just triggers for manual matching | 97 | # they are just triggers for manual matching |
75 | 98 | # which populates regular fields on the transaction | 98 | # which populates regular fields on the transaction |
76 | 99 | manual_invoice_id = vals.pop('manual_invoice_id', False) | ||
77 | 100 | manual_move_line_id = vals.pop('manual_move_line_id', False) | ||
78 | 101 | manual_invoice_ids = vals.pop('manual_invoice_ids', []) | 99 | manual_invoice_ids = vals.pop('manual_invoice_ids', []) |
79 | 102 | manual_move_line_ids = vals.pop('manual_move_line_ids', []) | 100 | manual_move_line_ids = vals.pop('manual_move_line_ids', []) |
80 | 103 | 101 | ||
81 | @@ -171,17 +169,17 @@ | |||
82 | 171 | _("No entry found for the selected invoice. " + | 169 | _("No entry found for the selected invoice. " + |
83 | 172 | "Try manual reconciliation.")) | 170 | "Try manual reconciliation.")) |
84 | 173 | 171 | ||
87 | 174 | if manual_move_line_id or manual_invoice_id \ | 172 | if manual_move_line_ids or manual_invoice_ids: |
86 | 175 | or manual_move_line_ids or manual_invoice_ids: | ||
88 | 176 | move_line_obj = self.pool.get('account.move.line') | 173 | move_line_obj = self.pool.get('account.move.line') |
89 | 177 | invoice_obj = self.pool.get('account.invoice') | 174 | invoice_obj = self.pool.get('account.invoice') |
90 | 178 | statement_line_obj = self.pool.get('account.bank.statement.line') | 175 | statement_line_obj = self.pool.get('account.bank.statement.line') |
93 | 179 | manual_invoice_ids = ( | 176 | # Rewrite *2many directive notation |
94 | 180 | ([manual_invoice_id] if manual_invoice_id else []) + | 177 | if manual_invoice_ids: |
95 | 178 | manual_invoice_ids = ( | ||
96 | 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] + |
97 | 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]]) |
100 | 183 | manual_move_line_ids = ( | 181 | if manual_move_line_ids: |
101 | 184 | ([manual_move_line_id] if manual_move_line_id else []) + | 182 | manual_move_line_ids = ( |
102 | 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] + |
103 | 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]]) |
104 | 187 | for wiz in self.browse(cr, uid, ids, context=context): | 185 | for wiz in self.browse(cr, uid, ids, context=context): |
105 | @@ -228,7 +226,7 @@ | |||
106 | 228 | 226 | ||
107 | 229 | if len(todo) > 0: | 227 | if len(todo) > 0: |
108 | 230 | statement_line_id = wiz.statement_line_id.split_off( | 228 | statement_line_id = wiz.statement_line_id.split_off( |
110 | 231 | move_line.credit or move_line.debit)[0] | 229 | move_line.debit or -move_line.credit)[0] |
111 | 232 | transaction_id = statement_line_obj.browse( | 230 | transaction_id = statement_line_obj.browse( |
112 | 233 | cr, | 231 | cr, |
113 | 234 | uid, | 232 | uid, |
114 | @@ -292,7 +290,12 @@ | |||
115 | 292 | account_id = setting.default_debit_account_id and setting.default_debit_account_id.id | 290 | account_id = setting.default_debit_account_id and setting.default_debit_account_id.id |
116 | 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}) |
117 | 294 | 292 | ||
119 | 295 | wiz.write({'partner_id': False}) | 293 | # Restore partner id from the bank account or else reset |
120 | 294 | partner_id = False | ||
121 | 295 | if (wiz.statement_line_id.partner_bank_id and | ||
122 | 296 | wiz.statement_line_id.partner_bank_id.partner_id): | ||
123 | 297 | partner_id = wiz.statement_line_id.partner_bank_id.partner_id.id | ||
124 | 298 | wiz.write({'partner_id': partner_id}) | ||
125 | 296 | 299 | ||
126 | 297 | if wiz.statement_line_id: | 300 | if wiz.statement_line_id: |
127 | 298 | #delete splits causing an unsplit if this is a split | 301 | #delete splits causing an unsplit if this is a split |
128 | @@ -391,22 +394,15 @@ | |||
129 | 391 | 'match_type': fields.related( | 394 | 'match_type': fields.related( |
130 | 392 | 'import_transaction_id', 'match_type', | 395 | 'import_transaction_id', 'match_type', |
131 | 393 | type="char", size=16, string='Match type', readonly=True), | 396 | type="char", size=16, string='Match type', readonly=True), |
132 | 394 | 'manual_invoice_id': fields.many2one( | ||
133 | 395 | 'account.invoice', 'Match this invoice', | ||
134 | 396 | domain=[('reconciled', '=', False)]), | ||
135 | 397 | 'manual_move_line_id': fields.many2one( | ||
136 | 398 | 'account.move.line', 'Or match this entry', | ||
137 | 399 | domain=[('account_id.reconcile', '=', True), | ||
138 | 400 | ('reconcile_id', '=', False)]), | ||
139 | 401 | 'manual_invoice_ids': fields.many2many( | 397 | 'manual_invoice_ids': fields.many2many( |
140 | 402 | 'account.invoice', | 398 | 'account.invoice', |
141 | 403 | 'banking_transaction_wizard_account_invoice_rel', | 399 | 'banking_transaction_wizard_account_invoice_rel', |
143 | 404 | 'wizard_id', 'invoice_id', string='Match following invoices', | 400 | 'wizard_id', 'invoice_id', string='Match one or more invoices', |
144 | 405 | domain=[('reconciled', '=', False)]), | 401 | domain=[('reconciled', '=', False)]), |
145 | 406 | 'manual_move_line_ids': fields.many2many( | 402 | 'manual_move_line_ids': fields.many2many( |
146 | 407 | 'account.move.line', | 403 | 'account.move.line', |
147 | 408 | 'banking_transaction_wizard_account_move_line_rel', | 404 | 'banking_transaction_wizard_account_move_line_rel', |
149 | 409 | 'wizard_id', 'move_line_id', string='Or match this entries', | 405 | 'wizard_id', 'move_line_id', string='Or match one or more entries', |
150 | 410 | domain=[('account_id.reconcile', '=', True), | 406 | domain=[('account_id.reconcile', '=', True), |
151 | 411 | ('reconcile_id', '=', False)]), | 407 | ('reconcile_id', '=', False)]), |
152 | 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, |
153 | 413 | 409 | ||
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 | 82 | name="trigger_match" | 82 | name="trigger_match" |
159 | 83 | type="object" | 83 | type="object" |
160 | 84 | string="Match again"/> | 84 | string="Match again"/> |
161 | 85 | <!-- Manual selection --> | ||
162 | 86 | </page> | 85 | </page> |
163 | 86 | <!-- Manual selection --> | ||
164 | 87 | <page string="Manual match"> | 87 | <page string="Manual match"> |
165 | 88 | <field name="manual_invoice_id" | ||
166 | 89 | context="{'search_default_partner_id': partner_id}" | ||
167 | 90 | /> | ||
168 | 91 | <!-- | ||
169 | 92 | Specify alternative tree_view_ref as a | ||
170 | 93 | workaround for lp:1073521 in OpenERP 6.1 | ||
171 | 94 | Need to also define 'view_mode' to prevent | ||
172 | 95 | an instant editable tree view | ||
173 | 96 | reconstruction by account.move.line's | ||
174 | 97 | fields_view_get(). | ||
175 | 98 | Both are not needed in OpenERP 6.0 or 7.0. | ||
176 | 99 | --> | ||
177 | 100 | <field name="manual_move_line_id" | ||
178 | 101 | context="{ | ||
179 | 102 | 'search_default_partner_id': partner_id, | ||
180 | 103 | 'tree_view_ref': 'account.view_move_line_tax_tree', | ||
181 | 104 | 'view_mode': 'yes' | ||
182 | 105 | }" | ||
183 | 106 | /> | ||
184 | 107 | <newline/> | ||
185 | 108 | <button colspan="1" | ||
186 | 109 | name="trigger_write" | ||
187 | 110 | type="object" | ||
188 | 111 | string="Match"/> | ||
189 | 112 | </page> | ||
190 | 113 | <page string="Multiple manual matches" attrs="{'invisible': ['|', ('match_type', '!=', False), ('statement_line_parent_id', '!=', False)]}"> | ||
191 | 114 | <field name="manual_invoice_ids" colspan="4" | 88 | <field name="manual_invoice_ids" colspan="4" |
192 | 115 | context="{'search_default_partner_id': partner_id}" | 89 | context="{'search_default_partner_id': partner_id}" |
193 | 116 | /> | 90 | /> |
194 | @@ -146,7 +120,7 @@ | |||
195 | 146 | </notebook> | 120 | </notebook> |
196 | 147 | <group colspan="2"> | 121 | <group colspan="2"> |
197 | 148 | <separator/> | 122 | <separator/> |
199 | 149 | <button icon="gtk-ok" string="Done" special="cancel"/> | 123 | <button icon="gtk-ok" string="Close" special="cancel"/> |
200 | 150 | </group> | 124 | </group> |
201 | 151 | </group> | 125 | </group> |
202 | 152 | </form> | 126 | </form> |