Hello, We have merged a fix for this issue in 7.0
revno: 10045 [merge] revision-id: [email protected] Thanks for the report ** Changed in: openobject-addons Status: Confirmed => Fix Released -- You received this bug notification because you are a member of OpenERP Indian Team, which is subscribed to OpenERP Addons. https://bugs.launchpad.net/bugs/1187995 Title: [7.0] sale_stock: Onchange product line give wrong error message regarding qty uom Status in OpenERP Addons (modules): Fix Released Bug description: Hello, This bug is regarding multiple uom. Adding product line in SO, giving qty and uom, it calculate and display warning message about "not enough stock" incorrectly. Based On 7.0 (Build 12681) server (4997) addons (9199) web (3946) Steps: 1. Create a new product -> ProductA - Type = Stockable Product - Unit of Measure = Unit(s) - Quantity on hand = 18 (which is equal to 1.5 dozen) 2. Try ordering this product in SO - ProductA - Change unit of measure to "Dozen" - Change quantity to 2 Dozen --> Error - Change quantity to 1 Dozen --> Error (which should not be because 1 dozen = 12 units and we have 18) The error is as following, Not enough stock ! : You plan to sell 1.00 Dozen(s) but you only have 1.50 Unit(s) available ! The real stock is 1.50 Unit(s). (without reservations) It seem to mess up with the unit of measure. I found problem is with product.virtual_available, which already gives the stock in regards to the selected UOM (Dozen), but it still try to convert it with the UOM conversion, I fix in sale_stock/sale_order_line/product_id_change() (but I am not sure if it will effect backward), by removing the multiplying factor of both "product_obj.virtual_available" and "qty". AS, during onchnage in SO Line, both are already quantity of the uom selected. SOLUTION ======== def product_id_change() .... if not uom2: uom2 = product_obj.uom_id # FIX: compare_qty = float_compare(product_obj.virtual_available * uom2.factor, qty * product_obj.uom_id.factor, precision_rounding=product_obj.uom_id.rounding) compare_qty = float_compare(product_obj.virtual_available, qty, precision_rounding=product_obj.uom_id.rounding) if (product_obj.type=='product') and int(compare_qty) == -1 \ and (product_obj.procure_method=='make_to_stock'): warn_msg = _('You plan to sell %.2f %s but you only have %.2f %s available !\nThe real stock is %.2f %s. (without reservations)') % \ (qty, uom2 and uom2.name or product_obj.uom_id.name, # FIX: max(0,product_obj.virtual_available), product_obj.uom_id.name, max(0,product_obj.virtual_available), uom2 and uom2.name or product_obj.uom_id.name, # FIX: max(0,product_obj.qty_available), product_obj.uom_id.name) max(0,product_obj.qty_available), uom2 and uom2.name or product_obj.uom_id.name) warning_msgs += _("Not enough stock ! : ") + warn_msg + "\n\n" To manage notifications about this bug go to: https://bugs.launchpad.net/openobject-addons/+bug/1187995/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~openerp-india Post to : [email protected] Unsubscribe : https://launchpad.net/~openerp-india More help : https://help.launchpad.net/ListHelp

