openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #25990
[Bug 1238233] [NEW] [7.0] product_visible_discount doesn't update price_unit on UOM change
Public bug reported:
On product_visible_discount the function get_real_price is not
considering UOM.
I have a product with uom_id = 'Unit(s)' with price of 12
When I change the uom to dozen on sale_order, get_real_price returns 12 too.
I've detected why.
factor = 1.0
if uom_id and uom_id != product.uom_id.id:
product_uom_obj = self.pool.get('product.uom')
uom_data = product_uom_obj.browse(cr, uid, product.uom_id.id)
factor = uom_data.factor
return product_read[field_name] * factor
If your product_id.uom is unit even if you change uom on sale_order this
is pulling the factor only from product_id uom. So it's going to be 1.
The fix must be:
factor = 1.0
if uom_id and uom_id != product.uom_id.id:
product_uom_obj = self.pool.get('product.uom')
uom_data = product_uom_obj.browse(cr, uid, product.uom_id.id)
factor_uom = product_uom_obj.browse(cr, uid, uom).factor
factor_product=uom_data.factor
factor=factor_product/factor_uom
return product_read[field_name] * factor
** Affects: openobject-addons
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1238233
Title:
[7.0] product_visible_discount doesn't update price_unit on UOM change
Status in OpenERP Addons (modules):
New
Bug description:
On product_visible_discount the function get_real_price is not
considering UOM.
I have a product with uom_id = 'Unit(s)' with price of 12
When I change the uom to dozen on sale_order, get_real_price returns 12 too.
I've detected why.
factor = 1.0
if uom_id and uom_id != product.uom_id.id:
product_uom_obj = self.pool.get('product.uom')
uom_data = product_uom_obj.browse(cr, uid, product.uom_id.id)
factor = uom_data.factor
return product_read[field_name] * factor
If your product_id.uom is unit even if you change uom on sale_order
this is pulling the factor only from product_id uom. So it's going to
be 1.
The fix must be:
factor = 1.0
if uom_id and uom_id != product.uom_id.id:
product_uom_obj = self.pool.get('product.uom')
uom_data = product_uom_obj.browse(cr, uid, product.uom_id.id)
factor_uom = product_uom_obj.browse(cr, uid, uom).factor
factor_product=uom_data.factor
factor=factor_product/factor_uom
return product_read[field_name] * factor
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1238233/+subscriptions
Follow ups
References