Amit Dodiya (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-579152-ado into 
lp:openobject-addons/6.0.

Requested reviews:
  Xavier ALT (OpenERP) (xal-openerp)
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-579152-ado/+merge/131852

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
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-579152-ado/+merge/131852
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-579152-ado.
=== modified file 'product/product.py'
--- product/product.py	2012-03-30 08:53:02 +0000
+++ product/product.py	2012-10-29 10:36:31 +0000
@@ -144,7 +144,10 @@
                 return qty
         amount = qty / from_unit.factor
         if to_unit:
-            amount = rounding(amount * to_unit.factor, to_unit.rounding)
+            if context.get('unit'):
+                amount = math.ceil(amount * to_unit.factor)  
+            else:      
+                amount = rounding(amount * to_unit.factor, to_unit.rounding)
         return amount
 
     def _compute_price(self, cr, uid, from_uom_id, price, to_uom_id=False):

=== modified file 'purchase/purchase.py'
--- purchase/purchase.py	2012-06-29 14:14:29 +0000
+++ purchase/purchase.py	2012-10-29 10:36:31 +0000
@@ -806,7 +806,9 @@
 
             uom_id = procurement.product_id.uom_po_id.id
 
-            qty = uom_obj._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, uom_id)
+            if procurement.product_id.uom_po_id.rounding == 1.0:
+                context.update(unit=True)
+            qty = uom_obj._compute_qty_obj(cr, uid, procurement.product_uom, procurement.product_qty, procurement.product_id.uom_po_id, context=context)
             if seller_qty:
                 qty = max(qty,seller_qty)
 
@@ -828,7 +830,7 @@
                 'name': product.partner_ref,
                 'product_qty': res_onchange['value']['product_qty'],
                 'product_id': procurement.product_id.id,
-                'product_uom': res_onchange['value']['product_uom'],
+                'product_uom': uom_id,
                 'price_unit': res_onchange['value']['price_unit'],
                 'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'),
                 'move_dest_id': res_id,

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to