Merge lp:~openerp-dev/openobject-addons/7.0-opw-599727-fka into lp:openobject-addons/7.0

Proposed by Foram Katharotiya (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-599727-fka
Merge into: lp:openobject-addons/7.0
Diff against target: 53 lines (+14/-6)
3 files modified
product/pricelist.py (+5/-1)
product_visible_discount/product_visible_discount.py (+3/-3)
sale_margin/sale_margin.py (+6/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-599727-fka
Reviewer Review Type Date Requested Status
Vinay Rana (OpenERP) Pending
Naresh(OpenERP) Pending
Review via email: mp+194788@code.launchpad.net

Description of the change

Hello,

I have fixed the issue of Unit of Measures is not work properly for pricelist in sale.order.line in sale.
When changing the Unit of Measure for a line in a Sales Order, the conversions are not respected.
For example: one product unit price is 10 and the price list is defined as (-.50) from Public price list, the price on the sales order line returns 9.50, but if the Case of 4 UOM is selected the price returns $39.50,It should be $38.00 (9.50*4).
The cost price is also incorrect and it does not reflect the correct cost, it returns the sales UOM not the actual UOM from the sales order line.

Thanks,
FKA

To post a comment you must log in.
Revision history for this message
E.R. Spada II (er-k) wrote :

Hello,
This bug was reported by me, an OpenERP partner and verified by a senior developer at OpenERP. The status should be changed to important since the issue involved every product that the UOS and the purchase UOM are different. Any module that using that inherits the fields is also effected.

I now fixing bzr branch lp:margin-analysis since the calculated BOM is incorrect due to this bug. I cannot believe this is still sitting around

Unmerged revisions

9577. By Foram Katharotiya (OpenERP)

[MERGE] with 7.0

9576. By Foram Katharotiya (OpenERP)

[IMP] incorrect margin

9575. By Foram Katharotiya (OpenERP)

[MERGE] with 7.0

9574. By Foram Katharotiya (OpenERP)

[IMP] calculate unit price in sale.order.line when installed discount module

9573. By Foram Katharotiya (OpenERP)

[IMP] calculate cost price in sale.order.line

9572. By Foram Katharotiya (OpenERP)

[IMP] improve code

9571. By Foram Katharotiya (OpenERP)

[IMP] improve code

9570. By Foram Katharotiya (OpenERP)

[FIX] bug of pricelist which returns incorrect total in sale.order.line

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'product/pricelist.py'
2--- product/pricelist.py 2013-09-20 14:45:29 +0000
3+++ product/pricelist.py 2013-11-12 05:32:02 +0000
4@@ -296,7 +296,11 @@
5 price_limit = price
6 price = price * (1.0+(res['price_discount'] or 0.0))
7 price = rounding(price, res['price_round']) #TOFIX: rounding with tools.float_rouding
8- price += (res['price_surcharge'] or 0.0)
9+ fact = 1.00
10+ if context.get('uom'):
11+ fact = product_uom_obj.read(cr, uid, context['uom'], ['factor'])['factor']
12+ if res['price_surcharge']:
13+ price += ((res['price_surcharge'] / fact) or 0.0)
14 if res['price_min_margin']:
15 price = max(price, price_limit+res['price_min_margin'])
16 if res['price_max_margin']:
17
18=== modified file 'product_visible_discount/product_visible_discount.py'
19--- product_visible_discount/product_visible_discount.py 2013-01-25 07:09:52 +0000
20+++ product_visible_discount/product_visible_discount.py 2013-11-12 05:32:02 +0000
21@@ -59,11 +59,11 @@
22 product_read = product_obj.read(cr, uid, product_id, [field_name], context=context)
23
24 factor = 1.0
25- if uom and uom != product.uom_id.id:
26+ if uom:
27 product_uom_obj = self.pool.get('product.uom')
28- uom_data = product_uom_obj.browse(cr, uid, product.uom_id.id)
29+ uom_data = product_uom_obj.browse(cr, uid, uom)
30 factor = uom_data.factor
31- return product_read[field_name] * factor
32+ return product_read[field_name] / factor
33
34
35 res=super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty,
36
37=== modified file 'sale_margin/sale_margin.py'
38--- sale_margin/sale_margin.py 2012-12-19 01:25:10 +0000
39+++ sale_margin/sale_margin.py 2013-11-12 05:32:02 +0000
40@@ -34,8 +34,12 @@
41 frm_cur = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id
42 to_cur = self.pool.get('product.pricelist').browse(cr, uid, [pricelist])[0].currency_id.id
43 if product:
44- purchase_price = self.pool.get('product.product').browse(cr, uid, product).standard_price
45- price = self.pool.get('res.currency').compute(cr, uid, frm_cur, to_cur, purchase_price, round=False)
46+ product_obj = self.pool.get('product.product').browse(cr, uid, product)
47+ frm_uom = product_obj.uom_id.id
48+ to_uom = uos or uom
49+ purchase_price = product_obj.standard_price
50+ price = self.pool.get('product.uom')._compute_price(cr, uid, frm_uom, purchase_price, to_uom)
51+ price = self.pool.get('res.currency').compute(cr, uid, frm_cur, to_cur, price, round=False)
52 res['value'].update({'purchase_price': price})
53 return res
54