From a6ef1d4a428674b71710c84590dcccc1b89f82b4 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 28 Sep 2012 11:50:35 +0200 Subject: [PATCH 01/77] [IMP] mrp: cleaning of stock move name bzr revid: qdp-launchpad@openerp.com-20120928095035-w1g06od25auo52ev --- addons/mrp/mrp.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 049c7c712fb..c14b852d08e 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -902,12 +902,11 @@ class mrp_production(osv.osv): # Internal shipment is created for Stockable and Consumer Products if production_line.product_id.type not in ('product', 'consu'): return False - move_name = _('PROD: %s') % production.name source_location_id = production.location_src_id.id if not destination_location_id: destination_location_id = source_location_id return stock_move.create(cr, uid, { - 'name': move_name, + 'name': production.name, 'picking_id': shipment_id, 'product_id': production_line.product_id.id, 'product_qty': production_line.product_qty, @@ -957,9 +956,8 @@ class mrp_production(osv.osv): stock_move = self.pool.get('stock.move') source_location_id = production.product_id.product_tmpl_id.property_stock_production.id destination_location_id = production.location_dest_id.id - move_name = _('PROD: %s') + production.name data = { - 'name': move_name, + 'name': production.name, 'date': production.date_planned, 'product_id': production.product_id.id, 'product_qty': production.product_qty, @@ -982,12 +980,11 @@ class mrp_production(osv.osv): # Internal shipment is created for Stockable and Consumer Products if production_line.product_id.type not in ('product', 'consu'): return False - move_name = _('PROD: %s') % production.name destination_location_id = production.product_id.product_tmpl_id.property_stock_production.id if not source_location_id: source_location_id = production.location_src_id.id move_id = stock_move.create(cr, uid, { - 'name': move_name, + 'name': production.name, 'date': production.date_planned, 'product_id': production_line.product_id.id, 'product_qty': production_line.product_qty, From 20bf037ea40d38f600a7166ea948b81840c613a0 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 28 Sep 2012 11:54:58 +0200 Subject: [PATCH 02/77] [IMP] sale: added a test to verify the the product onchange in sale order line was correctly triggered bzr revid: qdp-launchpad@openerp.com-20120928095458-vjwd4xt0nun8lfjx --- addons/sale/test/sale_order_demo.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/sale/test/sale_order_demo.yml b/addons/sale/test/sale_order_demo.yml index 05109efbea2..5b1c08bb5e1 100644 --- a/addons/sale/test/sale_order_demo.yml +++ b/addons/sale/test/sale_order_demo.yml @@ -7,8 +7,12 @@ payment_term: account.account_payment_term - !record {model: sale.order.line, id: line}: - name : 'LCD Monitor' order_id: sale_order_test1 product_id: product.product_product_7 - price_unit: 190.50 product_uom_qty: 8 +- + I verify that the onchange was correctly triggered +- + !assert {model: sale.order.line, id: sale.line, string: The onchange function of product was not correctly triggered}: + - l.name == '17” LCD Monitor' + - l.price_unit == 1350.0 From 6251b57b39ac2a01d907f1f5f6fccf13a0319830 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 28 Sep 2012 12:15:31 +0200 Subject: [PATCH 03/77] [IMP] sale_stock: added a test to verify the the product onchange in sale order line was correctly triggered bzr revid: qdp-launchpad@openerp.com-20120928101531-sw1r2d5tc034ie23 --- addons/sale_stock/__openerp__.py | 1 + addons/sale_stock/sale_stock.py | 2 +- addons/sale_stock/sale_stock_view.xml | 6 ++--- .../sale_stock/test/sale_order_onchange.yml | 24 +++++++++++++++++++ 4 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 addons/sale_stock/test/sale_order_onchange.yml diff --git a/addons/sale_stock/__openerp__.py b/addons/sale_stock/__openerp__.py index 2a670000581..10773b44a3f 100644 --- a/addons/sale_stock/__openerp__.py +++ b/addons/sale_stock/__openerp__.py @@ -61,6 +61,7 @@ You can choose flexible invoicing methods: 'test': ['test/cancel_order_sale_stock.yml', 'test/picking_order_policy.yml', 'test/prepaid_order_policy.yml', + 'test/sale_order_onchange.yml', ], 'installable': True, 'auto_install': True, diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index a48b766f3bb..aea39590152 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -625,7 +625,7 @@ class sale_order_line(osv.osv): uom = False if not uom2: uom2 = product_obj.uom_id - + compare_qty = float_compare(product_obj.virtual_available * uom2.factor, qty * product_obj.uom_id.factor, 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'): diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml index 7efb2849a52..09a8cd51af8 100644 --- a/addons/sale_stock/sale_stock_view.xml +++ b/addons/sale_stock/sale_stock_view.xml @@ -1,7 +1,7 @@ - + sale.shop.inherit.form sale.shop @@ -13,7 +13,7 @@ - + sale.shop.sale.stock sale.shop @@ -41,7 +41,7 @@