From 47ffee6acdc337a5b939643840ce4032bb1986d9 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 1 Dec 2011 10:35:47 +0530 Subject: [PATCH] [FIX] sale: UOM qty should be consider if UOS is not specified on creating shipment. bzr revid: hmo@tinyerp.com-20111201050547-qrn3y9ttl43szrqe --- addons/sale/sale.py | 5 ++--- addons/sale/test/order_process.yml | 8 ++++---- addons/sale/test/sale_order_demo.yml | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 782aac7..4cb1f5d 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -705,7 +705,7 @@ class sale_order(osv.osv): 'date_expected': date_planned, 'product_qty': line.product_uom_qty, 'product_uom': line.product_uom.id, - 'product_uos_qty': line.product_uos_qty, + 'product_uos_qty': (line.product_uos and line.product_uos_qty) or line.product_uom_qty, 'product_uos': (line.product_uos and line.product_uos.id)\ or line.product_uom.id, 'product_packaging': line.product_packaging.id, @@ -738,8 +738,7 @@ class sale_order(osv.osv): } def ship_recreate(self, cr, uid, order, line, move_id, proc_id): -# FIXME: deals with potentially cancelled shipments, seems broken, see below -# FIXME: was introduced by revid: mtr@mtr-20101125100355-0a1b7m792t63mssv + # FIXME: deals with potentially cancelled shipments, seems broken (specially if shipment has production lot) """ Define ship_recreate for process after shipping exception param order: sale order to which the order lines belong diff --git a/addons/sale/test/order_process.yml b/addons/sale/test/order_process.yml index 7a3af32..267b7d4 100644 --- a/addons/sale/test/order_process.yml +++ b/addons/sale/test/order_process.yml @@ -65,7 +65,7 @@ assert move.product_id.id == order_line.product_id.id,"Product is not correspond." assert move.product_qty == order_line.product_uom_qty,"Product Quantity is not correspond." assert move.product_uom.id == order_line.product_uom.id,"Product UOM is not correspond." - assert move.product_uos_qty == order_line.product_uos_qty,"Product UOS Quantity is not correspond." + assert move.product_uos_qty == (order_line.product_uos and order_line.product_uos_qty) or order_line.product_uom_qty,"Product UOS Quantity is not correspond." assert move.product_uos == (order_line.product_uos and order_line.product_uos.id) or order_line.product_uom.id,"Product UOS is not correspond" assert move.product_packaging.id == order_line.product_packaging.id,"Product packaging is not correspond." assert move.address_id.id == order_line.address_allotment_id.id or sale_order.partner_shipping_id.id,"Address is not correspond" @@ -125,10 +125,10 @@ ac = so_line.product_id.product_tmpl_id.property_account_income.id or so_line.product_id.categ_id.property_account_income_categ.id assert inv_line.product_id.id == so_line.product_id.id or False,"Product is not correspond" assert inv_line.account_id.id == ac,"Account of Invoice line is not corresponding." - assert inv_line.uos_id.id == so_line.product_uom.id , "UOM is not correspond." + assert inv_line.uos_id.id == (so_line.product_uos and so_line.product_uos.id) or so_line.product_uom.id, "Product UOS is not correspond." assert inv_line.price_unit == so_line.price_unit , "Price Unit is not correspond." - #assert inv_line.quantity == so_line.product_uom_qty , "Product qty is not correspond." - #assert inv_line.price_subtotal == so_line.price_subtotal, "Price sub total is not correspond." + assert inv_line.quantity == (so_line.product_uos and so_line.product_uos_qty) or so_line.product_uom_qty , "Product qty is not correspond." + assert inv_line.price_subtotal == so_line.price_subtotal, "Price sub total is not correspond." - Now I confirm the Quotation with "Invoice on order after delivery" policy. - diff --git a/addons/sale/test/sale_order_demo.yml b/addons/sale/test/sale_order_demo.yml index a1bd7fd..074565f 100644 --- a/addons/sale/test/sale_order_demo.yml +++ b/addons/sale/test/sale_order_demo.yml @@ -8,6 +8,6 @@ - !record {model: sale.order.line, id: line}: product_id: product.product_product_mb1 - price_unit: 150.50 + price_unit: 190.50 product_uom_qty: 8 -- 1.7.10.4