Merge lp:~unifield-team/unifield-wm/UF_2164 into lp:unifield-wm

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
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+193952@code.launchpad.net
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
=== modified file 'account_corrections/__init__.py'
--- account_corrections/__init__.py 2013-09-13 13:57:37 +0000
+++ account_corrections/__init__.py 2013-11-06 10:36:19 +0000
@@ -23,5 +23,7 @@
2323
24import account_move_line24import account_move_line
25import wizard25import wizard
26import account_analytic_line
27import account_invoice
2628
27# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:29# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2830
=== added file 'account_corrections/account_analytic_line.py'
--- account_corrections/account_analytic_line.py 1970-01-01 00:00:00 +0000
+++ account_corrections/account_analytic_line.py 2013-11-06 10:36:19 +0000
@@ -0,0 +1,149 @@
1#!/usr/bin/env python
2#-*- encoding:utf-8 -*-
3##############################################################################
4#
5# OpenERP, Open Source Management Solution
6# Copyright (C) 2011 TeMPO Consulting, MSF. All Rights Reserved
7# Developer: Olivier DOSSMANN
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU Affero General Public License as
11# published by the Free Software Foundation, either version 3 of the
12# License, or (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU Affero General Public License for more details.
18#
19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
22##############################################################################
23
24from osv import osv
25from osv import fields
26from tools.translate import _
27
28class account_analytic_line(osv.osv):
29 _name = 'account.analytic.line'
30 _inherit = 'account.analytic.line'
31
32 _columns = {
33 'is_corrigible': fields.related('move_id', 'is_corrigible', string='Is correctible?', type="boolean", readonly=True),
34 'last_corrected_id': fields.many2one('account.analytic.line', string="Last corrected entry", readonly=True),
35 }
36
37 def button_corrections(self, cr, uid, ids, context=None):
38 """
39 Launch accounting correction wizard to do reverse or correction on selected analytic line.
40 """
41 # Verification
42 if not context:
43 context={}
44 if isinstance(ids, (int, long)):
45 ids = [ids]
46 # Retrieve some values
47 wiz_obj = self.pool.get('wizard.journal.items.corrections')
48 al = self.browse(cr, uid, ids[0])
49 if not al.move_id:
50 raise osv.except_osv(_('Warning'), _('No link to a journal item found!'))
51 if not al.move_id.is_corrigible:
52 raise osv.except_osv(_('Error'), _('The journal item linked to this analytic line is not correctible!'))
53 # Create wizard
54 wizard = wiz_obj.create(cr, uid, {'move_line_id': al.move_id.id}, context=context)
55 # Change wizard state in order to change date requirement on wizard
56 wiz_obj.write(cr, uid, [wizard], {'state': 'open'}, context=context)
57 # Update context
58 context.update({
59 'active_id': al.move_id.id,
60 'active_ids': [al.move_id.id],
61 })
62 # Change context if account special type is "donation"
63 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':
64 wiz_obj.write(cr, uid, [wizard], {'from_donation': True}, context=context)
65 # Update context to inform wizard we come from a correction wizard
66 context.update({'from_correction': True,})
67 return {
68 'name': _("Accounting Corrections Wizard (from Analytic Journal Items)"),
69 'type': 'ir.actions.act_window',
70 'res_model': 'wizard.journal.items.corrections',
71 'target': 'new',
72 'view_mode': 'form,tree',
73 'view_type': 'form',
74 'res_id': [wizard],
75 'context': context,
76 }
77
78 def get_corrections_history(self, cr, uid, ids, context=None):
79 """
80 Give for each line their history by using "move_id and reversal_origin" field to browse lines
81 Return something like that:
82 {id1: [line_id, another_line_id], id2: [a_line_id, other_line_id]}
83 """
84 # Verifications
85 if not context:
86 context = {}
87 if isinstance(ids, (int, long)):
88 ids = [ids]
89 # Prepare some values
90 res = {}
91 upstream_line_ids = []
92 downstream_line_ids = []
93 # Browse all given lines
94 for aml in self.browse(cr, uid, ids, context=context):
95 # Get upstream move lines
96 line = aml
97 while line:
98 # Add line to result
99 upstream_line_ids.append(line.id)
100 # Add reversal line to result
101 upstream_line_ids += self.search(cr, uid, [('reversal_origin', '=', line.id), ('is_reversal', '=', True)], context=context)
102 line = line.last_corrected_id
103 # Get downstream move lines
104 sline_ids = [aml.id]
105 while sline_ids:
106 sline_ids = self.search(cr, uid, [('last_corrected_id', 'in', sline_ids)], context=context)
107 if sline_ids:
108 # Add line to result
109 downstream_line_ids += sline_ids
110 # Add reversal line to result
111 downstream_line_ids += self.search(cr, uid, [('reversal_origin', 'in', sline_ids), ('is_reversal', '=', True)], context=context)
112
113 return list(set(upstream_line_ids + downstream_line_ids))
114
115 def button_open_analytic_corrections(self, cr, uid, ids, context=None):
116 """
117 Open a wizard that contains all analytic lines linked to this one.
118 """
119 # Verification
120 if not context:
121 context={}
122 if isinstance(ids, (int, long)):
123 ids = [ids]
124
125 # Search ids to be open
126 domain_ids = self.get_corrections_history(cr, uid, ids, context=context)
127 # Create domain
128 domain = [('id', 'in', domain_ids)]
129 # Update context
130 context.update({
131 'active_id': ids[0],
132 'active_ids': ids,
133 'display_fp': True,
134 })
135 # Display the result
136 return {
137 'name': "History Analytic Line",
138 'type': 'ir.actions.act_window',
139 'res_model': 'account.analytic.line',
140 'target': 'new',
141 'view_type': 'form',
142 'view_mode': 'tree',
143 'context': context,
144 'domain': domain,
145 }
146 return True
147
148account_analytic_line()
149# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0150
=== added file 'account_corrections/account_invoice.py'
--- account_corrections/account_invoice.py 1970-01-01 00:00:00 +0000
+++ account_corrections/account_invoice.py 2013-11-06 10:36:19 +0000
@@ -0,0 +1,85 @@
1#!/usr/bin/env python
2#-*- encoding:utf-8 -*-
3##############################################################################
4#
5# OpenERP, Open Source Management Solution
6# Copyright (C) 2013 TeMPO Consulting, MSF. All Rights Reserved
7# Developer: Olivier DOSSMANN
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU Affero General Public License as
11# published by the Free Software Foundation, either version 3 of the
12# License, or (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU Affero General Public License for more details.
18#
19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
22##############################################################################
23
24from osv import osv
25from osv import fields
26from tools.translate import _
27from time import strftime
28
29class account_invoice_line(osv.osv):
30 _name = 'account.invoice.line'
31 _inherit = 'account.invoice.line'
32
33 def _have_been_corrected(self, cr, uid, ids, name, args, context=None):
34 """
35 Return True if ALL elements are OK:
36 - a journal items is linked to this invoice line
37 - the journal items is linked to an analytic line that have been reallocated
38 """
39 if context is None:
40 context = {}
41 res = {}
42
43 def has_ana_reallocated(move):
44 for ml in move.move_lines or []:
45 for al in ml.analytic_lines or []:
46 if al.is_reallocated:
47 return True
48 return False
49
50 for il in self.browse(cr, uid, ids, context=context):
51 res[il.id] = has_ana_reallocated(il)
52 return res
53
54 _columns = {
55 'is_corrected': fields.function(_have_been_corrected, method=True, string="Have been corrected?", type='boolean',
56 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.",
57 store=False),
58 }
59
60 _defaults = {
61 'is_corrected': lambda *a: False,
62 }
63
64 def button_open_analytic_lines(self, cr, uid, ids, context=None):
65 """
66 Return analytic lines linked to this invoice line.
67 First we takes all journal items that are linked to this invoice line.
68 Then for all journal items, we take all analytic journal items.
69 Finally we display the result for "button_open_analytic_corrections" of analytic lines
70 """
71 # Some checks
72 if not context:
73 context = {}
74 # Prepare some values
75 al_ids = []
76 # Browse give invoice lines
77 for il in self.browse(cr, uid, ids, context=context):
78 if il.move_lines:
79 for ml in il.move_lines:
80 if ml.analytic_lines:
81 al_ids += [x.id for x in ml.analytic_lines]
82 return self.pool.get('account.analytic.line').button_open_analytic_corrections(cr, uid, al_ids, context=context)
83
84account_invoice_line()
85# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
086
=== modified file 'account_corrections/account_move_line.py'
--- account_corrections/account_move_line.py 2013-09-13 13:57:37 +0000
+++ account_corrections/account_move_line.py 2013-11-06 10:36:19 +0000
@@ -256,7 +256,7 @@
256 # Update context to inform wizard we come from a correction wizard256 # Update context to inform wizard we come from a correction wizard
257 context.update({'from_correction': True,})257 context.update({'from_correction': True,})
258 return {258 return {
259 'name': "Accounting Corrections Wizard",259 'name': _("Accounting Corrections Wizard (from Journal Items)"),
260 'type': 'ir.actions.act_window',260 'type': 'ir.actions.act_window',
261 'res_model': 'wizard.journal.items.corrections',261 'res_model': 'wizard.journal.items.corrections',
262 'target': 'new',262 'target': 'new',
@@ -600,6 +600,13 @@
600 # Abort process if this move line was corrected before600 # Abort process if this move line was corrected before
601 if ml.corrected:601 if ml.corrected:
602 continue602 continue
603 # If this line was already been corrected, check the first analytic line ID (but not the first first analytic line)
604 first_analytic_line_id = False
605 first_ana_ids = self.pool.get('account.analytic.line').search(cr, uid, [('move_id', '=', ml.id)])
606 if first_ana_ids:
607 first_ana = self.pool.get('account.analytic.line').browse(cr, uid, first_ana_ids)[0]
608 if first_ana.last_corrected_id:
609 first_analytic_line_id = first_ana.last_corrected_id.id
603 # Retrieve right journal610 # Retrieve right journal
604 journal_id = j_corr_id611 journal_id = j_corr_id
605612
@@ -681,19 +688,23 @@
681 move_obj.post(cr, uid, [move_id], context=context)688 move_obj.post(cr, uid, [move_id], context=context)
682 # Change analytic lines that come from:689 # Change analytic lines that come from:
683 #- initial move line: is_reallocated is True690 #- initial move line: is_reallocated is True
684 #- reversal move line: is_reversal is True691 #- reversal move line: is_reversal is True + initial analytic line
685 #- correction line: change is_reallocated and is_reversal to False692 #- correction line: change is_reallocated and is_reversal to False
686 #- old reversal line: reset is_reversal to True (lost previously in validate())693 #- old reversal line: reset is_reversal to True (lost previously in validate())
694 initial_al_ids = al_obj.search(cr, uid, [('move_id', '=', ml.id)])
687 search_datas = [(ml.id, {'is_reallocated': True}),695 search_datas = [(ml.id, {'is_reallocated': True}),
688 (rev_line_id, {'is_reversal': True}),696 (rev_line_id, {'is_reversal': True, 'reversal_origin': initial_al_ids[0]}),
689 (correction_line_id, {'is_reallocated': False, 'is_reversal': False})]697 (correction_line_id, {'is_reallocated': False, 'is_reversal': False, 'last_corrected_id': initial_al_ids[0]})]
690 # If line is already a correction, take the previous reversal move line id698 # If line is already a correction, take the previous reversal move line id
691 # (UF_1234: otherwise, the reversal is not set correctly)699 # (UF_1234: otherwise, the reversal is not set correctly)
692 if ml.corrected_line_id:700 if ml.corrected_line_id:
693 old_reverse_ids = self.search(cr, uid, [('reversal_line_id', '=', ml.corrected_line_id.id)])701 old_reverse_ids = self.search(cr, uid, [('reversal_line_id', '=', ml.corrected_line_id.id)])
694 if len(old_reverse_ids) > 0:702 if len(old_reverse_ids) > 0:
695 search_datas += [(old_reverse_ids[0], {'is_reversal': True})]703 search_datas += [(old_reverse_ids[0], {'is_reversal': True, 'reversal_origin': first_analytic_line_id})]
696 for search_data in search_datas:704 for search_data in search_datas:
705 # keep initial analytic line as corrected line if it the 2nd or more correction on this line
706 if ml.corrected_line_id and search_data[0] == ml.id and first_analytic_line_id:
707 search_data[1].update({'last_corrected_id': first_analytic_line_id})
697 search_ids = al_obj.search(cr, uid, [('move_id', '=', search_data[0])])708 search_ids = al_obj.search(cr, uid, [('move_id', '=', search_data[0])])
698 if search_ids:709 if search_ids:
699 al_obj.write(cr, uid, search_ids, search_data[1])710 al_obj.write(cr, uid, search_ids, search_data[1])
700711
=== modified file 'account_corrections/account_wizard_view.xml'
--- account_corrections/account_wizard_view.xml 2013-07-30 12:08:55 +0000
+++ account_corrections/account_wizard_view.xml 2013-11-06 10:36:19 +0000
@@ -9,11 +9,9 @@
9 <field name="type">tree</field>9 <field name="type">tree</field>
10 <field name="arch" type="xml">10 <field name="arch" type="xml">
11 <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')">11 <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')">
12 <field name="journal_id"/>
13 <field name="move_id"/>12 <field name="move_id"/>
14 <field name="ref"/>13 <field name="ref"/>
15 <field name="date"/>14 <field name="date"/>
16 <field name="period_id"/>
17 <field name="account_id" domain="[('type', '&lt;&gt;', 'view')]"/>15 <field name="account_id" domain="[('type', '&lt;&gt;', 'view')]"/>
18 <button name="button_analytic_distribution" type="object" icon="terp-stock_symbol-selection" string="Ana. Distri."/>16 <button name="button_analytic_distribution" type="object" icon="terp-stock_symbol-selection" string="Ana. Distri."/>
19 <field name="analytic_distribution_state"/>17 <field name="analytic_distribution_state"/>
@@ -32,13 +30,13 @@
32 <field name="type">form</field>30 <field name="type">form</field>
33 <field name="arch" type="xml">31 <field name="arch" type="xml">
34 <form string="Journal items corrections Wizard">32 <form string="Journal items corrections Wizard">
35 <field name="move_line_id" invisible="1" colspan="1"/>33 <separator string="Correction"/>
36 <field name="date" on_change="onchange_date(date)"/>34 <field name="date" on_change="onchange_date(date)" colspan="2"/>
35 <label string="" colspan="2"/>
37 <field name="from_donation" invisible="1"/>36 <field name="from_donation" invisible="1"/>
38 <newline/>37 <newline/>
39 <field name="to_be_corrected_ids" colspan="6" context="{'from_donation_account': from_donation}" />38 <field name="to_be_corrected_ids" colspan="6" context="{'from_donation_account': from_donation}" nolabel="1"/>
40 <newline/>39 <newline/>
41 <label string="" colspan="6"/>
42 <group colspan="4" col="6">40 <group colspan="4" col="6">
43 <label string ="" colspan="1"/>41 <label string ="" colspan="1"/>
44 <button icon="gtk-cancel" special="cancel" string="Cancel"/>42 <button icon="gtk-cancel" special="cancel" string="Cancel"/>
@@ -63,9 +61,12 @@
63 attrs="{'invisible': [('state', '!=', 'correction')], 'required': [('state', '=', 'correction')]}"/>61 attrs="{'invisible': [('state', '!=', 'correction')], 'required': [('state', '=', 'correction')]}"/>
64 <newline/>62 <newline/>
65 </xpath>63 </xpath>
66 <xpath expr="/form//button[@name='button_confirm']" position="replace">64 <xpath expr="/form//field[@name='state']" position="before">
67 <button name="button_confirm" string="Save" type="object" icon="gtk-ok" colspan="1" attrs="{'invisible': [('state', '=', 'correction')], 'readonly': [('is_writable', '=', False)]}"/>65 <group colspan="4" attrs="{'invisible': [('state', '!=', 'correction')]}">
68 <button name="button_confirm" string="Correct it!" type="object" icon="gtk-edit" colspan="1" attrs="{'invisible': [('state', '!=', 'correction')]}"/>66 <label string="" colspan="2"/>
67 <button name="button_cancel" string='Cancel' type='object' icon='gtk-cancel' colspan="1"/>
68 <button name="button_confirm" string="Correct it" type="object" icon="gtk-edit" colspan="1" attrs="{'readonly': [('is_writable', '=', False)]}"/>
69 </group>
69 </xpath>70 </xpath>
70 </data>71 </data>
71 </field>72 </field>
7273
=== modified file 'account_corrections/wizard/analytic_distribution_wizard.py'
--- account_corrections/wizard/analytic_distribution_wizard.py 2013-11-05 09:23:49 +0000
+++ account_corrections/wizard/analytic_distribution_wizard.py 2013-11-06 10:36:19 +0000
@@ -204,11 +204,12 @@
204 # reverse the line204 # reverse the line
205 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)])205 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)])
206 # UTP-943: Set wizard date as date for REVERSAL AND CORRECTION lines206 # UTP-943: Set wizard date as date for REVERSAL AND CORRECTION lines
207 rev_ids = self.pool.get('account.analytic.line').reverse(cr, uid, to_reverse_ids, posting_date=wizard.date)207 reversed_ids = self.pool.get('account.analytic.line').reverse(cr, uid, to_reverse_ids[0], posting_date=wizard.date)
208 # 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
208 # UTP-943: Add correction journal on it209 # UTP-943: Add correction journal on it
209 self.pool.get('account.analytic.line').write(cr, uid, rev_ids, {'journal_id': correction_journal_id})210 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})
210 # Mark old lines as non reallocatable (ana_ids): why reverse() don't set this flag ?211 # Mark old lines as non reallocatable (ana_ids): why reverse() don't set this flag ?
211 self.pool.get('account.analytic.line').write(cr, uid, to_reverse_ids, {'is_reallocated': True,})212 self.pool.get('account.analytic.line').write(cr, uid, [to_reverse_ids[0]], {'is_reallocated': True,})
212 # update the distrib line213 # update the distrib line
213 name = False214 name = False
214 if to_reverse_ids:215 if to_reverse_ids:
@@ -228,9 +229,10 @@
228 if cp.state != 'draft':229 if cp.state != 'draft':
229 raise osv.except_osv(_('Error'), _('Period (%s) is not open.') % (cp.name,))230 raise osv.except_osv(_('Error'), _('Period (%s) is not open.') % (cp.name,))
230 # Create the new ana line231 # Create the new ana line
231 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)232 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)
232 for distrib_id in cor_ids:233 # Add link to first analytic lines
233 self.pool.get('account.analytic.line').write(cr, uid, [cor_ids[distrib_id]], {'journal_id': correction_journal_id})234 for ret_id in ret:
235 self.pool.get('account.analytic.line').write(cr, uid, [ret[ret_id]], {'last_corrected_id': to_reverse_ids[0], 'journal_id': correction_journal_id})
234236
235 for line in to_override:237 for line in to_override:
236 # update the ana line238 # update the ana line
237239
=== modified file 'account_hq_entries/hq_entries.py'
--- account_hq_entries/hq_entries.py 2013-10-31 13:55:38 +0000
+++ account_hq_entries/hq_entries.py 2013-11-06 10:36:19 +0000
@@ -255,8 +255,10 @@
255 # create new lines255 # create new lines
256 if not fp_old_lines: # UTP-546 - this have been added because of sync that break analytic lines generation256 if not fp_old_lines: # UTP-546 - this have been added because of sync that break analytic lines generation
257 continue257 continue
258 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, 258 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,
259 'account_id': line.analytic_id.id, 'destination_id': line.destination_id.id, 'journal_id': acor_journal_id})259 'account_id': line.analytic_id.id, 'destination_id': line.destination_id.id, 'journal_id': acor_journal_id, 'last_correction_id': fp_old_lines[0]})
260 # update new ana line
261 ana_line_obj.write(cr, uid, cor_ids, {'last_corrected_id': fp_old_lines[0]})
260 # update old ana lines262 # update old ana lines
261 ana_line_obj.write(cr, uid, fp_old_lines, {'is_reallocated': True})263 ana_line_obj.write(cr, uid, fp_old_lines, {'is_reallocated': True})
262264
263265
=== modified file 'account_mcdb/account_view.xml'
--- account_mcdb/account_view.xml 2013-04-16 15:08:18 +0000
+++ account_mcdb/account_view.xml 2013-11-06 10:36:19 +0000
@@ -10,6 +10,12 @@
10 <field name="arch" type="xml">10 <field name="arch" type="xml">
11 <tree string="Account Entries" min_rows="100" hide_new_button="1">11 <tree string="Account Entries" min_rows="100" hide_new_button="1">
12 <field name="instance_id"/>12 <field name="instance_id"/>
13 <field name="is_corrigible" invisible="1"/>
14 <field name="have_an_historic" invisible="1"/>
15 <button name="button_do_accounting_corrections" type="object" string="Open Accounting Correction Wizard"
16 attrs="{'invisible': [('is_corrigible', '=', False)]}" icon="terp-mail-message-new"/>
17 <button name="button_open_corrections" type="object" string="Open corrections history"
18 attrs="{'invisible': [('have_an_historic', '=', False)]}" icon="terp-mail-"/>
13 <field name="journal_id"/>19 <field name="journal_id"/>
14 <field name="move_id"/>20 <field name="move_id"/>
15 <field name="name"/>21 <field name="name"/>
@@ -47,10 +53,15 @@
47 <field name="model">account.analytic.line</field>53 <field name="model">account.analytic.line</field>
48 <field name="type">tree</field>54 <field name="type">tree</field>
49 <field name="arch" type="xml">55 <field name="arch" type="xml">
50 <tree string="Analytic Line" min_rows="100" editable="bottom" noteditable="1" hide_delete_button="1" hide_new_button="1">56 <tree string="Analytic Journal Items" min_rows="100" editable="bottom" noteditable="1" hide_delete_button="1" hide_new_button="1">
51 <field name="is_reallocated" invisible="1"/>57 <field name="is_reallocated" invisible="1"/>
52 <button string="Have been reallocated" attrs="{'invisible': [('is_reallocated', '=', False)]}" icon="terp-mail-" colspan="2"/>
53 <field name="instance_id"/>58 <field name="instance_id"/>
59 <field name="is_reversal" invisible="1"/>
60 <field name="journal_type" invisible="1"/>
61 <field name="is_corrigible" invisible="1"/>
62 <button name="button_corrections" type="object" string="Accounting info/correction"
63 attrs="{'invisible': ['|', '|', '|', ('is_reallocated', '=', True), ('is_reversal', '=', True), ('journal_type', '=', 'engagement'), ('is_corrigible', '=', False)]}" icon="terp-mail-message-new"/>
64 <button string="Have been reallocated?" attrs="{'invisible': [('is_reallocated', '=', False)]}" icon="terp-mail-" colspan="2" name="button_open_analytic_corrections" type="object"/>
54 <field name="journal_id"/>65 <field name="journal_id"/>
55 <field name="entry_sequence"/>66 <field name="entry_sequence"/>
56 <field name="name"/>67 <field name="name"/>
@@ -75,6 +86,29 @@
75 </field>86 </field>
76 </record>87 </record>
7788
89 <!-- Account analytic line tree view -->
90 <record model="ir.ui.view" id="account_analytic_line_default">
91 <field name="name">account.analytic.line.default</field>
92 <field name="model">account.analytic.line</field>
93 <field name="type">tree</field>
94 <field name="inherit_id" ref="account.view_account_analytic_line_tree"/>
95 <field name="priority" eval="40"/>
96 <field name="arch" type="xml">
97 <data>
98 <xpath expr="/tree/field[@name='journal_id']" position="before">
99 <field name="is_reversal" invisible="1"/>
100 <field name="journal_type" invisible="1"/>
101 <field name="is_corrigible" invisible="1"/>
102 <button name="button_corrections" type="object" string="Accounting info/correction"
103 attrs="{'invisible': ['|', '|', '|', ('is_reallocated', '=', True), ('is_reversal', '=', True), ('journal_type', '=', 'engagement'), ('is_corrigible', '=', False)]}" icon="terp-mail-message-new"/>
104 <field name="is_reallocated" invisible="1"/>
105 <field name="last_corrected_id" invisible="1"/>
106 <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"/>
107 </xpath>
108 </data>
109 </field>
110 </record>
111
78 <!-- Account move line search view -->112 <!-- Account move line search view -->
79 <record id="mcdb_view_account_move_line_filter" model="ir.ui.view">113 <record id="mcdb_view_account_move_line_filter" model="ir.ui.view">
80 <field name="name">Journal Items</field>114 <field name="name">Journal Items</field>
81115
=== modified file 'account_msf/invoice.py'
--- account_msf/invoice.py 2013-03-11 10:50:12 +0000
+++ account_msf/invoice.py 2013-11-06 10:36:19 +0000
@@ -250,7 +250,7 @@
250 if inv.type != 'out_invoice' or inv.is_debit_note == False:250 if inv.type != 'out_invoice' or inv.is_debit_note == False:
251 raise osv.except_osv(_('Error'), _('You can only do import invoice on a Debit Note!'))251 raise osv.except_osv(_('Error'), _('You can only do import invoice on a Debit Note!'))
252 w_id = self.pool.get('debit.note.import.invoice').create(cr, uid, {'invoice_id': inv.id, 'currency_id': inv.currency_id.id, 252 w_id = self.pool.get('debit.note.import.invoice').create(cr, uid, {'invoice_id': inv.id, 'currency_id': inv.currency_id.id,
253 'partner_id': inv.partner_id.id})253 'partner_id': inv.partner_id.id}, context=context)
254 context.update({254 context.update({
255 'active_id': inv.id,255 'active_id': inv.id,
256 'active_ids': ids,256 'active_ids': ids,
257257
=== modified file 'account_msf/invoice_view.xml'
--- account_msf/invoice_view.xml 2013-09-09 13:14:25 +0000
+++ account_msf/invoice_view.xml 2013-11-06 10:36:19 +0000
@@ -185,6 +185,8 @@
185 <field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list">185 <field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list">
186 <tree editable="top" string="Donation Lines" noteditable="1" hide_new_button="1" colors="red: inactive_product == True">186 <tree editable="top" string="Donation Lines" noteditable="1" hide_new_button="1" colors="red: inactive_product == True">
187 <field name="line_number"/>187 <field name="line_number"/>
188 <field name="is_corrected" invisible="1"/>
189 <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/>
188 <field name="product_id"/>190 <field name="product_id"/>
189 <field name="account_id" />191 <field name="account_id" />
190 <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-stock_symbol-selection" 192 <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-stock_symbol-selection"
@@ -282,6 +284,8 @@
282 <newline/>284 <newline/>
283 <field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list">285 <field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list">
284 <tree editable="top" string="Intermission Voucher Lines" hide_new_button="1" colors="red: inactive_product == True">286 <tree editable="top" string="Intermission Voucher Lines" hide_new_button="1" colors="red: inactive_product == True">
287 <field name="is_corrected" invisible="1"/>
288 <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/>
285 <field name="name"/>289 <field name="name"/>
286 <field name="account_id" />290 <field name="account_id" />
287 <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-stock_symbol-selection" 291 <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-stock_symbol-selection"
288292
=== modified file 'account_override/account_analytic_line.py'
--- account_override/account_analytic_line.py 2013-10-31 13:55:38 +0000
+++ account_override/account_analytic_line.py 2013-11-06 10:36:19 +0000
@@ -54,6 +54,7 @@
54 'is_reversal': fields.boolean('Reversal?'),54 'is_reversal': fields.boolean('Reversal?'),
55 'is_reallocated': fields.boolean('Reallocated?'),55 'is_reallocated': fields.boolean('Reallocated?'),
56 'journal_id': fields.many2one('account.analytic.journal', 'Journal Code', required=True, ondelete='restrict', select=True, readonly=True),56 'journal_id': fields.many2one('account.analytic.journal', 'Journal Code', required=True, ondelete='restrict', select=True, readonly=True),
57 'journal_type': fields.related('journal_id', 'type', 'Journal type', readonly=True),
57 'date': fields.date('Posting Date', required=True, select=True, readonly=True),58 'date': fields.date('Posting Date', required=True, select=True, readonly=True),
58 'document_date': fields.date('Document Date', readonly=True, required=True),59 'document_date': fields.date('Document Date', readonly=True, required=True),
59 '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 view60 '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
6061
=== modified file 'account_override/account_view.xml'
--- account_override/account_view.xml 2013-10-21 12:02:45 +0000
+++ account_override/account_view.xml 2013-11-06 10:36:19 +0000
@@ -14,6 +14,8 @@
14 <data>14 <data>
15 <xpath expr="/tree/field[@name='name']" position="before">15 <xpath expr="/tree/field[@name='name']" position="before">
16 <field name="line_number"/>16 <field name="line_number"/>
17 <field name="is_corrected" invisible="1"/>
18 <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/>
17 </xpath>19 </xpath>
18 </data>20 </data>
19 </field>21 </field>
2022
=== modified file 'analytic_distribution/analytic_distribution_wizard_view.xml'
--- analytic_distribution/analytic_distribution_wizard_view.xml 2013-10-30 11:00:44 +0000
+++ analytic_distribution/analytic_distribution_wizard_view.xml 2013-11-06 10:36:19 +0000
@@ -109,7 +109,7 @@
109 <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)]}"/>109 <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)]}"/>
110 </group>110 </group>
111 </group>111 </group>
112 <group colspan="4">112 <group colspan="4" attrs="{'invisible': [('state', '=', 'correction')]}">
113 <label string="" colspan="2"/>113 <label string="" colspan="2"/>
114 <button name="button_cancel" string='Cancel' type='object' icon='gtk-cancel' colspan="1"/>114 <button name="button_cancel" string='Cancel' type='object' icon='gtk-cancel' colspan="1"/>
115 <button name="button_confirm" string="Save" type="object" icon="gtk-ok" colspan="1" attrs="{'readonly': [('is_writable', '=', False)]}"/>115 <button name="button_confirm" string="Save" type="object" icon="gtk-ok" colspan="1" attrs="{'readonly': [('is_writable', '=', False)]}"/>
116116
=== modified file 'analytic_distribution/analytic_line.py'
--- analytic_distribution/analytic_line.py 2013-11-05 09:23:49 +0000
+++ analytic_distribution/analytic_line.py 2013-11-06 10:36:19 +0000
@@ -324,7 +324,7 @@
324 # First reverse line324 # First reverse line
325 rev_ids = self.pool.get('account.analytic.line').reverse(cr, uid, [aline.id], posting_date=date)325 rev_ids = self.pool.get('account.analytic.line').reverse(cr, uid, [aline.id], posting_date=date)
326 # UTP-943: Shoud have a correction journal on these lines326 # UTP-943: Shoud have a correction journal on these lines
327 self.pool.get('account.analytic.line').write(cr, uid, rev_ids, {'journal_id': correction_journal_id})327 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})
328 # UTP-943: Check that period is open328 # UTP-943: Check that period is open
329 correction_period_ids = self.pool.get('account.period').get_period_from_date(cr, uid, date, context=context)329 correction_period_ids = self.pool.get('account.period').get_period_from_date(cr, uid, date, context=context)
330 if not correction_period_ids:330 if not correction_period_ids:
@@ -333,8 +333,9 @@
333 if p.state != 'draft':333 if p.state != 'draft':
334 raise osv.except_osv(_('Error'), _('Period (%s) is not open.') % (p.name,))334 raise osv.except_osv(_('Error'), _('Period (%s) is not open.') % (p.name,))
335 # then create new lines335 # then create new lines
336 self.pool.get('account.analytic.line').copy(cr, uid, aline.id, {fieldname: account_id, 'date': date,336 cor_ids = self.pool.get('account.analytic.line').copy(cr, uid, aline.id, {fieldname: account_id, 'date': date,
337 'source_date': aline.source_date or aline.date, 'journal_id': correction_journal_id}, context=context)337 'source_date': aline.source_date or aline.date, 'journal_id': correction_journal_id}, context=context)
338 self.pool.get('account.analytic.line').write(cr, uid, cor_ids, {'last_corrected_id': aline.id})
338 # finally flag analytic line as reallocated339 # finally flag analytic line as reallocated
339 self.pool.get('account.analytic.line').write(cr, uid, [aline.id], {'is_reallocated': True})340 self.pool.get('account.analytic.line').write(cr, uid, [aline.id], {'is_reallocated': True})
340 else:341 else:
341342
=== modified file 'analytic_distribution/analytic_line_view.xml'
--- analytic_distribution/analytic_line_view.xml 2013-07-08 16:03:00 +0000
+++ analytic_distribution/analytic_line_view.xml 2013-11-06 10:36:19 +0000
@@ -11,11 +11,6 @@
11 <field name="priority" eval="11"/>11 <field name="priority" eval="11"/>
12 <field name="arch" type="xml">12 <field name="arch" type="xml">
13 <data>13 <data>
14 <xpath expr="/tree/field[@name='journal_id']" position='before'>
15 <field name="is_reallocated" invisible="1"/>
16 <button string="Have been reallocated" attrs="{'invisible': [('is_reallocated', '=', False)]}"
17 icon="terp-mail-" colspan="2"/>
18 </xpath>
19 <xpath expr="/tree/field[@name='move_id']" position='replace'>14 <xpath expr="/tree/field[@name='move_id']" position='replace'>
20 <field name="entry_sequence"/>15 <field name="entry_sequence"/>
21 </xpath>16 </xpath>
2217
=== modified file 'analytic_distribution_invoice/account_invoice_view.xml'
--- analytic_distribution_invoice/account_invoice_view.xml 2013-03-26 17:07:53 +0000
+++ analytic_distribution_invoice/account_invoice_view.xml 2013-11-06 10:36:19 +0000
@@ -26,7 +26,11 @@
26 <field name="is_allocatable" invisible="1"/>26 <field name="is_allocatable" invisible="1"/>
27 </xpath>27 </xpath>
28 <xpath expr="//tree[@string='Invoice lines']" position="attributes">28 <xpath expr="//tree[@string='Invoice lines']" position="attributes">
29 <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>29 <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>
30 </xpath>
31 <xpath expr="//tree[@string='Invoice lines']/field[@name='product_id']" position="before">
32 <field name="is_corrected" invisible="1"/>
33 <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/>
30 </xpath>34 </xpath>
31 </data>35 </data>
32 </field>36 </field>
3337
=== modified file 'analytic_distribution_invoice/invoice.py'
--- analytic_distribution_invoice/invoice.py 2013-07-19 13:23:03 +0000
+++ analytic_distribution_invoice/invoice.py 2013-11-06 10:36:19 +0000
@@ -128,9 +128,12 @@
128 # Give false analytic lines for 'line' in order not to give an error128 # Give false analytic lines for 'line' in order not to give an error
129 if 'analytic_line_ids' in el[2]:129 if 'analytic_line_ids' in el[2]:
130 el[2]['analytic_line_ids'] = False130 el[2]['analytic_line_ids'] = False
131 # Give false order_line_id in order not to give an error131 # Give false for (because not needed):
132 if 'order_line_id' in el[2]:132 # - order_line_id
133 el[2]['order_line_id'] = el[2].get('order_line_id', False) and el[2]['order_line_id'][0] or False133 # - sale_order_line_id
134 for field in ['order_line_id', 'sale_order_line_id']:
135 if field in el[2]:
136 el[2][field] = el[2].get(field, False) and el[2][field][0] or False
134 return res137 return res
135138
136 def refund(self, cr, uid, ids, date=None, period_id=None, description=None, journal_id=None, document_date=None):139 def refund(self, cr, uid, ids, date=None, period_id=None, description=None, journal_id=None, document_date=None):
137140
=== modified file 'msf_instance/msf_instance_view.xml'
--- msf_instance/msf_instance_view.xml 2013-10-31 21:48:37 +0000
+++ msf_instance/msf_instance_view.xml 2013-11-06 10:36:19 +0000
@@ -125,6 +125,7 @@
125 <field name="model">account.analytic.line</field>125 <field name="model">account.analytic.line</field>
126 <field name="type">tree</field>126 <field name="type">tree</field>
127 <field name="inherit_id" ref="account.view_account_analytic_line_tree"/>127 <field name="inherit_id" ref="account.view_account_analytic_line_tree"/>
128 <field name="priority" eval="18"/>
128 <field name="arch" type="xml">129 <field name="arch" type="xml">
129 <field name="journal_id" position="before">130 <field name="journal_id" position="before">
130 <field name="instance_id" readonly="1"/>131 <field name="instance_id" readonly="1"/>
@@ -297,6 +298,20 @@
297 </field>298 </field>
298 </record>299 </record>
299300
301 <record id="view_move_line_tree_from_move_inherit" model="ir.ui.view">
302 <field name="name">account.move.line.tree.from.move.inherit</field>
303 <field name="model">account.move.line</field>
304 <field name="type">tree</field>
305 <field name="inherit_id" ref="register_accounting.view_move_line_tree_from_move"/>
306 <field name="arch" type="xml">
307 <data>
308 <xpath expr="/tree/field[@name='is_corrigible']" position="before">
309 <field name="instance_id" readonly="1"/>
310 </xpath>
311 </data>
312 </field>
313 </record>
314
300 <record id="view_account_move_line_filter_instance_inherit" model="ir.ui.view">315 <record id="view_account_move_line_filter_instance_inherit" model="ir.ui.view">
301 <field name="name">account.move.line.filter.instance.inherit</field>316 <field name="name">account.move.line.filter.instance.inherit</field>
302 <field name="model">account.move.line</field>317 <field name="model">account.move.line</field>
303318
=== modified file 'register_accounting/account_bank_statement.py'
--- register_accounting/account_bank_statement.py 2013-10-14 16:04:11 +0000
+++ register_accounting/account_bank_statement.py 2013-11-06 10:36:19 +0000
@@ -862,6 +862,52 @@
862 return open_register_view(self, cr, uid, st_line.statement_id.id)862 return open_register_view(self, cr, uid, st_line.statement_id.id)
863 raise osv.except_osv(_('Warning'), _('You have to select some line to return to a register.'))863 raise osv.except_osv(_('Warning'), _('You have to select some line to return to a register.'))
864864
865 def get_analytic_lines(self, cr, uid, ids, context=None):
866 """
867 Give all analytic lines linked to the given register line(s)
868 """
869 # Some verifications
870 if not context:
871 context = {}
872 if not 'active_ids' in context or not context.get('active_ids', False):
873 raise osv.except_osv(_('Error'), _('No line selected!'))
874 # Use right register line IDS
875 ids = context.get('active_ids')
876 if isinstance(ids, (int, long)):
877 ids = [ids]
878 # Check which move_id to use
879 move_ids = []
880 for absl in self.browse(cr, uid, ids):
881 if absl.move_ids:
882 # Default ones (direct link to register lines)
883 for m in absl.move_ids:
884 if m.id not in move_ids:
885 move_ids.append(m.id)
886 # Those from cash advance return (we should use the reconciliation to find the return and its expenses)
887 for ml in m.line_id:
888 if ml.reconcile_id and ml.reconcile_id.line_id:
889 for line in ml.reconcile_id.line_id:
890 if line.move_id and line.move_id.id and line.move_id.id not in move_ids:
891 move_ids.append(line.move_id.id)
892 # Those from pending payments (imported_invoice_line_ids are move_line)
893 if absl.imported_invoice_line_ids:
894 for ml in absl.imported_invoice_line_ids:
895 if ml.move_id and ml.move_id.id not in move_ids:
896 move_ids.append(ml.move_id.id)
897 # Search valid ids
898 domain = [('account_id.category', '=', 'FUNDING'), ('move_id.move_id', 'in', move_ids)]
899 context.update({'display_fp': True}) # to display "Funding Pool" column name instead of "Analytic account"
900 return {
901 'name': _('Analytic Journal Items'),
902 'type': 'ir.actions.act_window',
903 'res_model': 'account.analytic.line',
904 'view_type': 'form',
905 'view_mode': 'tree,form',
906 'context': context,
907 'domain': domain,
908 'target': 'current',
909 }
910
865 def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None):911 def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None):
866 """912 """
867 Create move from the register line913 Create move from the register line
@@ -1714,6 +1760,17 @@
1714 """1760 """
1715 return self.posting(cr, uid, ids, 'temp', context=context)1761 return self.posting(cr, uid, ids, 'temp', context=context)
17161762
1763 def button_analytic_lines(self, cr, uid, ids, context=None):
1764 """
1765 Give analytic lines linked to the given register lines
1766 """
1767 if not context:
1768 context = {}
1769 # Update context
1770 context.update({'active_ids': ids})
1771 # Return result of action named "Analytic Lines" on register lines
1772 return self.get_analytic_lines(cr, uid, ids, context=context)
1773
1717 def unlink(self, cr, uid, ids, context=None):1774 def unlink(self, cr, uid, ids, context=None):
1718 """1775 """
1719 Permit to delete some account_bank_statement_line. But do some treatments on temp posting lines and do nothing for hard posting lines.1776 Permit to delete some account_bank_statement_line. But do some treatments on temp posting lines and do nothing for hard posting lines.
17201777
=== modified file 'register_accounting/account_invoice_view.xml'
--- register_accounting/account_invoice_view.xml 2013-09-11 14:31:05 +0000
+++ register_accounting/account_invoice_view.xml 2013-11-06 10:36:19 +0000
@@ -130,6 +130,8 @@
130 address_invoice_id, 'partner_id': partner_id, 'price_type': 'price_type' in dir() and price_type or False}" 130 address_invoice_id, 'partner_id': partner_id, 'price_type': 'price_type' in dir() and price_type or False}"
131 name="invoice_line" nolabel="1" attrs="{'readonly': [('state', 'not in', ['draft', 'open']), ('is_direct_invoice', '=', True)]}">131 name="invoice_line" nolabel="1" attrs="{'readonly': [('state', 'not in', ['draft', 'open']), ('is_direct_invoice', '=', True)]}">
132 <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')">132 <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')">
133 <field name="is_corrected" invisible="1"/>
134 <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/>
133 <field name="product_id" on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, 135 <field name="product_id" on_change="product_id_change(product_id, uos_id, quantity, name, parent.type,
134 parent.partner_id, parent.fiscal_position, price_unit, parent.address_invoice_id, parent.currency_id, 136 parent.partner_id, parent.fiscal_position, price_unit, parent.address_invoice_id, parent.currency_id,
135 {'company_id': parent.company_id})"/>137 {'company_id': parent.company_id})"/>
136138
=== modified file 'register_accounting/account_view.xml'
--- register_accounting/account_view.xml 2013-10-14 16:04:11 +0000
+++ register_accounting/account_view.xml 2013-11-06 10:36:19 +0000
@@ -55,6 +55,7 @@
55 <field colspan="4" name="line_ids" nolabel="1">55 <field colspan="4" name="line_ids" nolabel="1">
56 <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')">56 <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')">
57 <button name="button_duplicate" string="Duplicate" type="object" icon="gtk-copy" />57 <button name="button_duplicate" string="Duplicate" type="object" icon="gtk-copy" />
58 <button name="button_analytic_lines" string="Analytic lines" type="object" icon="terp-stock_zoom" />
58 <field name="document_date" attrs="{'readonly': [('from_import_cheque_id', '!=', False)]}"/>59 <field name="document_date" attrs="{'readonly': [('from_import_cheque_id', '!=', False)]}"/>
59 <field name="date"/>60 <field name="date"/>
60 <field name="sequence_for_reference" />61 <field name="sequence_for_reference" />
@@ -189,6 +190,7 @@
189 <field colspan="4" name="line_ids" nolabel="1">190 <field colspan="4" name="line_ids" nolabel="1">
190 <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')">191 <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')">
191 <button name="button_duplicate" string="Duplicate" type="object" icon="gtk-copy" />192 <button name="button_duplicate" string="Duplicate" type="object" icon="gtk-copy" />
193 <button name="button_analytic_lines" string="Analytic lines" type="object" icon="terp-stock_zoom" />
192 <field name="from_cash_return" invisible="1"/>194 <field name="from_cash_return" invisible="1"/>
193 <button name="button_advance" states="hard" string="Advance return" type="object" 195 <button name="button_advance" states="hard" string="Advance return" type="object"
194 icon="terp-stock_effects-object-colorize" context="context" 196 icon="terp-stock_effects-object-colorize" context="context"
@@ -355,6 +357,7 @@
355 icon="terp-stock_effects-object-colorize" context="context"357 icon="terp-stock_effects-object-colorize" context="context"
356 attrs="{'invisible': ['|', ('from_cash_return', '=', True), '|', ('amount', '&gt;=', 0), 358 attrs="{'invisible': ['|', ('from_cash_return', '=', True), '|', ('amount', '&gt;=', 0),
357 ('employee_id', '=', False)]}"/>359 ('employee_id', '=', False)]}"/>
360 <button name="button_analytic_lines" string="Analytic lines" type="object" icon="terp-stock_zoom" />
358 <field name="from_cash_return" invisible="1"/>361 <field name="from_cash_return" invisible="1"/>
359 <field name="amount" invisible="1"/>362 <field name="amount" invisible="1"/>
360 <field name="document_date"/>363 <field name="document_date"/>
@@ -663,6 +666,7 @@
663 <!-- 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. -->666 <!-- 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. -->
664 <tree editable="bottom" string="Statement lines" noteditable="state=='hard'" colors="red:display_analytic_button and (not analytic_distribution_id or analytic_distribution_state == 'invalid')">667 <tree editable="bottom" string="Statement lines" noteditable="state=='hard'" colors="red:display_analytic_button and (not analytic_distribution_id or analytic_distribution_state == 'invalid')">
665 <button name="button_duplicate" string="Duplicate" type="object" icon="gtk-copy" />668 <button name="button_duplicate" string="Duplicate" type="object" icon="gtk-copy" />
669 <button name="button_analytic_lines" string="Analytic lines" type="object" icon="terp-stock_zoom" />
666 <field name="document_date" attrs="{'readonly': [('direct_invoice', '=', True)]}"/>670 <field name="document_date" attrs="{'readonly': [('direct_invoice', '=', True)]}"/>
667 <field name="date" attrs="{'readonly': [('direct_invoice', '=', True)]}"/>671 <field name="date" attrs="{'readonly': [('direct_invoice', '=', True)]}"/>
668 <field name="cheque_number" required="1"/>672 <field name="cheque_number" required="1"/>
@@ -910,6 +914,12 @@
910 <field name="priority" eval="1"/>914 <field name="priority" eval="1"/>
911 <field name="arch" type="xml">915 <field name="arch" type="xml">
912 <tree string="Journal Items" editable="bottom" noteditable="1" colors="red:state in ('draft');black:state in ('valid')" hide_new_button="1">916 <tree string="Journal Items" editable="bottom" noteditable="1" colors="red:state in ('draft');black:state in ('valid')" hide_new_button="1">
917 <field name="is_corrigible" invisible="1"/>
918 <field name="have_an_historic" invisible="1"/>
919 <button name="button_do_accounting_corrections" type="object" string="Open Accounting Correction Wizard"
920 attrs="{'invisible': [('is_corrigible', '=', False)]}" icon="terp-mail-message-new"/>
921 <button name="button_open_corrections" type="object" string="Open corrections history"
922 attrs="{'invisible': [('have_an_historic', '=', False)]}" icon="terp-mail-"/>
913 <field name="journal_id"/>923 <field name="journal_id"/>
914 <field name="move_id"/>924 <field name="move_id"/>
915 <field name="name"/>925 <field name="name"/>
916926
=== modified file 'register_accounting/account_wizard.xml'
--- register_accounting/account_wizard.xml 2013-01-30 15:51:06 +0000
+++ register_accounting/account_wizard.xml 2013-11-06 10:36:19 +0000
@@ -42,6 +42,7 @@
42 Account bank statement lines42 Account bank statement lines
43 -->43 -->
4444
45 <!-- Return to the register linked to the given line -->
45 <record id="action_return_to_register" model="ir.actions.server">46 <record id="action_return_to_register" model="ir.actions.server">
46 <field name="name">Return to register</field>47 <field name="name">Return to register</field>
47 <field name="model_id" ref="model_account_bank_statement_line"/>48 <field name="model_id" ref="model_account_bank_statement_line"/>
@@ -57,5 +58,21 @@
57 <field eval="True" name="object"/>58 <field eval="True" name="object"/>
58 </record>59 </record>
5960
61 <!-- Display all Analytic Lines attached to given Register Lines -->
62 <record id="action_analytic_register_lines" model="ir.actions.server">
63 <field name="name">Analytic Lines</field>
64 <field name="model_id" ref="model_account_bank_statement_line"/>
65 <field name="state">code</field>
66 <field name="code">action = obj.get_analytic_lines(context=context)</field>
67 </record>
68
69 <record id="ir_open_analytic_register_lines" model="ir.values">
70 <field name="key2">client_action_multi</field>
71 <field name="model">account.bank.statement.line</field>
72 <field name="name">Analytic Lines</field>
73 <field eval="'ir.actions.server,%d'%action_analytic_register_lines" name="value"/>
74 <field eval="True" name="object"/>
75 </record>
76
60 </data>77 </data>
61</openerp>78</openerp>

Subscribers

People subscribed via source and target branches