Merge lp:~vauxoo/addons-vauxoo/addons-vauxoo-6.1-mrp_production_analytic_acc-dev_rodo into lp:addons-vauxoo/6.1
- addons-vauxoo-6.1-mrp_production_analytic_acc-dev_rodo
- Merge into 6.1
Proposed by
Rodolfo Lopez
Status: | Merged |
---|---|
Merged at revision: | 515 |
Proposed branch: | lp:~vauxoo/addons-vauxoo/addons-vauxoo-6.1-mrp_production_analytic_acc-dev_rodo |
Merge into: | lp:addons-vauxoo/6.1 |
Diff against target: |
394 lines (+353/-0) 8 files modified
mrp_production_analytic_acc/__init__.py (+27/-0) mrp_production_analytic_acc/__openerp__.py (+43/-0) mrp_production_analytic_acc/mrp.py (+55/-0) mrp_production_analytic_acc/mrp_view.xml (+83/-0) mrp_production_analytic_acc/patch/mrp_analytic.patch (+28/-0) mrp_production_analytic_acc/patch/stock_analytic.patch (+19/-0) mrp_production_analytic_acc/stock.py (+34/-0) mrp_production_analytic_acc/stock_view.xml (+64/-0) |
To merge this branch: | bzr merge lp:~vauxoo/addons-vauxoo/addons-vauxoo-6.1-mrp_production_analytic_acc-dev_rodo |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Moisés López - http://www.vauxoo.com | Pending | ||
Review via email:
|
Commit message
Description of the change
[ADD][mrp_
To post a comment you must log in.
- 515. By Rodolfo Lopez
-
[ADD][mrp_
production_ analytic_ acc] analytic account in move in production and analytic account in entries of production
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'mrp_production_analytic_acc' |
2 | === added file 'mrp_production_analytic_acc/__init__.py' |
3 | --- mrp_production_analytic_acc/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ mrp_production_analytic_acc/__init__.py 2012-10-16 16:39:20 +0000 |
5 | @@ -0,0 +1,27 @@ |
6 | +# -*- coding: utf-8 -*- |
7 | +########################################################################### |
8 | +# Module Writen to OpenERP, Open Source Management Solution |
9 | +# |
10 | +# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com |
11 | +# All Rights Reserved. |
12 | +# info@vauxoo.com |
13 | +############################################################################ |
14 | +# Coded by: Luis Torres (luis_t@vauxoo.com) |
15 | +############################################################################ |
16 | +# |
17 | +# This program is free software: you can redistribute it and/or modify |
18 | +# it under the terms of the GNU Affero General Public License as |
19 | +# published by the Free Software Foundation, either version 3 of the |
20 | +# License, or (at your option) any later version. |
21 | +# |
22 | +# This program is distributed in the hope that it will be useful, |
23 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
24 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
25 | +# GNU Affero General Public License for more details. |
26 | +# |
27 | +# You should have received a copy of the GNU Affero General Public License |
28 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
29 | +# |
30 | +############################################################################## |
31 | +import stock |
32 | +import mrp |
33 | |
34 | === added file 'mrp_production_analytic_acc/__openerp__.py' |
35 | --- mrp_production_analytic_acc/__openerp__.py 1970-01-01 00:00:00 +0000 |
36 | +++ mrp_production_analytic_acc/__openerp__.py 2012-10-16 16:39:20 +0000 |
37 | @@ -0,0 +1,43 @@ |
38 | +# -*- coding: utf-8 -*- |
39 | +########################################################################### |
40 | +# Module Writen to OpenERP, Open Source Management Solution |
41 | +# |
42 | +# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com |
43 | +# All Rights Reserved. |
44 | +# info@vauxoo.com |
45 | +############################################################################ |
46 | +# Coded by: Luis torres (luis_t@vauxoo.com) |
47 | +# Rodo (rodo@vauxoo.com) |
48 | +############################################################################ |
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 |
52 | +# published by the Free Software Foundation, either version 3 of the |
53 | +# License, or (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 Affero 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': 'mrp account analytics', |
66 | + "version" : "1.1", |
67 | + 'author': 'Vauxoo', |
68 | + "category" : "analytic production", |
69 | + 'depends': ['stock','account','mrp'], |
70 | + 'description': """ |
71 | + Added field for account analitic |
72 | + """, |
73 | + 'update_xml':[ |
74 | + 'stock_view.xml', |
75 | + 'mrp_view.xml', |
76 | + ], |
77 | + 'active': False, |
78 | + 'installable': True |
79 | +} |
80 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
81 | |
82 | === added file 'mrp_production_analytic_acc/mrp.py' |
83 | --- mrp_production_analytic_acc/mrp.py 1970-01-01 00:00:00 +0000 |
84 | +++ mrp_production_analytic_acc/mrp.py 2012-10-16 16:39:20 +0000 |
85 | @@ -0,0 +1,55 @@ |
86 | +# -*- coding: utf-8 -*- |
87 | +########################################################################### |
88 | +# Module Writen to OpenERP, Open Source Management Solution |
89 | +# |
90 | +# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com |
91 | +# All Rights Reserved. |
92 | +# info@vauxoo.com |
93 | +############################################################################ |
94 | +# Coded by: Luis Torres (luis_t@vauxoo.com),Rodo (rodo@vauxoo.com) |
95 | +############################################################################ |
96 | +# |
97 | +# This program is free software: you can redistribute it and/or modify |
98 | +# it under the terms of the GNU Affero General Public License as |
99 | +# published by the Free Software Foundation, either version 3 of the |
100 | +# License, or (at your option) any later version. |
101 | +# |
102 | +# This program is distributed in the hope that it will be useful, |
103 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
104 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
105 | +# GNU Affero General Public License for more details. |
106 | +# |
107 | +# You should have received a copy of the GNU Affero General Public License |
108 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
109 | +# |
110 | +############################################################################## |
111 | +from osv import fields, osv |
112 | + |
113 | +class mrp_production(osv.osv): |
114 | + _inherit= "mrp.production" |
115 | + |
116 | + def product_id_change(self, cr, uid, ids, product_id, context=None): |
117 | + bom_obj=self.pool.get('mrp.bom') |
118 | + res=super(mrp_production, self).product_id_change(cr, uid, ids,product_id,context=None) |
119 | + bom=bom_obj.browse(cr,uid,[res['value']['bom_id']],context=context) |
120 | + res['value']['analytic_acc_rm']=bom and bom[0].analytic_acc_rm.id or False |
121 | + res['value']['analytic_acc_fg']=bom and bom[0].analytic_acc_fg.id or False |
122 | + return res |
123 | + |
124 | + _columns={ |
125 | + 'analytic_acc_rm': fields.many2one('account.analytic.account','Analytic Account RM',), |
126 | + 'analytic_acc_fg': fields.many2one('account.analytic.account','Analytic Account FG',) |
127 | + } |
128 | + |
129 | + |
130 | +class mrp_bom(osv.osv): |
131 | + _inherit= "mrp.bom" |
132 | + |
133 | + |
134 | + |
135 | + _columns={ |
136 | + 'analytic_acc_rm': fields.many2one('account.analytic.account','Analytic Account RM',), |
137 | + 'analytic_acc_fg': fields.many2one('account.analytic.account','Analytic Account FG',) |
138 | + } |
139 | + |
140 | + |
141 | |
142 | === added file 'mrp_production_analytic_acc/mrp_view.xml' |
143 | --- mrp_production_analytic_acc/mrp_view.xml 1970-01-01 00:00:00 +0000 |
144 | +++ mrp_production_analytic_acc/mrp_view.xml 2012-10-16 16:39:20 +0000 |
145 | @@ -0,0 +1,83 @@ |
146 | +<?xml version="1.0" encoding="utf-8"?> |
147 | +<openerp> |
148 | + <data> |
149 | + <record model="ir.ui.view" id="view_mrp_bom_inherit_analytic_acc_form"> |
150 | + <field name="name">view.mrp.bom.inherit.analytic.acc.form</field> |
151 | + <field name="model">mrp.bom</field> |
152 | + <field name="type">form</field> |
153 | + <field name="inherit_id" ref="mrp.mrp_bom_form_view"/> |
154 | + <field name="arch" type="xml"> |
155 | + <field name="company_id" position="after"> |
156 | + <field name="analytic_acc_rm" select="2"/> |
157 | + <field name="analytic_acc_fg" select="2"/> |
158 | + </field> |
159 | + </field> |
160 | + </record> |
161 | + |
162 | + |
163 | + <record model="ir.ui.view" id="view_mrp_production_inherit_analytic_acc_form2"> |
164 | + <field name="name">view.mrp.production.inherit.analytic.acc.form2</field> |
165 | + <field name="model">mrp.production</field> |
166 | + <field name="type">form</field> |
167 | + <field name="inherit_id" ref="mrp.mrp_production_form_view"/> |
168 | + <field name="arch" type="xml"> |
169 | + <field name="location_dest_id" position="after"> |
170 | + <field name="analytic_acc_rm" select="2"/> |
171 | + <field name="analytic_acc_fg" select="2"/> |
172 | + </field> |
173 | + </field> |
174 | + </record> |
175 | + |
176 | + |
177 | + <record model="ir.ui.view" id="view_mrp_production_inherit_analytic_acc_tree"> |
178 | + <field name="name">view.mrp.production.inherit.analytic.acc.tree</field> |
179 | + <field name="model">mrp.production</field> |
180 | + <field name="type">form</field> |
181 | + <field name="inherit_id" ref="mrp.mrp_production_form_view"/> |
182 | + <field name="arch" type="xml"> |
183 | + <xpath expr="/form/notebook/page/field[@name='move_lines']/tree[@string='Products to Consume']/field[@name='location_id']" position="after"> |
184 | + <field name="analytic_acc" colspan="2"/> |
185 | + </xpath> |
186 | + </field> |
187 | + </record> |
188 | + |
189 | + <record model="ir.ui.view" id="view_mrp_production_consumed_inherit_analytic_acc_tree"> |
190 | + <field name="name">view.mrp.production.consumed.inherit.analytic.acc.tree</field> |
191 | + <field name="model">mrp.production</field> |
192 | + <field name="type">form</field> |
193 | + <field name="inherit_id" ref="mrp.mrp_production_form_view"/> |
194 | + <field name="arch" type="xml"> |
195 | + <xpath expr="/form/notebook/page/field[@name='move_lines2']/tree[@string='Consumed Products']/field[@name='prodlot_id']" position="after"> |
196 | + <field name="analytic_acc" colspan="2"/> |
197 | + </xpath> |
198 | + </field> |
199 | + </record> |
200 | + |
201 | + |
202 | + <record model="ir.ui.view" id="view_mrp_production_to_finish_inherit_analytic_acc_tree"> |
203 | + <field name="name">view.mrp.production.to.finish.inherit.analytic.acc.tree</field> |
204 | + <field name="model">mrp.production</field> |
205 | + <field name="type">form</field> |
206 | + <field name="inherit_id" ref="mrp.mrp_production_form_view"/> |
207 | + <field name="arch" type="xml"> |
208 | + <xpath expr="/form/notebook/page/field[@name='move_created_ids']/tree[@string='Products to Finish']/field[@name='product_uom']" position="after"> |
209 | + <field name="analytic_acc" colspan="2"/> |
210 | + </xpath> |
211 | + </field> |
212 | + </record> |
213 | + |
214 | + <record model="ir.ui.view" id="view_mrp_production_finish_inherit_analytic_acc_tree"> |
215 | + <field name="name">view.mrp.production.finish.inherit.analytic.acc.tree</field> |
216 | + <field name="model">mrp.production</field> |
217 | + <field name="type">form</field> |
218 | + <field name="inherit_id" ref="mrp.mrp_production_form_view"/> |
219 | + <field name="arch" type="xml"> |
220 | + <xpath expr="/form/notebook/page/field[@name='move_created_ids2']/tree[@string='Finished Products']/field[@name='prodlot_id']" position="after"> |
221 | + <field name="analytic_acc" colspan="2"/> |
222 | + </xpath> |
223 | + </field> |
224 | + </record> |
225 | + |
226 | + |
227 | + </data> |
228 | +</openerp> |
229 | |
230 | === added directory 'mrp_production_analytic_acc/patch' |
231 | === added file 'mrp_production_analytic_acc/patch/mrp_analytic.patch' |
232 | --- mrp_production_analytic_acc/patch/mrp_analytic.patch 1970-01-01 00:00:00 +0000 |
233 | +++ mrp_production_analytic_acc/patch/mrp_analytic.patch 2012-10-16 16:39:20 +0000 |
234 | @@ -0,0 +1,28 @@ |
235 | +=== modified file 'mrp/mrp.py' |
236 | +--- mrp/mrp.py 2012-10-05 10:44:47 +0000 |
237 | ++++ mrp/mrp.py 2012-10-16 16:26:16 +0000 |
238 | +@@ -913,6 +913,7 @@ |
239 | + 'location_dest_id': destination_location_id, |
240 | + 'state': 'waiting', |
241 | + 'company_id': production.company_id.id, |
242 | ++ 'analytic_acc': production.analytic_acc_rm and production.analytic_acc_rm.id or False, |
243 | + }) |
244 | + |
245 | + def _make_production_internal_shipment(self, cr, uid, production, context=None): |
246 | +@@ -964,6 +965,7 @@ |
247 | + 'move_dest_id': production.move_prod_id.id, |
248 | + 'state': 'waiting', |
249 | + 'company_id': production.company_id.id, |
250 | ++ 'analytic_acc': production.analytic_acc_fg and production.analytic_acc_fg.id or False, |
251 | + } |
252 | + move_id = stock_move.create(cr, uid, data, context=context) |
253 | + production.write({'move_created_ids': [(6, 0, [move_id])]}, context=context) |
254 | +@@ -992,6 +994,7 @@ |
255 | + 'move_dest_id': parent_move_id, |
256 | + 'state': 'waiting', |
257 | + 'company_id': production.company_id.id, |
258 | ++ 'analytic_acc': production.analytic_acc_rm and production.analytic_acc_rm.id or False, |
259 | + }) |
260 | + production.write({'move_lines': [(4, move_id)]}, context=context) |
261 | + return move_id |
262 | + |
263 | |
264 | === added file 'mrp_production_analytic_acc/patch/stock_analytic.patch' |
265 | --- mrp_production_analytic_acc/patch/stock_analytic.patch 1970-01-01 00:00:00 +0000 |
266 | +++ mrp_production_analytic_acc/patch/stock_analytic.patch 2012-10-16 16:39:20 +0000 |
267 | @@ -0,0 +1,19 @@ |
268 | +=== modified file 'stock/stock.py' |
269 | +--- stock/stock.py 2012-08-07 10:04:35 +0000 |
270 | ++++ stock/stock.py 2012-10-16 04:42:28 +0000 |
271 | +@@ -2277,6 +2277,7 @@ |
272 | + 'partner_id': partner_id, |
273 | + 'debit': reference_amount, |
274 | + 'account_id': dest_account_id, |
275 | ++ 'analytic_account_id': move.analytic_acc and move.analytic_acc.id or False, |
276 | + } |
277 | + credit_line_vals = { |
278 | + 'name': move.name, |
279 | +@@ -2287,6 +2288,7 @@ |
280 | + 'partner_id': partner_id, |
281 | + 'credit': reference_amount, |
282 | + 'account_id': src_account_id, |
283 | ++ 'analytic_account_id': move.analytic_acc and move.analytic_acc.id or False, |
284 | + } |
285 | + |
286 | + # if we are posting to accounts in a different currency, provide correct values in both currencies correctly |
287 | |
288 | === added file 'mrp_production_analytic_acc/stock.py' |
289 | --- mrp_production_analytic_acc/stock.py 1970-01-01 00:00:00 +0000 |
290 | +++ mrp_production_analytic_acc/stock.py 2012-10-16 16:39:20 +0000 |
291 | @@ -0,0 +1,34 @@ |
292 | +# -*- coding: utf-8 -*- |
293 | +########################################################################### |
294 | +# Module Writen to OpenERP, Open Source Management Solution |
295 | +# |
296 | +# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com |
297 | +# All Rights Reserved. |
298 | +# info@vauxoo.com |
299 | +############################################################################ |
300 | +# Coded by: Luis Torres (luis_t@vauxoo.com),Rodo (rodo@vauxoo.com) |
301 | +############################################################################ |
302 | +# |
303 | +# This program is free software: you can redistribute it and/or modify |
304 | +# it under the terms of the GNU Affero General Public License as |
305 | +# published by the Free Software Foundation, either version 3 of the |
306 | +# License, or (at your option) any later version. |
307 | +# |
308 | +# This program is distributed in the hope that it will be useful, |
309 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
310 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
311 | +# GNU Affero General Public License for more details. |
312 | +# |
313 | +# You should have received a copy of the GNU Affero General Public License |
314 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
315 | +# |
316 | +############################################################################## |
317 | +from osv import fields, osv |
318 | + |
319 | +class stock_move(osv.osv): |
320 | + _inherit= "stock.move" |
321 | + |
322 | + _columns={ |
323 | + 'analytic_acc': fields.many2one('account.analytic.account','Analytic Account',) |
324 | + } |
325 | + |
326 | |
327 | === added file 'mrp_production_analytic_acc/stock_view.xml' |
328 | --- mrp_production_analytic_acc/stock_view.xml 1970-01-01 00:00:00 +0000 |
329 | +++ mrp_production_analytic_acc/stock_view.xml 2012-10-16 16:39:20 +0000 |
330 | @@ -0,0 +1,64 @@ |
331 | +<?xml version="1.0" encoding="utf-8"?> |
332 | +<openerp> |
333 | + <data> |
334 | + <record model="ir.ui.view" id="view_stock_move_inc_inherit_analytic_acc_form"> |
335 | + <field name="name">view.stock.move.inc.inherit.analytic.acc.form</field> |
336 | + <field name="model">stock.move</field> |
337 | + <field name="type">form</field> |
338 | + <field name="inherit_id" ref="stock.view_move_form_reception_picking"/> |
339 | + <field name="arch" type="xml"> |
340 | + <xpath expr="/form/group/field[@name='address_id']" position="after"> |
341 | + <field name="analytic_acc" colspan="2"/> |
342 | + </xpath> |
343 | + </field> |
344 | + </record> |
345 | + |
346 | + <record model="ir.ui.view" id="view_stock_move_out_inherit_analytic_acc_form"> |
347 | + <field name="name">view.stock.move.out.inherit.analytic.acc.form</field> |
348 | + <field name="model">stock.move</field> |
349 | + <field name="type">form</field> |
350 | + <field name="inherit_id" ref="stock.view_move_form"/> |
351 | + <field name="arch" type="xml"> |
352 | + <xpath expr="/form/group/field[@name='address_id']" position="after"> |
353 | + <field name="analytic_acc" colspan="2"/> |
354 | + </xpath> |
355 | + </field> |
356 | + </record> |
357 | + |
358 | + <record model="ir.ui.view" id="view_stock_picking_out_inherit_analytic_acc_form"> |
359 | + <field name="name">view.stock.picking.out.inherit.analytic.acc.form</field> |
360 | + <field name="model">stock.picking</field> |
361 | + <field name="type">form</field> |
362 | + <field name="inherit_id" ref="stock.view_picking_out_form"/> |
363 | + <field name="arch" type="xml"> |
364 | + <xpath expr="/form/notebook/page/field[@name='move_lines']/form[@string='Stock Moves']/group/field[@name='location_dest_id']" position="after"> |
365 | + <field name="analytic_acc" colspan="2"/> |
366 | + </xpath> |
367 | + </field> |
368 | + </record> |
369 | + |
370 | + <record model="ir.ui.view" id="view_stock_move_lines_inc_inherit_analytic_acc_form"> |
371 | + <field name="name">view.stock.move.lines.inc.inherit.type.analytic.acc.form</field> |
372 | + <field name="model">stock.picking</field> |
373 | + <field name="type">form</field> |
374 | + <field name="inherit_id" ref="stock.view_picking_in_form"/> |
375 | + <field name="arch" type="xml"> |
376 | + <xpath expr="/form/notebook/page/field[@name='move_lines']/form[@string='Stock Moves']/group/field[@name='location_dest_id']" position="after"> |
377 | + <field name="analytic_acc" colspan="2"/> |
378 | + </xpath> |
379 | + </field> |
380 | + </record> |
381 | + |
382 | + <record model="ir.ui.view" id="view_stock_move_lines_int_inherit_analytic_acc_form"> |
383 | + <field name="name">view.stock.move.lines.int.inherit.analytic.acc.form</field> |
384 | + <field name="model">stock.picking</field> |
385 | + <field name="type">form</field> |
386 | + <field name="inherit_id" ref="stock.view_picking_form"/> |
387 | + <field name="arch" type="xml"> |
388 | + <xpath expr="/form/notebook/page/field[@name='move_lines']/form[@string='Stock Moves']/group/field[@name='location_dest_id']" position="after"> |
389 | + <field name="analytic_acc" colspan="2"/> |
390 | + </xpath> |
391 | + </field> |
392 | + </record> |
393 | + </data> |
394 | +</openerp> |