Merge lp:~openerp-dev/openobject-addons/6.0-opw-579152-ado into lp:openobject-addons/6.0

Proposed by Amit Dodiya (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-579152-ado
Merge into: lp:openobject-addons/6.0
Diff against target: 39 lines (+8/-3)
2 files modified
product/product.py (+4/-1)
purchase/purchase.py (+4/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-579152-ado
Reviewer Review Type Date Requested Status
Xavier ALT Pending
Naresh(OpenERP) Pending
Review via email: mp+131852@code.launchpad.net

Description of the change

Hello,

"[FIX](1)purchase uom is not passed in uom of purchase order while creating purchase order from procurement (2)while we have box to purchase instead of pce the quantity is wrongly rounded(If you have 100 qnty = 1 box and you purchase 101 qnty so it should take 2 box instead of 1 box)"

Common Configuration:
1.) Create a new product, stockable, MTO, Buy
2.) Define 2 units from the same category (PCE = 1, BOX = 100)
3.) Assign the 'PCE' as the 'Default Unit Of Measure' and 'BOX' as the 'Purchase Unit of Measure'
4.) Define a supplier

Issue 1) : Purchase uom is not passed in uom of purchase order while creating purchase order from procurement
Steps: Create a 'Procurement request' for 149 PCE : Got a purchase order with PCE
It should create a purchase order with UOM = BOX instead of PCE

Issue 2) : While we have box to purchase instead of pce the quantity is wrongly rounded
Steps: After above configuration try following scenario.
Create a 'Procurement request' for 149 PCE : Got a purchase.order for 1 BOX
Create a 'Procurement request' for 150 PCE : Got a purchase.order for 2 BOX
Result should like following data:
Request for 100 : Purchase for 1 BOX
Request for 101 : Purchase for 2 BOX
Request for 200 : Purchase for 2 BOX
Request for 201 : Purchase for 3 BOX

Regards,
Amit

To post a comment you must log in.

Unmerged revisions

5363. By Amit Dodiya<email address hidden>

[FIX](1)purchase uom is not passed in uom of purchase order while creating purchase order from procurement (2)while we have box to purchase instead of pce the quantity is wrongly rounded(If you have 100 qnty = 1 box and you purchase 101 qnty so it should take 2 box instead of 1 box)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'product/product.py'
2--- product/product.py 2012-03-30 08:53:02 +0000
3+++ product/product.py 2012-10-29 10:36:31 +0000
4@@ -144,7 +144,10 @@
5 return qty
6 amount = qty / from_unit.factor
7 if to_unit:
8- amount = rounding(amount * to_unit.factor, to_unit.rounding)
9+ if context.get('unit'):
10+ amount = math.ceil(amount * to_unit.factor)
11+ else:
12+ amount = rounding(amount * to_unit.factor, to_unit.rounding)
13 return amount
14
15 def _compute_price(self, cr, uid, from_uom_id, price, to_uom_id=False):
16
17=== modified file 'purchase/purchase.py'
18--- purchase/purchase.py 2012-06-29 14:14:29 +0000
19+++ purchase/purchase.py 2012-10-29 10:36:31 +0000
20@@ -806,7 +806,9 @@
21
22 uom_id = procurement.product_id.uom_po_id.id
23
24- qty = uom_obj._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, uom_id)
25+ if procurement.product_id.uom_po_id.rounding == 1.0:
26+ context.update(unit=True)
27+ qty = uom_obj._compute_qty_obj(cr, uid, procurement.product_uom, procurement.product_qty, procurement.product_id.uom_po_id, context=context)
28 if seller_qty:
29 qty = max(qty,seller_qty)
30
31@@ -828,7 +830,7 @@
32 'name': product.partner_ref,
33 'product_qty': res_onchange['value']['product_qty'],
34 'product_id': procurement.product_id.id,
35- 'product_uom': res_onchange['value']['product_uom'],
36+ 'product_uom': uom_id,
37 'price_unit': res_onchange['value']['price_unit'],
38 'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'),
39 'move_dest_id': res_id,