[trunk][purchase]Seller quantity for procurements uses default UOM

Bug #847867 reported by John B
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Won't Fix
Medium
OpenERP R&D Addons Team 2

Bug Description

It appears that seller_qty is calculated using the default UOM rather than the purchase UOM. This might not be an issue for most things, but if the purchase UOM and default UOM are different, the quantity for PO's from procurements may be wrong.

For a test case, create a product 'XYZ' with a default UOM of 'each' and a purchase UOM of 'each x 10'. Now add a procurement order for quantity 2 of XYZ. When the purchase order is created, the quantity will be 10.

make_po() sets the qty to the supplier minimum (which uses the default UOM) or the procurement, whichever is higher. In this case it's the incorrect supplier minimum calc'd to be 10.

I'm not sure the seller_qty should be using the default UOM, it might make more sense for it to use the Purchase UOM, but the attached patch updates make_po() to do the conversion on seller_qty instead. The alternative would be to update _calc_qty() and change the UOM used.

Patch attached for latest trunk.

Related branches

Revision history for this message
John B (johnb-ca) wrote :
Revision history for this message
Dhruti Shastri(OpenERP) (dhs-openerp) wrote :

Hello John,

I have checked your scenario at my end and it is working as per required.

I have create a new "UOM"= 'each x 10' which is smaller then the reference UOM(PCE) with ratio 10.

Now I have created a SO for qty 3PC then related PO created for 30 'each x 10' so it is fine as per the calculation and the Purchase order line's UOM is same as purchase UOM.

For more information I have attached a video so would you please check it and notify us where you faced the problem and if I have missing anything.

Thanks and waiting for your reply!

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
John B (johnb-ca) wrote :

I'm a little confused - your SO was for 2 PCE, as was your procurement. But your PO was for 20 boxes of 10? That's 200 PCE.

Also, I should have specified - you need to set the supplier minimum quantity (1.0 is fine). Otherwise, seller_qty will be 0.0 and the problematic line in make_po():
   if seller_qty:
        qty = max(qty,seller_qty)
Will always return qty rather than seller_qty. If you set the supplier minimum, seller_qty will be returned as 20 in.

To simplify the test case (since the scenario is happening on orderpoints) you only need to create the Procurement Order for 2 PCE once you've set the minimum quantity on the supplier.

Hope that makes sense.

Revision history for this message
Dhruti Shastri(OpenERP) (dhs-openerp) wrote :

Hello John,

Thanks for your reply with nice explanation and patch.

I have faced the problem because of the Supplier (seller_qty) qty can not be converted in the Purchase UoM.

The problem appears when we have given the different Purchase UoM then the default UoM which is "Bigger than the reference uom".

IN max(qty,seller_qty) function gives the wrong Quantity because of the here "seller_qty" doesn't converted.
According to function it should return maximum but qty is 0.2 and seller_qty is 1.0 (instead of 0.1).

I have attached the video which shows the problem(purchase_uom_bug). After applying your patch it is working fine.(kindly check attached videopurchase_uom_with_patch).

Revision history for this message
Dhruti Shastri(OpenERP) (dhs-openerp) wrote :
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 2 (openerp-dev-addons2)
importance: Undecided → Medium
status: Incomplete → Confirmed
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Rohan Nayani(Open ERP) (ron-tinyerp) wrote :

Hello John,

Thanks for Reporting and contribution,

It has been fixed in lp:~openerp-dev/openobject-addons/trunk-bug-847867-ron
revision-id: <email address hidden>
Revision num: 5096.
It will be available in trunk soon.

Thanks

Changed in openobject-addons:
status: In Progress → Fix Committed
Changed in openobject-addons:
status: Fix Committed → Won't Fix
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.