Merge lp:~vauxoo/addons-vauxoo/6.1_patch_product_in_raice_cons_prod_dev_luis into lp:addons-vauxoo

Proposed by Luis Torres - http://www.vauxoo.com
Status: Needs review
Proposed branch: lp:~vauxoo/addons-vauxoo/6.1_patch_product_in_raice_cons_prod_dev_luis
Merge into: lp:addons-vauxoo
Diff against target: 72 lines (+51/-1)
3 files modified
mrp_consume_produce/__openerp__.py (+1/-1)
mrp_consume_produce/patch/product_py.patch (+34/-0)
mrp_consume_produce/patch/stock_py.patch (+16/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/6.1_patch_product_in_raice_cons_prod_dev_luis
Reviewer Review Type Date Requested Status
Rodolfo Lopez Pending
Review via email: mp+163234@code.launchpad.net

Description of the change

Se agregarón 2 parches, para aplicar en los addons de Open, para que agregue el nombre del producto cuando se quiere consumir la produccion, y la unidad de medida que se coloco al producto pertenece a otra categoria.

To post a comment you must log in.

Unmerged revisions

620. By Luis Torres - http://www.vauxoo.com

[ADD][mrp_consume_produce]Add files .patch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'mrp_consume_produce/__openerp__.py'
--- mrp_consume_produce/__openerp__.py 2012-09-18 22:20:16 +0000
+++ mrp_consume_produce/__openerp__.py 2013-05-09 22:20:35 +0000
@@ -31,7 +31,7 @@
31 "category": "Generic Modules/Production",31 "category": "Generic Modules/Production",
32 "website" : "http://www.vauxoo.com/",32 "website" : "http://www.vauxoo.com/",
33 "description": """ Add wizard to consume and produce.It will be necesary to apply the patch 33 "description": """ Add wizard to consume and produce.It will be necesary to apply the patch
34 patch/stock.patch located in this module ( useatch -b stock.py stock.patch )34 patch/stock.patch, product_py & stock_py located in this module ( useatch -b stock.py stock.patch )
35 """,35 """,
36 'depends': ['mrp'],36 'depends': ['mrp'],
37 'init_xml': [],37 'init_xml': [],
3838
=== added file 'mrp_consume_produce/patch/product_py.patch'
--- mrp_consume_produce/patch/product_py.patch 1970-01-01 00:00:00 +0000
+++ mrp_consume_produce/patch/product_py.patch 2013-05-09 22:20:35 +0000
@@ -0,0 +1,34 @@
1=== modified file 'product/product.py'
2--- product/product.py 2012-04-03 13:05:28 +0000
3+++ product/product.py 2013-05-09 20:38:53 +0000
4@@ -125,7 +125,7 @@
5 ('factor_gt_zero', 'CHECK (factor!=0)', 'The conversion ratio for a unit of measure cannot be 0!')
6 ]
7
8- def _compute_qty(self, cr, uid, from_uom_id, qty, to_uom_id=False):
9+ def _compute_qty(self, cr, uid, from_uom_id, qty, to_uom_id=False, context=None):
10 if not from_uom_id or not qty or not to_uom_id:
11 return qty
12 uoms = self.browse(cr, uid, [from_uom_id, to_uom_id])
13@@ -133,14 +133,17 @@
14 from_unit, to_unit = uoms[0], uoms[-1]
15 else:
16 from_unit, to_unit = uoms[-1], uoms[0]
17- return self._compute_qty_obj(cr, uid, from_unit, qty, to_unit)
18+ return self._compute_qty_obj(cr, uid, from_unit, qty, to_unit, context=context)
19
20 def _compute_qty_obj(self, cr, uid, from_unit, qty, to_unit, context=None):
21- if context is None:
22+ product_name = ''
23+ if context:
24+ product_name = context.get('product_name')
25+ else:
26 context = {}
27 if from_unit.category_id.id <> to_unit.category_id.id:
28 if context.get('raise-exception', True):
29- raise osv.except_osv(_('Error !'), _('Conversion from Product UoM %s to Default UoM %s is not possible as they both belong to different Category!.') % (from_unit.name,to_unit.name,))
30+ raise osv.except_osv(_('Error !'), _('Conversion from Product UoM %s of product %s to Default UoM %s is not possible as they both belong to different Category!.') % (from_unit.name, product_name, to_unit.name,))
31 else:
32 return qty
33 amount = qty / from_unit.factor
34
035
=== added file 'mrp_consume_produce/patch/stock_py.patch'
--- mrp_consume_produce/patch/stock_py.patch 1970-01-01 00:00:00 +0000
+++ mrp_consume_produce/patch/stock_py.patch 2013-05-09 22:20:35 +0000
@@ -0,0 +1,16 @@
1=== modified file 'stock/stock.py'
2--- stock/stock.py 2012-10-22 09:29:02 +0000
3+++ stock/stock.py 2013-05-09 20:35:01 +0000
4@@ -2153,8 +2153,9 @@
5 reference_currency_id = move.company_id.currency_id.id
6
7 default_uom = move.product_id.uom_id.id
8- qty = product_uom_obj._compute_qty(cr, uid, move.product_uom.id, move.product_qty, default_uom)
9-
10+ context.update({'product_name' : move.product_id.name})
11+ qty = product_uom_obj._compute_qty(cr, uid, move.product_uom.id, move.product_qty, default_uom, context=context)
12+ context.pop('product_name')
13 # if product is set to average price and a specific value was entered in the picking wizard,
14 # we use it
15 if move.product_id.cost_method == 'average' and move.price_unit:
16