Merge lp:~unifield-team/unifield-wm/UF_2164 into lp:unifield-wm
- UF_2164
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 1837 |
Proposed branch: | lp:~unifield-team/unifield-wm/UF_2164 |
Merge into: | lp:unifield-wm |
Diff against target: |
830 lines (+434/-37) 22 files modified
account_corrections/__init__.py (+2/-0) account_corrections/account_analytic_line.py (+149/-0) account_corrections/account_invoice.py (+85/-0) account_corrections/account_move_line.py (+16/-5) account_corrections/account_wizard_view.xml (+10/-9) account_corrections/wizard/analytic_distribution_wizard.py (+8/-6) account_hq_entries/hq_entries.py (+4/-2) account_mcdb/account_view.xml (+36/-2) account_msf/invoice.py (+1/-1) account_msf/invoice_view.xml (+4/-0) account_override/account_analytic_line.py (+1/-0) account_override/account_view.xml (+2/-0) analytic_distribution/analytic_distribution_wizard_view.xml (+1/-1) analytic_distribution/analytic_line.py (+3/-2) analytic_distribution/analytic_line_view.xml (+0/-5) analytic_distribution_invoice/account_invoice_view.xml (+5/-1) analytic_distribution_invoice/invoice.py (+6/-3) msf_instance/msf_instance_view.xml (+15/-0) register_accounting/account_bank_statement.py (+57/-0) register_accounting/account_invoice_view.xml (+2/-0) register_accounting/account_view.xml (+10/-0) register_accounting/account_wizard.xml (+17/-0) |
To merge this branch: | bzr merge lp:~unifield-team/unifield-wm/UF_2164 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Dev Team | Pending | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
- 1837. By jftempo
-
UF-2164 [IMP] Correction handling
lp:~unifield-team/unifield-wm/UF_2164 - 1838. By jftempo
-
UF-2164 [IMP] Code simplification
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'account_corrections/__init__.py' |
2 | --- account_corrections/__init__.py 2013-09-13 13:57:37 +0000 |
3 | +++ account_corrections/__init__.py 2013-11-06 10:36:19 +0000 |
4 | @@ -23,5 +23,7 @@ |
5 | |
6 | import account_move_line |
7 | import wizard |
8 | +import account_analytic_line |
9 | +import account_invoice |
10 | |
11 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
12 | |
13 | === added file 'account_corrections/account_analytic_line.py' |
14 | --- account_corrections/account_analytic_line.py 1970-01-01 00:00:00 +0000 |
15 | +++ account_corrections/account_analytic_line.py 2013-11-06 10:36:19 +0000 |
16 | @@ -0,0 +1,149 @@ |
17 | +#!/usr/bin/env python |
18 | +#-*- encoding:utf-8 -*- |
19 | +############################################################################## |
20 | +# |
21 | +# OpenERP, Open Source Management Solution |
22 | +# Copyright (C) 2011 TeMPO Consulting, MSF. All Rights Reserved |
23 | +# Developer: Olivier DOSSMANN |
24 | +# |
25 | +# This program is free software: you can redistribute it and/or modify |
26 | +# it under the terms of the GNU Affero General Public License as |
27 | +# published by the Free Software Foundation, either version 3 of the |
28 | +# License, or (at your option) any later version. |
29 | +# |
30 | +# This program is distributed in the hope that it will be useful, |
31 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
32 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
33 | +# GNU Affero General Public License for more details. |
34 | +# |
35 | +# You should have received a copy of the GNU Affero General Public License |
36 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
37 | +# |
38 | +############################################################################## |
39 | + |
40 | +from osv import osv |
41 | +from osv import fields |
42 | +from tools.translate import _ |
43 | + |
44 | +class account_analytic_line(osv.osv): |
45 | + _name = 'account.analytic.line' |
46 | + _inherit = 'account.analytic.line' |
47 | + |
48 | + _columns = { |
49 | + 'is_corrigible': fields.related('move_id', 'is_corrigible', string='Is correctible?', type="boolean", readonly=True), |
50 | + 'last_corrected_id': fields.many2one('account.analytic.line', string="Last corrected entry", readonly=True), |
51 | + } |
52 | + |
53 | + def button_corrections(self, cr, uid, ids, context=None): |
54 | + """ |
55 | + Launch accounting correction wizard to do reverse or correction on selected analytic line. |
56 | + """ |
57 | + # Verification |
58 | + if not context: |
59 | + context={} |
60 | + if isinstance(ids, (int, long)): |
61 | + ids = [ids] |
62 | + # Retrieve some values |
63 | + wiz_obj = self.pool.get('wizard.journal.items.corrections') |
64 | + al = self.browse(cr, uid, ids[0]) |
65 | + if not al.move_id: |
66 | + raise osv.except_osv(_('Warning'), _('No link to a journal item found!')) |
67 | + if not al.move_id.is_corrigible: |
68 | + raise osv.except_osv(_('Error'), _('The journal item linked to this analytic line is not correctible!')) |
69 | + # Create wizard |
70 | + wizard = wiz_obj.create(cr, uid, {'move_line_id': al.move_id.id}, context=context) |
71 | + # Change wizard state in order to change date requirement on wizard |
72 | + wiz_obj.write(cr, uid, [wizard], {'state': 'open'}, context=context) |
73 | + # Update context |
74 | + context.update({ |
75 | + 'active_id': al.move_id.id, |
76 | + 'active_ids': [al.move_id.id], |
77 | + }) |
78 | + # Change context if account special type is "donation" |
79 | + if al.move_id.account_id and al.move_id.account_id.type_for_register and al.move_id.account_id.type_for_register == 'donation': |
80 | + wiz_obj.write(cr, uid, [wizard], {'from_donation': True}, context=context) |
81 | + # Update context to inform wizard we come from a correction wizard |
82 | + context.update({'from_correction': True,}) |
83 | + return { |
84 | + 'name': _("Accounting Corrections Wizard (from Analytic Journal Items)"), |
85 | + 'type': 'ir.actions.act_window', |
86 | + 'res_model': 'wizard.journal.items.corrections', |
87 | + 'target': 'new', |
88 | + 'view_mode': 'form,tree', |
89 | + 'view_type': 'form', |
90 | + 'res_id': [wizard], |
91 | + 'context': context, |
92 | + } |
93 | + |
94 | + def get_corrections_history(self, cr, uid, ids, context=None): |
95 | + """ |
96 | + Give for each line their history by using "move_id and reversal_origin" field to browse lines |
97 | + Return something like that: |
98 | + {id1: [line_id, another_line_id], id2: [a_line_id, other_line_id]} |
99 | + """ |
100 | + # Verifications |
101 | + if not context: |
102 | + context = {} |
103 | + if isinstance(ids, (int, long)): |
104 | + ids = [ids] |
105 | + # Prepare some values |
106 | + res = {} |
107 | + upstream_line_ids = [] |
108 | + downstream_line_ids = [] |
109 | + # Browse all given lines |
110 | + for aml in self.browse(cr, uid, ids, context=context): |
111 | + # Get upstream move lines |
112 | + line = aml |
113 | + while line: |
114 | + # Add line to result |
115 | + upstream_line_ids.append(line.id) |
116 | + # Add reversal line to result |
117 | + upstream_line_ids += self.search(cr, uid, [('reversal_origin', '=', line.id), ('is_reversal', '=', True)], context=context) |
118 | + line = line.last_corrected_id |
119 | + # Get downstream move lines |
120 | + sline_ids = [aml.id] |
121 | + while sline_ids: |
122 | + sline_ids = self.search(cr, uid, [('last_corrected_id', 'in', sline_ids)], context=context) |
123 | + if sline_ids: |
124 | + # Add line to result |
125 | + downstream_line_ids += sline_ids |
126 | + # Add reversal line to result |
127 | + downstream_line_ids += self.search(cr, uid, [('reversal_origin', 'in', sline_ids), ('is_reversal', '=', True)], context=context) |
128 | + |
129 | + return list(set(upstream_line_ids + downstream_line_ids)) |
130 | + |
131 | + def button_open_analytic_corrections(self, cr, uid, ids, context=None): |
132 | + """ |
133 | + Open a wizard that contains all analytic lines linked to this one. |
134 | + """ |
135 | + # Verification |
136 | + if not context: |
137 | + context={} |
138 | + if isinstance(ids, (int, long)): |
139 | + ids = [ids] |
140 | + |
141 | + # Search ids to be open |
142 | + domain_ids = self.get_corrections_history(cr, uid, ids, context=context) |
143 | + # Create domain |
144 | + domain = [('id', 'in', domain_ids)] |
145 | + # Update context |
146 | + context.update({ |
147 | + 'active_id': ids[0], |
148 | + 'active_ids': ids, |
149 | + 'display_fp': True, |
150 | + }) |
151 | + # Display the result |
152 | + return { |
153 | + 'name': "History Analytic Line", |
154 | + 'type': 'ir.actions.act_window', |
155 | + 'res_model': 'account.analytic.line', |
156 | + 'target': 'new', |
157 | + 'view_type': 'form', |
158 | + 'view_mode': 'tree', |
159 | + 'context': context, |
160 | + 'domain': domain, |
161 | + } |
162 | + return True |
163 | + |
164 | +account_analytic_line() |
165 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
166 | |
167 | === added file 'account_corrections/account_invoice.py' |
168 | --- account_corrections/account_invoice.py 1970-01-01 00:00:00 +0000 |
169 | +++ account_corrections/account_invoice.py 2013-11-06 10:36:19 +0000 |
170 | @@ -0,0 +1,85 @@ |
171 | +#!/usr/bin/env python |
172 | +#-*- encoding:utf-8 -*- |
173 | +############################################################################## |
174 | +# |
175 | +# OpenERP, Open Source Management Solution |
176 | +# Copyright (C) 2013 TeMPO Consulting, MSF. All Rights Reserved |
177 | +# Developer: Olivier DOSSMANN |
178 | +# |
179 | +# This program is free software: you can redistribute it and/or modify |
180 | +# it under the terms of the GNU Affero General Public License as |
181 | +# published by the Free Software Foundation, either version 3 of the |
182 | +# License, or (at your option) any later version. |
183 | +# |
184 | +# This program is distributed in the hope that it will be useful, |
185 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
186 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
187 | +# GNU Affero General Public License for more details. |
188 | +# |
189 | +# You should have received a copy of the GNU Affero General Public License |
190 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
191 | +# |
192 | +############################################################################## |
193 | + |
194 | +from osv import osv |
195 | +from osv import fields |
196 | +from tools.translate import _ |
197 | +from time import strftime |
198 | + |
199 | +class account_invoice_line(osv.osv): |
200 | + _name = 'account.invoice.line' |
201 | + _inherit = 'account.invoice.line' |
202 | + |
203 | + def _have_been_corrected(self, cr, uid, ids, name, args, context=None): |
204 | + """ |
205 | + Return True if ALL elements are OK: |
206 | + - a journal items is linked to this invoice line |
207 | + - the journal items is linked to an analytic line that have been reallocated |
208 | + """ |
209 | + if context is None: |
210 | + context = {} |
211 | + res = {} |
212 | + |
213 | + def has_ana_reallocated(move): |
214 | + for ml in move.move_lines or []: |
215 | + for al in ml.analytic_lines or []: |
216 | + if al.is_reallocated: |
217 | + return True |
218 | + return False |
219 | + |
220 | + for il in self.browse(cr, uid, ids, context=context): |
221 | + res[il.id] = has_ana_reallocated(il) |
222 | + return res |
223 | + |
224 | + _columns = { |
225 | + 'is_corrected': fields.function(_have_been_corrected, method=True, string="Have been corrected?", type='boolean', |
226 | + readonly=True, help="This informs system if this item have been corrected in analytic lines. Criteria: the invoice line is linked to a journal items that have analytic item which is reallocated.", |
227 | + store=False), |
228 | + } |
229 | + |
230 | + _defaults = { |
231 | + 'is_corrected': lambda *a: False, |
232 | + } |
233 | + |
234 | + def button_open_analytic_lines(self, cr, uid, ids, context=None): |
235 | + """ |
236 | + Return analytic lines linked to this invoice line. |
237 | + First we takes all journal items that are linked to this invoice line. |
238 | + Then for all journal items, we take all analytic journal items. |
239 | + Finally we display the result for "button_open_analytic_corrections" of analytic lines |
240 | + """ |
241 | + # Some checks |
242 | + if not context: |
243 | + context = {} |
244 | + # Prepare some values |
245 | + al_ids = [] |
246 | + # Browse give invoice lines |
247 | + for il in self.browse(cr, uid, ids, context=context): |
248 | + if il.move_lines: |
249 | + for ml in il.move_lines: |
250 | + if ml.analytic_lines: |
251 | + al_ids += [x.id for x in ml.analytic_lines] |
252 | + return self.pool.get('account.analytic.line').button_open_analytic_corrections(cr, uid, al_ids, context=context) |
253 | + |
254 | +account_invoice_line() |
255 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
256 | |
257 | === modified file 'account_corrections/account_move_line.py' |
258 | --- account_corrections/account_move_line.py 2013-09-13 13:57:37 +0000 |
259 | +++ account_corrections/account_move_line.py 2013-11-06 10:36:19 +0000 |
260 | @@ -256,7 +256,7 @@ |
261 | # Update context to inform wizard we come from a correction wizard |
262 | context.update({'from_correction': True,}) |
263 | return { |
264 | - 'name': "Accounting Corrections Wizard", |
265 | + 'name': _("Accounting Corrections Wizard (from Journal Items)"), |
266 | 'type': 'ir.actions.act_window', |
267 | 'res_model': 'wizard.journal.items.corrections', |
268 | 'target': 'new', |
269 | @@ -600,6 +600,13 @@ |
270 | # Abort process if this move line was corrected before |
271 | if ml.corrected: |
272 | continue |
273 | + # If this line was already been corrected, check the first analytic line ID (but not the first first analytic line) |
274 | + first_analytic_line_id = False |
275 | + first_ana_ids = self.pool.get('account.analytic.line').search(cr, uid, [('move_id', '=', ml.id)]) |
276 | + if first_ana_ids: |
277 | + first_ana = self.pool.get('account.analytic.line').browse(cr, uid, first_ana_ids)[0] |
278 | + if first_ana.last_corrected_id: |
279 | + first_analytic_line_id = first_ana.last_corrected_id.id |
280 | # Retrieve right journal |
281 | journal_id = j_corr_id |
282 | |
283 | @@ -681,19 +688,23 @@ |
284 | move_obj.post(cr, uid, [move_id], context=context) |
285 | # Change analytic lines that come from: |
286 | #- initial move line: is_reallocated is True |
287 | - #- reversal move line: is_reversal is True |
288 | + #- reversal move line: is_reversal is True + initial analytic line |
289 | #- correction line: change is_reallocated and is_reversal to False |
290 | #- old reversal line: reset is_reversal to True (lost previously in validate()) |
291 | + initial_al_ids = al_obj.search(cr, uid, [('move_id', '=', ml.id)]) |
292 | search_datas = [(ml.id, {'is_reallocated': True}), |
293 | - (rev_line_id, {'is_reversal': True}), |
294 | - (correction_line_id, {'is_reallocated': False, 'is_reversal': False})] |
295 | + (rev_line_id, {'is_reversal': True, 'reversal_origin': initial_al_ids[0]}), |
296 | + (correction_line_id, {'is_reallocated': False, 'is_reversal': False, 'last_corrected_id': initial_al_ids[0]})] |
297 | # If line is already a correction, take the previous reversal move line id |
298 | # (UF_1234: otherwise, the reversal is not set correctly) |
299 | if ml.corrected_line_id: |
300 | old_reverse_ids = self.search(cr, uid, [('reversal_line_id', '=', ml.corrected_line_id.id)]) |
301 | if len(old_reverse_ids) > 0: |
302 | - search_datas += [(old_reverse_ids[0], {'is_reversal': True})] |
303 | + search_datas += [(old_reverse_ids[0], {'is_reversal': True, 'reversal_origin': first_analytic_line_id})] |
304 | for search_data in search_datas: |
305 | + # keep initial analytic line as corrected line if it the 2nd or more correction on this line |
306 | + if ml.corrected_line_id and search_data[0] == ml.id and first_analytic_line_id: |
307 | + search_data[1].update({'last_corrected_id': first_analytic_line_id}) |
308 | search_ids = al_obj.search(cr, uid, [('move_id', '=', search_data[0])]) |
309 | if search_ids: |
310 | al_obj.write(cr, uid, search_ids, search_data[1]) |
311 | |
312 | === modified file 'account_corrections/account_wizard_view.xml' |
313 | --- account_corrections/account_wizard_view.xml 2013-07-30 12:08:55 +0000 |
314 | +++ account_corrections/account_wizard_view.xml 2013-11-06 10:36:19 +0000 |
315 | @@ -9,11 +9,9 @@ |
316 | <field name="type">tree</field> |
317 | <field name="arch" type="xml"> |
318 | <tree hide_new_button="1" hide_delete_button="1" editable="bottom" colors="blue:analytic_distribution_state in ('valid');red:analytic_distribution_state in ('invalid');black:analytic_distribution_state in ('none')"> |
319 | - <field name="journal_id"/> |
320 | <field name="move_id"/> |
321 | <field name="ref"/> |
322 | <field name="date"/> |
323 | - <field name="period_id"/> |
324 | <field name="account_id" domain="[('type', '<>', 'view')]"/> |
325 | <button name="button_analytic_distribution" type="object" icon="terp-stock_symbol-selection" string="Ana. Distri."/> |
326 | <field name="analytic_distribution_state"/> |
327 | @@ -32,13 +30,13 @@ |
328 | <field name="type">form</field> |
329 | <field name="arch" type="xml"> |
330 | <form string="Journal items corrections Wizard"> |
331 | - <field name="move_line_id" invisible="1" colspan="1"/> |
332 | - <field name="date" on_change="onchange_date(date)"/> |
333 | + <separator string="Correction"/> |
334 | + <field name="date" on_change="onchange_date(date)" colspan="2"/> |
335 | + <label string="" colspan="2"/> |
336 | <field name="from_donation" invisible="1"/> |
337 | <newline/> |
338 | - <field name="to_be_corrected_ids" colspan="6" context="{'from_donation_account': from_donation}" /> |
339 | + <field name="to_be_corrected_ids" colspan="6" context="{'from_donation_account': from_donation}" nolabel="1"/> |
340 | <newline/> |
341 | - <label string="" colspan="6"/> |
342 | <group colspan="4" col="6"> |
343 | <label string ="" colspan="1"/> |
344 | <button icon="gtk-cancel" special="cancel" string="Cancel"/> |
345 | @@ -63,9 +61,12 @@ |
346 | attrs="{'invisible': [('state', '!=', 'correction')], 'required': [('state', '=', 'correction')]}"/> |
347 | <newline/> |
348 | </xpath> |
349 | - <xpath expr="/form//button[@name='button_confirm']" position="replace"> |
350 | - <button name="button_confirm" string="Save" type="object" icon="gtk-ok" colspan="1" attrs="{'invisible': [('state', '=', 'correction')], 'readonly': [('is_writable', '=', False)]}"/> |
351 | - <button name="button_confirm" string="Correct it!" type="object" icon="gtk-edit" colspan="1" attrs="{'invisible': [('state', '!=', 'correction')]}"/> |
352 | + <xpath expr="/form//field[@name='state']" position="before"> |
353 | + <group colspan="4" attrs="{'invisible': [('state', '!=', 'correction')]}"> |
354 | + <label string="" colspan="2"/> |
355 | + <button name="button_cancel" string='Cancel' type='object' icon='gtk-cancel' colspan="1"/> |
356 | + <button name="button_confirm" string="Correct it" type="object" icon="gtk-edit" colspan="1" attrs="{'readonly': [('is_writable', '=', False)]}"/> |
357 | + </group> |
358 | </xpath> |
359 | </data> |
360 | </field> |
361 | |
362 | === modified file 'account_corrections/wizard/analytic_distribution_wizard.py' |
363 | --- account_corrections/wizard/analytic_distribution_wizard.py 2013-11-05 09:23:49 +0000 |
364 | +++ account_corrections/wizard/analytic_distribution_wizard.py 2013-11-06 10:36:19 +0000 |
365 | @@ -204,11 +204,12 @@ |
366 | # reverse the line |
367 | to_reverse_ids = self.pool.get('account.analytic.line').search(cr, uid, [('distrib_line_id', '=', 'funding.pool.distribution.line,%d'%line.distribution_line_id.id), ('is_reversal', '=', False), ('is_reallocated', '=', False)]) |
368 | # UTP-943: Set wizard date as date for REVERSAL AND CORRECTION lines |
369 | - rev_ids = self.pool.get('account.analytic.line').reverse(cr, uid, to_reverse_ids, posting_date=wizard.date) |
370 | + reversed_ids = self.pool.get('account.analytic.line').reverse(cr, uid, to_reverse_ids[0], posting_date=wizard.date) |
371 | + # Add reversal origin link (to not loose it). last_corrected_id is to prevent case where you do a reverse a line that have been already corrected |
372 | # UTP-943: Add correction journal on it |
373 | - self.pool.get('account.analytic.line').write(cr, uid, rev_ids, {'journal_id': correction_journal_id}) |
374 | + self.pool.get('account.analytic.line').write(cr, uid, [reversed_ids[0]], {'reversal_origin': to_reverse_ids[0], 'last_corrected_id': False, 'journal_id': correction_journal_id}) |
375 | # Mark old lines as non reallocatable (ana_ids): why reverse() don't set this flag ? |
376 | - self.pool.get('account.analytic.line').write(cr, uid, to_reverse_ids, {'is_reallocated': True,}) |
377 | + self.pool.get('account.analytic.line').write(cr, uid, [to_reverse_ids[0]], {'is_reallocated': True,}) |
378 | # update the distrib line |
379 | name = False |
380 | if to_reverse_ids: |
381 | @@ -228,9 +229,10 @@ |
382 | if cp.state != 'draft': |
383 | raise osv.except_osv(_('Error'), _('Period (%s) is not open.') % (cp.name,)) |
384 | # Create the new ana line |
385 | - cor_ids = self.pool.get('funding.pool.distribution.line').create_analytic_lines(cr, uid, line.distribution_line_id.id, ml.id, date=wizard.date, document_date=orig_document_date, source_date=orig_date, name=name) |
386 | - for distrib_id in cor_ids: |
387 | - self.pool.get('account.analytic.line').write(cr, uid, [cor_ids[distrib_id]], {'journal_id': correction_journal_id}) |
388 | + ret = self.pool.get('funding.pool.distribution.line').create_analytic_lines(cr, uid, line.distribution_line_id.id, ml.id, date=wizard.date, document_date=orig_document_date, source_date=orig_date, name=name) |
389 | + # Add link to first analytic lines |
390 | + for ret_id in ret: |
391 | + self.pool.get('account.analytic.line').write(cr, uid, [ret[ret_id]], {'last_corrected_id': to_reverse_ids[0], 'journal_id': correction_journal_id}) |
392 | |
393 | for line in to_override: |
394 | # update the ana line |
395 | |
396 | === modified file 'account_hq_entries/hq_entries.py' |
397 | --- account_hq_entries/hq_entries.py 2013-10-31 13:55:38 +0000 |
398 | +++ account_hq_entries/hq_entries.py 2013-11-06 10:36:19 +0000 |
399 | @@ -255,8 +255,10 @@ |
400 | # create new lines |
401 | if not fp_old_lines: # UTP-546 - this have been added because of sync that break analytic lines generation |
402 | continue |
403 | - ana_line_obj.copy(cr, uid, fp_old_lines[0], {'date': current_date, 'source_date': line.date, 'cost_center_id': line.cost_center_id.id, |
404 | - 'account_id': line.analytic_id.id, 'destination_id': line.destination_id.id, 'journal_id': acor_journal_id}) |
405 | + cor_ids = ana_line_obj.copy(cr, uid, fp_old_lines[0], {'date': current_date, 'source_date': line.date, 'cost_center_id': line.cost_center_id.id, |
406 | + 'account_id': line.analytic_id.id, 'destination_id': line.destination_id.id, 'journal_id': acor_journal_id, 'last_correction_id': fp_old_lines[0]}) |
407 | + # update new ana line |
408 | + ana_line_obj.write(cr, uid, cor_ids, {'last_corrected_id': fp_old_lines[0]}) |
409 | # update old ana lines |
410 | ana_line_obj.write(cr, uid, fp_old_lines, {'is_reallocated': True}) |
411 | |
412 | |
413 | === modified file 'account_mcdb/account_view.xml' |
414 | --- account_mcdb/account_view.xml 2013-04-16 15:08:18 +0000 |
415 | +++ account_mcdb/account_view.xml 2013-11-06 10:36:19 +0000 |
416 | @@ -10,6 +10,12 @@ |
417 | <field name="arch" type="xml"> |
418 | <tree string="Account Entries" min_rows="100" hide_new_button="1"> |
419 | <field name="instance_id"/> |
420 | + <field name="is_corrigible" invisible="1"/> |
421 | + <field name="have_an_historic" invisible="1"/> |
422 | + <button name="button_do_accounting_corrections" type="object" string="Open Accounting Correction Wizard" |
423 | + attrs="{'invisible': [('is_corrigible', '=', False)]}" icon="terp-mail-message-new"/> |
424 | + <button name="button_open_corrections" type="object" string="Open corrections history" |
425 | + attrs="{'invisible': [('have_an_historic', '=', False)]}" icon="terp-mail-"/> |
426 | <field name="journal_id"/> |
427 | <field name="move_id"/> |
428 | <field name="name"/> |
429 | @@ -47,10 +53,15 @@ |
430 | <field name="model">account.analytic.line</field> |
431 | <field name="type">tree</field> |
432 | <field name="arch" type="xml"> |
433 | - <tree string="Analytic Line" min_rows="100" editable="bottom" noteditable="1" hide_delete_button="1" hide_new_button="1"> |
434 | + <tree string="Analytic Journal Items" min_rows="100" editable="bottom" noteditable="1" hide_delete_button="1" hide_new_button="1"> |
435 | <field name="is_reallocated" invisible="1"/> |
436 | - <button string="Have been reallocated" attrs="{'invisible': [('is_reallocated', '=', False)]}" icon="terp-mail-" colspan="2"/> |
437 | <field name="instance_id"/> |
438 | + <field name="is_reversal" invisible="1"/> |
439 | + <field name="journal_type" invisible="1"/> |
440 | + <field name="is_corrigible" invisible="1"/> |
441 | + <button name="button_corrections" type="object" string="Accounting info/correction" |
442 | + attrs="{'invisible': ['|', '|', '|', ('is_reallocated', '=', True), ('is_reversal', '=', True), ('journal_type', '=', 'engagement'), ('is_corrigible', '=', False)]}" icon="terp-mail-message-new"/> |
443 | + <button string="Have been reallocated?" attrs="{'invisible': [('is_reallocated', '=', False)]}" icon="terp-mail-" colspan="2" name="button_open_analytic_corrections" type="object"/> |
444 | <field name="journal_id"/> |
445 | <field name="entry_sequence"/> |
446 | <field name="name"/> |
447 | @@ -75,6 +86,29 @@ |
448 | </field> |
449 | </record> |
450 | |
451 | + <!-- Account analytic line tree view --> |
452 | + <record model="ir.ui.view" id="account_analytic_line_default"> |
453 | + <field name="name">account.analytic.line.default</field> |
454 | + <field name="model">account.analytic.line</field> |
455 | + <field name="type">tree</field> |
456 | + <field name="inherit_id" ref="account.view_account_analytic_line_tree"/> |
457 | + <field name="priority" eval="40"/> |
458 | + <field name="arch" type="xml"> |
459 | + <data> |
460 | + <xpath expr="/tree/field[@name='journal_id']" position="before"> |
461 | + <field name="is_reversal" invisible="1"/> |
462 | + <field name="journal_type" invisible="1"/> |
463 | + <field name="is_corrigible" invisible="1"/> |
464 | + <button name="button_corrections" type="object" string="Accounting info/correction" |
465 | + attrs="{'invisible': ['|', '|', '|', ('is_reallocated', '=', True), ('is_reversal', '=', True), ('journal_type', '=', 'engagement'), ('is_corrigible', '=', False)]}" icon="terp-mail-message-new"/> |
466 | + <field name="is_reallocated" invisible="1"/> |
467 | + <field name="last_corrected_id" invisible="1"/> |
468 | + <button string="Have been reallocated" attrs="{'invisible': [('is_reallocated', '=', False), ('last_corrected_id', '=', False)]}" icon="terp-mail-" colspan="2" name="button_open_analytic_corrections" type="object"/> |
469 | + </xpath> |
470 | + </data> |
471 | + </field> |
472 | + </record> |
473 | + |
474 | <!-- Account move line search view --> |
475 | <record id="mcdb_view_account_move_line_filter" model="ir.ui.view"> |
476 | <field name="name">Journal Items</field> |
477 | |
478 | === modified file 'account_msf/invoice.py' |
479 | --- account_msf/invoice.py 2013-03-11 10:50:12 +0000 |
480 | +++ account_msf/invoice.py 2013-11-06 10:36:19 +0000 |
481 | @@ -250,7 +250,7 @@ |
482 | if inv.type != 'out_invoice' or inv.is_debit_note == False: |
483 | raise osv.except_osv(_('Error'), _('You can only do import invoice on a Debit Note!')) |
484 | w_id = self.pool.get('debit.note.import.invoice').create(cr, uid, {'invoice_id': inv.id, 'currency_id': inv.currency_id.id, |
485 | - 'partner_id': inv.partner_id.id}) |
486 | + 'partner_id': inv.partner_id.id}, context=context) |
487 | context.update({ |
488 | 'active_id': inv.id, |
489 | 'active_ids': ids, |
490 | |
491 | === modified file 'account_msf/invoice_view.xml' |
492 | --- account_msf/invoice_view.xml 2013-09-09 13:14:25 +0000 |
493 | +++ account_msf/invoice_view.xml 2013-11-06 10:36:19 +0000 |
494 | @@ -185,6 +185,8 @@ |
495 | <field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list"> |
496 | <tree editable="top" string="Donation Lines" noteditable="1" hide_new_button="1" colors="red: inactive_product == True"> |
497 | <field name="line_number"/> |
498 | + <field name="is_corrected" invisible="1"/> |
499 | + <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/> |
500 | <field name="product_id"/> |
501 | <field name="account_id" /> |
502 | <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-stock_symbol-selection" |
503 | @@ -282,6 +284,8 @@ |
504 | <newline/> |
505 | <field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list"> |
506 | <tree editable="top" string="Intermission Voucher Lines" hide_new_button="1" colors="red: inactive_product == True"> |
507 | + <field name="is_corrected" invisible="1"/> |
508 | + <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/> |
509 | <field name="name"/> |
510 | <field name="account_id" /> |
511 | <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-stock_symbol-selection" |
512 | |
513 | === modified file 'account_override/account_analytic_line.py' |
514 | --- account_override/account_analytic_line.py 2013-10-31 13:55:38 +0000 |
515 | +++ account_override/account_analytic_line.py 2013-11-06 10:36:19 +0000 |
516 | @@ -54,6 +54,7 @@ |
517 | 'is_reversal': fields.boolean('Reversal?'), |
518 | 'is_reallocated': fields.boolean('Reallocated?'), |
519 | 'journal_id': fields.many2one('account.analytic.journal', 'Journal Code', required=True, ondelete='restrict', select=True, readonly=True), |
520 | + 'journal_type': fields.related('journal_id', 'type', 'Journal type', readonly=True), |
521 | 'date': fields.date('Posting Date', required=True, select=True, readonly=True), |
522 | 'document_date': fields.date('Document Date', readonly=True, required=True), |
523 | 'move_id': fields.many2one('account.move.line', 'Entry Sequence', ondelete='restrict', select=True, readonly=True, domain="[('account_id.user_type.code', 'in', ['expense', 'income'])]"), # UF-1719: Domain added for search view |
524 | |
525 | === modified file 'account_override/account_view.xml' |
526 | --- account_override/account_view.xml 2013-10-21 12:02:45 +0000 |
527 | +++ account_override/account_view.xml 2013-11-06 10:36:19 +0000 |
528 | @@ -14,6 +14,8 @@ |
529 | <data> |
530 | <xpath expr="/tree/field[@name='name']" position="before"> |
531 | <field name="line_number"/> |
532 | + <field name="is_corrected" invisible="1"/> |
533 | + <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/> |
534 | </xpath> |
535 | </data> |
536 | </field> |
537 | |
538 | === modified file 'analytic_distribution/analytic_distribution_wizard_view.xml' |
539 | --- analytic_distribution/analytic_distribution_wizard_view.xml 2013-10-30 11:00:44 +0000 |
540 | +++ analytic_distribution/analytic_distribution_wizard_view.xml 2013-11-06 10:36:19 +0000 |
541 | @@ -109,7 +109,7 @@ |
542 | <field colspan="4" name="f2_line_ids" nolabel="1" widget="one2many_list" context="{'mode': entry_mode, 'parent_id':active_id}" attrs="{'readonly': [('is_writable', '=', False)]}"/> |
543 | </group> |
544 | </group> |
545 | - <group colspan="4"> |
546 | + <group colspan="4" attrs="{'invisible': [('state', '=', 'correction')]}"> |
547 | <label string="" colspan="2"/> |
548 | <button name="button_cancel" string='Cancel' type='object' icon='gtk-cancel' colspan="1"/> |
549 | <button name="button_confirm" string="Save" type="object" icon="gtk-ok" colspan="1" attrs="{'readonly': [('is_writable', '=', False)]}"/> |
550 | |
551 | === modified file 'analytic_distribution/analytic_line.py' |
552 | --- analytic_distribution/analytic_line.py 2013-11-05 09:23:49 +0000 |
553 | +++ analytic_distribution/analytic_line.py 2013-11-06 10:36:19 +0000 |
554 | @@ -324,7 +324,7 @@ |
555 | # First reverse line |
556 | rev_ids = self.pool.get('account.analytic.line').reverse(cr, uid, [aline.id], posting_date=date) |
557 | # UTP-943: Shoud have a correction journal on these lines |
558 | - self.pool.get('account.analytic.line').write(cr, uid, rev_ids, {'journal_id': correction_journal_id}) |
559 | + self.pool.get('account.analytic.line').write(cr, uid, rev_ids, {'journal_id': correction_journal_id, 'is_reversal': True, 'reversal_origin': aline.id, 'last_corrected_id': False}) |
560 | # UTP-943: Check that period is open |
561 | correction_period_ids = self.pool.get('account.period').get_period_from_date(cr, uid, date, context=context) |
562 | if not correction_period_ids: |
563 | @@ -333,8 +333,9 @@ |
564 | if p.state != 'draft': |
565 | raise osv.except_osv(_('Error'), _('Period (%s) is not open.') % (p.name,)) |
566 | # then create new lines |
567 | - self.pool.get('account.analytic.line').copy(cr, uid, aline.id, {fieldname: account_id, 'date': date, |
568 | + cor_ids = self.pool.get('account.analytic.line').copy(cr, uid, aline.id, {fieldname: account_id, 'date': date, |
569 | 'source_date': aline.source_date or aline.date, 'journal_id': correction_journal_id}, context=context) |
570 | + self.pool.get('account.analytic.line').write(cr, uid, cor_ids, {'last_corrected_id': aline.id}) |
571 | # finally flag analytic line as reallocated |
572 | self.pool.get('account.analytic.line').write(cr, uid, [aline.id], {'is_reallocated': True}) |
573 | else: |
574 | |
575 | === modified file 'analytic_distribution/analytic_line_view.xml' |
576 | --- analytic_distribution/analytic_line_view.xml 2013-07-08 16:03:00 +0000 |
577 | +++ analytic_distribution/analytic_line_view.xml 2013-11-06 10:36:19 +0000 |
578 | @@ -11,11 +11,6 @@ |
579 | <field name="priority" eval="11"/> |
580 | <field name="arch" type="xml"> |
581 | <data> |
582 | - <xpath expr="/tree/field[@name='journal_id']" position='before'> |
583 | - <field name="is_reallocated" invisible="1"/> |
584 | - <button string="Have been reallocated" attrs="{'invisible': [('is_reallocated', '=', False)]}" |
585 | - icon="terp-mail-" colspan="2"/> |
586 | - </xpath> |
587 | <xpath expr="/tree/field[@name='move_id']" position='replace'> |
588 | <field name="entry_sequence"/> |
589 | </xpath> |
590 | |
591 | === modified file 'analytic_distribution_invoice/account_invoice_view.xml' |
592 | --- analytic_distribution_invoice/account_invoice_view.xml 2013-03-26 17:07:53 +0000 |
593 | +++ analytic_distribution_invoice/account_invoice_view.xml 2013-11-06 10:36:19 +0000 |
594 | @@ -26,7 +26,11 @@ |
595 | <field name="is_allocatable" invisible="1"/> |
596 | </xpath> |
597 | <xpath expr="//tree[@string='Invoice lines']" position="attributes"> |
598 | - <attribute name="colors">red:analytic_distribution_state in ('invalid') or inactive_product == True;blue:analytic_distribution_state in ('valid') and inactive_product == False;black:analytic_distribution_state in ('none') and inactive_product = False</attribute> |
599 | + <attribute name="colors">red:analytic_distribution_state in ('invalid') or inactive_product == True;blue:analytic_distribution_state in ('valid') and inactive_product == False;black:analytic_distribution_state in ('none') and inactive_product == False</attribute> |
600 | + </xpath> |
601 | + <xpath expr="//tree[@string='Invoice lines']/field[@name='product_id']" position="before"> |
602 | + <field name="is_corrected" invisible="1"/> |
603 | + <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/> |
604 | </xpath> |
605 | </data> |
606 | </field> |
607 | |
608 | === modified file 'analytic_distribution_invoice/invoice.py' |
609 | --- analytic_distribution_invoice/invoice.py 2013-07-19 13:23:03 +0000 |
610 | +++ analytic_distribution_invoice/invoice.py 2013-11-06 10:36:19 +0000 |
611 | @@ -128,9 +128,12 @@ |
612 | # Give false analytic lines for 'line' in order not to give an error |
613 | if 'analytic_line_ids' in el[2]: |
614 | el[2]['analytic_line_ids'] = False |
615 | - # Give false order_line_id in order not to give an error |
616 | - if 'order_line_id' in el[2]: |
617 | - el[2]['order_line_id'] = el[2].get('order_line_id', False) and el[2]['order_line_id'][0] or False |
618 | + # Give false for (because not needed): |
619 | + # - order_line_id |
620 | + # - sale_order_line_id |
621 | + for field in ['order_line_id', 'sale_order_line_id']: |
622 | + if field in el[2]: |
623 | + el[2][field] = el[2].get(field, False) and el[2][field][0] or False |
624 | return res |
625 | |
626 | def refund(self, cr, uid, ids, date=None, period_id=None, description=None, journal_id=None, document_date=None): |
627 | |
628 | === modified file 'msf_instance/msf_instance_view.xml' |
629 | --- msf_instance/msf_instance_view.xml 2013-10-31 21:48:37 +0000 |
630 | +++ msf_instance/msf_instance_view.xml 2013-11-06 10:36:19 +0000 |
631 | @@ -125,6 +125,7 @@ |
632 | <field name="model">account.analytic.line</field> |
633 | <field name="type">tree</field> |
634 | <field name="inherit_id" ref="account.view_account_analytic_line_tree"/> |
635 | + <field name="priority" eval="18"/> |
636 | <field name="arch" type="xml"> |
637 | <field name="journal_id" position="before"> |
638 | <field name="instance_id" readonly="1"/> |
639 | @@ -297,6 +298,20 @@ |
640 | </field> |
641 | </record> |
642 | |
643 | + <record id="view_move_line_tree_from_move_inherit" model="ir.ui.view"> |
644 | + <field name="name">account.move.line.tree.from.move.inherit</field> |
645 | + <field name="model">account.move.line</field> |
646 | + <field name="type">tree</field> |
647 | + <field name="inherit_id" ref="register_accounting.view_move_line_tree_from_move"/> |
648 | + <field name="arch" type="xml"> |
649 | + <data> |
650 | + <xpath expr="/tree/field[@name='is_corrigible']" position="before"> |
651 | + <field name="instance_id" readonly="1"/> |
652 | + </xpath> |
653 | + </data> |
654 | + </field> |
655 | + </record> |
656 | + |
657 | <record id="view_account_move_line_filter_instance_inherit" model="ir.ui.view"> |
658 | <field name="name">account.move.line.filter.instance.inherit</field> |
659 | <field name="model">account.move.line</field> |
660 | |
661 | === modified file 'register_accounting/account_bank_statement.py' |
662 | --- register_accounting/account_bank_statement.py 2013-10-14 16:04:11 +0000 |
663 | +++ register_accounting/account_bank_statement.py 2013-11-06 10:36:19 +0000 |
664 | @@ -862,6 +862,52 @@ |
665 | return open_register_view(self, cr, uid, st_line.statement_id.id) |
666 | raise osv.except_osv(_('Warning'), _('You have to select some line to return to a register.')) |
667 | |
668 | + def get_analytic_lines(self, cr, uid, ids, context=None): |
669 | + """ |
670 | + Give all analytic lines linked to the given register line(s) |
671 | + """ |
672 | + # Some verifications |
673 | + if not context: |
674 | + context = {} |
675 | + if not 'active_ids' in context or not context.get('active_ids', False): |
676 | + raise osv.except_osv(_('Error'), _('No line selected!')) |
677 | + # Use right register line IDS |
678 | + ids = context.get('active_ids') |
679 | + if isinstance(ids, (int, long)): |
680 | + ids = [ids] |
681 | + # Check which move_id to use |
682 | + move_ids = [] |
683 | + for absl in self.browse(cr, uid, ids): |
684 | + if absl.move_ids: |
685 | + # Default ones (direct link to register lines) |
686 | + for m in absl.move_ids: |
687 | + if m.id not in move_ids: |
688 | + move_ids.append(m.id) |
689 | + # Those from cash advance return (we should use the reconciliation to find the return and its expenses) |
690 | + for ml in m.line_id: |
691 | + if ml.reconcile_id and ml.reconcile_id.line_id: |
692 | + for line in ml.reconcile_id.line_id: |
693 | + if line.move_id and line.move_id.id and line.move_id.id not in move_ids: |
694 | + move_ids.append(line.move_id.id) |
695 | + # Those from pending payments (imported_invoice_line_ids are move_line) |
696 | + if absl.imported_invoice_line_ids: |
697 | + for ml in absl.imported_invoice_line_ids: |
698 | + if ml.move_id and ml.move_id.id not in move_ids: |
699 | + move_ids.append(ml.move_id.id) |
700 | + # Search valid ids |
701 | + domain = [('account_id.category', '=', 'FUNDING'), ('move_id.move_id', 'in', move_ids)] |
702 | + context.update({'display_fp': True}) # to display "Funding Pool" column name instead of "Analytic account" |
703 | + return { |
704 | + 'name': _('Analytic Journal Items'), |
705 | + 'type': 'ir.actions.act_window', |
706 | + 'res_model': 'account.analytic.line', |
707 | + 'view_type': 'form', |
708 | + 'view_mode': 'tree,form', |
709 | + 'context': context, |
710 | + 'domain': domain, |
711 | + 'target': 'current', |
712 | + } |
713 | + |
714 | def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): |
715 | """ |
716 | Create move from the register line |
717 | @@ -1714,6 +1760,17 @@ |
718 | """ |
719 | return self.posting(cr, uid, ids, 'temp', context=context) |
720 | |
721 | + def button_analytic_lines(self, cr, uid, ids, context=None): |
722 | + """ |
723 | + Give analytic lines linked to the given register lines |
724 | + """ |
725 | + if not context: |
726 | + context = {} |
727 | + # Update context |
728 | + context.update({'active_ids': ids}) |
729 | + # Return result of action named "Analytic Lines" on register lines |
730 | + return self.get_analytic_lines(cr, uid, ids, context=context) |
731 | + |
732 | def unlink(self, cr, uid, ids, context=None): |
733 | """ |
734 | Permit to delete some account_bank_statement_line. But do some treatments on temp posting lines and do nothing for hard posting lines. |
735 | |
736 | === modified file 'register_accounting/account_invoice_view.xml' |
737 | --- register_accounting/account_invoice_view.xml 2013-09-11 14:31:05 +0000 |
738 | +++ register_accounting/account_invoice_view.xml 2013-11-06 10:36:19 +0000 |
739 | @@ -130,6 +130,8 @@ |
740 | address_invoice_id, 'partner_id': partner_id, 'price_type': 'price_type' in dir() and price_type or False}" |
741 | name="invoice_line" nolabel="1" attrs="{'readonly': [('state', 'not in', ['draft', 'open']), ('is_direct_invoice', '=', True)]}"> |
742 | <tree editable="bottom" string="Invoice lines" colors="blue:inactive_product == False and analytic_distribution_state in ('valid');red:analytic_distribution_state in ('invalid') or inactive_product == True;black:inactive_product == False and analytic_distribution_state in ('none')"> |
743 | + <field name="is_corrected" invisible="1"/> |
744 | + <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/> |
745 | <field name="product_id" on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, |
746 | parent.partner_id, parent.fiscal_position, price_unit, parent.address_invoice_id, parent.currency_id, |
747 | {'company_id': parent.company_id})"/> |
748 | |
749 | === modified file 'register_accounting/account_view.xml' |
750 | --- register_accounting/account_view.xml 2013-10-14 16:04:11 +0000 |
751 | +++ register_accounting/account_view.xml 2013-11-06 10:36:19 +0000 |
752 | @@ -55,6 +55,7 @@ |
753 | <field colspan="4" name="line_ids" nolabel="1"> |
754 | <tree editable="bottom" string="Statement lines" noteditable="state=='hard' or direct_invoice is True" colors="red:display_analytic_button and (not analytic_distribution_id or analytic_distribution_state == 'invalid')"> |
755 | <button name="button_duplicate" string="Duplicate" type="object" icon="gtk-copy" /> |
756 | + <button name="button_analytic_lines" string="Analytic lines" type="object" icon="terp-stock_zoom" /> |
757 | <field name="document_date" attrs="{'readonly': [('from_import_cheque_id', '!=', False)]}"/> |
758 | <field name="date"/> |
759 | <field name="sequence_for_reference" /> |
760 | @@ -189,6 +190,7 @@ |
761 | <field colspan="4" name="line_ids" nolabel="1"> |
762 | <tree editable="bottom" string="Statement lines" noteditable="state=='hard' or direct_invoice is True" colors="red:display_analytic_button and (not analytic_distribution_id or analytic_distribution_state == 'invalid')"> |
763 | <button name="button_duplicate" string="Duplicate" type="object" icon="gtk-copy" /> |
764 | + <button name="button_analytic_lines" string="Analytic lines" type="object" icon="terp-stock_zoom" /> |
765 | <field name="from_cash_return" invisible="1"/> |
766 | <button name="button_advance" states="hard" string="Advance return" type="object" |
767 | icon="terp-stock_effects-object-colorize" context="context" |
768 | @@ -355,6 +357,7 @@ |
769 | icon="terp-stock_effects-object-colorize" context="context" |
770 | attrs="{'invisible': ['|', ('from_cash_return', '=', True), '|', ('amount', '>=', 0), |
771 | ('employee_id', '=', False)]}"/> |
772 | + <button name="button_analytic_lines" string="Analytic lines" type="object" icon="terp-stock_zoom" /> |
773 | <field name="from_cash_return" invisible="1"/> |
774 | <field name="amount" invisible="1"/> |
775 | <field name="document_date"/> |
776 | @@ -663,6 +666,7 @@ |
777 | <!-- WARNING: because of UTP-331, in cheque register direct invoice lines should be editable but ONLY for cheque_number FIELD. That's why ALL field must be not editable when "direct_invoice" is True. --> |
778 | <tree editable="bottom" string="Statement lines" noteditable="state=='hard'" colors="red:display_analytic_button and (not analytic_distribution_id or analytic_distribution_state == 'invalid')"> |
779 | <button name="button_duplicate" string="Duplicate" type="object" icon="gtk-copy" /> |
780 | + <button name="button_analytic_lines" string="Analytic lines" type="object" icon="terp-stock_zoom" /> |
781 | <field name="document_date" attrs="{'readonly': [('direct_invoice', '=', True)]}"/> |
782 | <field name="date" attrs="{'readonly': [('direct_invoice', '=', True)]}"/> |
783 | <field name="cheque_number" required="1"/> |
784 | @@ -910,6 +914,12 @@ |
785 | <field name="priority" eval="1"/> |
786 | <field name="arch" type="xml"> |
787 | <tree string="Journal Items" editable="bottom" noteditable="1" colors="red:state in ('draft');black:state in ('valid')" hide_new_button="1"> |
788 | + <field name="is_corrigible" invisible="1"/> |
789 | + <field name="have_an_historic" invisible="1"/> |
790 | + <button name="button_do_accounting_corrections" type="object" string="Open Accounting Correction Wizard" |
791 | + attrs="{'invisible': [('is_corrigible', '=', False)]}" icon="terp-mail-message-new"/> |
792 | + <button name="button_open_corrections" type="object" string="Open corrections history" |
793 | + attrs="{'invisible': [('have_an_historic', '=', False)]}" icon="terp-mail-"/> |
794 | <field name="journal_id"/> |
795 | <field name="move_id"/> |
796 | <field name="name"/> |
797 | |
798 | === modified file 'register_accounting/account_wizard.xml' |
799 | --- register_accounting/account_wizard.xml 2013-01-30 15:51:06 +0000 |
800 | +++ register_accounting/account_wizard.xml 2013-11-06 10:36:19 +0000 |
801 | @@ -42,6 +42,7 @@ |
802 | Account bank statement lines |
803 | --> |
804 | |
805 | + <!-- Return to the register linked to the given line --> |
806 | <record id="action_return_to_register" model="ir.actions.server"> |
807 | <field name="name">Return to register</field> |
808 | <field name="model_id" ref="model_account_bank_statement_line"/> |
809 | @@ -57,5 +58,21 @@ |
810 | <field eval="True" name="object"/> |
811 | </record> |
812 | |
813 | + <!-- Display all Analytic Lines attached to given Register Lines --> |
814 | + <record id="action_analytic_register_lines" model="ir.actions.server"> |
815 | + <field name="name">Analytic Lines</field> |
816 | + <field name="model_id" ref="model_account_bank_statement_line"/> |
817 | + <field name="state">code</field> |
818 | + <field name="code">action = obj.get_analytic_lines(context=context)</field> |
819 | + </record> |
820 | + |
821 | + <record id="ir_open_analytic_register_lines" model="ir.values"> |
822 | + <field name="key2">client_action_multi</field> |
823 | + <field name="model">account.bank.statement.line</field> |
824 | + <field name="name">Analytic Lines</field> |
825 | + <field eval="'ir.actions.server,%d'%action_analytic_register_lines" name="value"/> |
826 | + <field eval="True" name="object"/> |
827 | + </record> |
828 | + |
829 | </data> |
830 | </openerp> |