Merge lp:~vauxoo/addons-vauxoo/addons-vauxoo-mrp_production_wizard-dev-fernando into lp:addons-vauxoo/6.1
- addons-vauxoo-mrp_production_wizard-dev-fernando
- Merge into 6.1
Status: | Superseded |
---|---|
Proposed branch: | lp:~vauxoo/addons-vauxoo/addons-vauxoo-mrp_production_wizard-dev-fernando |
Merge into: | lp:addons-vauxoo/6.1 |
Diff against target: |
506 lines (+461/-0) 7 files modified
mrp_production_wizard/__init__.py (+27/-0) mrp_production_wizard/__openerp__.py (+47/-0) mrp_production_wizard/i18n/es_MX.po (+127/-0) mrp_production_wizard/mrp.py (+82/-0) mrp_production_wizard/mrp_view.xml (+52/-0) mrp_production_wizard/wizard/__init__.py (+26/-0) mrp_production_wizard/wizard/wizard.py (+100/-0) |
To merge this branch: | bzr merge lp:~vauxoo/addons-vauxoo/addons-vauxoo-mrp_production_wizard-dev-fernando |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Fernando Lopez (community) | Needs Resubmitting | ||
Isaac López Zúñiga | Pending | ||
Rodolfo Lopez | Pending | ||
Moisés López - http://www.vauxoo.com | Pending | ||
Review via email: mp+130615@code.launchpad.net |
This proposal has been superseded by a proposal from 2012-10-26.
Commit message
Description of the change
Se agregó un módulo que genera una orden de producción desde un wizard, el cual de datos de entrada pide el producto a producir, y los productos que se usarán como su lista de materiales, creando la orden de producción en estado draft y escribiendo en los o2m de productos planificados y productos planificados terminados los registros correspondientes.
Moisés López - http://www.vauxoo.com (moylop260) wrote : | # |
- 522. By Fernando Lopez
-
[IMP]Added functionality so it pulls the total quantity available of product on the wizard qty field.
Fernando Lopez (kyon) wrote : | # |
La cantidad del producto en el o2m ahora se llena con la existencia que hay actualmente.
Rodolfo Lopez (el-rodo-1) wrote : | # |
Una mejora Fer.
Al momento de generar la producción podrías abrir la vista de producciones mostrando la producción que se creo.
- 523. By Fernando Lopez
-
[IMP] Wizard now shows the view of the newly created production order.
- 524. By Fernando Lopez
-
[IMP]Added translation for the module
Fernando Lopez (kyon) wrote : | # |
Se agregó que muestre la orden de producción creada y las traducciones del módulo.
- 525. By Fernando Lopez
-
[IMP]Added tree view to the new production order view. Changed order of fields of the wizard
Fernando Lopez (kyon) wrote : | # |
Se cambio a la vista tree por default y se cambió el orden de los campos en el wizard para capturar mas rápido
- 526. By Fernando Lopez
-
[IMP] wizard gets a sum for the weight of the products and multiplies it by the quantity to consume
- 527. By Fernando Lopez
-
[IMP] Located factor of the product uom
- 528. By Fernando Lopez
-
[IMP] Gets and multiplies converting with factor
- 529. By Fernando Lopez
-
[IMP] The field qty of the production order now grabs the correct value, and also the weight considers the weight of the product to produce
- 530. By Fernando Lopez
-
[REM] Module is now full functional. Removed prints, and unnecesary comments.
- 531. By Fernando Lopez
-
[FIX] Fixed translations, and wizard file name
Unmerged revisions
Preview Diff
1 | === added directory 'mrp_production_wizard' |
2 | === added file 'mrp_production_wizard/__init__.py' |
3 | --- mrp_production_wizard/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ mrp_production_wizard/__init__.py 2012-10-22 18:48:22 +0000 |
5 | @@ -0,0 +1,27 @@ |
6 | +# -*- encoding: 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: fernandoL (fernando_ld@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 mrp |
32 | +import wizard |
33 | \ No newline at end of file |
34 | |
35 | === added file 'mrp_production_wizard/__openerp__.py' |
36 | --- mrp_production_wizard/__openerp__.py 1970-01-01 00:00:00 +0000 |
37 | +++ mrp_production_wizard/__openerp__.py 2012-10-22 18:48:22 +0000 |
38 | @@ -0,0 +1,47 @@ |
39 | +# -*- encoding: utf-8 -*- |
40 | +########################################################################### |
41 | +# Module Writen to OpenERP, Open Source Management Solution |
42 | +# |
43 | +# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com |
44 | +# All Rights Reserved. |
45 | +# info@vauxoo.com |
46 | +############################################################################ |
47 | +# Coded by: fernandoL (fernando_ld@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 | +{ |
66 | + "name": "MPR Production Wizard", |
67 | + "version": "1.0", |
68 | + "author" : "Vauxoo", |
69 | + "category": "Generic Modules/Production", |
70 | + "website" : "http://www.vauxoo.com/", |
71 | + "description": """ Add wizard to create a new production order of the |
72 | + selected product in draft state, with the qty added of the selected |
73 | + products. from the stock_picking model |
74 | + """, |
75 | + 'depends': ['mrp_default_location', |
76 | + 'mrp_pt_planified'], |
77 | + 'init_xml': [], |
78 | + 'update_xml': [ |
79 | + 'mrp_view.xml', |
80 | + ], |
81 | + 'demo_xml': [], |
82 | + 'test': [], |
83 | + 'installable': True, |
84 | + 'active': False, |
85 | +} |
86 | \ No newline at end of file |
87 | |
88 | === added directory 'mrp_production_wizard/i18n' |
89 | === added file 'mrp_production_wizard/i18n/es_MX.mo' |
90 | Binary files mrp_production_wizard/i18n/es_MX.mo 1970-01-01 00:00:00 +0000 and mrp_production_wizard/i18n/es_MX.mo 2012-10-22 18:48:22 +0000 differ |
91 | === added file 'mrp_production_wizard/i18n/es_MX.po' |
92 | --- mrp_production_wizard/i18n/es_MX.po 1970-01-01 00:00:00 +0000 |
93 | +++ mrp_production_wizard/i18n/es_MX.po 2012-10-22 18:48:22 +0000 |
94 | @@ -0,0 +1,127 @@ |
95 | +# Translation of OpenERP Server. |
96 | +# This file contains the translation of the following modules: |
97 | +# * mrp_production_wizard |
98 | +# |
99 | +msgid "" |
100 | +msgstr "" |
101 | +"Project-Id-Version: OpenERP Server 6.1\n" |
102 | +"Report-Msgid-Bugs-To: \n" |
103 | +"POT-Creation-Date: 2012-10-22 18:08+0000\n" |
104 | +"PO-Revision-Date: 2012-10-22 13:20-0600\n" |
105 | +"Last-Translator: fernando <fernando_ld@vauxoo.com>\n" |
106 | +"Language-Team: \n" |
107 | +"MIME-Version: 1.0\n" |
108 | +"Content-Type: text/plain; charset=UTF-8\n" |
109 | +"Content-Transfer-Encoding: 8bit\n" |
110 | +"Plural-Forms: \n" |
111 | + |
112 | +#. module: mrp_production_wizard |
113 | +#: field:mrp.production.wizard,product_id:0 |
114 | +#: field:wizard.data,product_id_consume:0 |
115 | +msgid "Product" |
116 | +msgstr "Producto" |
117 | + |
118 | +#. module: mrp_production_wizard |
119 | +#: sql_constraint:mrp.production:0 |
120 | +msgid "Reference must be unique per Company!" |
121 | +msgstr "Referencia debe ser única por compañía!" |
122 | + |
123 | +#. module: mrp_production_wizard |
124 | +#: field:wizard.data,name:0 |
125 | +msgid "Name" |
126 | +msgstr "Nombre" |
127 | + |
128 | +#. module: mrp_production_wizard |
129 | +#: code:addons/mrp_production_wizard/mrp.py:79 |
130 | +#, python-format |
131 | +msgid "The category of the product to produce has not predefined locations " |
132 | +msgstr "La categoría del producto a producir no tiene ubicaciones predefinidas." |
133 | + |
134 | +#. module: mrp_production_wizard |
135 | +#: model:ir.model,name:mrp_production_wizard.model_mrp_production |
136 | +msgid "Manufacturing Order" |
137 | +msgstr "Orden de fabricación" |
138 | + |
139 | +#. module: mrp_production_wizard |
140 | +#: view:mrp.production.wizard:0 |
141 | +msgid "Create production order" |
142 | +msgstr "Crear orden de producción" |
143 | + |
144 | +#. module: mrp_production_wizard |
145 | +#: code:addons/mrp_production_wizard/mrp.py:79 |
146 | +#, python-format |
147 | +msgid "Error" |
148 | +msgstr "Error" |
149 | + |
150 | +#. module: mrp_production_wizard |
151 | +#: view:mrp.production.wizard:0 |
152 | +msgid "Qty" |
153 | +msgstr "Ctd" |
154 | + |
155 | +#. module: mrp_production_wizard |
156 | +#: model:ir.model,name:mrp_production_wizard.model_mrp_production_wizard |
157 | +msgid "mrp.production.wizard" |
158 | +msgstr "mrp.production.wizard" |
159 | + |
160 | +#. module: mrp_production_wizard |
161 | +#: field:wizard.data,product_qty:0 |
162 | +msgid "Product Qty" |
163 | +msgstr "Cantidad de producto" |
164 | + |
165 | +#. module: mrp_production_wizard |
166 | +#: field:wizard.data,product_uom:0 |
167 | +msgid "Product UOM" |
168 | +msgstr "LdM del producto" |
169 | + |
170 | +#. module: mrp_production_wizard |
171 | +#: view:mrp.production.wizard:0 |
172 | +msgid "Produce without BoM" |
173 | +msgstr "Producir sin LdM" |
174 | + |
175 | +#. module: mrp_production_wizard |
176 | +#: view:mrp.production.wizard:0 |
177 | +msgid "Products to consume" |
178 | +msgstr "Productos a consumir" |
179 | + |
180 | +#. module: mrp_production_wizard |
181 | +#: code:addons/mrp_production_wizard/wizard/wizard.py:60 |
182 | +#, python-format |
183 | +msgid "Manufacturing orders" |
184 | +msgstr "Ordenes de producción" |
185 | + |
186 | +#. module: mrp_production_wizard |
187 | +#: view:mrp.production.wizard:0 |
188 | +msgid "Cancel" |
189 | +msgstr "Cancelar" |
190 | + |
191 | +#. module: mrp_production_wizard |
192 | +#: constraint:mrp.production:0 |
193 | +msgid "Order quantity cannot be negative or zero!" |
194 | +msgstr "¡La cantidad de la orden no puede ser negativa o cero!" |
195 | + |
196 | +#. module: mrp_production_wizard |
197 | +#: model:ir.actions.act_window,name:mrp_production_wizard.mrp_production_wizard_act |
198 | +#: model:ir.ui.menu,name:mrp_production_wizard.mrp_production_wizard_action |
199 | +msgid "Special Order" |
200 | +msgstr "Orden especial" |
201 | + |
202 | +#. module: mrp_production_wizard |
203 | +#: field:mrp.production.wizard,wiz_data:0 |
204 | +msgid "Prod lines" |
205 | +msgstr "Líneas de prod" |
206 | + |
207 | +#. module: mrp_production_wizard |
208 | +#: model:ir.model,name:mrp_production_wizard.model_wizard_data |
209 | +msgid "wizard.data" |
210 | +msgstr "wizard.data" |
211 | + |
212 | +#. module: mrp_production_wizard |
213 | +#: view:mrp.production.wizard:0 |
214 | +msgid "UOM" |
215 | +msgstr "LdM" |
216 | + |
217 | +#. module: mrp_production_wizard |
218 | +#: field:wizard.data,mrp_production_wiz:0 |
219 | +msgid "Padre" |
220 | +msgstr "Padre" |
221 | + |
222 | |
223 | === added file 'mrp_production_wizard/mrp.py' |
224 | --- mrp_production_wizard/mrp.py 1970-01-01 00:00:00 +0000 |
225 | +++ mrp_production_wizard/mrp.py 2012-10-22 18:48:22 +0000 |
226 | @@ -0,0 +1,82 @@ |
227 | +# -*- encoding: utf-8 -*- |
228 | +########################################################################### |
229 | +# Module Writen to OpenERP, Open Source Management Solution |
230 | +# |
231 | +# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com |
232 | +# All Rights Reserved. |
233 | +# info@vauxoo.com |
234 | +############################################################################ |
235 | +# Coded by: fernandoL (fernando_ld@vauxoo.com) |
236 | +############################################################################ |
237 | +# |
238 | +# This program is free software: you can redistribute it and/or modify |
239 | +# it under the terms of the GNU Affero General Public License as |
240 | +# published by the Free Software Foundation, either version 3 of the |
241 | +# License, or (at your option) any later version. |
242 | +# |
243 | +# This program is distributed in the hope that it will be useful, |
244 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
245 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
246 | +# GNU Affero General Public License for more details. |
247 | +# |
248 | +# You should have received a copy of the GNU Affero General Public License |
249 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
250 | +# |
251 | +############################################################################## |
252 | + |
253 | +import pooler |
254 | +import wizard |
255 | +import netsvc |
256 | +from tools.translate import _ |
257 | +import tools |
258 | +import os |
259 | +from osv import osv, fields |
260 | +import time |
261 | +from tools import ustr |
262 | + |
263 | +class mrp_production(osv.osv): |
264 | + _inherit = "mrp.production" |
265 | + |
266 | + """ |
267 | + """ |
268 | + def create_production_wizard(self, cr, uid, product, list_produce, context): |
269 | + """ creates the production order |
270 | + @param product id to create |
271 | + @return: True |
272 | + """ |
273 | + default_location_dict = self.product_id_change(cr, uid, [], product.id, context) |
274 | + if (default_location_dict['value']['location_src_id'] & default_location_dict['value']['location_dest_id']): |
275 | + production_order_dict = { |
276 | + 'name' : self.pool.get('ir.sequence').get(cr, uid, 'mrp.production'), |
277 | + 'date_planned' : time.strftime('%Y-%m-%d %H:%M:%S'), |
278 | + 'product_id' : product.id, |
279 | + 'product_qty' : 1, |
280 | + 'product_uom' : product.uom_id.id, |
281 | + 'location_src_id': default_location_dict['value']['location_src_id'], |
282 | + 'location_dest_id': default_location_dict['value']['location_dest_id'], |
283 | + 'state' : 'draft' |
284 | + } |
285 | + new_id = self.create(cr, uid, production_order_dict) |
286 | + |
287 | + for line in list_produce: |
288 | + production_scheduled_dict = { |
289 | + 'name': line['name'], |
290 | + 'product_id': line['product_id'], |
291 | + 'product_qty': line['product_qty'], |
292 | + 'product_uom': line['product_uom'], |
293 | + 'production_id': new_id, |
294 | + } |
295 | + self.pool.get('mrp.production.product.line').create(cr, uid, production_scheduled_dict) |
296 | + |
297 | + mrp_pt_planifed_dict = { |
298 | + 'product_id' : product.id, |
299 | + 'quantity' : 1, |
300 | + 'production_id' : new_id, |
301 | + 'product_uom' : product.uom_id.id, |
302 | + } |
303 | + self.pool.get('mrp.pt.planified').create(cr, uid, mrp_pt_planifed_dict) |
304 | + else: |
305 | + raise osv.except_osv(_('Error'), _("The category of the product to produce has not predefined locations ")) |
306 | + return new_id |
307 | + |
308 | +mrp_production() |
309 | \ No newline at end of file |
310 | |
311 | === added file 'mrp_production_wizard/mrp_view.xml' |
312 | --- mrp_production_wizard/mrp_view.xml 1970-01-01 00:00:00 +0000 |
313 | +++ mrp_production_wizard/mrp_view.xml 2012-10-22 18:48:22 +0000 |
314 | @@ -0,0 +1,52 @@ |
315 | +<?xml version="1.0" encoding="utf-8"?> |
316 | +<openerp> |
317 | + <data> |
318 | +<!-- |
319 | + View of wizard on mrp production |
320 | +--> |
321 | + <record id="mrp_production_wizard_form" model="ir.ui.view"> |
322 | + <field name="name">mrp.production.wizard.form</field> |
323 | + <field name="model">mrp.production.wizard</field> |
324 | + <field name="type">form</field> |
325 | + <field name="arch" type="xml"> |
326 | + <form string="Produce without BoM"> |
327 | + <field name="product_id"/> |
328 | + <newline/> |
329 | + <field colspan="2" name="wiz_data" nolabel="1" widget="one2many_list" mode="tree,form" height="275"> |
330 | + <tree string="Products to consume"> |
331 | + <field name="product_id_consume" on_change="onchange_production_wizard_product_name(product_id_consume)"/> |
332 | + <field name="product_qty" string="Qty"/> |
333 | + <field name="name"/> |
334 | + <field name="product_uom" string="UOM"/> |
335 | + </tree> |
336 | + <form string="Products to consume"> |
337 | + <field name="product_id_consume" on_change="onchange_production_wizard_product_name(product_id_consume)"/> |
338 | + <field name="product_qty" string="Qty"/> |
339 | + <field name="name"/> |
340 | + <field name="product_uom" string="UOM"/> |
341 | + </form> |
342 | + </field> |
343 | + <group colspan="4"> |
344 | + <button string="Cancel" icon="gtk-cancel" type="object" special="cancel"/> |
345 | + <button string="Create production order" icon="gtk-ok" name="pass_products_to_parent" type="object"/> |
346 | + </group> |
347 | + </form> |
348 | + </field> |
349 | + </record> |
350 | + |
351 | + |
352 | + |
353 | + <act_window id="mrp_production_wizard_act" |
354 | + name="Special Order" |
355 | + src_model="mrp.production" |
356 | + res_model="mrp.production.wizard" |
357 | + view_mode="form" |
358 | + target="new" |
359 | + key2="client_action_multi" |
360 | + /> |
361 | + |
362 | + <menuitem action="mrp_production_wizard_act" id="mrp_production_wizard_action" |
363 | + parent="mrp.menu_mrp_manufacturing" sequence="50"/> |
364 | + |
365 | + </data> |
366 | +</openerp> |
367 | \ No newline at end of file |
368 | |
369 | === added directory 'mrp_production_wizard/wizard' |
370 | === added file 'mrp_production_wizard/wizard/__init__.py' |
371 | --- mrp_production_wizard/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
372 | +++ mrp_production_wizard/wizard/__init__.py 2012-10-22 18:48:22 +0000 |
373 | @@ -0,0 +1,26 @@ |
374 | +# -*- encoding: utf-8 -*- |
375 | +########################################################################### |
376 | +# Module Writen to OpenERP, Open Source Management Solution |
377 | +# |
378 | +# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com |
379 | +# All Rights Reserved. |
380 | +# info@vauxoo.com |
381 | +############################################################################ |
382 | +# Coded by: fernandoL (fernando_ld@vauxoo.com) |
383 | +############################################################################ |
384 | +# |
385 | +# This program is free software: you can redistribute it and/or modify |
386 | +# it under the terms of the GNU Affero General Public License as |
387 | +# published by the Free Software Foundation, either version 3 of the |
388 | +# License, or (at your option) any later version. |
389 | +# |
390 | +# This program is distributed in the hope that it will be useful, |
391 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
392 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
393 | +# GNU Affero General Public License for more details. |
394 | +# |
395 | +# You should have received a copy of the GNU Affero General Public License |
396 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
397 | +# |
398 | +############################################################################## |
399 | +import wizard |
400 | \ No newline at end of file |
401 | |
402 | === added file 'mrp_production_wizard/wizard/wizard.py' |
403 | --- mrp_production_wizard/wizard/wizard.py 1970-01-01 00:00:00 +0000 |
404 | +++ mrp_production_wizard/wizard/wizard.py 2012-10-22 18:48:22 +0000 |
405 | @@ -0,0 +1,100 @@ |
406 | +# -*- encoding: utf-8 -*- |
407 | +########################################################################### |
408 | +# Module Writen to OpenERP, Open Source Management Solution |
409 | +# |
410 | +# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com |
411 | +# All Rights Reserved. |
412 | +# info@vauxoo.com |
413 | +############################################################################ |
414 | +# Coded by: fernandoL (fernando_ld@vauxoo.com) |
415 | +############################################################################ |
416 | +# |
417 | +# This program is free software: you can redistribute it and/or modify |
418 | +# it under the terms of the GNU Affero General Public License as |
419 | +# published by the Free Software Foundation, either version 3 of the |
420 | +# License, or (at your option) any later version. |
421 | +# |
422 | +# This program is distributed in the hope that it will be useful, |
423 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
424 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
425 | +# GNU Affero General Public License for more details. |
426 | +# |
427 | +# You should have received a copy of the GNU Affero General Public License |
428 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
429 | +# |
430 | +############################################################################## |
431 | +import time |
432 | +from osv import osv, fields |
433 | +import decimal_precision as dp |
434 | +from tools.translate import _ |
435 | + |
436 | +class mrp_production_wizard(osv.osv_memory): |
437 | + _name='mrp.production.wizard' |
438 | + _columns={ |
439 | + 'product_id': fields.many2one('product.product', 'Product', required=True, ), |
440 | + 'wiz_data': fields.one2many('wizard.data', 'mrp_production_wiz', 'Prod lines'), |
441 | + } |
442 | + |
443 | + def pass_products_to_parent(self,cr,uid,ids,context={}): |
444 | + if not context: |
445 | + context={} |
446 | + wizard_data_data = self.browse(cr, uid, ids, context=context) |
447 | + list_product_lines = [] |
448 | + dict_line = {} |
449 | + for line in wizard_data_data: |
450 | + product = line.product_id |
451 | + for move in line.wiz_data: |
452 | + dict_line = { |
453 | + 'name' : move.name, |
454 | + 'product_id' : move.product_id_consume.id, |
455 | + 'product_qty' : move.product_qty, |
456 | + 'product_uom' : move.product_uom.id} |
457 | + list_product_lines.append(dict_line) |
458 | + mrp_production_id = self.pool.get('mrp.production').create_production_wizard(cr, uid, product, list_product_lines, context=context) |
459 | + |
460 | + mod_obj = self.pool.get('ir.model.data') |
461 | + res = mod_obj.get_object_reference(cr, uid, 'mrp', 'mrp_production_form_view') |
462 | + res_id = res and res[1] or False, |
463 | + return { |
464 | + 'name': _('Manufacturing orders'), |
465 | + 'view_type': 'form', |
466 | + 'view_mode': 'form,tree', |
467 | + 'view_id': [res_id], |
468 | + 'res_model': 'mrp.production', |
469 | + 'context': "", |
470 | + 'type': 'ir.actions.act_window', |
471 | + 'nodestroy': False, |
472 | + 'target': 'current', |
473 | + 'res_id': mrp_production_id or False, |
474 | + } |
475 | + |
476 | +mrp_production_wizard() |
477 | + |
478 | +class wizard_data(osv.osv_memory): |
479 | + _name='wizard.data' |
480 | + |
481 | + _columns={ |
482 | + 'mrp_production_wiz': fields.many2one('mrp.production.wizard', 'Padre'), |
483 | + 'name': fields.char('Name', size=64, required=True), |
484 | + 'product_id_consume': fields.many2one('product.product', 'Product', required=True), |
485 | + 'product_qty': fields.float('Product Qty', required=True), |
486 | + 'product_uom': fields.many2one('product.uom', 'Product UOM', required=True), |
487 | + } |
488 | + |
489 | + def onchange_production_wizard_product_name(self, cr, uid, ids, product_id): |
490 | + if product_id: |
491 | + new_product_id = [product_id] |
492 | + product_product_obj = self.pool.get('product.product') |
493 | + product_product_data = product_product_obj.browse(cr, uid, new_product_id, context=None) |
494 | + if product_product_data: |
495 | + for line in product_product_data: |
496 | + val = { |
497 | + 'name' : line.name, |
498 | + 'product_uom' : line.uom_id.id, |
499 | + 'product_qty' : line.qty_available, |
500 | + } |
501 | + domain_uom = {'product_uom':[('category_id', '=', line.uom_id.category_id.id)]} |
502 | + return {'value': val, 'domain': domain_uom} |
503 | + return {} |
504 | + |
505 | +wizard_data() |
506 | \ No newline at end of file |
Ok Fernando,
Ahora la nueva funcionalidad que te había prometido decirte será:
El one2many cuando se esté llenando, agregar un onchange en el product_id, para que se llene automáticamente la cantidad de producto, que hay actualmente.