Merge lp:~dr.dran/domsense-agilebg-addons/account_analytics_deferred_6_0 into lp:domsense-agilebg-addons/6.0
- account_analytics_deferred_6_0
- Merge into 6.0
Proposed by
Franco Tampieri
Status: | Needs review |
---|---|
Proposed branch: | lp:~dr.dran/domsense-agilebg-addons/account_analytics_deferred_6_0 |
Merge into: | lp:domsense-agilebg-addons/6.0 |
Diff against target: |
490 lines (+271/-79) 6 files modified
account_analytic_deferred_choice/AUTHORS.txt (+2/-0) account_analytic_deferred_choice/account_invoice_view.xml (+29/-0) account_analytic_deferred_choice/analytic.py (+4/-1) account_analytic_deferred_choice/i18n/it.po (+147/-70) account_analytic_deferred_choice/invoice.py (+86/-8) account_analytic_deferred_choice/project_view.xml (+3/-0) |
To merge this branch: | bzr merge lp:~dr.dran/domsense-agilebg-addons/account_analytics_deferred_6_0 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Agile Business Group | Pending | ||
Review via email: mp+105060@code.launchpad.net |
Commit message
Description of the change
Aggiunte nuove funzionalità all'account_
To post a comment you must log in.
- 139. By Franco Tampieri
-
[Fix] A problem on the enrty lines view
[Add] The possibility to add an entry line without an account deferred_analytics_ id that didn't permit to the system to raise a exception
Unmerged revisions
- 139. By Franco Tampieri
-
[Fix] A problem on the enrty lines view
[Add] The possibility to add an entry line without an account deferred_analytics_ id that didn't permit to the system to raise a exception - 138. By Franco Tampieri
-
[Fix] Corretti bugs minori di interfaccia
- 137. By Franco Tampieri
-
[ADD] Added the deferred Analytic choice to the account.move and account move.line
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'account_analytic_deferred_choice/AUTHORS.txt' |
2 | --- account_analytic_deferred_choice/AUTHORS.txt 2011-12-06 17:34:39 +0000 |
3 | +++ account_analytic_deferred_choice/AUTHORS.txt 2012-05-21 16:22:22 +0000 |
4 | @@ -1,1 +1,3 @@ |
5 | Lorenzo Battistini <lorenzo.battistini@agilebg.com> |
6 | +Leonardo Pistone <leonardo.pistobe@agilebg.com> |
7 | +Franco Tampieri <franco.tampieri@agilebg.com> |
8 | |
9 | === modified file 'account_analytic_deferred_choice/account_invoice_view.xml' |
10 | --- account_analytic_deferred_choice/account_invoice_view.xml 2012-01-24 22:03:25 +0000 |
11 | +++ account_analytic_deferred_choice/account_invoice_view.xml 2012-05-21 16:22:22 +0000 |
12 | @@ -21,6 +21,7 @@ |
13 | </page> |
14 | </field> |
15 | </record> |
16 | + |
17 | <record id="invoice_form" model="ir.ui.view"> |
18 | <field name="name">account.invoice.form</field> |
19 | <field name="model">account.invoice</field> |
20 | @@ -53,5 +54,33 @@ |
21 | </field> |
22 | </field> |
23 | </record> |
24 | + |
25 | + <record id="account_move_deferred_form" model="ir.ui.view"> |
26 | + <field name="name">account.move.deferred.form</field> |
27 | + <field name="model">account.move</field> |
28 | + <field name="type">form</field> |
29 | + <field name="inherit_id" ref="account.view_move_form"></field> |
30 | + <field name="arch" type="xml"> |
31 | + <xpath expr="/form/notebook/page[@string='Journal Items']/field[@name='line_id']/form/notebook/page[@string='Information']/group/field[@name='analytic_account_id']" position="after"> |
32 | + <field name="deferred_analytics_id" groups="analytic.group_analytic_accounting" domain="[('plan_id','<>',False)]"/> |
33 | + </xpath> |
34 | + <xpath expr="/form/notebook/page[@string='Journal Items']/field[@name='line_id']/tree/field[@name='analytic_account_id']" position="after"> |
35 | + <field name="deferred_analytics_id" groups="analytic.group_analytic_accounting" domain="[('plan_id','<>',False)]"/> |
36 | + </xpath> |
37 | + <page string="Journal Items" position="after"> |
38 | + <page string="Deferred analytic lines" groups="account.group_account_user"> |
39 | + <group colspan="2" col="4" groups="analytic.group_analytic_accounting"> |
40 | + <field name="deferred_analytics_id" domain="[('plan_id','<>',False)]"/> |
41 | + <button name="create_analytic_lines" type="object" string="Create analytic lines" groups="account.group_account_user"/> |
42 | + <button name="delete_analytic_lines" type="object" string="Delete analytic lines" groups="account.group_account_user"/> |
43 | + </group> |
44 | + <newline/> |
45 | + <field name="deferred_line_ids" nolabel="1" colspan="4"/> |
46 | + </page> |
47 | + </page> |
48 | + </field> |
49 | + </record> |
50 | + |
51 | + |
52 | </data> |
53 | </openerp> |
54 | |
55 | === modified file 'account_analytic_deferred_choice/analytic.py' |
56 | --- account_analytic_deferred_choice/analytic.py 2011-12-07 14:35:51 +0000 |
57 | +++ account_analytic_deferred_choice/analytic.py 2012-05-21 16:22:22 +0000 |
58 | @@ -1,6 +1,6 @@ |
59 | # -*- coding: utf-8 -*- |
60 | ############################################################################## |
61 | -# |
62 | +# |
63 | # Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
64 | # Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
65 | # All Rights Reserved |
66 | @@ -29,6 +29,9 @@ |
67 | 'deferred_invoice_line_id': fields.many2one('account.invoice.line', 'Invoice Line', readonly=True), |
68 | 'deferred_invoice_id': fields.related('deferred_invoice_line_id', 'invoice_id', type="many2one", |
69 | relation="account.invoice", string="Invoice", store=False, readonly=True), |
70 | + 'deferred_account_move_line_id': fields.many2one('account.move.line', 'Account Entry Line', readonly=True), |
71 | + 'deferred_account_move_id': fields.related('deferred_account_move_line_id', 'move_id', type="many2one", |
72 | + relation="account.move", string="Account Entry", store=False, readonly=True), |
73 | } |
74 | |
75 | account_analytic_line() |
76 | |
77 | === added file 'account_analytic_deferred_choice/i18n/it.mo' |
78 | Binary files account_analytic_deferred_choice/i18n/it.mo 1970-01-01 00:00:00 +0000 and account_analytic_deferred_choice/i18n/it.mo 2012-05-21 16:22:22 +0000 differ |
79 | === modified file 'account_analytic_deferred_choice/i18n/it.po' |
80 | --- account_analytic_deferred_choice/i18n/it.po 2011-12-09 10:50:36 +0000 |
81 | +++ account_analytic_deferred_choice/i18n/it.po 2012-05-21 16:22:22 +0000 |
82 | @@ -4,11 +4,11 @@ |
83 | # |
84 | msgid "" |
85 | msgstr "" |
86 | -"Project-Id-Version: OpenERP Server 6.0.3\n" |
87 | +"Project-Id-Version: OpenERP Server 6.0.4\n" |
88 | "Report-Msgid-Bugs-To: support@openerp.com\n" |
89 | -"POT-Creation-Date: 2011-12-09 10:28+0000\n" |
90 | -"PO-Revision-Date: 2011-12-09 11:46+0100\n" |
91 | -"Last-Translator: Lorenzo Battistini <lorenzo.battistini@agilebg.com>\n" |
92 | +"POT-Creation-Date: 2012-05-08 08:09+0000\n" |
93 | +"PO-Revision-Date: 2012-05-08 10:24+0100\n" |
94 | +"Last-Translator: Franco Tampieri <info@francotampieri.com>\n" |
95 | "Language-Team: \n" |
96 | "MIME-Version: 1.0\n" |
97 | "Content-Type: text/plain; charset=UTF-8\n" |
98 | @@ -16,58 +16,170 @@ |
99 | "Plural-Forms: \n" |
100 | |
101 | #. module: account_analytic_deferred_choice |
102 | +#: constraint:account.move:0 |
103 | +msgid "You cannot create entries on different periods/journals in the same move" |
104 | +msgstr "Non si possono creare scritture in sezionali differenti con una stessa registrazione." |
105 | + |
106 | +#. module: account_analytic_deferred_choice |
107 | +#: view:account.invoice:0 |
108 | +#: view:account.move:0 |
109 | +msgid "Create analytic lines" |
110 | +msgstr "Crea righe analitiche" |
111 | + |
112 | +#. module: account_analytic_deferred_choice |
113 | +#: code:addons/account_analytic_deferred_choice/invoice.py:69 |
114 | +#: code:addons/account_analytic_deferred_choice/invoice.py:148 |
115 | +#, python-format |
116 | +msgid "You have to define an analytic journal on the '%s' journal!" |
117 | +msgstr "E' necessario definite un giornale analitico per il sezionale '%s'!" |
118 | + |
119 | +#. module: account_analytic_deferred_choice |
120 | +#: code:addons/account_analytic_deferred_choice/invoice.py:63 |
121 | +#, python-format |
122 | +msgid "Analytic lines yet generated for invoice %s. Remove them first" |
123 | +msgstr "Righe analitiche già generate per la fattura %s. Rimuoverle prima di crearne altre" |
124 | + |
125 | +#. module: account_analytic_deferred_choice |
126 | +#: code:addons/account_analytic_deferred_choice/invoice.py:142 |
127 | +#, python-format |
128 | +msgid "Analytic lines yet generated for Account Entry %s. Remove them first" |
129 | +msgstr "Righe analitiche già generate per il Movimento %s. Rimuoverle prima di crearne altre" |
130 | + |
131 | +#. module: account_analytic_deferred_choice |
132 | +#: model:ir.module.module,description:account_analytic_deferred_choice.module_meta_information |
133 | +msgid "" |
134 | +"User can assign the invoice amount to one or more analytic accounts, subsequently (or previously) to invoice confirmation.\n" |
135 | +" The invoice has a new field, containing the analytic plan to be used. The related button generates tha analytic lines, related to the invoice. The invoice lines have new fields too, containing the analytic plan. If the line's field is not filled, the invoice's one is used.\n" |
136 | +" On the invoice form, another button allows to delete the previously generated analytic lines.\n" |
137 | +" Every analytic line contains a reference to the invoice line that generated it." |
138 | +msgstr "" |
139 | +"User can assign the invoice amount to one or more analytic accounts, subsequently (or previously) to invoice confirmation.\n" |
140 | +" The invoice has a new field, containing the analytic plan to be used. The related button generates tha analytic lines, related to the invoice. The invoice lines have new fields too, containing the analytic plan. If the line's field is not filled, the invoice's one is used.\n" |
141 | +" On the invoice form, another button allows to delete the previously generated analytic lines.\n" |
142 | +" Every analytic line contains a reference to the invoice line that generated it." |
143 | + |
144 | +#. module: account_analytic_deferred_choice |
145 | #: model:ir.model,name:account_analytic_deferred_choice.model_account_analytic_line |
146 | msgid "Analytic Line" |
147 | -msgstr "Voce conto analitico" |
148 | - |
149 | -#. module: account_analytic_deferred_choice |
150 | -#: code:addons/account_analytic_deferred_choice/invoice.py:61 |
151 | +msgstr "Linea conto analitico" |
152 | + |
153 | +#. module: account_analytic_deferred_choice |
154 | +#: constraint:account.move.line:0 |
155 | +msgid "You can not create move line on closed account." |
156 | +msgstr "Non si puo' inserire una voce per una registrazione su un conto chiuso." |
157 | + |
158 | +#. module: account_analytic_deferred_choice |
159 | +#: field:account.invoice,deferred_analytics_id:0 |
160 | +#: field:account.invoice.line,deferred_analytics_id:0 |
161 | +#: field:account.move,deferred_analytics_id:0 |
162 | +#: field:account.move.line,deferred_analytics_id:0 |
163 | +msgid "Deferred Analytic Distribution" |
164 | +msgstr "Distribuzione analitica differita" |
165 | + |
166 | +#. module: account_analytic_deferred_choice |
167 | +#: code:addons/account_analytic_deferred_choice/invoice.py:66 |
168 | #, python-format |
169 | msgid "Invoice %s and line %s have no Deferred Analytic Distribution" |
170 | msgstr "La fattura %s e la riga %s non hanno una distribuzione analitica differita" |
171 | |
172 | #. module: account_analytic_deferred_choice |
173 | +#: model:ir.module.module,shortdesc:account_analytic_deferred_choice.module_meta_information |
174 | +msgid "Analytic Deferred Choice for Invoices" |
175 | +msgstr "Scelta analitica differita per le fatture" |
176 | + |
177 | +#. module: account_analytic_deferred_choice |
178 | +#: view:account.move:0 |
179 | +#: model:ir.model,name:account_analytic_deferred_choice.model_account_move_line |
180 | +msgid "Journal Items" |
181 | +msgstr "Voci sezionale" |
182 | + |
183 | +#. module: account_analytic_deferred_choice |
184 | +#: constraint:account.move.line:0 |
185 | +msgid "Company must be same for its related account and period." |
186 | +msgstr "L'azienda deve essere la stessa per il periodo ed il conto ad essa correlato." |
187 | + |
188 | +#. module: account_analytic_deferred_choice |
189 | +#: code:addons/account_analytic_deferred_choice/invoice.py:145 |
190 | +#, python-format |
191 | +msgid "Account Entry %s and line %s have no Deferred Analytic Distribution" |
192 | +msgstr "Il Movimento Sezionale %s e la riga %s non hanno una distribuzione analitica differita" |
193 | + |
194 | +#. module: account_analytic_deferred_choice |
195 | #: field:account.invoice,deferred_line_ids:0 |
196 | #: field:account.invoice.line,deferred_line_ids:0 |
197 | +#: field:account.move,deferred_line_ids:0 |
198 | +#: field:account.move.line,deferred_line_ids:0 |
199 | msgid "Analytic Lines" |
200 | msgstr "Righe analitiche" |
201 | |
202 | #. module: account_analytic_deferred_choice |
203 | -#: code:addons/account_analytic_deferred_choice/invoice.py:64 |
204 | +#: constraint:account.move:0 |
205 | +#: constraint:account.move.line:0 |
206 | +msgid "The date of your Journal Entry is not in the defined period!" |
207 | +msgstr "La data del Movimento Sezionale non è inclusa nel periodo definito!" |
208 | + |
209 | +#. module: account_analytic_deferred_choice |
210 | +#: field:account.analytic.line,deferred_account_move_line_id:0 |
211 | +msgid "Account Entry Line" |
212 | +msgstr "Linea Movimento Sezionale" |
213 | + |
214 | +#. module: account_analytic_deferred_choice |
215 | +#: constraint:account.move:0 |
216 | +msgid "You cannot create more than one move per period on centralized journal" |
217 | +msgstr "Non si puo' creare piu' di un movimento per periodo su un sezionale centralizzato" |
218 | + |
219 | +#. module: account_analytic_deferred_choice |
220 | +#: sql_constraint:account.move.line:0 |
221 | +msgid "Wrong credit or debit value in accounting entry !" |
222 | +msgstr "Valore di credito o debito errato nella registrazione contabile !" |
223 | + |
224 | +#. module: account_analytic_deferred_choice |
225 | +#: view:account.invoice:0 |
226 | +msgid "Payments" |
227 | +msgstr "Pagamenti" |
228 | + |
229 | +#. module: account_analytic_deferred_choice |
230 | +#: code:addons/account_analytic_deferred_choice/invoice.py:62 |
231 | +#: code:addons/account_analytic_deferred_choice/invoice.py:66 |
232 | +#: code:addons/account_analytic_deferred_choice/invoice.py:141 |
233 | +#: code:addons/account_analytic_deferred_choice/invoice.py:145 |
234 | +#, python-format |
235 | +msgid "Error" |
236 | +msgstr "Errore" |
237 | + |
238 | +#. module: account_analytic_deferred_choice |
239 | +#: view:account.invoice:0 |
240 | +#: view:account.move:0 |
241 | +msgid "Deferred analytic lines" |
242 | +msgstr "Righe analitiche differite" |
243 | + |
244 | +#. module: account_analytic_deferred_choice |
245 | +#: view:account.invoice:0 |
246 | +#: view:account.move:0 |
247 | +msgid "Delete analytic lines" |
248 | +msgstr "Rimuovi righe analitiche" |
249 | + |
250 | +#. module: account_analytic_deferred_choice |
251 | +#: view:account.analytic.line:0 |
252 | +#: field:account.analytic.line,deferred_account_move_id:0 |
253 | +#: model:ir.model,name:account_analytic_deferred_choice.model_account_move |
254 | +msgid "Account Entry" |
255 | +msgstr "Movimento Sezionale" |
256 | + |
257 | +#. module: account_analytic_deferred_choice |
258 | +#: code:addons/account_analytic_deferred_choice/invoice.py:69 |
259 | +#: code:addons/account_analytic_deferred_choice/invoice.py:148 |
260 | #, python-format |
261 | msgid "No Analytic Journal !" |
262 | msgstr "Nessun giornale analitico!" |
263 | |
264 | #. module: account_analytic_deferred_choice |
265 | -#: view:account.invoice:0 |
266 | -msgid "Create analytic lines" |
267 | -msgstr "Crea righe analitiche" |
268 | - |
269 | -#. module: account_analytic_deferred_choice |
270 | -#: code:addons/account_analytic_deferred_choice/invoice.py:57 |
271 | -#: code:addons/account_analytic_deferred_choice/invoice.py:61 |
272 | -#, python-format |
273 | -msgid "Error" |
274 | -msgstr "Errore" |
275 | - |
276 | -#. module: account_analytic_deferred_choice |
277 | #: field:account.analytic.line,deferred_invoice_line_id:0 |
278 | #: model:ir.model,name:account_analytic_deferred_choice.model_account_invoice_line |
279 | msgid "Invoice Line" |
280 | msgstr "Riga fattura" |
281 | |
282 | #. module: account_analytic_deferred_choice |
283 | -#: code:addons/account_analytic_deferred_choice/invoice.py:64 |
284 | -#, python-format |
285 | -msgid "You have to define an analytic journal on the '%s' journal!" |
286 | -msgstr "E' necessario definite un giornale analitico per il sezionale '%s'!" |
287 | - |
288 | -#. module: account_analytic_deferred_choice |
289 | -#: view:account.invoice:0 |
290 | -msgid "Delete analytic lines" |
291 | -msgstr "Rimuovi righe analitiche" |
292 | - |
293 | -#. module: account_analytic_deferred_choice |
294 | #: view:account.analytic.line:0 |
295 | #: field:account.analytic.line,deferred_invoice_id:0 |
296 | #: model:ir.model,name:account_analytic_deferred_choice.model_account_invoice |
297 | @@ -75,42 +187,7 @@ |
298 | msgstr "Fattura" |
299 | |
300 | #. module: account_analytic_deferred_choice |
301 | -#: model:ir.module.module,shortdesc:account_analytic_deferred_choice.module_meta_information |
302 | -msgid "Analytic Deferred Choice for Invoices" |
303 | -msgstr "Scelta analitica differita per le fatture" |
304 | - |
305 | -#. module: account_analytic_deferred_choice |
306 | -#: code:addons/account_analytic_deferred_choice/invoice.py:58 |
307 | -#, python-format |
308 | -msgid "Analytic lines yet generated for invoice %s. Remove them first" |
309 | -msgstr "Righe analitiche già generate per la fattura %s. Rimuoverle prima di crearne altre" |
310 | - |
311 | -#. module: account_analytic_deferred_choice |
312 | -#: model:ir.module.module,description:account_analytic_deferred_choice.module_meta_information |
313 | -msgid "" |
314 | -"User can assign the invoice amount to one or more analytic accounts, subsequently (or previously) to invoice confirmation.\n" |
315 | -" The invoice has a new field, containing the analytic plan to be used. The related button generates tha analytic lines, related to the invoice. The invoice lines have new fields too, containing the analytic plan. If the line's field is not filled, the invoice's one is used.\n" |
316 | -" On the invoice form, another button allows to delete the previously generated analytic lines.\n" |
317 | -" Every analytic line contains a reference to the invoice line that generated it." |
318 | -msgstr "" |
319 | -"User can assign the invoice amount to one or more analytic accounts, subsequently (or previously) to invoice confirmation.\n" |
320 | -" The invoice has a new field, containing the analytic plan to be used. The related button generates tha analytic lines, related to the invoice. The invoice lines have new fields too, containing the analytic plan. If the line's field is not filled, the invoice's one is used.\n" |
321 | -" On the invoice form, another button allows to delete the previously generated analytic lines.\n" |
322 | -" Every analytic line contains a reference to the invoice line that generated it." |
323 | - |
324 | -#. module: account_analytic_deferred_choice |
325 | -#: view:account.invoice:0 |
326 | -msgid "Deferred analytic lines" |
327 | -msgstr "Righe analitiche differite" |
328 | - |
329 | -#. module: account_analytic_deferred_choice |
330 | -#: field:account.invoice,deferred_analytics_id:0 |
331 | -#: field:account.invoice.line,deferred_analytics_id:0 |
332 | -msgid "Deferred Analytic Distribution" |
333 | -msgstr "Distribuzione analitica differita" |
334 | - |
335 | -#. module: account_analytic_deferred_choice |
336 | -#: view:account.invoice:0 |
337 | -msgid "Payments" |
338 | -msgstr "Pagamenti" |
339 | +#: constraint:account.move.line:0 |
340 | +msgid "You can not create move line on view account." |
341 | +msgstr "Non si possono inserire movimenti in un conto di tipo \"vista\"" |
342 | |
343 | |
344 | === modified file 'account_analytic_deferred_choice/invoice.py' |
345 | --- account_analytic_deferred_choice/invoice.py 2012-01-24 15:41:42 +0000 |
346 | +++ account_analytic_deferred_choice/invoice.py 2012-05-21 16:22:22 +0000 |
347 | @@ -1,6 +1,6 @@ |
348 | # -*- coding: utf-8 -*- |
349 | ############################################################################## |
350 | -# |
351 | +# |
352 | # Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
353 | # Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
354 | # All Rights Reserved |
355 | @@ -25,9 +25,9 @@ |
356 | from osv import orm |
357 | |
358 | class account_invoice(osv.osv): |
359 | - |
360 | + |
361 | _inherit = 'account.invoice' |
362 | - |
363 | + |
364 | def _get_deferred_analytic_lines(self, cr, uid, ids, field_name, arg, context=None): |
365 | res={} |
366 | for invoice in self.browse(cr, uid, ids): |
367 | @@ -41,7 +41,7 @@ |
368 | raise e |
369 | res[invoice.id] = analytic_lines |
370 | return res |
371 | - |
372 | + |
373 | _columns={ |
374 | 'deferred_analytics_id': fields.many2one('account.analytic.plan.instance', 'Deferred Analytic Distribution'), |
375 | 'deferred_line_ids': fields.function(_get_deferred_analytic_lines, type='one2many', obj='account.analytic.line', method=True, string='Analytic Lines'), |
376 | @@ -89,17 +89,95 @@ |
377 | } |
378 | al_id = analytic_line_obj.create(cr, uid, al_vals, context=context) |
379 | return True |
380 | - |
381 | + |
382 | account_invoice() |
383 | |
384 | class account_invoice_line(osv.osv): |
385 | - |
386 | + |
387 | _inherit = 'account.invoice.line' |
388 | - |
389 | + |
390 | _columns={ |
391 | # TODO is it possible to have editable? |
392 | 'deferred_analytics_id': fields.many2one('account.analytic.plan.instance', 'Deferred Analytic Distribution'), |
393 | 'deferred_line_ids': fields.one2many('account.analytic.line', 'deferred_invoice_line_id', 'Analytic Lines'), |
394 | } |
395 | - |
396 | + |
397 | account_invoice_line() |
398 | + |
399 | +class account_move(osv.osv): |
400 | + |
401 | + _inherit = 'account.move' |
402 | + |
403 | + def _get_deferred_analytic_lines(self, cr, uid, ids, field_name, arg, context=None): |
404 | + res={} |
405 | + for move in self.browse(cr, uid, ids): |
406 | + analytic_lines = [] |
407 | + for line in move.line_id: |
408 | + try: |
409 | + if line.deferred_line_ids: |
410 | + analytic_lines.extend([x.id for x in line.deferred_line_ids]) |
411 | + except orm.except_orm, e: |
412 | + if e.name != 'AccessError': |
413 | + raise e |
414 | + res[move.id] = analytic_lines |
415 | + return res |
416 | + |
417 | + _columns={ |
418 | + 'deferred_analytics_id': fields.many2one('account.analytic.plan.instance', 'Deferred Analytic Distribution'), |
419 | + 'deferred_line_ids': fields.function(_get_deferred_analytic_lines, type='one2many', obj='account.analytic.line', method=True, string='Analytic Lines'), |
420 | + } |
421 | + |
422 | + def delete_analytic_lines(self, cr, uid, ids, context=None): |
423 | + analytic_line_obj = self.pool.get('account.analytic.line') |
424 | + for move in self.browse(cr, uid, ids): |
425 | + for line in move.deferred_line_ids: |
426 | + line.unlink() |
427 | + return True |
428 | + |
429 | + def create_analytic_lines(self, cr, uid, ids, context=None): |
430 | + analytic_line_obj = self.pool.get('account.analytic.line') |
431 | + for move in self.browse(cr, uid, ids): |
432 | + if move.deferred_line_ids: |
433 | + raise osv.except_osv(_('Error'), |
434 | + _('Analytic lines yet generated for Account Entry %s. Remove them first') % move.name) |
435 | + for move_line in move.line_id: |
436 | + if not move_line.deferred_analytics_id and not move.deferred_analytics_id: |
437 | + continue |
438 | + if not move.journal_id.analytic_journal_id: |
439 | + raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (invoice.journal_id.name,)) |
440 | + if move_line.deferred_analytics_id: |
441 | + deferred_analytics_id = move_line.deferred_analytics_id |
442 | + else: |
443 | + deferred_analytics_id = move.deferred_analytics_id |
444 | + for plan_line in deferred_analytics_id.account_ids: |
445 | + if move_line.credit: |
446 | + amount = move_line.credit * (plan_line.rate / 100) |
447 | + if move_line.debit: |
448 | + amount = - move_line.debit * (plan_line.rate / 100) |
449 | + al_vals={ |
450 | + 'name': move_line.name, |
451 | + 'account_id': plan_line.analytic_account_id.id, |
452 | + 'unit_amount': False, |
453 | + 'product_id': False, |
454 | + 'product_uom_id': False, |
455 | + 'amount': amount, |
456 | + 'journal_id': move.journal_id.analytic_journal_id.id, |
457 | + 'percentage': plan_line.rate, |
458 | + 'deferred_account_move_line_id': move_line.id, |
459 | + 'general_account_id': move_line.account_id.id, |
460 | + } |
461 | + al_id = analytic_line_obj.create(cr, uid, al_vals, context=context) |
462 | + return True |
463 | + |
464 | +account_move() |
465 | + |
466 | +class account_move_line(osv.osv): |
467 | + |
468 | + _inherit = 'account.move.line' |
469 | + |
470 | + _columns={ |
471 | + 'deferred_analytics_id': fields.many2one('account.analytic.plan.instance', 'Deferred Analytic Distribution'), |
472 | + 'deferred_line_ids': fields.one2many('account.analytic.line', 'deferred_account_move_line_id', 'Analytic Lines'), |
473 | + } |
474 | + |
475 | +account_move_line() |
476 | \ No newline at end of file |
477 | |
478 | === modified file 'account_analytic_deferred_choice/project_view.xml' |
479 | --- account_analytic_deferred_choice/project_view.xml 2011-12-07 16:22:31 +0000 |
480 | +++ account_analytic_deferred_choice/project_view.xml 2012-05-21 16:22:22 +0000 |
481 | @@ -11,6 +11,9 @@ |
482 | <separator colspan="2" string="Invoice"/> |
483 | <field name="deferred_invoice_id"/> |
484 | <field name="deferred_invoice_line_id"/> |
485 | + <separator colspan="2" string="Account Entry"/> |
486 | + <field name="deferred_account_move_id"/> |
487 | + <field name="deferred_account_move_line_id"/> |
488 | </field> |
489 | </field> |
490 | </record> |
merged in 6.1: http:// bazaar. launchpad. net/~domsense/ domsense- agilebg- addons/ 6.1/revision/ 219