[trunk/7.0] product_visible_discount doesn't update price_unit on UOM change

Bug #1238233 reported by Grover Menacho
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Confirmed
Medium
OpenERP R&D Addons Team 2

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

Amit Parik (amit-parik)
summary: - [7.0] product_visible_discount doesn't update price_unit on UOM change
+ [trunk/7.0] product_visible_discount doesn't update price_unit on UOM
+ change
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 2 (openerp-dev-addons2)
importance: Undecided → Medium
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.