Merge lp:~dr.dran/domsense-agilebg-addons/account_analytics_deferred_6_0 into lp:domsense-agilebg-addons/6.1
- account_analytics_deferred_6_0
- Merge into 6.1
Status: | Rejected |
---|---|
Rejected by: | Lorenzo Battistini |
Proposed branch: | lp:~dr.dran/domsense-agilebg-addons/account_analytics_deferred_6_0 |
Merge into: | lp:domsense-agilebg-addons/6.1 |
Diff against target: |
2836 lines (+2445/-2) (has conflicts) 54 files modified
account_analytic_deferred_choice/AUTHORS.txt (+3/-0) account_analytic_deferred_choice/__init__.py (+23/-0) account_analytic_deferred_choice/__openerp__.py (+42/-0) account_analytic_deferred_choice/account_invoice_view.xml (+86/-0) account_analytic_deferred_choice/analytic.py (+37/-0) account_analytic_deferred_choice/i18n/it.po (+193/-0) account_analytic_deferred_choice/invoice.py (+183/-0) account_analytic_deferred_choice/project_view.xml (+21/-0) account_analytic_distribution_menu/AUTHORS.txt (+2/-0) account_analytic_distribution_menu/__init__.py (+22/-0) account_analytic_distribution_menu/__openerp__.py (+43/-0) account_analytic_distribution_menu/account_analytic_plans.py (+37/-0) account_analytic_distribution_menu/account_distribution.xml (+50/-0) account_move_template/__openerp__.py (+4/-0) account_move_template/wizard/select_template.py (+34/-2) account_move_template/wizard/select_template.xml (+9/-0) analytic_move/AUTHORS.txt (+1/-0) analytic_move/__init__.py (+22/-0) analytic_move/__openerp__.py (+40/-0) analytic_move/analytic.py (+40/-0) analytic_move/analytic_view.xml (+86/-0) analytic_move/i18n/it.po (+70/-0) analytic_move/security/ir.model.access.csv (+2/-0) hr_expense_analytic_deferred_choice/AUTHORS.txt (+1/-0) hr_expense_analytic_deferred_choice/__init__.py (+23/-0) hr_expense_analytic_deferred_choice/__openerp__.py (+42/-0) hr_expense_analytic_deferred_choice/analytic.py (+34/-0) hr_expense_analytic_deferred_choice/hr_expense.py (+116/-0) hr_expense_analytic_deferred_choice/hr_expense_view.xml (+37/-0) hr_expense_analytic_deferred_choice/i18n/it.po (+140/-0) hr_expense_analytic_deferred_choice/project_view.xml (+18/-0) project_issue_customer_view/project_issue_menu.xml (+6/-0) purchase_analytic_deferred_choice/AUTHORS.txt (+1/-0) purchase_analytic_deferred_choice/__init__.py (+23/-0) purchase_analytic_deferred_choice/__openerp__.py (+42/-0) purchase_analytic_deferred_choice/analytic.py (+34/-0) purchase_analytic_deferred_choice/i18n/it.po (+150/-0) purchase_analytic_deferred_choice/project_view.xml (+18/-0) purchase_analytic_deferred_choice/purchase_order.py (+116/-0) purchase_analytic_deferred_choice/purchase_order_view.xml (+38/-0) sale_double_validation/AUTHORS.txt (+1/-0) sale_double_validation/__init__.py (+22/-0) sale_double_validation/__openerp__.py (+41/-0) sale_double_validation/i18n/it.po (+58/-0) sale_double_validation/sale.py (+46/-0) sale_double_validation/sale_view.xml (+20/-0) sale_double_validation/sale_workflow.xml (+31/-0) super_calendar/AUTHORS.txt (+1/-0) super_calendar/__init__.py (+22/-0) super_calendar/__openerp__.py (+46/-0) super_calendar/cron_data.xml (+13/-0) super_calendar/security/ir.model.access.csv (+4/-0) super_calendar/super_calendar.py (+116/-0) super_calendar/super_calendar_view.xml (+135/-0) Conflict adding file account_analytic_deferred_choice. Moved existing file to account_analytic_deferred_choice.moved. Conflict adding file account_analytic_distribution_menu. Moved existing file to account_analytic_distribution_menu.moved. Text conflict in account_move_template/__openerp__.py Text conflict in account_move_template/wizard/select_template.py Text conflict in account_move_template/wizard/select_template.xml Conflict adding file analytic_move. Moved existing file to analytic_move.moved. Conflict adding file hr_expense_analytic_deferred_choice. Moved existing file to hr_expense_analytic_deferred_choice.moved. Conflict adding file project_issue_customer_view/data. Moved existing file to project_issue_customer_view/data.moved. Text conflict in project_issue_customer_view/project_issue_menu.xml Conflict adding file purchase_analytic_deferred_choice. Moved existing file to purchase_analytic_deferred_choice.moved. Conflict adding file sale_double_validation. Moved existing file to sale_double_validation.moved. Conflict adding file super_calendar. Moved existing file to super_calendar.moved. |
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 |
---|---|---|---|
Lorenzo Battistini | Disapprove | ||
Leonardo Pistone (community) | Disapprove | ||
Review via email: mp+105053@code.launchpad.net |
Commit message
Description of the change
Modificato il modulo account_
- 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
Lorenzo Battistini (elbati) wrote : | # |
It has been proposed to be merged into lp:domsense-agilebg-addons while should be lp:domsense-agilebg-addons/6.0 I think
Lorenzo Battistini (elbati) wrote : | # |
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
- 136. By Lorenzo Battistini
-
[MERGE] aggiunto il partner nel wizard di scelta del template per inserirlo nei move generati
- 135. By Franco Tampieri <email address hidden>
-
Added menu icons
- 134. By Lorenzo Battistini
-
[ADD] sale_double_
validation - 133. By Lorenzo Battistini
-
[FIX] avoiding record creation when missing required fields
- 132. By Lorenzo Battistini
-
[FIX] super_calendar constraint
- 131. By Lorenzo Battistini
-
[ADD] account_
analytic_ deferred_ choice analytic_move hr_expense_ analytic_ deferred_ choice purchase_ analytic_ deferred_ choice - 130. By Lorenzo Battistini
-
[FIX] confusing menu items
Preview Diff
1 | === added directory 'account_analytic_deferred_choice' |
2 | === renamed directory 'account_analytic_deferred_choice' => 'account_analytic_deferred_choice.moved' |
3 | === added file 'account_analytic_deferred_choice/AUTHORS.txt' |
4 | --- account_analytic_deferred_choice/AUTHORS.txt 1970-01-01 00:00:00 +0000 |
5 | +++ account_analytic_deferred_choice/AUTHORS.txt 2012-05-21 16:22:21 +0000 |
6 | @@ -0,0 +1,3 @@ |
7 | +Lorenzo Battistini <lorenzo.battistini@agilebg.com> |
8 | +Leonardo Pistone <leonardo.pistobe@agilebg.com> |
9 | +Franco Tampieri <franco.tampieri@agilebg.com> |
10 | |
11 | === added file 'account_analytic_deferred_choice/__init__.py' |
12 | --- account_analytic_deferred_choice/__init__.py 1970-01-01 00:00:00 +0000 |
13 | +++ account_analytic_deferred_choice/__init__.py 2012-05-21 16:22:21 +0000 |
14 | @@ -0,0 +1,23 @@ |
15 | +# -*- coding: utf-8 -*- |
16 | +############################################################################## |
17 | +# |
18 | +# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
19 | +# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
20 | +# All Rights Reserved |
21 | +# |
22 | +# This program is free software: you can redistribute it and/or modify |
23 | +# it under the terms of the GNU Affero General Public License as published |
24 | +# by the Free Software Foundation, either version 3 of the License, or |
25 | +# (at your option) any later version. |
26 | +# |
27 | +# This program is distributed in the hope that it will be useful, |
28 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
29 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
30 | +# GNU General Public License for more details. |
31 | +# |
32 | +# You should have received a copy of the GNU Affero General Public License |
33 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
34 | +# |
35 | +############################################################################## |
36 | +import invoice |
37 | +import analytic |
38 | |
39 | === added file 'account_analytic_deferred_choice/__openerp__.py' |
40 | --- account_analytic_deferred_choice/__openerp__.py 1970-01-01 00:00:00 +0000 |
41 | +++ account_analytic_deferred_choice/__openerp__.py 2012-05-21 16:22:21 +0000 |
42 | @@ -0,0 +1,42 @@ |
43 | +# -*- coding: utf-8 -*- |
44 | +############################################################################## |
45 | +# |
46 | +# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
47 | +# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
48 | +# All Rights Reserved |
49 | +# |
50 | +# This program is free software: you can redistribute it and/or modify |
51 | +# it under the terms of the GNU Affero General Public License as published |
52 | +# by the Free Software Foundation, either version 3 of the License, or |
53 | +# (at your option) any later version. |
54 | +# |
55 | +# This program is distributed in the hope that it will be useful, |
56 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
57 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
58 | +# GNU General Public License for more details. |
59 | +# |
60 | +# You should have received a copy of the GNU Affero General Public License |
61 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
62 | +# |
63 | +############################################################################## |
64 | +{ |
65 | + 'name': "Analytic Deferred Choice for Invoices", |
66 | + 'version': '0.1', |
67 | + 'category': 'Generic Modules/Accounting', |
68 | + 'description': """User can assign the invoice amount to one or more analytic accounts, subsequently (or previously) to invoice confirmation. |
69 | + 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. |
70 | + On the invoice form, another button allows to delete the previously generated analytic lines. |
71 | + Every analytic line contains a reference to the invoice line that generated it.""", |
72 | + 'author': 'Agile Business Group & Domsense', |
73 | + 'website': 'http://www.agilebg.com', |
74 | + 'license': 'AGPL-3', |
75 | + "depends" : ['account_analytic_plans'], |
76 | + "init_xml" : [], |
77 | + "update_xml" : [ |
78 | + 'account_invoice_view.xml', |
79 | + 'project_view.xml', |
80 | + ], |
81 | + "demo_xml" : [], |
82 | + "active": False, |
83 | + "installable": True |
84 | +} |
85 | |
86 | === added file 'account_analytic_deferred_choice/account_invoice_view.xml' |
87 | --- account_analytic_deferred_choice/account_invoice_view.xml 1970-01-01 00:00:00 +0000 |
88 | +++ account_analytic_deferred_choice/account_invoice_view.xml 2012-05-21 16:22:21 +0000 |
89 | @@ -0,0 +1,86 @@ |
90 | +<?xml version="1.0" encoding="utf-8"?> |
91 | +<openerp> |
92 | + <data> |
93 | + <record id="invoice_supplier_form" model="ir.ui.view"> |
94 | + <field name="name">account.invoice.supplier.form</field> |
95 | + <field name="model">account.invoice</field> |
96 | + <field name="type">form</field> |
97 | + <field name="inherit_id" ref="account.invoice_supplier_form"></field> |
98 | + <field name="arch" type="xml"> |
99 | + <field name="move_id" position="after"> |
100 | + <group colspan="2" col="4" groups="analytic.group_analytic_accounting"> |
101 | + <field name="deferred_analytics_id" domain="[('plan_id','<>',False)]"/> |
102 | + <button name="create_analytic_lines" type="object" string="Create analytic lines" groups="account.group_account_user"/> |
103 | + <button name="delete_analytic_lines" type="object" string="Delete analytic lines" groups="account.group_account_user"/> |
104 | + </group> |
105 | + </field> |
106 | + <page string="Payments" position="after"> |
107 | + <page string="Deferred analytic lines" groups="account.group_account_user"> |
108 | + <field name="deferred_line_ids" nolabel="1" colspan="4"/> |
109 | + </page> |
110 | + </page> |
111 | + </field> |
112 | + </record> |
113 | + |
114 | + <record id="invoice_form" model="ir.ui.view"> |
115 | + <field name="name">account.invoice.form</field> |
116 | + <field name="model">account.invoice</field> |
117 | + <field name="type">form</field> |
118 | + <field name="inherit_id" ref="account.invoice_form"></field> |
119 | + <field name="arch" type="xml"> |
120 | + <field name="move_id" position="after"> |
121 | + <group colspan="2" col="4" groups="analytic.group_analytic_accounting"> |
122 | + <field name="deferred_analytics_id" domain="[('plan_id','<>',False)]"/> |
123 | + <button name="create_analytic_lines" type="object" string="Create analytic lines" groups="account.group_account_user"/> |
124 | + <button name="delete_analytic_lines" type="object" string="Delete analytic lines" groups="account.group_account_user"/> |
125 | + </group> |
126 | + </field> |
127 | + <page string="Payments" position="after"> |
128 | + <page string="Deferred analytic lines" groups="account.group_account_user"> |
129 | + <field name="deferred_line_ids" nolabel="1" colspan="4"/> |
130 | + </page> |
131 | + </page> |
132 | + </field> |
133 | + </record> |
134 | + |
135 | + <record id="view_invoice_line_form" model="ir.ui.view"> |
136 | + <field name="name">account.invoice.line.form</field> |
137 | + <field name="model">account.invoice.line</field> |
138 | + <field name="type">form</field> |
139 | + <field name="inherit_id" ref="account_analytic_plans.view_invoice_line_form_inherit"></field> |
140 | + <field name="arch" type="xml"> |
141 | + <field name="analytics_id" position="after"> |
142 | + <field name="deferred_analytics_id" groups="analytic.group_analytic_accounting" domain="[('plan_id','<>',False)]"/> |
143 | + </field> |
144 | + </field> |
145 | + </record> |
146 | + |
147 | + <record id="account_move_deferred_form" model="ir.ui.view"> |
148 | + <field name="name">account.move.deferred.form</field> |
149 | + <field name="model">account.move</field> |
150 | + <field name="type">form</field> |
151 | + <field name="inherit_id" ref="account.view_move_form"></field> |
152 | + <field name="arch" type="xml"> |
153 | + <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"> |
154 | + <field name="deferred_analytics_id" groups="analytic.group_analytic_accounting" domain="[('plan_id','<>',False)]"/> |
155 | + </xpath> |
156 | + <xpath expr="/form/notebook/page[@string='Journal Items']/field[@name='line_id']/tree/field[@name='analytic_account_id']" position="after"> |
157 | + <field name="deferred_analytics_id" groups="analytic.group_analytic_accounting" domain="[('plan_id','<>',False)]"/> |
158 | + </xpath> |
159 | + <page string="Journal Items" position="after"> |
160 | + <page string="Deferred analytic lines" groups="account.group_account_user"> |
161 | + <group colspan="2" col="4" groups="analytic.group_analytic_accounting"> |
162 | + <field name="deferred_analytics_id" domain="[('plan_id','<>',False)]"/> |
163 | + <button name="create_analytic_lines" type="object" string="Create analytic lines" groups="account.group_account_user"/> |
164 | + <button name="delete_analytic_lines" type="object" string="Delete analytic lines" groups="account.group_account_user"/> |
165 | + </group> |
166 | + <newline/> |
167 | + <field name="deferred_line_ids" nolabel="1" colspan="4"/> |
168 | + </page> |
169 | + </page> |
170 | + </field> |
171 | + </record> |
172 | + |
173 | + |
174 | + </data> |
175 | +</openerp> |
176 | |
177 | === added file 'account_analytic_deferred_choice/analytic.py' |
178 | --- account_analytic_deferred_choice/analytic.py 1970-01-01 00:00:00 +0000 |
179 | +++ account_analytic_deferred_choice/analytic.py 2012-05-21 16:22:21 +0000 |
180 | @@ -0,0 +1,37 @@ |
181 | +# -*- coding: utf-8 -*- |
182 | +############################################################################## |
183 | +# |
184 | +# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
185 | +# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
186 | +# All Rights Reserved |
187 | +# |
188 | +# This program is free software: you can redistribute it and/or modify |
189 | +# it under the terms of the GNU Affero General Public License as published |
190 | +# by the Free Software Foundation, either version 3 of the License, or |
191 | +# (at your option) any later version. |
192 | +# |
193 | +# This program is distributed in the hope that it will be useful, |
194 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
195 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
196 | +# GNU General Public License for more details. |
197 | +# |
198 | +# You should have received a copy of the GNU Affero General Public License |
199 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
200 | +# |
201 | +############################################################################## |
202 | + |
203 | +from osv import fields, osv |
204 | + |
205 | +class account_analytic_line(osv.osv): |
206 | + _inherit = 'account.analytic.line' |
207 | + |
208 | + _columns = { |
209 | + 'deferred_invoice_line_id': fields.many2one('account.invoice.line', 'Invoice Line', readonly=True), |
210 | + 'deferred_invoice_id': fields.related('deferred_invoice_line_id', 'invoice_id', type="many2one", |
211 | + relation="account.invoice", string="Invoice", store=False, readonly=True), |
212 | + 'deferred_account_move_line_id': fields.many2one('account.move.line', 'Account Entry Line', readonly=True), |
213 | + 'deferred_account_move_id': fields.related('deferred_account_move_line_id', 'move_id', type="many2one", |
214 | + relation="account.move", string="Account Entry", store=False, readonly=True), |
215 | + } |
216 | + |
217 | +account_analytic_line() |
218 | |
219 | === added directory 'account_analytic_deferred_choice/i18n' |
220 | === added file 'account_analytic_deferred_choice/i18n/it.mo' |
221 | 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:21 +0000 differ |
222 | === added file 'account_analytic_deferred_choice/i18n/it.po' |
223 | --- account_analytic_deferred_choice/i18n/it.po 1970-01-01 00:00:00 +0000 |
224 | +++ account_analytic_deferred_choice/i18n/it.po 2012-05-21 16:22:21 +0000 |
225 | @@ -0,0 +1,193 @@ |
226 | +# Translation of OpenERP Server. |
227 | +# This file contains the translation of the following modules: |
228 | +# * account_analytic_deferred_choice |
229 | +# |
230 | +msgid "" |
231 | +msgstr "" |
232 | +"Project-Id-Version: OpenERP Server 6.0.4\n" |
233 | +"Report-Msgid-Bugs-To: support@openerp.com\n" |
234 | +"POT-Creation-Date: 2012-05-08 08:09+0000\n" |
235 | +"PO-Revision-Date: 2012-05-08 10:24+0100\n" |
236 | +"Last-Translator: Franco Tampieri <info@francotampieri.com>\n" |
237 | +"Language-Team: \n" |
238 | +"MIME-Version: 1.0\n" |
239 | +"Content-Type: text/plain; charset=UTF-8\n" |
240 | +"Content-Transfer-Encoding: 8bit\n" |
241 | +"Plural-Forms: \n" |
242 | + |
243 | +#. module: account_analytic_deferred_choice |
244 | +#: constraint:account.move:0 |
245 | +msgid "You cannot create entries on different periods/journals in the same move" |
246 | +msgstr "Non si possono creare scritture in sezionali differenti con una stessa registrazione." |
247 | + |
248 | +#. module: account_analytic_deferred_choice |
249 | +#: view:account.invoice:0 |
250 | +#: view:account.move:0 |
251 | +msgid "Create analytic lines" |
252 | +msgstr "Crea righe analitiche" |
253 | + |
254 | +#. module: account_analytic_deferred_choice |
255 | +#: code:addons/account_analytic_deferred_choice/invoice.py:69 |
256 | +#: code:addons/account_analytic_deferred_choice/invoice.py:148 |
257 | +#, python-format |
258 | +msgid "You have to define an analytic journal on the '%s' journal!" |
259 | +msgstr "E' necessario definite un giornale analitico per il sezionale '%s'!" |
260 | + |
261 | +#. module: account_analytic_deferred_choice |
262 | +#: code:addons/account_analytic_deferred_choice/invoice.py:63 |
263 | +#, python-format |
264 | +msgid "Analytic lines yet generated for invoice %s. Remove them first" |
265 | +msgstr "Righe analitiche già generate per la fattura %s. Rimuoverle prima di crearne altre" |
266 | + |
267 | +#. module: account_analytic_deferred_choice |
268 | +#: code:addons/account_analytic_deferred_choice/invoice.py:142 |
269 | +#, python-format |
270 | +msgid "Analytic lines yet generated for Account Entry %s. Remove them first" |
271 | +msgstr "Righe analitiche già generate per il Movimento %s. Rimuoverle prima di crearne altre" |
272 | + |
273 | +#. module: account_analytic_deferred_choice |
274 | +#: model:ir.module.module,description:account_analytic_deferred_choice.module_meta_information |
275 | +msgid "" |
276 | +"User can assign the invoice amount to one or more analytic accounts, subsequently (or previously) to invoice confirmation.\n" |
277 | +" 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" |
278 | +" On the invoice form, another button allows to delete the previously generated analytic lines.\n" |
279 | +" Every analytic line contains a reference to the invoice line that generated it." |
280 | +msgstr "" |
281 | +"User can assign the invoice amount to one or more analytic accounts, subsequently (or previously) to invoice confirmation.\n" |
282 | +" 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" |
283 | +" On the invoice form, another button allows to delete the previously generated analytic lines.\n" |
284 | +" Every analytic line contains a reference to the invoice line that generated it." |
285 | + |
286 | +#. module: account_analytic_deferred_choice |
287 | +#: model:ir.model,name:account_analytic_deferred_choice.model_account_analytic_line |
288 | +msgid "Analytic Line" |
289 | +msgstr "Linea conto analitico" |
290 | + |
291 | +#. module: account_analytic_deferred_choice |
292 | +#: constraint:account.move.line:0 |
293 | +msgid "You can not create move line on closed account." |
294 | +msgstr "Non si puo' inserire una voce per una registrazione su un conto chiuso." |
295 | + |
296 | +#. module: account_analytic_deferred_choice |
297 | +#: field:account.invoice,deferred_analytics_id:0 |
298 | +#: field:account.invoice.line,deferred_analytics_id:0 |
299 | +#: field:account.move,deferred_analytics_id:0 |
300 | +#: field:account.move.line,deferred_analytics_id:0 |
301 | +msgid "Deferred Analytic Distribution" |
302 | +msgstr "Distribuzione analitica differita" |
303 | + |
304 | +#. module: account_analytic_deferred_choice |
305 | +#: code:addons/account_analytic_deferred_choice/invoice.py:66 |
306 | +#, python-format |
307 | +msgid "Invoice %s and line %s have no Deferred Analytic Distribution" |
308 | +msgstr "La fattura %s e la riga %s non hanno una distribuzione analitica differita" |
309 | + |
310 | +#. module: account_analytic_deferred_choice |
311 | +#: model:ir.module.module,shortdesc:account_analytic_deferred_choice.module_meta_information |
312 | +msgid "Analytic Deferred Choice for Invoices" |
313 | +msgstr "Scelta analitica differita per le fatture" |
314 | + |
315 | +#. module: account_analytic_deferred_choice |
316 | +#: view:account.move:0 |
317 | +#: model:ir.model,name:account_analytic_deferred_choice.model_account_move_line |
318 | +msgid "Journal Items" |
319 | +msgstr "Voci sezionale" |
320 | + |
321 | +#. module: account_analytic_deferred_choice |
322 | +#: constraint:account.move.line:0 |
323 | +msgid "Company must be same for its related account and period." |
324 | +msgstr "L'azienda deve essere la stessa per il periodo ed il conto ad essa correlato." |
325 | + |
326 | +#. module: account_analytic_deferred_choice |
327 | +#: code:addons/account_analytic_deferred_choice/invoice.py:145 |
328 | +#, python-format |
329 | +msgid "Account Entry %s and line %s have no Deferred Analytic Distribution" |
330 | +msgstr "Il Movimento Sezionale %s e la riga %s non hanno una distribuzione analitica differita" |
331 | + |
332 | +#. module: account_analytic_deferred_choice |
333 | +#: field:account.invoice,deferred_line_ids:0 |
334 | +#: field:account.invoice.line,deferred_line_ids:0 |
335 | +#: field:account.move,deferred_line_ids:0 |
336 | +#: field:account.move.line,deferred_line_ids:0 |
337 | +msgid "Analytic Lines" |
338 | +msgstr "Righe analitiche" |
339 | + |
340 | +#. module: account_analytic_deferred_choice |
341 | +#: constraint:account.move:0 |
342 | +#: constraint:account.move.line:0 |
343 | +msgid "The date of your Journal Entry is not in the defined period!" |
344 | +msgstr "La data del Movimento Sezionale non è inclusa nel periodo definito!" |
345 | + |
346 | +#. module: account_analytic_deferred_choice |
347 | +#: field:account.analytic.line,deferred_account_move_line_id:0 |
348 | +msgid "Account Entry Line" |
349 | +msgstr "Linea Movimento Sezionale" |
350 | + |
351 | +#. module: account_analytic_deferred_choice |
352 | +#: constraint:account.move:0 |
353 | +msgid "You cannot create more than one move per period on centralized journal" |
354 | +msgstr "Non si puo' creare piu' di un movimento per periodo su un sezionale centralizzato" |
355 | + |
356 | +#. module: account_analytic_deferred_choice |
357 | +#: sql_constraint:account.move.line:0 |
358 | +msgid "Wrong credit or debit value in accounting entry !" |
359 | +msgstr "Valore di credito o debito errato nella registrazione contabile !" |
360 | + |
361 | +#. module: account_analytic_deferred_choice |
362 | +#: view:account.invoice:0 |
363 | +msgid "Payments" |
364 | +msgstr "Pagamenti" |
365 | + |
366 | +#. module: account_analytic_deferred_choice |
367 | +#: code:addons/account_analytic_deferred_choice/invoice.py:62 |
368 | +#: code:addons/account_analytic_deferred_choice/invoice.py:66 |
369 | +#: code:addons/account_analytic_deferred_choice/invoice.py:141 |
370 | +#: code:addons/account_analytic_deferred_choice/invoice.py:145 |
371 | +#, python-format |
372 | +msgid "Error" |
373 | +msgstr "Errore" |
374 | + |
375 | +#. module: account_analytic_deferred_choice |
376 | +#: view:account.invoice:0 |
377 | +#: view:account.move:0 |
378 | +msgid "Deferred analytic lines" |
379 | +msgstr "Righe analitiche differite" |
380 | + |
381 | +#. module: account_analytic_deferred_choice |
382 | +#: view:account.invoice:0 |
383 | +#: view:account.move:0 |
384 | +msgid "Delete analytic lines" |
385 | +msgstr "Rimuovi righe analitiche" |
386 | + |
387 | +#. module: account_analytic_deferred_choice |
388 | +#: view:account.analytic.line:0 |
389 | +#: field:account.analytic.line,deferred_account_move_id:0 |
390 | +#: model:ir.model,name:account_analytic_deferred_choice.model_account_move |
391 | +msgid "Account Entry" |
392 | +msgstr "Movimento Sezionale" |
393 | + |
394 | +#. module: account_analytic_deferred_choice |
395 | +#: code:addons/account_analytic_deferred_choice/invoice.py:69 |
396 | +#: code:addons/account_analytic_deferred_choice/invoice.py:148 |
397 | +#, python-format |
398 | +msgid "No Analytic Journal !" |
399 | +msgstr "Nessun giornale analitico!" |
400 | + |
401 | +#. module: account_analytic_deferred_choice |
402 | +#: field:account.analytic.line,deferred_invoice_line_id:0 |
403 | +#: model:ir.model,name:account_analytic_deferred_choice.model_account_invoice_line |
404 | +msgid "Invoice Line" |
405 | +msgstr "Riga fattura" |
406 | + |
407 | +#. module: account_analytic_deferred_choice |
408 | +#: view:account.analytic.line:0 |
409 | +#: field:account.analytic.line,deferred_invoice_id:0 |
410 | +#: model:ir.model,name:account_analytic_deferred_choice.model_account_invoice |
411 | +msgid "Invoice" |
412 | +msgstr "Fattura" |
413 | + |
414 | +#. module: account_analytic_deferred_choice |
415 | +#: constraint:account.move.line:0 |
416 | +msgid "You can not create move line on view account." |
417 | +msgstr "Non si possono inserire movimenti in un conto di tipo \"vista\"" |
418 | + |
419 | |
420 | === added file 'account_analytic_deferred_choice/invoice.py' |
421 | --- account_analytic_deferred_choice/invoice.py 1970-01-01 00:00:00 +0000 |
422 | +++ account_analytic_deferred_choice/invoice.py 2012-05-21 16:22:21 +0000 |
423 | @@ -0,0 +1,183 @@ |
424 | +# -*- coding: utf-8 -*- |
425 | +############################################################################## |
426 | +# |
427 | +# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
428 | +# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
429 | +# All Rights Reserved |
430 | +# |
431 | +# This program is free software: you can redistribute it and/or modify |
432 | +# it under the terms of the GNU Affero General Public License as published |
433 | +# by the Free Software Foundation, either version 3 of the License, or |
434 | +# (at your option) any later version. |
435 | +# |
436 | +# This program is distributed in the hope that it will be useful, |
437 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
438 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
439 | +# GNU General Public License for more details. |
440 | +# |
441 | +# You should have received a copy of the GNU Affero General Public License |
442 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
443 | +# |
444 | +############################################################################## |
445 | + |
446 | +from osv import fields, osv |
447 | +from tools.translate import _ |
448 | +from osv import orm |
449 | + |
450 | +class account_invoice(osv.osv): |
451 | + |
452 | + _inherit = 'account.invoice' |
453 | + |
454 | + def _get_deferred_analytic_lines(self, cr, uid, ids, field_name, arg, context=None): |
455 | + res={} |
456 | + for invoice in self.browse(cr, uid, ids): |
457 | + analytic_lines = [] |
458 | + for line in invoice.invoice_line: |
459 | + try: |
460 | + if line.deferred_line_ids: |
461 | + analytic_lines.extend([x.id for x in line.deferred_line_ids]) |
462 | + except orm.except_orm, e: |
463 | + if e.name != 'AccessError': |
464 | + raise e |
465 | + res[invoice.id] = analytic_lines |
466 | + return res |
467 | + |
468 | + _columns={ |
469 | + 'deferred_analytics_id': fields.many2one('account.analytic.plan.instance', 'Deferred Analytic Distribution'), |
470 | + 'deferred_line_ids': fields.function(_get_deferred_analytic_lines, type='one2many', obj='account.analytic.line', method=True, string='Analytic Lines'), |
471 | + } |
472 | + |
473 | + def delete_analytic_lines(self, cr, uid, ids, context=None): |
474 | + analytic_line_obj = self.pool.get('account.analytic.line') |
475 | + for invoice in self.browse(cr, uid, ids): |
476 | + for line in invoice.deferred_line_ids: |
477 | + line.unlink() |
478 | + return True |
479 | + |
480 | + def create_analytic_lines(self, cr, uid, ids, context=None): |
481 | + analytic_line_obj = self.pool.get('account.analytic.line') |
482 | + invoice_line_obj = self.pool.get('account.invoice.line') |
483 | + for invoice in self.browse(cr, uid, ids): |
484 | + if invoice.deferred_line_ids: |
485 | + raise osv.except_osv(_('Error'), |
486 | + _('Analytic lines yet generated for invoice %s. Remove them first') % invoice.name) |
487 | + for inv_line in invoice.invoice_line: |
488 | + if not inv_line.deferred_analytics_id and not invoice.deferred_analytics_id: |
489 | + raise osv.except_osv(_('Error'),_('Invoice %s and line %s have no Deferred Analytic Distribution') |
490 | + % (invoice.name or '', inv_line.name)) |
491 | + if not invoice.journal_id.analytic_journal_id: |
492 | + raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (invoice.journal_id.name,)) |
493 | + if inv_line.deferred_analytics_id: |
494 | + deferred_analytics_id = inv_line.deferred_analytics_id |
495 | + else: |
496 | + deferred_analytics_id = invoice.deferred_analytics_id |
497 | + for plan_line in deferred_analytics_id.account_ids: |
498 | + amount = inv_line.price_subtotal * (plan_line.rate / 100) |
499 | + if invoice.type in ('in_invoice', 'out_refund'): |
500 | + amount = - amount |
501 | + al_vals={ |
502 | + 'name': inv_line.name, |
503 | + 'account_id': plan_line.analytic_account_id.id, |
504 | + 'unit_amount': inv_line.quantity, |
505 | + 'product_id': inv_line.product_id and inv_line.product_id.id or False, |
506 | + 'product_uom_id': inv_line.uos_id and inv_line.uos_id.id or False, |
507 | + 'amount': amount, |
508 | + 'journal_id': invoice.journal_id.analytic_journal_id.id, |
509 | + 'percentage': plan_line.rate, |
510 | + 'deferred_invoice_line_id': inv_line.id, |
511 | + 'general_account_id': inv_line.account_id.id, |
512 | + } |
513 | + al_id = analytic_line_obj.create(cr, uid, al_vals, context=context) |
514 | + return True |
515 | + |
516 | +account_invoice() |
517 | + |
518 | +class account_invoice_line(osv.osv): |
519 | + |
520 | + _inherit = 'account.invoice.line' |
521 | + |
522 | + _columns={ |
523 | + # TODO is it possible to have editable? |
524 | + 'deferred_analytics_id': fields.many2one('account.analytic.plan.instance', 'Deferred Analytic Distribution'), |
525 | + 'deferred_line_ids': fields.one2many('account.analytic.line', 'deferred_invoice_line_id', 'Analytic Lines'), |
526 | + } |
527 | + |
528 | +account_invoice_line() |
529 | + |
530 | +class account_move(osv.osv): |
531 | + |
532 | + _inherit = 'account.move' |
533 | + |
534 | + def _get_deferred_analytic_lines(self, cr, uid, ids, field_name, arg, context=None): |
535 | + res={} |
536 | + for move in self.browse(cr, uid, ids): |
537 | + analytic_lines = [] |
538 | + for line in move.line_id: |
539 | + try: |
540 | + if line.deferred_line_ids: |
541 | + analytic_lines.extend([x.id for x in line.deferred_line_ids]) |
542 | + except orm.except_orm, e: |
543 | + if e.name != 'AccessError': |
544 | + raise e |
545 | + res[move.id] = analytic_lines |
546 | + return res |
547 | + |
548 | + _columns={ |
549 | + 'deferred_analytics_id': fields.many2one('account.analytic.plan.instance', 'Deferred Analytic Distribution'), |
550 | + 'deferred_line_ids': fields.function(_get_deferred_analytic_lines, type='one2many', obj='account.analytic.line', method=True, string='Analytic Lines'), |
551 | + } |
552 | + |
553 | + def delete_analytic_lines(self, cr, uid, ids, context=None): |
554 | + analytic_line_obj = self.pool.get('account.analytic.line') |
555 | + for move in self.browse(cr, uid, ids): |
556 | + for line in move.deferred_line_ids: |
557 | + line.unlink() |
558 | + return True |
559 | + |
560 | + def create_analytic_lines(self, cr, uid, ids, context=None): |
561 | + analytic_line_obj = self.pool.get('account.analytic.line') |
562 | + for move in self.browse(cr, uid, ids): |
563 | + if move.deferred_line_ids: |
564 | + raise osv.except_osv(_('Error'), |
565 | + _('Analytic lines yet generated for Account Entry %s. Remove them first') % move.name) |
566 | + for move_line in move.line_id: |
567 | + if not move_line.deferred_analytics_id and not move.deferred_analytics_id: |
568 | + continue |
569 | + if not move.journal_id.analytic_journal_id: |
570 | + raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (invoice.journal_id.name,)) |
571 | + if move_line.deferred_analytics_id: |
572 | + deferred_analytics_id = move_line.deferred_analytics_id |
573 | + else: |
574 | + deferred_analytics_id = move.deferred_analytics_id |
575 | + for plan_line in deferred_analytics_id.account_ids: |
576 | + if move_line.credit: |
577 | + amount = move_line.credit * (plan_line.rate / 100) |
578 | + if move_line.debit: |
579 | + amount = - move_line.debit * (plan_line.rate / 100) |
580 | + al_vals={ |
581 | + 'name': move_line.name, |
582 | + 'account_id': plan_line.analytic_account_id.id, |
583 | + 'unit_amount': False, |
584 | + 'product_id': False, |
585 | + 'product_uom_id': False, |
586 | + 'amount': amount, |
587 | + 'journal_id': move.journal_id.analytic_journal_id.id, |
588 | + 'percentage': plan_line.rate, |
589 | + 'deferred_account_move_line_id': move_line.id, |
590 | + 'general_account_id': move_line.account_id.id, |
591 | + } |
592 | + al_id = analytic_line_obj.create(cr, uid, al_vals, context=context) |
593 | + return True |
594 | + |
595 | +account_move() |
596 | + |
597 | +class account_move_line(osv.osv): |
598 | + |
599 | + _inherit = 'account.move.line' |
600 | + |
601 | + _columns={ |
602 | + 'deferred_analytics_id': fields.many2one('account.analytic.plan.instance', 'Deferred Analytic Distribution'), |
603 | + 'deferred_line_ids': fields.one2many('account.analytic.line', 'deferred_account_move_line_id', 'Analytic Lines'), |
604 | + } |
605 | + |
606 | +account_move_line() |
607 | \ No newline at end of file |
608 | |
609 | === added file 'account_analytic_deferred_choice/project_view.xml' |
610 | --- account_analytic_deferred_choice/project_view.xml 1970-01-01 00:00:00 +0000 |
611 | +++ account_analytic_deferred_choice/project_view.xml 2012-05-21 16:22:21 +0000 |
612 | @@ -0,0 +1,21 @@ |
613 | +<?xml version="1.0" encoding="utf-8"?> |
614 | +<openerp> |
615 | + <data> |
616 | + <record id="view_account_analytic_line_form" model="ir.ui.view"> |
617 | + <field name="name">account.analytic.line.form</field> |
618 | + <field name="model">account.analytic.line</field> |
619 | + <field name="type">form</field> |
620 | + <field name="inherit_id" ref="account.view_account_analytic_line_form"></field> |
621 | + <field name="arch" type="xml"> |
622 | + <field name="move_id" position="after"> |
623 | + <separator colspan="2" string="Invoice"/> |
624 | + <field name="deferred_invoice_id"/> |
625 | + <field name="deferred_invoice_line_id"/> |
626 | + <separator colspan="2" string="Account Entry"/> |
627 | + <field name="deferred_account_move_id"/> |
628 | + <field name="deferred_account_move_line_id"/> |
629 | + </field> |
630 | + </field> |
631 | + </record> |
632 | + </data> |
633 | +</openerp> |
634 | |
635 | === added directory 'account_analytic_distribution_menu' |
636 | === renamed directory 'account_analytic_distribution_menu' => 'account_analytic_distribution_menu.moved' |
637 | === added file 'account_analytic_distribution_menu/AUTHORS.txt' |
638 | --- account_analytic_distribution_menu/AUTHORS.txt 1970-01-01 00:00:00 +0000 |
639 | +++ account_analytic_distribution_menu/AUTHORS.txt 2012-05-21 16:22:21 +0000 |
640 | @@ -0,0 +1,2 @@ |
641 | +Leonardo Pistone <leonardo.pistone@domsense.com> |
642 | +Lorenzo Battistini <lorenzo.battistini@domsense.com> |
643 | |
644 | === added file 'account_analytic_distribution_menu/__init__.py' |
645 | --- account_analytic_distribution_menu/__init__.py 1970-01-01 00:00:00 +0000 |
646 | +++ account_analytic_distribution_menu/__init__.py 2012-05-21 16:22:21 +0000 |
647 | @@ -0,0 +1,22 @@ |
648 | +# -*- coding: utf-8 -*- |
649 | +############################################################################## |
650 | +# |
651 | +# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
652 | +# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>) |
653 | +# All Rights Reserved |
654 | +# |
655 | +# This program is free software: you can redistribute it and/or modify |
656 | +# it under the terms of the GNU Affero General Public License as published |
657 | +# by the Free Software Foundation, either version 3 of the License, or |
658 | +# (at your option) any later version. |
659 | +# |
660 | +# This program is distributed in the hope that it will be useful, |
661 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
662 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
663 | +# GNU General Public License for more details. |
664 | +# |
665 | +# You should have received a copy of the GNU Affero General Public License |
666 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
667 | +# |
668 | +############################################################################## |
669 | +import account_analytic_plans |
670 | |
671 | === added file 'account_analytic_distribution_menu/__openerp__.py' |
672 | --- account_analytic_distribution_menu/__openerp__.py 1970-01-01 00:00:00 +0000 |
673 | +++ account_analytic_distribution_menu/__openerp__.py 2012-05-21 16:22:21 +0000 |
674 | @@ -0,0 +1,43 @@ |
675 | +# -*- coding: utf-8 -*- |
676 | +############################################################################## |
677 | +# |
678 | +# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
679 | +# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>) |
680 | +# All Rights Reserved |
681 | +# |
682 | +# This program is free software: you can redistribute it and/or modify |
683 | +# it under the terms of the GNU Affero General Public License as published |
684 | +# by the Free Software Foundation, either version 3 of the License, or |
685 | +# (at your option) any later version. |
686 | +# |
687 | +# This program is distributed in the hope that it will be useful, |
688 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
689 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
690 | +# GNU General Public License for more details. |
691 | +# |
692 | +# You should have received a copy of the GNU Affero General Public License |
693 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
694 | +# |
695 | +############################################################################## |
696 | +{ |
697 | + 'name': "Account Analytic Distribution Menu", |
698 | + 'version': '0.1', |
699 | + 'category' : 'Accounting & Finance', |
700 | + 'complexity': "easy", |
701 | + 'description': """ |
702 | +Account Analytic Distribution Menu |
703 | + |
704 | +This little module adds a menuitem to see all the analytic distributions |
705 | +in the system""", |
706 | + 'author': 'Agile Business Group & Domsense', |
707 | + 'website': 'http://www.agilebg.com', |
708 | + 'license': 'AGPL-3', |
709 | + "depends" : ['account_analytic_plans'], |
710 | + "init_xml" : [], |
711 | + "update_xml" : [ |
712 | + 'account_distribution.xml', |
713 | + ], |
714 | + "demo_xml" : [], |
715 | + "active": False, |
716 | + "installable": True |
717 | +} |
718 | |
719 | === added file 'account_analytic_distribution_menu/account_analytic_plans.py' |
720 | --- account_analytic_distribution_menu/account_analytic_plans.py 1970-01-01 00:00:00 +0000 |
721 | +++ account_analytic_distribution_menu/account_analytic_plans.py 2012-05-21 16:22:21 +0000 |
722 | @@ -0,0 +1,37 @@ |
723 | +# -*- coding: utf-8 -*- |
724 | +############################################################################## |
725 | +# |
726 | +# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
727 | +# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>) |
728 | +# All Rights Reserved |
729 | +# |
730 | +# This program is free software: you can redistribute it and/or modify |
731 | +# it under the terms of the GNU Affero General Public License as published |
732 | +# by the Free Software Foundation, either version 3 of the License, or |
733 | +# (at your option) any later version. |
734 | +# |
735 | +# This program is distributed in the hope that it will be useful, |
736 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
737 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
738 | +# GNU General Public License for more details. |
739 | +# |
740 | +# You should have received a copy of the GNU Affero General Public License |
741 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
742 | +# |
743 | +############################################################################## |
744 | + |
745 | +from osv import fields, osv |
746 | + |
747 | +class account_analytic_plan_instance(osv.osv): |
748 | + |
749 | + _inherit = "account.analytic.plan.instance" |
750 | + |
751 | + def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): |
752 | + if context is None: |
753 | + context = {} |
754 | + this = self.browse(cr, uid, ids[0], context=context) |
755 | + if this.plan_id and not vals.has_key('plan_id'): |
756 | + vals['plan_id'] = this.plan_id.id |
757 | + return super(account_analytic_plan_instance, self).write(cr, uid, ids, vals, context=context) |
758 | + |
759 | +account_analytic_plan_instance() |
760 | |
761 | === added file 'account_analytic_distribution_menu/account_distribution.xml' |
762 | --- account_analytic_distribution_menu/account_distribution.xml 1970-01-01 00:00:00 +0000 |
763 | +++ account_analytic_distribution_menu/account_distribution.xml 2012-05-21 16:22:21 +0000 |
764 | @@ -0,0 +1,50 @@ |
765 | +<?xml version="1.0"?> |
766 | +<openerp> |
767 | +<data> |
768 | + |
769 | + <record model="ir.ui.view" id="account_analytic_plan_instance_form"> |
770 | + <field name="name">account.analytic.plan.instance.form</field> |
771 | + <field name="model">account.analytic.plan.instance</field> |
772 | + <field name="type">form</field> |
773 | + <field name="inherit_id" ref="account_analytic_plans.account_analytic_plan_instance_form"></field> |
774 | + <field name="arch" type="xml"> |
775 | + <field name="account_ids" nolabel="1" colspan="4" position="replace"> |
776 | + <field name="account_ids" nolabel="1" colspan="4" /> |
777 | + </field> |
778 | + </field> |
779 | + </record> |
780 | + |
781 | + <record model="ir.ui.view" id="account_analytic_plan_instance_line_form"> |
782 | + <field name="name">account.analytic.plan.instance.line.form</field> |
783 | + <field name="model">account.analytic.plan.instance.line</field> |
784 | + <field name="type">form</field> |
785 | + <field name="inherit_id" ref="account_analytic_plans.account_analytic_plan_instance_line_form"></field> |
786 | + <field name="arch" type="xml"> |
787 | + <field name="plan_id" position="replace"/> |
788 | + </field> |
789 | + </record> |
790 | + |
791 | + <record model="ir.ui.view" id="account_analytic_plan_instance_line_tree"> |
792 | + <field name="name">account.analytic.plan.instance.line.tree</field> |
793 | + <field name="model">account.analytic.plan.instance.line</field> |
794 | + <field name="inherit_id" ref="account_analytic_plans.account_analytic_plan_instance_line_tree"></field> |
795 | + <field name="type">tree</field> |
796 | + <field name="arch" type="xml"> |
797 | + <field name="plan_id" position="replace"/> |
798 | + </field> |
799 | + </record> |
800 | + |
801 | + <record model="ir.actions.act_window" id="account_analytic_plan_instance_action"> |
802 | + <field name="name">Analytic Distribution's Models</field> |
803 | + <field name="type">ir.actions.act_window</field> |
804 | + <field name="res_model">account.analytic.plan.instance</field> |
805 | + <field name="view_type">form</field> |
806 | + <field name="view_mode">tree,form</field> |
807 | + </record> |
808 | + |
809 | + <menuitem |
810 | + parent="account_analytic_plans.menu_account_analytic_multi_plan_action" |
811 | + id="menu_account_analytic_plan_instance" |
812 | + action="account_analytic_plan_instance_action"/> |
813 | +</data> |
814 | +</openerp> |
815 | |
816 | === modified file 'account_invoice_template/account_invoice_template.py' |
817 | === modified file 'account_move_template/__openerp__.py' |
818 | --- account_move_template/__openerp__.py 2012-02-18 10:13:35 +0000 |
819 | +++ account_move_template/__openerp__.py 2012-05-21 16:22:21 +0000 |
820 | @@ -33,7 +33,11 @@ |
821 | 'author': 'Agile Business Group & Domsense', |
822 | 'website': 'http://www.agilebg.com', |
823 | 'license': 'AGPL-3', |
824 | +<<<<<<< TREE |
825 | "depends" : ['account_accountant', 'analytic'], |
826 | +======= |
827 | + "depends" : ['account_accountant'], |
828 | +>>>>>>> MERGE-SOURCE |
829 | "init_xml" : [], |
830 | "update_xml" : [ |
831 | 'move_template.xml', |
832 | |
833 | === modified file 'account_move_template/wizard/select_template.py' |
834 | --- account_move_template/wizard/select_template.py 2012-03-25 09:53:44 +0000 |
835 | +++ account_move_template/wizard/select_template.py 2012-05-21 16:22:21 +0000 |
836 | @@ -28,7 +28,12 @@ |
837 | |
838 | _name = "wizard.select.move.template" |
839 | _columns = { |
840 | +<<<<<<< TREE |
841 | 'template_id': fields.many2one('account.move.template', 'Move Template', required=True),'partner_id': fields.many2one('res.partner', 'Partner'), |
842 | +======= |
843 | + 'template_id': fields.many2one('account.move.template', 'Move Template', required=True), |
844 | + 'partner_id': fields.many2one('res.partner', 'Partner'), |
845 | +>>>>>>> MERGE-SOURCE |
846 | 'line_ids': fields.one2many('wizard.select.move.template.line', 'template_id', 'Lines'), |
847 | 'state': fields.selection([ |
848 | ('template_selected','Template selected'), |
849 | @@ -75,11 +80,14 @@ |
850 | template_obj = self.pool.get('account.move.template') |
851 | template_line_obj = self.pool.get('account.move.template.line') |
852 | account_period_obj = self.pool.get('account.period') |
853 | - |
854 | - |
855 | mod_obj = self.pool.get('ir.model.data') |
856 | wizard = self.browse(cr, uid, ids, context=context)[0] |
857 | +<<<<<<< TREE |
858 | if not template_obj.check_zero_lines(cr, uid, wizard): |
859 | +======= |
860 | + partner_id=wizard.partner_id.id |
861 | + if not self.check_zero_lines(cr, uid, wizard): |
862 | +>>>>>>> MERGE-SOURCE |
863 | raise osv.except_osv(_('Error !'), _('At least one amount has to be non-zero!')) |
864 | input_lines = {} |
865 | |
866 | @@ -96,15 +104,27 @@ |
867 | moves={} |
868 | for line in wizard.template_id.template_line_ids: |
869 | if line.journal_id.id not in moves: |
870 | +<<<<<<< TREE |
871 | moves[line.journal_id.id]=self._make_move( |
872 | cr,uid,wizard.template_id.name,period_id,line.journal_id.id, wizard.partner_id.id) |
873 | +======= |
874 | + moves[line.journal_id.id]=self._make_move(cr,uid,wizard.template_id.name,period_id,line.journal_id.id,partner_id) |
875 | +>>>>>>> MERGE-SOURCE |
876 | |
877 | +<<<<<<< TREE |
878 | id_line=self._make_move_line(cr,uid,line,computed_lines,moves[line.journal_id.id],period_id, |
879 | wizard.partner_id.id) |
880 | +======= |
881 | + id_line=self._make_move_line(cr,uid,line,computed_lines,moves[line.journal_id.id],period_id,partner_id) |
882 | +>>>>>>> MERGE-SOURCE |
883 | if wizard.template_id.cross_journals : |
884 | trans_account_id=wizard.template_id.transitory_acc_id.id |
885 | +<<<<<<< TREE |
886 | id_trans_line=self._make_transitory_move_line(cr,uid,line,computed_lines, |
887 | moves[line.journal_id.id],period_id,trans_account_id, wizard.partner_id.id) |
888 | +======= |
889 | + id_trans_line=self._make_transitory_move_line(cr,uid,line,computed_lines,moves[line.journal_id.id],period_id,trans_account_id,partner_id) |
890 | +>>>>>>> MERGE-SOURCE |
891 | |
892 | return { |
893 | 'domain': "[('id','in', "+str(moves.values())+")]", |
894 | @@ -116,7 +136,11 @@ |
895 | 'target': 'current', |
896 | } |
897 | #'res_id': moves.values() or False, |
898 | +<<<<<<< TREE |
899 | def _make_move(self, cr, uid,ref,period_id,journal_id, partner_id): |
900 | +======= |
901 | + def _make_move(self, cr, uid,ref,period_id,journal_id,partner_id): |
902 | +>>>>>>> MERGE-SOURCE |
903 | account_move_obj = self.pool.get('account.move') |
904 | move_id = account_move_obj.create(cr, uid, { |
905 | 'ref': ref, |
906 | @@ -126,7 +150,11 @@ |
907 | }) |
908 | return move_id |
909 | |
910 | +<<<<<<< TREE |
911 | def _make_move_line(self,cr,uid,line,computed_lines,move_id,period_id, partner_id): |
912 | +======= |
913 | + def _make_move_line(self,cr,uid,line,computed_lines,move_id,period_id,partner_id): |
914 | +>>>>>>> MERGE-SOURCE |
915 | account_move_line_obj = self.pool.get('account.move.line') |
916 | analytic_account_id = False |
917 | if line.analytic_account_id: |
918 | @@ -153,8 +181,12 @@ |
919 | id_line = account_move_line_obj.create(cr, uid, val) |
920 | return id_line |
921 | |
922 | +<<<<<<< TREE |
923 | def _make_transitory_move_line( |
924 | self,cr,uid,line,computed_lines,move_id,period_id,trans_account_id, partner_id): |
925 | +======= |
926 | + def _make_transitory_move_line(self,cr,uid,line,computed_lines,move_id,period_id,trans_account_id,partner_id): |
927 | +>>>>>>> MERGE-SOURCE |
928 | account_move_line_obj = self.pool.get('account.move.line') |
929 | analytic_account_id = False |
930 | if line.analytic_account_id: |
931 | |
932 | === modified file 'account_move_template/wizard/select_template.xml' |
933 | --- account_move_template/wizard/select_template.xml 2012-03-25 09:53:44 +0000 |
934 | +++ account_move_template/wizard/select_template.xml 2012-05-21 16:22:21 +0000 |
935 | @@ -8,6 +8,7 @@ |
936 | <field name="type">form</field> |
937 | <field name="arch" type="xml"> |
938 | <form string="Move Template" > |
939 | +<<<<<<< TREE |
940 | <group col="2" width="600" height="500"> |
941 | <field name="template_id" attrs="{'invisible':[('state','=','template_selected')]}"/> |
942 | <field name="partner_id" attrs="{'invisible':[('state','=','template_selected')]}"/> |
943 | @@ -18,6 +19,14 @@ |
944 | <newline/> |
945 | <button icon="gtk-cancel" special="cancel" string="Cancel" /> |
946 | <field name="state" invisible="1"/> |
947 | +======= |
948 | + <group col="2"> |
949 | + <field name="template_id" on_change="on_change_template_id(template_id)"/> |
950 | + <field name="partner_id"/> |
951 | + <field name="line_ids" colspan="2" nolabel="1" width="600" height="500"/> |
952 | + <button icon="gtk-cancel" special="cancel" string="Cancel"/> |
953 | + <button icon="gtk-ok" name="load_template" string="Load" type="object"/> |
954 | +>>>>>>> MERGE-SOURCE |
955 | </group> |
956 | </form> |
957 | </field> |
958 | |
959 | === added directory 'analytic_move' |
960 | === renamed directory 'analytic_move' => 'analytic_move.moved' |
961 | === added file 'analytic_move/AUTHORS.txt' |
962 | --- analytic_move/AUTHORS.txt 1970-01-01 00:00:00 +0000 |
963 | +++ analytic_move/AUTHORS.txt 2012-05-21 16:22:21 +0000 |
964 | @@ -0,0 +1,1 @@ |
965 | +Lorenzo Battistini <lorenzo.battistini@agilebg.com> |
966 | |
967 | === added file 'analytic_move/__init__.py' |
968 | --- analytic_move/__init__.py 1970-01-01 00:00:00 +0000 |
969 | +++ analytic_move/__init__.py 2012-05-21 16:22:21 +0000 |
970 | @@ -0,0 +1,22 @@ |
971 | +# -*- coding: utf-8 -*- |
972 | +############################################################################## |
973 | +# |
974 | +# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
975 | +# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
976 | +# All Rights Reserved |
977 | +# |
978 | +# This program is free software: you can redistribute it and/or modify |
979 | +# it under the terms of the GNU Affero General Public License as published |
980 | +# by the Free Software Foundation, either version 3 of the License, or |
981 | +# (at your option) any later version. |
982 | +# |
983 | +# This program is distributed in the hope that it will be useful, |
984 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
985 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
986 | +# GNU General Public License for more details. |
987 | +# |
988 | +# You should have received a copy of the GNU Affero General Public License |
989 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
990 | +# |
991 | +############################################################################## |
992 | +import analytic |
993 | |
994 | === added file 'analytic_move/__openerp__.py' |
995 | --- analytic_move/__openerp__.py 1970-01-01 00:00:00 +0000 |
996 | +++ analytic_move/__openerp__.py 2012-05-21 16:22:21 +0000 |
997 | @@ -0,0 +1,40 @@ |
998 | +# -*- coding: utf-8 -*- |
999 | +############################################################################## |
1000 | +# |
1001 | +# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
1002 | +# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
1003 | +# All Rights Reserved |
1004 | +# |
1005 | +# This program is free software: you can redistribute it and/or modify |
1006 | +# it under the terms of the GNU Affero General Public License as published |
1007 | +# by the Free Software Foundation, either version 3 of the License, or |
1008 | +# (at your option) any later version. |
1009 | +# |
1010 | +# This program is distributed in the hope that it will be useful, |
1011 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1012 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1013 | +# GNU General Public License for more details. |
1014 | +# |
1015 | +# You should have received a copy of the GNU Affero General Public License |
1016 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1017 | +# |
1018 | +############################################################################## |
1019 | +{ |
1020 | + 'name': "Analytic Move", |
1021 | + 'version': '0.1', |
1022 | + 'category': 'Generic Modules/Accounting', |
1023 | + 'description': """When user manually creates analytic lines, he is now able to track source and destination of the amounts. That is, if user moves amounts from an account to another, he can see where those amounts come from. |
1024 | + This is achieved by the 'analytic move' object, that allows to group analytic lines.""", |
1025 | + 'author': 'Agile Business Group & Domsense', |
1026 | + 'website': 'http://www.agilebg.com', |
1027 | + 'license': 'AGPL-3', |
1028 | + "depends" : ['analytic', 'account'], |
1029 | + "init_xml" : [], |
1030 | + "update_xml" : [ |
1031 | + 'analytic_view.xml', |
1032 | + 'security/ir.model.access.csv', |
1033 | + ], |
1034 | + "demo_xml" : [], |
1035 | + "active": False, |
1036 | + "installable": True |
1037 | +} |
1038 | |
1039 | === added file 'analytic_move/analytic.py' |
1040 | --- analytic_move/analytic.py 1970-01-01 00:00:00 +0000 |
1041 | +++ analytic_move/analytic.py 2012-05-21 16:22:21 +0000 |
1042 | @@ -0,0 +1,40 @@ |
1043 | +# -*- coding: utf-8 -*- |
1044 | +############################################################################## |
1045 | +# |
1046 | +# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
1047 | +# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
1048 | +# All Rights Reserved |
1049 | +# |
1050 | +# This program is free software: you can redistribute it and/or modify |
1051 | +# it under the terms of the GNU Affero General Public License as published |
1052 | +# by the Free Software Foundation, either version 3 of the License, or |
1053 | +# (at your option) any later version. |
1054 | +# |
1055 | +# This program is distributed in the hope that it will be useful, |
1056 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1057 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1058 | +# GNU General Public License for more details. |
1059 | +# |
1060 | +# You should have received a copy of the GNU Affero General Public License |
1061 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1062 | +# |
1063 | +############################################################################## |
1064 | + |
1065 | +from osv import fields, osv |
1066 | + |
1067 | +class account_analytic_move(osv.osv): |
1068 | + _name = 'account.analytic.move' |
1069 | + _description = 'Analytic Move' |
1070 | + |
1071 | + _columns = { |
1072 | + 'name': fields.char('Name', size=64, required=True), |
1073 | + 'line_ids': fields.one2many('account.analytic.line', 'analytic_move_id', 'Analytic Lines'), |
1074 | + } |
1075 | +account_analytic_move() |
1076 | + |
1077 | +class account_analytic_line(osv.osv): |
1078 | + _inherit = 'account.analytic.line' |
1079 | + _columns = { |
1080 | + 'analytic_move_id': fields.many2one('account.analytic.move', 'Analytic Move'), |
1081 | + } |
1082 | +account_analytic_line() |
1083 | |
1084 | === added file 'analytic_move/analytic_view.xml' |
1085 | --- analytic_move/analytic_view.xml 1970-01-01 00:00:00 +0000 |
1086 | +++ analytic_move/analytic_view.xml 2012-05-21 16:22:21 +0000 |
1087 | @@ -0,0 +1,86 @@ |
1088 | +<?xml version="1.0" encoding="utf-8"?> |
1089 | +<openerp> |
1090 | + <data> |
1091 | + <record id="view_account_analytic_line_form" model="ir.ui.view"> |
1092 | + <field name="name">account.analytic.line.form</field> |
1093 | + <field name="model">account.analytic.line</field> |
1094 | + <field name="type">form</field> |
1095 | + <field name="inherit_id" ref="account.view_account_analytic_line_form"></field> |
1096 | + <field name="arch" type="xml"> |
1097 | + <field name="company_id" position="after"> |
1098 | + <field name="analytic_move_id"/> |
1099 | + </field> |
1100 | + </field> |
1101 | + </record> |
1102 | + <record id="view_account_analytic_line_tree" model="ir.ui.view"> |
1103 | + <field name="name">account.analytic.line.tree</field> |
1104 | + <field name="model">account.analytic.line</field> |
1105 | + <field name="type">tree</field> |
1106 | + <field name="inherit_id" ref="account.view_account_analytic_line_tree"></field> |
1107 | + <field name="arch" type="xml"> |
1108 | + <field name="user_id" position="after"> |
1109 | + <field name="analytic_move_id"/> |
1110 | + </field> |
1111 | + </field> |
1112 | + </record> |
1113 | + |
1114 | + <record id="view_account_analytic_move_form" model="ir.ui.view"> |
1115 | + <field name="name">account.analytic.move.form</field> |
1116 | + <field name="model">account.analytic.move</field> |
1117 | + <field name="type">form</field> |
1118 | + <field name="arch" type="xml"> |
1119 | + <form string="Analytic Move"> |
1120 | + <field name="name"/> |
1121 | + <newline/> |
1122 | + <field name="line_ids" nolabel="1" colspan="4"> |
1123 | + <tree string="Analytic Entries"> |
1124 | + <field name="date"/> |
1125 | + <field name="name"/> |
1126 | + <field name="journal_id"/> |
1127 | + <field name="amount" sum="Total"/> |
1128 | + <field name="account_id"/> |
1129 | + </tree> |
1130 | + <form string="Analytic Entry"> |
1131 | + <group colspan="4" col="6"> |
1132 | + <field name="name"/> |
1133 | + <field name="ref"/> |
1134 | + <field name="account_id"/> |
1135 | + <field name="journal_id"/> |
1136 | + <field name="date"/> |
1137 | + <field name="company_id" groups="base.group_multi_company"/> |
1138 | + </group> |
1139 | + <group colspan="2" col="4"> |
1140 | + <separator string="Amount" colspan="4"/> |
1141 | + <field name="amount" colspan="4"/> |
1142 | + <field name="amount_currency" colspan="2"/> |
1143 | + <field name="currency_id" colspan="2" nolabel="1"/> |
1144 | + </group> |
1145 | + </form> |
1146 | + </field> |
1147 | + </form> |
1148 | + </field> |
1149 | + </record> |
1150 | + |
1151 | + <record id="view_account_analytic_move_search" model="ir.ui.view"> |
1152 | + <field name="name">account.analytic.move.search</field> |
1153 | + <field name="model">account.analytic.move</field> |
1154 | + <field name="type">search</field> |
1155 | + <field name="arch" type="xml"> |
1156 | + <search string="Analytic Moves"> |
1157 | + <field name="name"/> |
1158 | + </search> |
1159 | + </field> |
1160 | + </record> |
1161 | + |
1162 | + <record id="action_account_analytic_journal_open_form" model="ir.actions.act_window"> |
1163 | + <field name="name">Analytic Journal Entries</field> |
1164 | + <field name="res_model">account.analytic.move</field> |
1165 | + <field name="view_type">form</field> |
1166 | + <field name="view_mode">tree,form</field> |
1167 | + </record> |
1168 | + <menuitem groups="analytic.group_analytic_accounting" |
1169 | + action="action_account_analytic_journal_open_form" |
1170 | + id="account_analytic_journal_entries" |
1171 | + parent="account.menu_finance_entries"/> |
1172 | + </data> |
1173 | +</openerp> |
1174 | |
1175 | === added directory 'analytic_move/i18n' |
1176 | === added file 'analytic_move/i18n/it.po' |
1177 | --- analytic_move/i18n/it.po 1970-01-01 00:00:00 +0000 |
1178 | +++ analytic_move/i18n/it.po 2012-05-21 16:22:21 +0000 |
1179 | @@ -0,0 +1,70 @@ |
1180 | +# Translation of OpenERP Server. |
1181 | +# This file contains the translation of the following modules: |
1182 | +# * analytic_move |
1183 | +# |
1184 | +msgid "" |
1185 | +msgstr "" |
1186 | +"Project-Id-Version: OpenERP Server 6.0.3\n" |
1187 | +"Report-Msgid-Bugs-To: support@openerp.com\n" |
1188 | +"POT-Creation-Date: 2011-12-09 10:28+0000\n" |
1189 | +"PO-Revision-Date: 2011-12-09 11:37+0100\n" |
1190 | +"Last-Translator: Lorenzo Battistini <lorenzo.battistini@agilebg.com>\n" |
1191 | +"Language-Team: \n" |
1192 | +"MIME-Version: 1.0\n" |
1193 | +"Content-Type: text/plain; charset=UTF-8\n" |
1194 | +"Content-Transfer-Encoding: 8bit\n" |
1195 | +"Plural-Forms: \n" |
1196 | + |
1197 | +#. module: analytic_move |
1198 | +#: view:account.analytic.move:0 |
1199 | +msgid "Total" |
1200 | +msgstr "Totale" |
1201 | + |
1202 | +#. module: analytic_move |
1203 | +#: model:ir.model,name:analytic_move.model_account_analytic_line |
1204 | +msgid "Analytic Line" |
1205 | +msgstr "Voce conto analitico" |
1206 | + |
1207 | +#. module: analytic_move |
1208 | +#: field:account.analytic.move,name:0 |
1209 | +msgid "Name" |
1210 | +msgstr "Nome" |
1211 | + |
1212 | +#. module: analytic_move |
1213 | +#: field:account.analytic.move,line_ids:0 |
1214 | +msgid "Analytic Lines" |
1215 | +msgstr "Righe analitiche" |
1216 | + |
1217 | +#. module: analytic_move |
1218 | +#: model:ir.actions.act_window,name:analytic_move.action_account_analytic_journal_open_form |
1219 | +#: model:ir.ui.menu,name:analytic_move.account_analytic_journal_entries |
1220 | +msgid "Analytic Journal Entries" |
1221 | +msgstr "Registrazioni analitiche" |
1222 | + |
1223 | +#. module: analytic_move |
1224 | +#: field:account.analytic.line,analytic_move_id:0 |
1225 | +#: view:account.analytic.move:0 |
1226 | +#: model:ir.model,name:analytic_move.model_account_analytic_move |
1227 | +msgid "Analytic Move" |
1228 | +msgstr "Movimento analitico" |
1229 | + |
1230 | +#. module: analytic_move |
1231 | +#: view:account.analytic.move:0 |
1232 | +msgid "Analytic Moves" |
1233 | +msgstr "Movimenti analitici" |
1234 | + |
1235 | +#. module: analytic_move |
1236 | +#: view:account.analytic.move:0 |
1237 | +msgid "Amount" |
1238 | +msgstr "Importo" |
1239 | + |
1240 | +#. module: analytic_move |
1241 | +#: view:account.analytic.move:0 |
1242 | +msgid "Analytic Entry" |
1243 | +msgstr "Registrazione analitica" |
1244 | + |
1245 | +#. module: analytic_move |
1246 | +#: view:account.analytic.move:0 |
1247 | +msgid "Analytic Entries" |
1248 | +msgstr "Registrazioni analitiche" |
1249 | + |
1250 | |
1251 | === added directory 'analytic_move/security' |
1252 | === added file 'analytic_move/security/ir.model.access.csv' |
1253 | --- analytic_move/security/ir.model.access.csv 1970-01-01 00:00:00 +0000 |
1254 | +++ analytic_move/security/ir.model.access.csv 2012-05-21 16:22:21 +0000 |
1255 | @@ -0,0 +1,2 @@ |
1256 | +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
1257 | +group_analytic_accounting,group_analytic_accounting,model_account_analytic_move,analytic.group_analytic_accounting,1,1,1,1 |
1258 | |
1259 | === added directory 'hr_expense_analytic_deferred_choice' |
1260 | === renamed directory 'hr_expense_analytic_deferred_choice' => 'hr_expense_analytic_deferred_choice.moved' |
1261 | === added file 'hr_expense_analytic_deferred_choice/AUTHORS.txt' |
1262 | --- hr_expense_analytic_deferred_choice/AUTHORS.txt 1970-01-01 00:00:00 +0000 |
1263 | +++ hr_expense_analytic_deferred_choice/AUTHORS.txt 2012-05-21 16:22:21 +0000 |
1264 | @@ -0,0 +1,1 @@ |
1265 | +Lorenzo Battistini <lorenzo.battistini@agilebg.com> |
1266 | |
1267 | === added file 'hr_expense_analytic_deferred_choice/__init__.py' |
1268 | --- hr_expense_analytic_deferred_choice/__init__.py 1970-01-01 00:00:00 +0000 |
1269 | +++ hr_expense_analytic_deferred_choice/__init__.py 2012-05-21 16:22:21 +0000 |
1270 | @@ -0,0 +1,23 @@ |
1271 | +# -*- coding: utf-8 -*- |
1272 | +############################################################################## |
1273 | +# |
1274 | +# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
1275 | +# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
1276 | +# All Rights Reserved |
1277 | +# |
1278 | +# This program is free software: you can redistribute it and/or modify |
1279 | +# it under the terms of the GNU Affero General Public License as published |
1280 | +# by the Free Software Foundation, either version 3 of the License, or |
1281 | +# (at your option) any later version. |
1282 | +# |
1283 | +# This program is distributed in the hope that it will be useful, |
1284 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1285 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1286 | +# GNU General Public License for more details. |
1287 | +# |
1288 | +# You should have received a copy of the GNU Affero General Public License |
1289 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1290 | +# |
1291 | +############################################################################## |
1292 | +import hr_expense |
1293 | +import analytic |
1294 | |
1295 | === added file 'hr_expense_analytic_deferred_choice/__openerp__.py' |
1296 | --- hr_expense_analytic_deferred_choice/__openerp__.py 1970-01-01 00:00:00 +0000 |
1297 | +++ hr_expense_analytic_deferred_choice/__openerp__.py 2012-05-21 16:22:21 +0000 |
1298 | @@ -0,0 +1,42 @@ |
1299 | +# -*- coding: utf-8 -*- |
1300 | +############################################################################## |
1301 | +# |
1302 | +# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
1303 | +# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
1304 | +# All Rights Reserved |
1305 | +# |
1306 | +# This program is free software: you can redistribute it and/or modify |
1307 | +# it under the terms of the GNU Affero General Public License as published |
1308 | +# by the Free Software Foundation, either version 3 of the License, or |
1309 | +# (at your option) any later version. |
1310 | +# |
1311 | +# This program is distributed in the hope that it will be useful, |
1312 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1313 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1314 | +# GNU General Public License for more details. |
1315 | +# |
1316 | +# You should have received a copy of the GNU Affero General Public License |
1317 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1318 | +# |
1319 | +############################################################################## |
1320 | +{ |
1321 | + 'name': "Analytic Deferred Choice for Expenses", |
1322 | + 'version': '0.1', |
1323 | + 'category': 'Generic Modules/Human Resources', |
1324 | + 'description': """User can assign the expense amount to one or more analytic accounts, subsequently (or previously) to expense confirmation. |
1325 | + The expense has a new field, containing the analytic plan to be used. The related button generates tha analytic lines, related to the expense. The expense lines have new fields too, containing the analytic plan. If the line's field is not filled, the expense's one is used. |
1326 | + On the expense form, another button allows to delete the previously generated analytic lines. |
1327 | + Every analytic line contains a reference to the expense line that generated it.""", |
1328 | + 'author': 'Agile Business Group & Domsense', |
1329 | + 'website': 'http://www.agilebg.com', |
1330 | + 'license': 'AGPL-3', |
1331 | + "depends" : ['account_analytic_plans', 'hr_analytic_plans'], |
1332 | + "init_xml" : [], |
1333 | + "update_xml" : [ |
1334 | + 'hr_expense_view.xml', |
1335 | + 'project_view.xml', |
1336 | + ], |
1337 | + "demo_xml" : [], |
1338 | + "active": False, |
1339 | + "installable": True |
1340 | +} |
1341 | |
1342 | === added file 'hr_expense_analytic_deferred_choice/analytic.py' |
1343 | --- hr_expense_analytic_deferred_choice/analytic.py 1970-01-01 00:00:00 +0000 |
1344 | +++ hr_expense_analytic_deferred_choice/analytic.py 2012-05-21 16:22:21 +0000 |
1345 | @@ -0,0 +1,34 @@ |
1346 | +# -*- coding: utf-8 -*- |
1347 | +############################################################################## |
1348 | +# |
1349 | +# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
1350 | +# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
1351 | +# All Rights Reserved |
1352 | +# |
1353 | +# This program is free software: you can redistribute it and/or modify |
1354 | +# it under the terms of the GNU Affero General Public License as published |
1355 | +# by the Free Software Foundation, either version 3 of the License, or |
1356 | +# (at your option) any later version. |
1357 | +# |
1358 | +# This program is distributed in the hope that it will be useful, |
1359 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1360 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1361 | +# GNU General Public License for more details. |
1362 | +# |
1363 | +# You should have received a copy of the GNU Affero General Public License |
1364 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1365 | +# |
1366 | +############################################################################## |
1367 | + |
1368 | +from osv import fields, osv |
1369 | + |
1370 | +class account_analytic_line(osv.osv): |
1371 | + _inherit = 'account.analytic.line' |
1372 | + |
1373 | + _columns = { |
1374 | + 'deferred_expense_line_id': fields.many2one('hr.expense.line', 'Expense Line', readonly=True), |
1375 | + 'deferred_expense_id': fields.related('deferred_expense_line_id', 'expense_id', type="many2one", |
1376 | + relation="hr.expense.expense", string="Expense", store=False, readonly=True), |
1377 | + } |
1378 | + |
1379 | +account_analytic_line() |
1380 | |
1381 | === added file 'hr_expense_analytic_deferred_choice/hr_expense.py' |
1382 | --- hr_expense_analytic_deferred_choice/hr_expense.py 1970-01-01 00:00:00 +0000 |
1383 | +++ hr_expense_analytic_deferred_choice/hr_expense.py 2012-05-21 16:22:21 +0000 |
1384 | @@ -0,0 +1,116 @@ |
1385 | +# -*- coding: utf-8 -*- |
1386 | +############################################################################## |
1387 | +# |
1388 | +# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
1389 | +# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
1390 | +# All Rights Reserved |
1391 | +# |
1392 | +# This program is free software: you can redistribute it and/or modify |
1393 | +# it under the terms of the GNU Affero General Public License as published |
1394 | +# by the Free Software Foundation, either version 3 of the License, or |
1395 | +# (at your option) any later version. |
1396 | +# |
1397 | +# This program is distributed in the hope that it will be useful, |
1398 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1399 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1400 | +# GNU General Public License for more details. |
1401 | +# |
1402 | +# You should have received a copy of the GNU Affero General Public License |
1403 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1404 | +# |
1405 | +############################################################################## |
1406 | + |
1407 | +from osv import fields, osv |
1408 | +from tools.translate import _ |
1409 | +from osv import orm |
1410 | + |
1411 | +class hr_expense(osv.osv): |
1412 | + |
1413 | + _inherit = 'hr.expense.expense' |
1414 | + |
1415 | + def _get_deferred_analytic_lines(self, cr, uid, ids, field_name, arg, context=None): |
1416 | + res={} |
1417 | + for expense in self.browse(cr, uid, ids): |
1418 | + analytic_lines = [] |
1419 | + for line in expense.line_ids: |
1420 | + try: |
1421 | + if line.deferred_line_ids: |
1422 | + analytic_lines.extend([x.id for x in line.deferred_line_ids]) |
1423 | + except orm.except_orm, e: |
1424 | + if e.name != 'AccessError': |
1425 | + raise e |
1426 | + res[expense.id] = analytic_lines |
1427 | + return res |
1428 | + |
1429 | + _columns={ |
1430 | + 'deferred_analytics_id': fields.many2one('account.analytic.plan.instance', 'Deferred Analytic Distribution'), |
1431 | + 'deferred_line_ids': fields.function(_get_deferred_analytic_lines, type='one2many', |
1432 | + obj='account.analytic.line', method=True, string='Analytic Lines'), |
1433 | + } |
1434 | + |
1435 | + def delete_analytic_lines(self, cr, uid, ids, context=None): |
1436 | + analytic_line_obj = self.pool.get('account.analytic.line') |
1437 | + for expense in self.browse(cr, uid, ids): |
1438 | + for line in expense.deferred_line_ids: |
1439 | + line.unlink() |
1440 | + return True |
1441 | + |
1442 | + def create_analytic_lines(self, cr, uid, ids, context=None): |
1443 | + analytic_line_obj = self.pool.get('account.analytic.line') |
1444 | + journal_obj = self.pool.get('account.journal') |
1445 | + expense_line_obj = self.pool.get('hr.expense.line') |
1446 | + for expense in self.browse(cr, uid, ids): |
1447 | + journal_ids = journal_obj.search(cr, uid, [ |
1448 | + ('type', '=','purchase'),('company_id', '=', expense.company_id.id)], limit=1) |
1449 | + if not journal_ids: |
1450 | + raise osv.except_osv(_('Error !'), |
1451 | + _('There is no purchase journal defined for this company: "%s" (id:%d)') |
1452 | + % (expense.company_id.name, expensecompany_id.id)) |
1453 | + journal = journal_obj.browse(cr, uid, journal_ids[0]) |
1454 | + if not journal.analytic_journal_id: |
1455 | + raise osv.except_osv(_('No Analytic Journal !'), |
1456 | + _("You have to define an analytic journal on the '%s' journal!") % (journal.name)) |
1457 | + if not journal.default_debit_account_id: |
1458 | + raise osv.except_osv(_('No Debit Account !'), |
1459 | + _("You have to define a default debit account on the '%s' journal!") % (journal.name)) |
1460 | + if expense.deferred_line_ids: |
1461 | + raise osv.except_osv(_('Error'), |
1462 | + _('Analytic lines yet generated for expense %s. Remove them first') % expense.name) |
1463 | + for line in expense.line_ids: |
1464 | + if not line.deferred_analytics_id and not expense.deferred_analytics_id: |
1465 | + raise osv.except_osv(_('Error'),_('Expense %s and line %s have no Deferred Analytic Distribution') |
1466 | + % (expense.name or '', line.name)) |
1467 | + if line.deferred_analytics_id: |
1468 | + deferred_analytics_id = line.deferred_analytics_id |
1469 | + else: |
1470 | + deferred_analytics_id = expense.deferred_analytics_id |
1471 | + for plan_line in deferred_analytics_id.account_ids: |
1472 | + amount = - line.total_amount * (plan_line.rate / 100) |
1473 | + al_vals={ |
1474 | + 'name': line.name, |
1475 | + 'account_id': plan_line.analytic_account_id.id, |
1476 | + 'unit_amount': line.unit_quantity, |
1477 | + 'product_id': line.product_id and line.product_id.id or False, |
1478 | + 'product_uom_id': line.uom_id and line.uom_id.id or False, |
1479 | + 'amount': amount, |
1480 | + 'journal_id': journal.analytic_journal_id.id, |
1481 | + 'percentage': plan_line.rate, |
1482 | + 'deferred_expense_line_id': line.id, |
1483 | + 'general_account_id': journal.default_debit_account_id.id, |
1484 | + } |
1485 | + al_id = analytic_line_obj.create(cr, uid, al_vals, context=context) |
1486 | + return True |
1487 | + |
1488 | +hr_expense() |
1489 | + |
1490 | +class hr_expense_line(osv.osv): |
1491 | + |
1492 | + _inherit = 'hr.expense.line' |
1493 | + |
1494 | + _columns={ |
1495 | + 'deferred_analytics_id': fields.many2one('account.analytic.plan.instance', 'Deferred Analytic Distribution'), |
1496 | + 'deferred_line_ids': fields.one2many('account.analytic.line', 'deferred_expense_line_id', |
1497 | + 'Analytic Lines'), |
1498 | + } |
1499 | + |
1500 | +hr_expense_line() |
1501 | |
1502 | === added file 'hr_expense_analytic_deferred_choice/hr_expense_view.xml' |
1503 | --- hr_expense_analytic_deferred_choice/hr_expense_view.xml 1970-01-01 00:00:00 +0000 |
1504 | +++ hr_expense_analytic_deferred_choice/hr_expense_view.xml 2012-05-21 16:22:21 +0000 |
1505 | @@ -0,0 +1,37 @@ |
1506 | +<?xml version="1.0" encoding="utf-8"?> |
1507 | +<openerp> |
1508 | + <data> |
1509 | + <record id="view_expenses_form" model="ir.ui.view"> |
1510 | + <field name="name">hr.expense.form</field> |
1511 | + <field name="type">form</field> |
1512 | + <field name="model">hr.expense.expense</field> |
1513 | + <field name="inherit_id" ref="hr_expense.view_expenses_form"></field> |
1514 | + <field name="arch" type="xml"> |
1515 | + <field name="company_id" position="after"> |
1516 | + <group colspan="2" col="4" groups="analytic.group_analytic_accounting"> |
1517 | + <field name="deferred_analytics_id" domain="[('plan_id','<>',False)]"/> |
1518 | + <button name="create_analytic_lines" type="object" string="Create analytic lines" groups="account.group_account_user"/> |
1519 | + <button name="delete_analytic_lines" type="object" string="Delete analytic lines" groups="account.group_account_user"/> |
1520 | + </group> |
1521 | + </field> |
1522 | + <page string="Other Info" position="after"> |
1523 | + <page string="Deferred analytic lines" groups="account.group_account_user"> |
1524 | + <field name="deferred_line_ids" nolabel="1" colspan="4"/> |
1525 | + </page> |
1526 | + </page> |
1527 | + </field> |
1528 | + </record> |
1529 | + <record id="view_expenses_form_distribution_id" model="ir.ui.view"> |
1530 | + <field name="name">hr.expense.form.distribution_id</field> |
1531 | + <field name="type">form</field> |
1532 | + <field name="model">hr.expense.expense</field> |
1533 | + <field name="inherit_id" ref="hr_analytic_plans.view_expenses_form"></field> |
1534 | + <field name="arch" type="xml"> |
1535 | + <field name="distribution_id" position="after"> |
1536 | + <field name="deferred_analytics_id" groups="analytic.group_analytic_accounting" domain="[('plan_id','<>',False)]"/> |
1537 | + </field> |
1538 | + </field> |
1539 | + </record> |
1540 | + |
1541 | + </data> |
1542 | +</openerp> |
1543 | |
1544 | === added directory 'hr_expense_analytic_deferred_choice/i18n' |
1545 | === added file 'hr_expense_analytic_deferred_choice/i18n/it.po' |
1546 | --- hr_expense_analytic_deferred_choice/i18n/it.po 1970-01-01 00:00:00 +0000 |
1547 | +++ hr_expense_analytic_deferred_choice/i18n/it.po 2012-05-21 16:22:21 +0000 |
1548 | @@ -0,0 +1,140 @@ |
1549 | +# Translation of OpenERP Server. |
1550 | +# This file contains the translation of the following modules: |
1551 | +# * hr_expense_analytic_deferred_choice |
1552 | +# |
1553 | +msgid "" |
1554 | +msgstr "" |
1555 | +"Project-Id-Version: OpenERP Server 6.0.3\n" |
1556 | +"Report-Msgid-Bugs-To: support@openerp.com\n" |
1557 | +"POT-Creation-Date: 2011-12-09 10:29+0000\n" |
1558 | +"PO-Revision-Date: 2011-12-09 11:49+0100\n" |
1559 | +"Last-Translator: Lorenzo Battistini <lorenzo.battistini@agilebg.com>\n" |
1560 | +"Language-Team: \n" |
1561 | +"MIME-Version: 1.0\n" |
1562 | +"Content-Type: text/plain; charset=UTF-8\n" |
1563 | +"Content-Transfer-Encoding: 8bit\n" |
1564 | +"Plural-Forms: \n" |
1565 | + |
1566 | +#. module: hr_expense_analytic_deferred_choice |
1567 | +#: code:addons/hr_expense_analytic_deferred_choice/hr_expense.py:70 |
1568 | +#, python-format |
1569 | +msgid "You have to define a default debit account on the '%s' journal!" |
1570 | +msgstr "E' necessario definire un conto di debito di default per il sezionale '%s'!" |
1571 | + |
1572 | +#. module: hr_expense_analytic_deferred_choice |
1573 | +#: model:ir.model,name:hr_expense_analytic_deferred_choice.model_account_analytic_line |
1574 | +msgid "Analytic Line" |
1575 | +msgstr "Voce conto analitico" |
1576 | + |
1577 | +#. module: hr_expense_analytic_deferred_choice |
1578 | +#: field:account.analytic.line,deferred_expense_line_id:0 |
1579 | +#: model:ir.model,name:hr_expense_analytic_deferred_choice.model_hr_expense_line |
1580 | +msgid "Expense Line" |
1581 | +msgstr "Riga spesa" |
1582 | + |
1583 | +#. module: hr_expense_analytic_deferred_choice |
1584 | +#: field:hr.expense.expense,deferred_line_ids:0 |
1585 | +#: field:hr.expense.line,deferred_line_ids:0 |
1586 | +msgid "Analytic Lines" |
1587 | +msgstr "Righe analitiche" |
1588 | + |
1589 | +#. module: hr_expense_analytic_deferred_choice |
1590 | +#: code:addons/hr_expense_analytic_deferred_choice/hr_expense.py:66 |
1591 | +#, python-format |
1592 | +msgid "No Analytic Journal !" |
1593 | +msgstr "Nessun giornale analitico!" |
1594 | + |
1595 | +#. module: hr_expense_analytic_deferred_choice |
1596 | +#: view:hr.expense.expense:0 |
1597 | +msgid "Other Info" |
1598 | +msgstr "Altre informazioni" |
1599 | + |
1600 | +#. module: hr_expense_analytic_deferred_choice |
1601 | +#: view:hr.expense.expense:0 |
1602 | +msgid "Create analytic lines" |
1603 | +msgstr "Crea righe analitiche" |
1604 | + |
1605 | +#. module: hr_expense_analytic_deferred_choice |
1606 | +#: model:ir.module.module,description:hr_expense_analytic_deferred_choice.module_meta_information |
1607 | +msgid "" |
1608 | +"User can assign the expense amount to one or more analytic accounts, subsequently (or previously) to expense confirmation.\n" |
1609 | +" The expense has a new field, containing the analytic plan to be used. The related button generates tha analytic lines, related to the expense. The expense lines have new fields too, containing the analytic plan. If the line's field is not filled, the expense's one is used.\n" |
1610 | +" On the expense form, another button allows to delete the previously generated analytic lines.\n" |
1611 | +" Every analytic line contains a reference to the expense line that generated it." |
1612 | +msgstr "" |
1613 | +"User can assign the expense amount to one or more analytic accounts, subsequently (or previously) to expense confirmation.\n" |
1614 | +" The expense has a new field, containing the analytic plan to be used. The related button generates tha analytic lines, related to the expense. The expense lines have new fields too, containing the analytic plan. If the line's field is not filled, the expense's one is used.\n" |
1615 | +" On the expense form, another button allows to delete the previously generated analytic lines.\n" |
1616 | +" Every analytic line contains a reference to the expense line that generated it." |
1617 | + |
1618 | +#. module: hr_expense_analytic_deferred_choice |
1619 | +#: code:addons/hr_expense_analytic_deferred_choice/hr_expense.py:76 |
1620 | +#, python-format |
1621 | +msgid "Expense %s and line %s have no Deferred Analytic Distribution" |
1622 | +msgstr "La spesa %s e la riga %s non hanno una distribuzione analitica differita" |
1623 | + |
1624 | +#. module: hr_expense_analytic_deferred_choice |
1625 | +#: code:addons/hr_expense_analytic_deferred_choice/hr_expense.py:62 |
1626 | +#, python-format |
1627 | +msgid "There is no purchase journal defined for this company: \"%s\" (id:%d)" |
1628 | +msgstr "Non c'è un sezionale d'acquisto definito per questa azienda: \"%s\" (id:%d)" |
1629 | + |
1630 | +#. module: hr_expense_analytic_deferred_choice |
1631 | +#: code:addons/hr_expense_analytic_deferred_choice/hr_expense.py:67 |
1632 | +#, python-format |
1633 | +msgid "You have to define an analytic journal on the '%s' journal!" |
1634 | +msgstr "E' necessario definite un giornale analitico per il sezionale '%s'!" |
1635 | + |
1636 | +#. module: hr_expense_analytic_deferred_choice |
1637 | +#: code:addons/hr_expense_analytic_deferred_choice/hr_expense.py:73 |
1638 | +#, python-format |
1639 | +msgid "Analytic lines yet generated for expense %s. Remove them first" |
1640 | +msgstr "Righe analitiche già generate per la fattura %s. Rimuoverle prima di crearne altre" |
1641 | + |
1642 | +#. module: hr_expense_analytic_deferred_choice |
1643 | +#: view:hr.expense.expense:0 |
1644 | +msgid "Delete analytic lines" |
1645 | +msgstr "Rimuovi righe analitiche" |
1646 | + |
1647 | +#. module: hr_expense_analytic_deferred_choice |
1648 | +#: code:addons/hr_expense_analytic_deferred_choice/hr_expense.py:72 |
1649 | +#: code:addons/hr_expense_analytic_deferred_choice/hr_expense.py:76 |
1650 | +#, python-format |
1651 | +msgid "Error" |
1652 | +msgstr "Errore" |
1653 | + |
1654 | +#. module: hr_expense_analytic_deferred_choice |
1655 | +#: view:hr.expense.expense:0 |
1656 | +msgid "Deferred analytic lines" |
1657 | +msgstr "Righe analitiche differite" |
1658 | + |
1659 | +#. module: hr_expense_analytic_deferred_choice |
1660 | +#: code:addons/hr_expense_analytic_deferred_choice/hr_expense.py:61 |
1661 | +#, python-format |
1662 | +msgid "Error !" |
1663 | +msgstr "Errore !" |
1664 | + |
1665 | +#. module: hr_expense_analytic_deferred_choice |
1666 | +#: view:account.analytic.line:0 |
1667 | +#: field:account.analytic.line,deferred_expense_id:0 |
1668 | +#: model:ir.model,name:hr_expense_analytic_deferred_choice.model_hr_expense_expense |
1669 | +msgid "Expense" |
1670 | +msgstr "Spesa" |
1671 | + |
1672 | +#. module: hr_expense_analytic_deferred_choice |
1673 | +#: model:ir.module.module,shortdesc:hr_expense_analytic_deferred_choice.module_meta_information |
1674 | +msgid "Analytic Deferred Choice for Expenses" |
1675 | +msgstr "Scelta analitica differita per i rimborsi spese" |
1676 | + |
1677 | +#. module: hr_expense_analytic_deferred_choice |
1678 | +#: code:addons/hr_expense_analytic_deferred_choice/hr_expense.py:69 |
1679 | +#, python-format |
1680 | +msgid "No Debit Account !" |
1681 | +msgstr "Nessun conto di debito!" |
1682 | + |
1683 | +#. module: hr_expense_analytic_deferred_choice |
1684 | +#: field:hr.expense.expense,deferred_analytics_id:0 |
1685 | +#: field:hr.expense.line,deferred_analytics_id:0 |
1686 | +msgid "Deferred Analytic Distribution" |
1687 | +msgstr "Distribuzione analitica differita" |
1688 | + |
1689 | |
1690 | === added file 'hr_expense_analytic_deferred_choice/project_view.xml' |
1691 | --- hr_expense_analytic_deferred_choice/project_view.xml 1970-01-01 00:00:00 +0000 |
1692 | +++ hr_expense_analytic_deferred_choice/project_view.xml 2012-05-21 16:22:21 +0000 |
1693 | @@ -0,0 +1,18 @@ |
1694 | +<?xml version="1.0" encoding="utf-8"?> |
1695 | +<openerp> |
1696 | + <data> |
1697 | + <record id="view_account_analytic_line_form" model="ir.ui.view"> |
1698 | + <field name="name">account.analytic.line.form</field> |
1699 | + <field name="model">account.analytic.line</field> |
1700 | + <field name="type">form</field> |
1701 | + <field name="inherit_id" ref="account.view_account_analytic_line_form"></field> |
1702 | + <field name="arch" type="xml"> |
1703 | + <field name="move_id" position="after"> |
1704 | + <separator colspan="2" string="Expense"/> |
1705 | + <field name="deferred_expense_id"/> |
1706 | + <field name="deferred_expense_line_id"/> |
1707 | + </field> |
1708 | + </field> |
1709 | + </record> |
1710 | + </data> |
1711 | +</openerp> |
1712 | |
1713 | === added directory 'project_issue_customer_view/data' |
1714 | === renamed directory 'project_issue_customer_view/data' => 'project_issue_customer_view/data.moved' |
1715 | === added file 'project_issue_customer_view/data/tickets-icon-hover.png' |
1716 | Binary files project_issue_customer_view/data/tickets-icon-hover.png 1970-01-01 00:00:00 +0000 and project_issue_customer_view/data/tickets-icon-hover.png 2012-05-21 16:22:21 +0000 differ |
1717 | === added file 'project_issue_customer_view/data/tickets-icon.png' |
1718 | Binary files project_issue_customer_view/data/tickets-icon.png 1970-01-01 00:00:00 +0000 and project_issue_customer_view/data/tickets-icon.png 2012-05-21 16:22:21 +0000 differ |
1719 | === modified file 'project_issue_customer_view/project_issue_menu.xml' |
1720 | --- project_issue_customer_view/project_issue_menu.xml 2012-03-31 15:46:16 +0000 |
1721 | +++ project_issue_customer_view/project_issue_menu.xml 2012-05-21 16:22:21 +0000 |
1722 | @@ -25,9 +25,15 @@ |
1723 | <field name="act_window_id" ref="action_project_ticket"/> |
1724 | </record> |
1725 | |
1726 | +<<<<<<< TREE |
1727 | <menuitem name="Support" id="menu_customer_support" |
1728 | web_icon="data/tickets-icon.png" |
1729 | web_icon_hover="data/tickets-icon-hover.png" action="action_project_ticket"/> |
1730 | +======= |
1731 | + <menuitem name="Support" id="menu_customer_support" |
1732 | + web_icon="data/tickets-icon.png" |
1733 | + web_icon_hover="data/tickets-icon-hover.png"/> |
1734 | +>>>>>>> MERGE-SOURCE |
1735 | <menuitem name="Tickets" id="menu_customer_ticket" parent="menu_customer_support"/> |
1736 | <menuitem name="Tickets" id="menu_customer_ticket_list" parent="menu_customer_ticket" |
1737 | action="action_project_ticket" sequence="5"/> |
1738 | |
1739 | === added directory 'purchase_analytic_deferred_choice' |
1740 | === renamed directory 'purchase_analytic_deferred_choice' => 'purchase_analytic_deferred_choice.moved' |
1741 | === added file 'purchase_analytic_deferred_choice/AUTHORS.txt' |
1742 | --- purchase_analytic_deferred_choice/AUTHORS.txt 1970-01-01 00:00:00 +0000 |
1743 | +++ purchase_analytic_deferred_choice/AUTHORS.txt 2012-05-21 16:22:21 +0000 |
1744 | @@ -0,0 +1,1 @@ |
1745 | +Lorenzo Battistini <lorenzo.battistini@agilebg.com> |
1746 | |
1747 | === added file 'purchase_analytic_deferred_choice/__init__.py' |
1748 | --- purchase_analytic_deferred_choice/__init__.py 1970-01-01 00:00:00 +0000 |
1749 | +++ purchase_analytic_deferred_choice/__init__.py 2012-05-21 16:22:21 +0000 |
1750 | @@ -0,0 +1,23 @@ |
1751 | +# -*- coding: utf-8 -*- |
1752 | +############################################################################## |
1753 | +# |
1754 | +# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
1755 | +# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
1756 | +# All Rights Reserved |
1757 | +# |
1758 | +# This program is free software: you can redistribute it and/or modify |
1759 | +# it under the terms of the GNU Affero General Public License as published |
1760 | +# by the Free Software Foundation, either version 3 of the License, or |
1761 | +# (at your option) any later version. |
1762 | +# |
1763 | +# This program is distributed in the hope that it will be useful, |
1764 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1765 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1766 | +# GNU General Public License for more details. |
1767 | +# |
1768 | +# You should have received a copy of the GNU Affero General Public License |
1769 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1770 | +# |
1771 | +############################################################################## |
1772 | +import purchase_order |
1773 | +import analytic |
1774 | |
1775 | === added file 'purchase_analytic_deferred_choice/__openerp__.py' |
1776 | --- purchase_analytic_deferred_choice/__openerp__.py 1970-01-01 00:00:00 +0000 |
1777 | +++ purchase_analytic_deferred_choice/__openerp__.py 2012-05-21 16:22:21 +0000 |
1778 | @@ -0,0 +1,42 @@ |
1779 | +# -*- coding: utf-8 -*- |
1780 | +############################################################################## |
1781 | +# |
1782 | +# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
1783 | +# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
1784 | +# All Rights Reserved |
1785 | +# |
1786 | +# This program is free software: you can redistribute it and/or modify |
1787 | +# it under the terms of the GNU Affero General Public License as published |
1788 | +# by the Free Software Foundation, either version 3 of the License, or |
1789 | +# (at your option) any later version. |
1790 | +# |
1791 | +# This program is distributed in the hope that it will be useful, |
1792 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1793 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1794 | +# GNU General Public License for more details. |
1795 | +# |
1796 | +# You should have received a copy of the GNU Affero General Public License |
1797 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1798 | +# |
1799 | +############################################################################## |
1800 | +{ |
1801 | + 'name': "Analytic Deferred Choice for Purchase Orders", |
1802 | + 'version': '0.1', |
1803 | + 'category': 'Generic Modules/Sales & Purchases', |
1804 | + 'description': """User can assign the invoice amount to one or more analytic accounts, subsequently (or previously) to purchase order confirmation. |
1805 | + The purchase order has a new field, containing the analytic plan to be used. The related button generates tha analytic lines, related to the order. The order lines have new fields too, containing the analytic plan. If the line's field is not filled, the order's one is used. |
1806 | + On the order form, another button allows to delete the previously generated analytic lines. |
1807 | + Every analytic line contains a reference to the order line that generated it.""", |
1808 | + 'author': 'Agile Business Group & Domsense', |
1809 | + 'website': 'http://www.agilebg.com', |
1810 | + 'license': 'AGPL-3', |
1811 | + "depends" : ['account_analytic_plans', 'purchase', 'purchase_analytic_plans'], |
1812 | + "init_xml" : [], |
1813 | + "update_xml" : [ |
1814 | + 'purchase_order_view.xml', |
1815 | + 'project_view.xml', |
1816 | + ], |
1817 | + "demo_xml" : [], |
1818 | + "active": False, |
1819 | + "installable": True |
1820 | +} |
1821 | |
1822 | === added file 'purchase_analytic_deferred_choice/analytic.py' |
1823 | --- purchase_analytic_deferred_choice/analytic.py 1970-01-01 00:00:00 +0000 |
1824 | +++ purchase_analytic_deferred_choice/analytic.py 2012-05-21 16:22:21 +0000 |
1825 | @@ -0,0 +1,34 @@ |
1826 | +# -*- coding: utf-8 -*- |
1827 | +############################################################################## |
1828 | +# |
1829 | +# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
1830 | +# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
1831 | +# All Rights Reserved |
1832 | +# |
1833 | +# This program is free software: you can redistribute it and/or modify |
1834 | +# it under the terms of the GNU Affero General Public License as published |
1835 | +# by the Free Software Foundation, either version 3 of the License, or |
1836 | +# (at your option) any later version. |
1837 | +# |
1838 | +# This program is distributed in the hope that it will be useful, |
1839 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1840 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1841 | +# GNU General Public License for more details. |
1842 | +# |
1843 | +# You should have received a copy of the GNU Affero General Public License |
1844 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1845 | +# |
1846 | +############################################################################## |
1847 | + |
1848 | +from osv import fields, osv |
1849 | + |
1850 | +class account_analytic_line(osv.osv): |
1851 | + _inherit = 'account.analytic.line' |
1852 | + |
1853 | + _columns = { |
1854 | + 'deferred_purchase_order_line_id': fields.many2one('purchase.order.line', 'Purchase Order Line', readonly=True), |
1855 | + 'deferred_purchase_order_id': fields.related('deferred_purchase_order_line_id', 'order_id', type="many2one", |
1856 | + relation="purchase.order", string="Purchase Order", store=False, readonly=True), |
1857 | + } |
1858 | + |
1859 | +account_analytic_line() |
1860 | |
1861 | === added directory 'purchase_analytic_deferred_choice/i18n' |
1862 | === added file 'purchase_analytic_deferred_choice/i18n/it.po' |
1863 | --- purchase_analytic_deferred_choice/i18n/it.po 1970-01-01 00:00:00 +0000 |
1864 | +++ purchase_analytic_deferred_choice/i18n/it.po 2012-05-21 16:22:21 +0000 |
1865 | @@ -0,0 +1,150 @@ |
1866 | +# Translation of OpenERP Server. |
1867 | +# This file contains the translation of the following modules: |
1868 | +# * purchase_analytic_deferred_choice |
1869 | +# |
1870 | +msgid "" |
1871 | +msgstr "" |
1872 | +"Project-Id-Version: OpenERP Server 6.0.3\n" |
1873 | +"Report-Msgid-Bugs-To: support@openerp.com\n" |
1874 | +"POT-Creation-Date: 2011-12-09 10:28+0000\n" |
1875 | +"PO-Revision-Date: 2011-12-09 11:47+0100\n" |
1876 | +"Last-Translator: Lorenzo Battistini <lorenzo.battistini@agilebg.com>\n" |
1877 | +"Language-Team: \n" |
1878 | +"MIME-Version: 1.0\n" |
1879 | +"Content-Type: text/plain; charset=UTF-8\n" |
1880 | +"Content-Transfer-Encoding: 8bit\n" |
1881 | +"Plural-Forms: \n" |
1882 | + |
1883 | +#. module: purchase_analytic_deferred_choice |
1884 | +#: field:account.analytic.line,deferred_purchase_order_line_id:0 |
1885 | +#: model:ir.model,name:purchase_analytic_deferred_choice.model_purchase_order_line |
1886 | +msgid "Purchase Order Line" |
1887 | +msgstr "Riga ordine d'acquisto" |
1888 | + |
1889 | +#. module: purchase_analytic_deferred_choice |
1890 | +#: view:purchase.order:0 |
1891 | +msgid "Create analytic lines" |
1892 | +msgstr "Crea righe analitiche" |
1893 | + |
1894 | +#. module: purchase_analytic_deferred_choice |
1895 | +#: code:addons/purchase_analytic_deferred_choice/purchase_order.py:67 |
1896 | +#, python-format |
1897 | +msgid "You have to define an analytic journal on the '%s' journal!" |
1898 | +msgstr "E' necessario definite un giornale analitico per il sezionale '%s'!" |
1899 | + |
1900 | +#. module: purchase_analytic_deferred_choice |
1901 | +#: code:addons/purchase_analytic_deferred_choice/purchase_order.py:70 |
1902 | +#, python-format |
1903 | +msgid "You have to define a default debit account on the '%s' journal!" |
1904 | +msgstr "E' necessario definire un conto di debito di default per il sezionale '%s'!" |
1905 | + |
1906 | +#. module: purchase_analytic_deferred_choice |
1907 | +#: model:ir.module.module,shortdesc:purchase_analytic_deferred_choice.module_meta_information |
1908 | +msgid "Analytic Deferred Choice for Purchase Orders" |
1909 | +msgstr "Scelta analitica differita per gli ordini d'acquisto" |
1910 | + |
1911 | +#. module: purchase_analytic_deferred_choice |
1912 | +#: sql_constraint:purchase.order:0 |
1913 | +msgid "Order Reference must be unique !" |
1914 | +msgstr "Il riferimento ordine deve essere unico!" |
1915 | + |
1916 | +#. module: purchase_analytic_deferred_choice |
1917 | +#: model:ir.model,name:purchase_analytic_deferred_choice.model_account_analytic_line |
1918 | +msgid "Analytic Line" |
1919 | +msgstr "Voce conto analitico" |
1920 | + |
1921 | +#. module: purchase_analytic_deferred_choice |
1922 | +#: code:addons/purchase_analytic_deferred_choice/purchase_order.py:62 |
1923 | +#, python-format |
1924 | +msgid "There is no purchase journal defined for this company: \"%s\" (id:%d)" |
1925 | +msgstr "Non c'è un sezionale d'acquisto definito per questa azienda: \"%s\" (id:%d)" |
1926 | + |
1927 | +#. module: purchase_analytic_deferred_choice |
1928 | +#: field:purchase.order,deferred_analytics_id:0 |
1929 | +#: field:purchase.order.line,deferred_analytics_id:0 |
1930 | +msgid "Deferred Analytic Distribution" |
1931 | +msgstr "Distribuzione analitica differita" |
1932 | + |
1933 | +#. module: purchase_analytic_deferred_choice |
1934 | +#: view:purchase.order:0 |
1935 | +msgid "Notes" |
1936 | +msgstr "Note" |
1937 | + |
1938 | +#. module: purchase_analytic_deferred_choice |
1939 | +#: field:purchase.order,deferred_line_ids:0 |
1940 | +#: field:purchase.order.line,deferred_line_ids:0 |
1941 | +msgid "Analytic Lines" |
1942 | +msgstr "Righe analitiche" |
1943 | + |
1944 | +#. module: purchase_analytic_deferred_choice |
1945 | +#: code:addons/purchase_analytic_deferred_choice/purchase_order.py:73 |
1946 | +#, python-format |
1947 | +msgid "Analytic lines yet generated for order %s. Remove them first" |
1948 | +msgstr "Righe analitiche già generate per la fattura %s. Rimuoverle prima di crearne altre" |
1949 | + |
1950 | +#. module: purchase_analytic_deferred_choice |
1951 | +#: view:account.analytic.line:0 |
1952 | +#: field:account.analytic.line,deferred_purchase_order_id:0 |
1953 | +#: model:ir.model,name:purchase_analytic_deferred_choice.model_purchase_order |
1954 | +msgid "Purchase Order" |
1955 | +msgstr "Ordine d'acquisto" |
1956 | + |
1957 | +#. module: purchase_analytic_deferred_choice |
1958 | +#: code:addons/purchase_analytic_deferred_choice/purchase_order.py:72 |
1959 | +#: code:addons/purchase_analytic_deferred_choice/purchase_order.py:76 |
1960 | +#, python-format |
1961 | +msgid "Error" |
1962 | +msgstr "Errore" |
1963 | + |
1964 | +#. module: purchase_analytic_deferred_choice |
1965 | +#: code:addons/purchase_analytic_deferred_choice/purchase_order.py:61 |
1966 | +#, python-format |
1967 | +msgid "Error !" |
1968 | +msgstr "Errore !" |
1969 | + |
1970 | +#. module: purchase_analytic_deferred_choice |
1971 | +#: view:purchase.order:0 |
1972 | +msgid "Deferred analytic lines" |
1973 | +msgstr "Righe analitiche differite" |
1974 | + |
1975 | +#. module: purchase_analytic_deferred_choice |
1976 | +#: view:purchase.order:0 |
1977 | +msgid "Delete analytic lines" |
1978 | +msgstr "Rimuovi righe analitiche" |
1979 | + |
1980 | +#. module: purchase_analytic_deferred_choice |
1981 | +#: view:purchase.order:0 |
1982 | +msgid "Analytic lines" |
1983 | +msgstr "Righe analitiche" |
1984 | + |
1985 | +#. module: purchase_analytic_deferred_choice |
1986 | +#: code:addons/purchase_analytic_deferred_choice/purchase_order.py:66 |
1987 | +#, python-format |
1988 | +msgid "No Analytic Journal !" |
1989 | +msgstr "Nessun giornale analitico!" |
1990 | + |
1991 | +#. module: purchase_analytic_deferred_choice |
1992 | +#: code:addons/purchase_analytic_deferred_choice/purchase_order.py:69 |
1993 | +#, python-format |
1994 | +msgid "No Debit Account !" |
1995 | +msgstr "Nessun conto di debito!" |
1996 | + |
1997 | +#. module: purchase_analytic_deferred_choice |
1998 | +#: model:ir.module.module,description:purchase_analytic_deferred_choice.module_meta_information |
1999 | +msgid "" |
2000 | +"User can assign the invoice amount to one or more analytic accounts, subsequently (or previously) to purchase order confirmation.\n" |
2001 | +" The purchase order has a new field, containing the analytic plan to be used. The related button generates tha analytic lines, related to the order. The order lines have new fields too, containing the analytic plan. If the line's field is not filled, the order's one is used.\n" |
2002 | +" On the order form, another button allows to delete the previously generated analytic lines.\n" |
2003 | +" Every analytic line contains a reference to the order line that generated it." |
2004 | +msgstr "" |
2005 | +"User can assign the invoice amount to one or more analytic accounts, subsequently (or previously) to purchase order confirmation.\n" |
2006 | +" The purchase order has a new field, containing the analytic plan to be used. The related button generates tha analytic lines, related to the order. The order lines have new fields too, containing the analytic plan. If the line's field is not filled, the order's one is used.\n" |
2007 | +" On the order form, another button allows to delete the previously generated analytic lines.\n" |
2008 | +" Every analytic line contains a reference to the order line that generated it." |
2009 | + |
2010 | +#. module: purchase_analytic_deferred_choice |
2011 | +#: code:addons/purchase_analytic_deferred_choice/purchase_order.py:76 |
2012 | +#, python-format |
2013 | +msgid "Order %s and line %s have no Deferred Analytic Distribution" |
2014 | +msgstr "L'ordine %s e la riga %s non hanno una distribuzione analitica differita" |
2015 | + |
2016 | |
2017 | === added file 'purchase_analytic_deferred_choice/project_view.xml' |
2018 | --- purchase_analytic_deferred_choice/project_view.xml 1970-01-01 00:00:00 +0000 |
2019 | +++ purchase_analytic_deferred_choice/project_view.xml 2012-05-21 16:22:21 +0000 |
2020 | @@ -0,0 +1,18 @@ |
2021 | +<?xml version="1.0" encoding="utf-8"?> |
2022 | +<openerp> |
2023 | + <data> |
2024 | + <record id="view_account_analytic_line_form" model="ir.ui.view"> |
2025 | + <field name="name">account.analytic.line.form</field> |
2026 | + <field name="model">account.analytic.line</field> |
2027 | + <field name="type">form</field> |
2028 | + <field name="inherit_id" ref="account.view_account_analytic_line_form"></field> |
2029 | + <field name="arch" type="xml"> |
2030 | + <field name="move_id" position="after"> |
2031 | + <separator colspan="2" string="Purchase Order"/> |
2032 | + <field name="deferred_purchase_order_id"/> |
2033 | + <field name="deferred_purchase_order_line_id"/> |
2034 | + </field> |
2035 | + </field> |
2036 | + </record> |
2037 | + </data> |
2038 | +</openerp> |
2039 | |
2040 | === added file 'purchase_analytic_deferred_choice/purchase_order.py' |
2041 | --- purchase_analytic_deferred_choice/purchase_order.py 1970-01-01 00:00:00 +0000 |
2042 | +++ purchase_analytic_deferred_choice/purchase_order.py 2012-05-21 16:22:21 +0000 |
2043 | @@ -0,0 +1,116 @@ |
2044 | +# -*- coding: utf-8 -*- |
2045 | +############################################################################## |
2046 | +# |
2047 | +# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) |
2048 | +# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) |
2049 | +# All Rights Reserved |
2050 | +# |
2051 | +# This program is free software: you can redistribute it and/or modify |
2052 | +# it under the terms of the GNU Affero General Public License as published |
2053 | +# by the Free Software Foundation, either version 3 of the License, or |
2054 | +# (at your option) any later version. |
2055 | +# |
2056 | +# This program is distributed in the hope that it will be useful, |
2057 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2058 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2059 | +# GNU General Public License for more details. |
2060 | +# |
2061 | +# You should have received a copy of the GNU Affero General Public License |
2062 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2063 | +# |
2064 | +############################################################################## |
2065 | + |
2066 | +from osv import fields, osv |
2067 | +from tools.translate import _ |
2068 | +from osv import orm |
2069 | + |
2070 | +class purchase_order(osv.osv): |
2071 | + |
2072 | + _inherit = 'purchase.order' |
2073 | + |
2074 | + def _get_deferred_analytic_lines(self, cr, uid, ids, field_name, arg, context=None): |
2075 | + res={} |
2076 | + for po in self.browse(cr, uid, ids): |
2077 | + analytic_lines = [] |
2078 | + for line in po.order_line: |
2079 | + try: |
2080 | + if line.deferred_line_ids: |
2081 | + analytic_lines.extend([x.id for x in line.deferred_line_ids]) |
2082 | + except orm.except_orm, e: |
2083 | + if e.name != 'AccessError': |
2084 | + raise e |
2085 | + res[po.id] = analytic_lines |
2086 | + return res |
2087 | + |
2088 | + _columns={ |
2089 | + 'deferred_analytics_id': fields.many2one('account.analytic.plan.instance', 'Deferred Analytic Distribution'), |
2090 | + 'deferred_line_ids': fields.function(_get_deferred_analytic_lines, type='one2many', |
2091 | + obj='account.analytic.line', method=True, string='Analytic Lines'), |
2092 | + } |
2093 | + |
2094 | + def delete_analytic_lines(self, cr, uid, ids, context=None): |
2095 | + analytic_line_obj = self.pool.get('account.analytic.line') |
2096 | + for po in self.browse(cr, uid, ids): |
2097 | + for line in po.deferred_line_ids: |
2098 | + line.unlink() |
2099 | + return True |
2100 | + |
2101 | + def create_analytic_lines(self, cr, uid, ids, context=None): |
2102 | + analytic_line_obj = self.pool.get('account.analytic.line') |
2103 | + journal_obj = self.pool.get('account.journal') |
2104 | + po_line_obj = self.pool.get('purchase.order.line') |
2105 | + for po in self.browse(cr, uid, ids): |
2106 | + journal_ids = journal_obj.search(cr, uid, [ |
2107 | + ('type', '=','purchase'),('company_id', '=', po.company_id.id)], limit=1) |
2108 | + if not journal_ids: |
2109 | + raise osv.except_osv(_('Error !'), |
2110 | + _('There is no purchase journal defined for this company: "%s" (id:%d)') |
2111 | + % (po.company_id.name, po.company_id.id)) |
2112 | + journal = journal_obj.browse(cr, uid, journal_ids[0]) |
2113 | + if not journal.analytic_journal_id: |
2114 | + raise osv.except_osv(_('No Analytic Journal !'), |
2115 | + _("You have to define an analytic journal on the '%s' journal!") % (journal.name)) |
2116 | + if not journal.default_debit_account_id: |
2117 | + raise osv.except_osv(_('No Debit Account !'), |
2118 | + _("You have to define a default debit account on the '%s' journal!") % (journal.name)) |
2119 | + if po.deferred_line_ids: |
2120 | + raise osv.except_osv(_('Error'), |
2121 | + _('Analytic lines yet generated for order %s. Remove them first') % po.name) |
2122 | + for po_line in po.order_line: |
2123 | + if not po_line.deferred_analytics_id and not po.deferred_analytics_id: |
2124 | + raise osv.except_osv(_('Error'),_('Order %s and line %s have no Deferred Analytic Distribution') |
2125 | + % (po.name or '', po_line.name)) |
2126 | + if po_line.deferred_analytics_id: |
2127 | + deferred_analytics_id = po_line.deferred_analytics_id |
2128 | + else: |
2129 | + deferred_analytics_id = po.deferred_analytics_id |
2130 | + for plan_line in deferred_analytics_id.account_ids: |
2131 | + amount = - po_line.price_subtotal * (plan_line.rate / 100) |
2132 | + al_vals={ |
2133 | + 'name': po_line.name, |
2134 | + 'account_id': plan_line.analytic_account_id.id, |
2135 | + 'unit_amount': po_line.product_qty, |
2136 | + 'product_id': po_line.product_id and po_line.product_id.id or False, |
2137 | + 'product_uom_id': po_line.product_uom and po_line.product_uom.id or False, |
2138 | + 'amount': amount, |
2139 | + 'journal_id': journal.analytic_journal_id.id, |
2140 | + 'percentage': plan_line.rate, |
2141 | + 'deferred_purchase_order_line_id': po_line.id, |
2142 | + 'general_account_id': journal.default_debit_account_id.id, |
2143 | + } |
2144 | + al_id = analytic_line_obj.create(cr, uid, al_vals, context=context) |
2145 | + return True |
2146 | + |
2147 | +purchase_order() |
2148 | + |
2149 | +class purchase_order_line(osv.osv): |
2150 | + |
2151 | + _inherit = 'purchase.order.line' |
2152 | + |
2153 | + _columns={ |
2154 | + 'deferred_analytics_id': fields.many2one('account.analytic.plan.instance', 'Deferred Analytic Distribution'), |
2155 | + 'deferred_line_ids': fields.one2many('account.analytic.line', 'deferred_purchase_order_line_id', |
2156 | + 'Analytic Lines'), |
2157 | + } |
2158 | + |
2159 | +purchase_order_line() |
2160 | |
2161 | === added file 'purchase_analytic_deferred_choice/purchase_order_view.xml' |
2162 | --- purchase_analytic_deferred_choice/purchase_order_view.xml 1970-01-01 00:00:00 +0000 |
2163 | +++ purchase_analytic_deferred_choice/purchase_order_view.xml 2012-05-21 16:22:21 +0000 |
2164 | @@ -0,0 +1,38 @@ |
2165 | +<?xml version="1.0" encoding="utf-8"?> |
2166 | +<openerp> |
2167 | + <data> |
2168 | + <record id="purchase_order_form" model="ir.ui.view"> |
2169 | + <field name="name">purchase.order.form</field> |
2170 | + <field name="model">purchase.order</field> |
2171 | + <field name="type">form</field> |
2172 | + <field name="inherit_id" ref="purchase.purchase_order_form"></field> |
2173 | + <field name="arch" type="xml"> |
2174 | + <field name="fiscal_position" position="after"> |
2175 | + <separator string="Analytic lines" colspan="2"/> |
2176 | + <group colspan="2" col="4" groups="analytic.group_analytic_accounting"> |
2177 | + <field name="deferred_analytics_id" domain="[('plan_id','<>',False)]"/> |
2178 | + <button name="create_analytic_lines" type="object" string="Create analytic lines"/> |
2179 | + <button name="delete_analytic_lines" type="object" string="Delete analytic lines"/> |
2180 | + </group> |
2181 | + </field> |
2182 | + <page string="Notes" position="after"> |
2183 | + <page string="Deferred analytic lines" groups="account.group_account_user"> |
2184 | + <field name="deferred_line_ids" nolabel="1" colspan="4"/> |
2185 | + </page> |
2186 | + </page> |
2187 | + </field> |
2188 | + </record> |
2189 | + |
2190 | + <record id="purchase_order_line_form" model="ir.ui.view"> |
2191 | + <field name="name">purchase.order.line.form</field> |
2192 | + <field name="model">purchase.order.line</field> |
2193 | + <field name="type">form</field> |
2194 | + <field name="inherit_id" ref="purchase_analytic_plans.purchase_order_line_form_inherit"></field> |
2195 | + <field name="arch" type="xml"> |
2196 | + <field name="analytics_id" position="after"> |
2197 | + <field name="deferred_analytics_id" groups="analytic.group_analytic_accounting" domain="[('plan_id','<>',False)]"/> |
2198 | + </field> |
2199 | + </field> |
2200 | + </record> |
2201 | + </data> |
2202 | +</openerp> |
2203 | |
2204 | === added directory 'sale_double_validation' |
2205 | === renamed directory 'sale_double_validation' => 'sale_double_validation.moved' |
2206 | === added file 'sale_double_validation/AUTHORS.txt' |
2207 | --- sale_double_validation/AUTHORS.txt 1970-01-01 00:00:00 +0000 |
2208 | +++ sale_double_validation/AUTHORS.txt 2012-05-21 16:22:21 +0000 |
2209 | @@ -0,0 +1,1 @@ |
2210 | +Lorenzo Battistini <lorenzo.battistini@agilebg.com> |
2211 | |
2212 | === added file 'sale_double_validation/__init__.py' |
2213 | --- sale_double_validation/__init__.py 1970-01-01 00:00:00 +0000 |
2214 | +++ sale_double_validation/__init__.py 2012-05-21 16:22:21 +0000 |
2215 | @@ -0,0 +1,22 @@ |
2216 | +# -*- coding: utf-8 -*- |
2217 | +############################################################################## |
2218 | +# |
2219 | +# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
2220 | +# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>) |
2221 | +# All Rights Reserved |
2222 | +# |
2223 | +# This program is free software: you can redistribute it and/or modify |
2224 | +# it under the terms of the GNU Affero General Public License as published |
2225 | +# by the Free Software Foundation, either version 3 of the License, or |
2226 | +# (at your option) any later version. |
2227 | +# |
2228 | +# This program is distributed in the hope that it will be useful, |
2229 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2230 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2231 | +# GNU General Public License for more details. |
2232 | +# |
2233 | +# You should have received a copy of the GNU Affero General Public License |
2234 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2235 | +# |
2236 | +############################################################################## |
2237 | +import sale |
2238 | |
2239 | === added file 'sale_double_validation/__openerp__.py' |
2240 | --- sale_double_validation/__openerp__.py 1970-01-01 00:00:00 +0000 |
2241 | +++ sale_double_validation/__openerp__.py 2012-05-21 16:22:21 +0000 |
2242 | @@ -0,0 +1,41 @@ |
2243 | +# -*- coding: utf-8 -*- |
2244 | +############################################################################## |
2245 | +# |
2246 | +# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
2247 | +# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>) |
2248 | +# All Rights Reserved |
2249 | +# |
2250 | +# This program is free software: you can redistribute it and/or modify |
2251 | +# it under the terms of the GNU Affero General Public License as published |
2252 | +# by the Free Software Foundation, either version 3 of the License, or |
2253 | +# (at your option) any later version. |
2254 | +# |
2255 | +# This program is distributed in the hope that it will be useful, |
2256 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2257 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2258 | +# GNU General Public License for more details. |
2259 | +# |
2260 | +# You should have received a copy of the GNU Affero General Public License |
2261 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2262 | +# |
2263 | +############################################################################## |
2264 | +{ |
2265 | + 'name': "Double validation for sale orders", |
2266 | + 'version': '0.1', |
2267 | + 'category': 'Generic Modules/Sales & Purchases', |
2268 | + 'description': """ |
2269 | + This module modifies the sale workflow adding a validation step before the sale order confirmation. |
2270 | + """, |
2271 | + 'author': 'Agile Business Group & Domsense', |
2272 | + 'website': 'http://www.agilebg.com', |
2273 | + 'license': 'AGPL-3', |
2274 | + "depends" : ['sale'], |
2275 | + "init_xml" : [], |
2276 | + "update_xml" : [ |
2277 | + 'sale_workflow.xml', |
2278 | + 'sale_view.xml', |
2279 | + ], |
2280 | + "demo_xml" : [], |
2281 | + "active": False, |
2282 | + "installable": True |
2283 | +} |
2284 | |
2285 | === added directory 'sale_double_validation/i18n' |
2286 | === added file 'sale_double_validation/i18n/it.po' |
2287 | --- sale_double_validation/i18n/it.po 1970-01-01 00:00:00 +0000 |
2288 | +++ sale_double_validation/i18n/it.po 2012-05-21 16:22:21 +0000 |
2289 | @@ -0,0 +1,58 @@ |
2290 | +# Translation of OpenERP Server. |
2291 | +# This file contains the translation of the following modules: |
2292 | +# * sale_double_validation |
2293 | +# |
2294 | +msgid "" |
2295 | +msgstr "" |
2296 | +"Project-Id-Version: OpenERP Server 6.0.3\n" |
2297 | +"Report-Msgid-Bugs-To: support@openerp.com\n" |
2298 | +"POT-Creation-Date: 2012-02-08 16:43+0000\n" |
2299 | +"PO-Revision-Date: 2012-02-08 17:44+0100\n" |
2300 | +"Last-Translator: eLBati <lorenzo.battistini@domsense.com>\n" |
2301 | +"Language-Team: \n" |
2302 | +"MIME-Version: 1.0\n" |
2303 | +"Content-Type: text/plain; charset=UTF-8\n" |
2304 | +"Content-Transfer-Encoding: 8bit\n" |
2305 | +"Plural-Forms: \n" |
2306 | + |
2307 | +#. module: sale_double_validation |
2308 | +#: sql_constraint:sale.order:0 |
2309 | +msgid "Order Reference must be unique !" |
2310 | +msgstr "Il riferimento ordine deve essere unico!" |
2311 | + |
2312 | +#. module: sale_double_validation |
2313 | +#: model:ir.module.module,description:sale_double_validation.module_meta_information |
2314 | +msgid "" |
2315 | +"\n" |
2316 | +" This module modifies the sale workflow adding a validation step before the sale order confirmation.\n" |
2317 | +" " |
2318 | +msgstr "" |
2319 | +"\n" |
2320 | +" This module modifies the sale workflow adding a validation step before the sale order confirmation.\n" |
2321 | +" " |
2322 | + |
2323 | +#. module: sale_double_validation |
2324 | +#: view:sale.order:0 |
2325 | +msgid "Quotation Accepted" |
2326 | +msgstr "Preventivo Accettato" |
2327 | + |
2328 | +#. module: sale_double_validation |
2329 | +#: model:ir.module.module,shortdesc:sale_double_validation.module_meta_information |
2330 | +msgid "Double validation for sale orders" |
2331 | +msgstr "Doppia validazione per gli ordini di vendita" |
2332 | + |
2333 | +#. module: sale_double_validation |
2334 | +#: view:sale.order:0 |
2335 | +msgid "Confirm Order" |
2336 | +msgstr "Conferma Ordine" |
2337 | + |
2338 | +#. module: sale_double_validation |
2339 | +#: model:ir.model,name:sale_double_validation.model_sale_order |
2340 | +msgid "Sales Order" |
2341 | +msgstr "Ordine di vendita" |
2342 | + |
2343 | +#. module: sale_double_validation |
2344 | +#: view:sale.order:0 |
2345 | +msgid "Cancel Order" |
2346 | +msgstr "Annulla Ordine" |
2347 | + |
2348 | |
2349 | === added file 'sale_double_validation/sale.py' |
2350 | --- sale_double_validation/sale.py 1970-01-01 00:00:00 +0000 |
2351 | +++ sale_double_validation/sale.py 2012-05-21 16:22:21 +0000 |
2352 | @@ -0,0 +1,46 @@ |
2353 | +# -*- coding: utf-8 -*- |
2354 | +############################################################################## |
2355 | +# |
2356 | +# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
2357 | +# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>) |
2358 | +# All Rights Reserved |
2359 | +# |
2360 | +# This program is free software: you can redistribute it and/or modify |
2361 | +# it under the terms of the GNU Affero General Public License as published |
2362 | +# by the Free Software Foundation, either version 3 of the License, or |
2363 | +# (at your option) any later version. |
2364 | +# |
2365 | +# This program is distributed in the hope that it will be useful, |
2366 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2367 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2368 | +# GNU General Public License for more details. |
2369 | +# |
2370 | +# You should have received a copy of the GNU Affero General Public License |
2371 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2372 | +# |
2373 | +############################################################################## |
2374 | + |
2375 | +from osv import fields, osv |
2376 | + |
2377 | +class sale_order(osv.osv): |
2378 | + _inherit = "sale.order" |
2379 | + |
2380 | + _columns = { |
2381 | + 'state': fields.selection([ |
2382 | + ('draft', 'Quotation'), |
2383 | + ('waiting_resp', 'Waiting Responsible'), |
2384 | + ('waiting_date', 'Waiting Schedule'), |
2385 | + ('manual', 'Manual In Progress'), |
2386 | + ('progress', 'In Progress'), |
2387 | + ('shipping_except', 'Shipping Exception'), |
2388 | + ('invoice_except', 'Invoice Exception'), |
2389 | + ('done', 'Done'), |
2390 | + ('cancel', 'Cancelled') |
2391 | + ], 'Order State', readonly=True, help="Gives the state of the quotation or sales order. \nThe exception state is automatically set when a cancel operation occurs in the invoice validation (Invoice Exception) or in the picking list process (Shipping Exception). \nThe 'Waiting Schedule' state is set when the invoice is confirmed but waiting for the scheduler to run on the date 'Ordered Date'.", select=True), |
2392 | + } |
2393 | + |
2394 | + def waiting_responsible(self, cr, uid, ids, context=None): |
2395 | + self.write(cr, uid, ids, {'state': 'waiting_resp'}) |
2396 | + return True |
2397 | + |
2398 | +sale_order() |
2399 | |
2400 | === added file 'sale_double_validation/sale_view.xml' |
2401 | --- sale_double_validation/sale_view.xml 1970-01-01 00:00:00 +0000 |
2402 | +++ sale_double_validation/sale_view.xml 2012-05-21 16:22:21 +0000 |
2403 | @@ -0,0 +1,20 @@ |
2404 | +<?xml version="1.0" encoding="utf-8"?> |
2405 | +<openerp> |
2406 | + <data> |
2407 | + <record id="view_order_form" model="ir.ui.view"> |
2408 | + <field name="name">sale.order.form</field> |
2409 | + <field name="model">sale.order</field> |
2410 | + <field name="type">form</field> |
2411 | + <field name="inherit_id" ref="sale.view_order_form"></field> |
2412 | + <field name="arch" type="xml"> |
2413 | + <button name="order_confirm" position="replace"> |
2414 | + <button name="order_confirm" states="waiting_resp" string="Confirm Order" icon="gtk-apply"/> |
2415 | + <button name="waiting_responsible" states="draft" string="Quotation Accepted" icon="gtk-apply"/> |
2416 | + </button> |
2417 | + <button name="cancel" position="replace" > |
2418 | + <button name="cancel" states="draft,waiting_resp" string="Cancel Order" icon="gtk-cancel"/> |
2419 | + </button> |
2420 | + </field> |
2421 | + </record> |
2422 | + </data> |
2423 | +</openerp> |
2424 | |
2425 | === added file 'sale_double_validation/sale_workflow.xml' |
2426 | --- sale_double_validation/sale_workflow.xml 1970-01-01 00:00:00 +0000 |
2427 | +++ sale_double_validation/sale_workflow.xml 2012-05-21 16:22:21 +0000 |
2428 | @@ -0,0 +1,31 @@ |
2429 | +<?xml version="1.0" encoding="utf-8"?> |
2430 | +<openerp> |
2431 | + <data> |
2432 | + <record id="act_waiting_responsible" model="workflow.activity"> |
2433 | + <field name="wkf_id" ref="sale.wkf_sale"/> |
2434 | + <field name="name">waiting_responsible</field> |
2435 | + <field name="action">waiting_responsible()</field> |
2436 | + <field name="kind">function</field> |
2437 | + </record> |
2438 | + |
2439 | + <record id="sale.trans_draft_router" model="workflow.transition"> |
2440 | + <field name="act_from" ref="sale.act_draft"/> |
2441 | + <field name="act_to" ref="act_waiting_responsible"/> |
2442 | + <field name="signal">waiting_responsible</field> |
2443 | + </record> |
2444 | + |
2445 | + <record id="trans_waiting_router" model="workflow.transition"> |
2446 | + <field name="act_from" ref="act_waiting_responsible"/> |
2447 | + <field name="act_to" ref="sale.act_router"/> |
2448 | + <field name="signal">order_confirm</field> |
2449 | + <field name="group_id" ref="base.group_sale_manager"/> |
2450 | + </record> |
2451 | + |
2452 | + <record id="trans_waiting_cancel" model="workflow.transition"> |
2453 | + <field name="act_from" ref="act_waiting_responsible"/> |
2454 | + <field name="act_to" ref="sale.act_cancel"/> |
2455 | + <field name="signal">cancel</field> |
2456 | + <field name="group_id" ref="base.group_sale_manager"/> |
2457 | + </record> |
2458 | + </data> |
2459 | +</openerp> |
2460 | |
2461 | === added directory 'sale_double_validation/security' |
2462 | === added directory 'super_calendar' |
2463 | === renamed directory 'super_calendar' => 'super_calendar.moved' |
2464 | === added file 'super_calendar/AUTHORS.txt' |
2465 | --- super_calendar/AUTHORS.txt 1970-01-01 00:00:00 +0000 |
2466 | +++ super_calendar/AUTHORS.txt 2012-05-21 16:22:21 +0000 |
2467 | @@ -0,0 +1,1 @@ |
2468 | +Lorenzo Battistini <lorenzo.battistini@agilebg.com> |
2469 | |
2470 | === added file 'super_calendar/__init__.py' |
2471 | --- super_calendar/__init__.py 1970-01-01 00:00:00 +0000 |
2472 | +++ super_calendar/__init__.py 2012-05-21 16:22:21 +0000 |
2473 | @@ -0,0 +1,22 @@ |
2474 | +# -*- coding: utf-8 -*- |
2475 | +############################################################################## |
2476 | +# |
2477 | +# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
2478 | +# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>) |
2479 | +# All Rights Reserved |
2480 | +# |
2481 | +# This program is free software: you can redistribute it and/or modify |
2482 | +# it under the terms of the GNU Affero General Public License as published |
2483 | +# by the Free Software Foundation, either version 3 of the License, or |
2484 | +# (at your option) any later version. |
2485 | +# |
2486 | +# This program is distributed in the hope that it will be useful, |
2487 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2488 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2489 | +# GNU General Public License for more details. |
2490 | +# |
2491 | +# You should have received a copy of the GNU Affero General Public License |
2492 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2493 | +# |
2494 | +############################################################################## |
2495 | +import super_calendar |
2496 | |
2497 | === added file 'super_calendar/__openerp__.py' |
2498 | --- super_calendar/__openerp__.py 1970-01-01 00:00:00 +0000 |
2499 | +++ super_calendar/__openerp__.py 2012-05-21 16:22:21 +0000 |
2500 | @@ -0,0 +1,46 @@ |
2501 | +# -*- coding: utf-8 -*- |
2502 | +############################################################################## |
2503 | +# |
2504 | +# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
2505 | +# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>) |
2506 | +# All Rights Reserved |
2507 | +# |
2508 | +# This program is free software: you can redistribute it and/or modify |
2509 | +# it under the terms of the GNU Affero General Public License as published |
2510 | +# by the Free Software Foundation, either version 3 of the License, or |
2511 | +# (at your option) any later version. |
2512 | +# |
2513 | +# This program is distributed in the hope that it will be useful, |
2514 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2515 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2516 | +# GNU General Public License for more details. |
2517 | +# |
2518 | +# You should have received a copy of the GNU Affero General Public License |
2519 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2520 | +# |
2521 | +############################################################################## |
2522 | +{ |
2523 | + 'name': "Super Calendar", |
2524 | + 'version': '0.1', |
2525 | + 'category': 'Generic Modules/Others', |
2526 | + 'description': """ |
2527 | + This module allows to create configurable calendars. |
2528 | + |
2529 | + Through the 'calendar configurator' object, you can specify which models have to be merged in the super calendar. For each model, you have to define the 'description' and 'date_start' fields at least. Then you can define 'duration' and the 'user_id' fields. |
2530 | + |
2531 | + The 'super.calendar' object contains the the merged calendars. The 'super.calendar' can be updated by 'ir.cron' or manually. |
2532 | + """, |
2533 | + 'author': 'Agile Business Group & Domsense', |
2534 | + 'website': 'http://www.agilebg.com', |
2535 | + 'license': 'AGPL-3', |
2536 | + "depends" : ['base'], |
2537 | + "init_xml" : [], |
2538 | + "update_xml" : [ |
2539 | + 'super_calendar_view.xml', |
2540 | + 'cron_data.xml', |
2541 | + 'security/ir.model.access.csv', |
2542 | + ], |
2543 | + "demo_xml" : [], |
2544 | + "active": False, |
2545 | + "installable": True |
2546 | +} |
2547 | |
2548 | === added file 'super_calendar/cron_data.xml' |
2549 | --- super_calendar/cron_data.xml 1970-01-01 00:00:00 +0000 |
2550 | +++ super_calendar/cron_data.xml 2012-05-21 16:22:21 +0000 |
2551 | @@ -0,0 +1,13 @@ |
2552 | +<?xml version="1.0"?> |
2553 | +<openerp> |
2554 | + <data noupdate="1"> |
2555 | + <record model="ir.cron" id="generate_calendar_records_cron"> |
2556 | + <field name="name">Generate Calendar Records</field> |
2557 | + <field name="interval_number">10</field> |
2558 | + <field name="interval_type">minutes</field> |
2559 | + <field eval="'super.calendar.configurator'" name="model"/> |
2560 | + <field eval="'generate_calendar_records'" name="function"/> |
2561 | + <field eval="'[[],{}]'" name="args"/> |
2562 | + </record> |
2563 | + </data> |
2564 | +</openerp> |
2565 | |
2566 | === added directory 'super_calendar/i18n' |
2567 | === added directory 'super_calendar/security' |
2568 | === added file 'super_calendar/security/ir.model.access.csv' |
2569 | --- super_calendar/security/ir.model.access.csv 1970-01-01 00:00:00 +0000 |
2570 | +++ super_calendar/security/ir.model.access.csv 2012-05-21 16:22:21 +0000 |
2571 | @@ -0,0 +1,4 @@ |
2572 | +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
2573 | +access_model_super_calendar_configurator,access_model_super_calendar_configurator,model_super_calendar_configurator,base.group_system,1,1,1,1 |
2574 | +access_model_super_calendar_configurator_line,access_model_super_calendar_configurator_line,model_super_calendar_configurator_line,base.group_system,1,1,1,1 |
2575 | +access_model_super_calendar,access_model_super_calendar,model_super_calendar,base.group_user,1,0,0,0 |
2576 | |
2577 | === added file 'super_calendar/super_calendar.py' |
2578 | --- super_calendar/super_calendar.py 1970-01-01 00:00:00 +0000 |
2579 | +++ super_calendar/super_calendar.py 2012-05-21 16:22:21 +0000 |
2580 | @@ -0,0 +1,116 @@ |
2581 | +# -*- coding: utf-8 -*- |
2582 | +############################################################################## |
2583 | +# |
2584 | +# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
2585 | +# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>) |
2586 | +# All Rights Reserved |
2587 | +# |
2588 | +# This program is free software: you can redistribute it and/or modify |
2589 | +# it under the terms of the GNU Affero General Public License as published |
2590 | +# by the Free Software Foundation, either version 3 of the License, or |
2591 | +# (at your option) any later version. |
2592 | +# |
2593 | +# This program is distributed in the hope that it will be useful, |
2594 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2595 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2596 | +# GNU General Public License for more details. |
2597 | +# |
2598 | +# You should have received a copy of the GNU Affero General Public License |
2599 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2600 | +# |
2601 | +############################################################################## |
2602 | + |
2603 | +from osv import fields, osv |
2604 | +from tools.translate import _ |
2605 | +import netsvc |
2606 | + |
2607 | +def _models_get(self, cr, uid, context={}): |
2608 | + obj = self.pool.get('ir.model') |
2609 | + ids = obj.search(cr, uid, []) |
2610 | + res = obj.read(cr, uid, ids, ['model', 'name'], context) |
2611 | + return [(r['model'], r['name']) for r in res] |
2612 | + |
2613 | +class super_calendar_configurator(osv.osv): |
2614 | + _logger = netsvc.Logger() |
2615 | + _name = 'super.calendar.configurator' |
2616 | + _columns = { |
2617 | + 'name': fields.char('Name', size=64, required=True), |
2618 | + 'line_ids': fields.one2many('super.calendar.configurator.line', 'configurator_id', 'Lines'), |
2619 | + } |
2620 | + |
2621 | + def generate_calendar_records(self, cr, uid, ids, context=None): |
2622 | + configurator_ids = self.search(cr, uid, []) |
2623 | + super_calendar_pool = self.pool.get('super.calendar') |
2624 | + |
2625 | + # removing old records |
2626 | + super_calendar_ids = super_calendar_pool.search(cr, uid, []) |
2627 | + super_calendar_pool.unlink(cr, uid, super_calendar_ids) |
2628 | + |
2629 | + for configurator_id in configurator_ids: |
2630 | + configurator = self.browse(cr, uid, configurator_id) |
2631 | + for line in configurator.line_ids: |
2632 | + current_pool = self.pool.get(line.name.model) |
2633 | + current_record_ids = current_pool.search(cr, uid, line.domain and eval(line.domain) or []) |
2634 | + for current_record_id in current_record_ids: |
2635 | + current_record = current_pool.browse(cr, uid, current_record_id) |
2636 | + if line.user_field_id and \ |
2637 | + current_record[line.user_field_id.name]._table_name != 'res.users': |
2638 | + raise osv.except_osv(_('Error'), |
2639 | + _("The 'User' field of record %s (%s) does not refer to res.users") |
2640 | + % (current_record[line.description_field_id.name], line.name.model)) |
2641 | + if current_record[line.description_field_id.name] \ |
2642 | + and current_record[line.date_start_field_id.name]: |
2643 | + super_calendar_values = { |
2644 | + 'name': current_record[line.description_field_id.name], |
2645 | + 'date_start': current_record[line.date_start_field_id.name], |
2646 | + #'date_stop': line.date_stop_field_id and current_record[line.date_stop_field_id.name] or False, |
2647 | + 'duration': line.duration_field_id and current_record[line.duration_field_id.name] \ |
2648 | + or False, |
2649 | + 'user_id': line.user_field_id and current_record[line.user_field_id.name] and current_record[line.user_field_id.name].id or False, |
2650 | + 'configurator_id': configurator.id, |
2651 | + 'res_id': line.name.model+','+str(current_record['id']), |
2652 | + 'model_id': line.name.id, |
2653 | + } |
2654 | + super_calendar_pool.create(cr, uid, super_calendar_values) |
2655 | + self._logger.notifyChannel('super_calendar', netsvc.LOG_INFO, "Calendar generated") |
2656 | + return True |
2657 | + |
2658 | +super_calendar_configurator() |
2659 | + |
2660 | +class super_calendar_configurator_line(osv.osv): |
2661 | + _name = 'super.calendar.configurator.line' |
2662 | + _columns = { |
2663 | + 'name': fields.many2one('ir.model', 'Model', required=True), |
2664 | + 'domain': fields.char('Domain', size=512), |
2665 | + 'configurator_id': fields.many2one('super.calendar.configurator', 'Configurator'), |
2666 | + 'description_field_id': fields.many2one('ir.model.fields', 'Description field', |
2667 | + domain="[('model_id', '=', name),('ttype', '=', 'char')]", required=True), |
2668 | + 'date_start_field_id': fields.many2one('ir.model.fields', 'Start date field', |
2669 | + domain="['&',('ttype', '=', 'datetime'),('model_id', '=', name)]", |
2670 | + required=True), |
2671 | +# 'date_stop_field_id': fields.many2one('ir.model.fields', 'End date field', |
2672 | +# domain="['&',('ttype', '=', 'datetime'),('model_id', '=', name)]"), |
2673 | + 'duration_field_id': fields.many2one('ir.model.fields', 'Duration field', |
2674 | + domain="['&',('ttype', '=', 'float'),('model_id', '=', name)]"), |
2675 | + 'user_field_id': fields.many2one('ir.model.fields', 'User field', |
2676 | + domain="['&',('ttype', '=', 'many2one'),('model_id', '=', name)]"), |
2677 | + } |
2678 | + # False. The same object can have several dates |
2679 | + #_sql_constraints = [ |
2680 | + # ('name', 'unique(configurator_id,name)', 'The model must be unique per configurator' ) |
2681 | + # ] |
2682 | +super_calendar_configurator_line() |
2683 | + |
2684 | +class super_calendar(osv.osv): |
2685 | + _name = 'super.calendar' |
2686 | + _columns = { |
2687 | + 'name': fields.char('Description', size=64, required=True), |
2688 | + 'date_start':fields.datetime('Start date', required=True), |
2689 | + #'date_stop':fields.datetime('End date'), # to be removed? |
2690 | + 'duration':fields.float('Duration'), |
2691 | + 'user_id': fields.many2one('res.users', 'User'), |
2692 | + 'configurator_id': fields.many2one('super.calendar.configurator', 'Configurator'), |
2693 | + 'res_id': fields.reference('Resource', selection=_models_get, size=128), |
2694 | + 'model_id': fields.many2one('ir.model', 'Model'), |
2695 | + } |
2696 | +super_calendar() |
2697 | |
2698 | === added file 'super_calendar/super_calendar_view.xml' |
2699 | --- super_calendar/super_calendar_view.xml 1970-01-01 00:00:00 +0000 |
2700 | +++ super_calendar/super_calendar_view.xml 2012-05-21 16:22:21 +0000 |
2701 | @@ -0,0 +1,135 @@ |
2702 | +<?xml version="1.0"?> |
2703 | +<openerp> |
2704 | + <data> |
2705 | + |
2706 | + <!-- configurator --> |
2707 | + |
2708 | + <record model="ir.ui.view" id="super_calendar_configurator_tree"> |
2709 | + <field name="name">super_calendar_configurator_tree</field> |
2710 | + <field name="model">super.calendar.configurator</field> |
2711 | + <field name="type">tree</field> |
2712 | + <field name="arch" type="xml"> |
2713 | + <tree string="Configurators"> |
2714 | + <field name="name"/> |
2715 | + </tree> |
2716 | + </field> |
2717 | + </record> |
2718 | + <record model="ir.ui.view" id="super_calendar_configurator_form"> |
2719 | + <field name="name">super_calendar_configurator_form</field> |
2720 | + <field name="model">super.calendar.configurator</field> |
2721 | + <field name="type">form</field> |
2722 | + <field name="arch" type="xml"> |
2723 | + <form string="Configurator"> |
2724 | + <field name="name" select="1" colspan="2"/> |
2725 | + <newline/> |
2726 | + <field name="line_ids" nolabel="1" colspan="4"> |
2727 | + <tree string="Lines"> |
2728 | + <field name="name"/> |
2729 | + <field name="domain"/> |
2730 | + </tree> |
2731 | + <form string="Line"> |
2732 | + <field name="name"/> |
2733 | + <field name="domain"/> |
2734 | + <field name="description_field_id"/> |
2735 | + <field name="date_start_field_id"/> |
2736 | + <!--<field name="date_stop_field_id"/>--> |
2737 | + <field name="duration_field_id"/> |
2738 | + <field name="user_field_id"/> |
2739 | + </form> |
2740 | + </field> |
2741 | + <newline/> |
2742 | + <button name="generate_calendar_records" string="Generate Calendar" type="object" icon="gtk-go-forward" colspan="2"/> |
2743 | + </form> |
2744 | + </field> |
2745 | + </record> |
2746 | + |
2747 | + <record model="ir.actions.act_window" id="super_calendar_configurator"> |
2748 | + <field name="name">Calendar Configurators</field> |
2749 | + <field name="res_model">super.calendar.configurator</field> |
2750 | + <field name="view_type">form</field> |
2751 | + <field name="view_mode">tree,form</field> |
2752 | + <field name="view_id" ref="super_calendar_configurator_tree"/> |
2753 | + </record> |
2754 | + |
2755 | + <!-- calendar --> |
2756 | + |
2757 | + <record model="ir.ui.view" id="super_calendar_tree"> |
2758 | + <field name="name">super_calendar_tree</field> |
2759 | + <field name="model">super.calendar</field> |
2760 | + <field name="type">tree</field> |
2761 | + <field name="arch" type="xml"> |
2762 | + <tree string="Calendar"> |
2763 | + <field name="name"/> |
2764 | + <field name="date_start"/> |
2765 | + <!--<field name="date_stop"/>--> |
2766 | + <field name="duration"/> |
2767 | + <field name="user_id"/> |
2768 | + <field name="configurator_id"/> |
2769 | + <field name="model_id"/> |
2770 | + </tree> |
2771 | + </field> |
2772 | + </record> |
2773 | + <record model="ir.ui.view" id="super_calendar_form"> |
2774 | + <field name="name">super_calendar_form</field> |
2775 | + <field name="model">super.calendar</field> |
2776 | + <field name="type">form</field> |
2777 | + <field name="arch" type="xml"> |
2778 | + <form string="Configurator"> |
2779 | + <field name="name" readonly="1"/> |
2780 | + <field name="date_start" readonly="1"/> |
2781 | + <!--<field name="date_stop" readonly="1"/>--> |
2782 | + <field name="duration" readonly="1"/> |
2783 | + <field name="user_id" readonly="1"/> |
2784 | + <field name="configurator_id" readonly="1"/> |
2785 | + <field name="model_id" readonly="1"/> |
2786 | + <field name="res_id"/> |
2787 | + </form> |
2788 | + </field> |
2789 | + </record> |
2790 | + <record model="ir.ui.view" id="super_calendar"> |
2791 | + <field name="name">super_calendar</field> |
2792 | + <field name="model">super.calendar</field> |
2793 | + <field name="type">calendar</field> |
2794 | + <field name="arch" type="xml"> |
2795 | + <calendar string="Calendar" color="model_id" date_start="date_start" date_delay="duration"> |
2796 | + <field name="name"/> |
2797 | + </calendar> |
2798 | + </field> |
2799 | + </record> |
2800 | + <record model="ir.ui.view" id="super_calendar_search"> |
2801 | + <field name="name">super_calendar_search</field> |
2802 | + <field name="model">super.calendar</field> |
2803 | + <field name="type">search</field> |
2804 | + <field name="arch" type="xml"> |
2805 | + <search string="Search Calendar" > |
2806 | + <field name="name"/> |
2807 | + <field name="configurator_id" select="1"/> |
2808 | + <field name="model_id" select="1"/> |
2809 | + <field name="user_id" select="1"> |
2810 | + <filter domain="[('user_id','=',uid)]" help="My Items" icon="terp-personal"/> |
2811 | + </field> |
2812 | + <newline/> |
2813 | + <group expand="0" string="Extended Filters..." colspan="4" col="8"> |
2814 | + <field name="date_start" /> |
2815 | + <!--<field name="date_stop" />--> |
2816 | + <field name="duration" /> |
2817 | + </group> |
2818 | + </search> |
2819 | + </field> |
2820 | + </record> |
2821 | + |
2822 | + <record model="ir.actions.act_window" id="super_calendar_action"> |
2823 | + <field name="name">Super Calendar</field> |
2824 | + <field name="res_model">super.calendar</field> |
2825 | + <field name="view_type">form</field> |
2826 | + <field name="view_mode">calendar,tree,form</field> |
2827 | + <field name="view_id" ref="super_calendar"/> |
2828 | + </record> |
2829 | + |
2830 | + <menuitem id="super_calendar_menu" name="Super Calendar" /> |
2831 | + <menuitem id="super_calendar_calendar" name="Calendar" parent="super_calendar_menu" /> |
2832 | + <menuitem id="super_calendar_calendar_calendar" name="Calendar" parent="super_calendar_calendar" action="super_calendar_action"/> |
2833 | + <menuitem id="super_calendar_configuration" name="Configuration" parent="super_calendar_menu" /> |
2834 | + <menuitem id="super_calendar_configurators" name="Configurators" parent="super_calendar_configuration" action="super_calendar_configurator"/> |
2835 | + </data> |
2836 | +</openerp> |
Conflicts, let's do that again )