From b5d729d874493c5e7669003cc5b8a200f2ce160b Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Wed, 7 Aug 2013 16:06:29 +0530 Subject: [PATCH 01/28] [IMP] stock_picking_out replace with stock_picking and set required field false bzr revid: rma@tinyerp.com-20130807103629-h6rc3mxmupyb0945 --- addons/mrp_repair/mrp_repair.py | 4 ++-- addons/sale_stock/stock.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 6e8a56ad7f0..bf8aa3260e4 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -518,7 +518,7 @@ class mrp_repair(osv.osv): }) repair_line_obj.write(cr, uid, [move.id], {'move_id': move_id, 'state': 'done'}, context=context) if repair.deliver_bool: - pick_name = seq_obj.get(cr, uid, 'stock.picking.out') + pick_name = seq_obj.get(cr, uid, 'stock.picking') picking = pick_obj.create(cr, uid, { 'name': pick_name, 'origin': repair.name, @@ -527,7 +527,7 @@ class mrp_repair(osv.osv): 'partner_id': repair.address_id and repair.address_id.id or False, 'note': repair.internal_notes, 'invoice_state': 'none', - 'type': 'out', + 'picking_type_id': self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'picking_type_out', context=context).id }) move_id = move_obj.create(cr, uid, { 'name': repair.name, diff --git a/addons/sale_stock/stock.py b/addons/sale_stock/stock.py index 2af7e1518f8..fc7fecba2d1 100644 --- a/addons/sale_stock/stock.py +++ b/addons/sale_stock/stock.py @@ -50,7 +50,7 @@ class stock_picking(osv.osv): ("invoiced", "Invoiced"), ("2binvoiced", "To Be Invoiced"), ("none", "Not Applicable") - ], string="Invoice Control", required=True, + ], string="Invoice Control", required=False, store={ 'procurement.order': (__get_picking_procurement, ['invoice_state'], 10), 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['state'], 10) From 8773c107c6c29fb9affb8e9cdb4ff59135c90a38 Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Wed, 7 Aug 2013 18:39:48 +0530 Subject: [PATCH 02/28] [IMP] remove invoice_state field from create,write methods and _default at stock.picking bzr revid: rma@tinyerp.com-20130807130948-vcvh73ufmv7zed7i --- addons/account_anglo_saxon/test/anglo_saxon.yml | 1 - addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml | 1 - addons/mrp_repair/mrp_repair.py | 1 - addons/point_of_sale/point_of_sale.py | 1 - addons/purchase/purchase.py | 1 - addons/sale_stock/sale_stock.py | 2 +- addons/sale_stock/stock.py | 3 --- addons/sale_stock/test/picking_order_policy.yml | 1 - addons/stock/test/shipment.yml | 3 --- addons/stock_invoice_directly/test/stock_invoice_directly.yml | 1 - 10 files changed, 1 insertion(+), 14 deletions(-) diff --git a/addons/account_anglo_saxon/test/anglo_saxon.yml b/addons/account_anglo_saxon/test/anglo_saxon.yml index 6e9ebc0068e..b6516f53b00 100644 --- a/addons/account_anglo_saxon/test/anglo_saxon.yml +++ b/addons/account_anglo_saxon/test/anglo_saxon.yml @@ -189,7 +189,6 @@ - !record {model: stock.picking, id: stock_picking_out001}: partner_id: base.res_partner_13 - invoice_state: 2binvoiced move_lines: - company_id: base.main_company location_id: stock.stock_location_stock diff --git a/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml b/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml index f7d52f4f5a8..8fba961f429 100644 --- a/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml +++ b/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml @@ -192,7 +192,6 @@ - !record {model: stock.picking, id: stock_picking_out001_fifo}: partner_id: base.res_partner_13 - invoice_state: 2binvoiced move_lines: - company_id: base.main_company location_id: stock.stock_location_stock diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index bf8aa3260e4..55fb41b9e6e 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -526,7 +526,6 @@ class mrp_repair(osv.osv): 'move_type': 'one', 'partner_id': repair.address_id and repair.address_id.id or False, 'note': repair.internal_notes, - 'invoice_state': 'none', 'picking_type_id': self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'picking_type_out', context=context).id }) move_id = move_obj.create(cr, uid, { diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 91a56e329ef..440c126e902 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -704,7 +704,6 @@ class pos_order(osv.osv): 'company_id': order.company_id.id, 'move_type': 'direct', 'note': order.note or "", - 'invoice_state': 'none', }, context=context) self.write(cr, uid, [order.id], {'picking_id': picking_id}, context=context) location_id = order.warehouse_id.lot_stock_id.id diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 31522c26dd9..00a62153865 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -659,7 +659,6 @@ class purchase_order(osv.osv): 'origin': order.name + ((order.origin and (':' + order.origin)) or ''), 'date': self.date_to_datetime(cr, uid, order.date_order, context), 'partner_id': order.dest_address_id.id or order.partner_id.id, - 'invoice_state': '2binvoiced' if order.invoice_method == 'picking' else 'none', 'partner_id': order.dest_address_id.id or order.partner_id.id, 'purchase_id': order.id, 'company_id': order.company_id.id, diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index 707adb27a7e..33a7832b0a0 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -162,7 +162,7 @@ class sale_order(osv.osv): res = super(sale_order,self).action_invoice_create(cr, uid, ids, grouped=grouped, states=states, date_invoice = date_invoice, context=context) for order in self.browse(cr, uid, ids, context=context): if order.order_policy == 'picking': - picking_obj.write(cr, uid, map(lambda x: x.id, order.picking_ids), {'invoice_state': 'invoiced'}) + picking_obj.write(cr, uid, map(lambda x: x.id, order.picking_ids)) return res def action_cancel(self, cr, uid, ids, context=None): diff --git a/addons/sale_stock/stock.py b/addons/sale_stock/stock.py index fc7fecba2d1..20ac9fc7e1d 100644 --- a/addons/sale_stock/stock.py +++ b/addons/sale_stock/stock.py @@ -57,9 +57,6 @@ class stock_picking(osv.osv): }, ), } - _defaults = { - 'invoice_state': lambda *args, **argv: 'none' - } def action_invoice_create(self, cr, uid, ids, journal_id=False, group=False, type='out_invoice', context=None): """ Creates invoice based on the invoice state selected for picking. diff --git a/addons/sale_stock/test/picking_order_policy.yml b/addons/sale_stock/test/picking_order_policy.yml index e28b4b066d4..5fc40b3041a 100644 --- a/addons/sale_stock/test/picking_order_policy.yml +++ b/addons/sale_stock/test/picking_order_policy.yml @@ -61,7 +61,6 @@ assert picking.move_type == sale_order.picking_policy,"Delivery Method is not corresponding with delivery method of sale order." assert picking.partner_id.id == sale_order.partner_shipping_id.id,"Shipping Address is not correspond with sale order." assert picking.note == sale_order.note,"Note is not correspond with sale order." - assert picking.invoice_state == (sale_order.order_policy=='picking' and '2binvoiced') or 'none',"Invoice policy is not correspond with sale order." assert len(picking.move_lines) == len(sale_order.order_line), "Total move of delivery order are not corresposning with total sale order lines." location_id = sale_order.warehouse_id.lot_stock_id.id output_id = sale_order.warehouse_id.lot_output_id.id diff --git a/addons/stock/test/shipment.yml b/addons/stock/test/shipment.yml index 70f9b14c57a..bf3472160c1 100644 --- a/addons/stock/test/shipment.yml +++ b/addons/stock/test/shipment.yml @@ -78,9 +78,6 @@ - I return last incomming shipment for 10 kgm Ice-cream. -- - !record {model: stock.return.picking, id: return_incomming}: - invoice_state: none - !python {model: stock.return.picking }: | # this work without giving the id of the picking to return, magically, thanks to the context diff --git a/addons/stock_invoice_directly/test/stock_invoice_directly.yml b/addons/stock_invoice_directly/test/stock_invoice_directly.yml index 53ecee5be8d..a64171b7b3f 100644 --- a/addons/stock_invoice_directly/test/stock_invoice_directly.yml +++ b/addons/stock_invoice_directly/test/stock_invoice_directly.yml @@ -6,7 +6,6 @@ - !record {model: stock.picking, id: stock_picking_out0}: partner_id: base.res_partner_address_22 - invoice_state: 2binvoiced move_lines: - company_id: base.main_company location_id: stock.stock_location_stock From 31327ae0bd481ac3adb0eb5467b3d85829da1d7a Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Wed, 7 Aug 2013 19:03:43 +0530 Subject: [PATCH 03/28] [IMP] change unnecessary code bzr revid: rma@tinyerp.com-20130807133343-jpz5p2t0bs8x3dm9 --- addons/sale_stock/sale_stock.py | 2 +- addons/sale_stock/test/picking_order_policy.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index 33a7832b0a0..707adb27a7e 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -162,7 +162,7 @@ class sale_order(osv.osv): res = super(sale_order,self).action_invoice_create(cr, uid, ids, grouped=grouped, states=states, date_invoice = date_invoice, context=context) for order in self.browse(cr, uid, ids, context=context): if order.order_policy == 'picking': - picking_obj.write(cr, uid, map(lambda x: x.id, order.picking_ids)) + picking_obj.write(cr, uid, map(lambda x: x.id, order.picking_ids), {'invoice_state': 'invoiced'}) return res def action_cancel(self, cr, uid, ids, context=None): diff --git a/addons/sale_stock/test/picking_order_policy.yml b/addons/sale_stock/test/picking_order_policy.yml index 5fc40b3041a..e28b4b066d4 100644 --- a/addons/sale_stock/test/picking_order_policy.yml +++ b/addons/sale_stock/test/picking_order_policy.yml @@ -61,6 +61,7 @@ assert picking.move_type == sale_order.picking_policy,"Delivery Method is not corresponding with delivery method of sale order." assert picking.partner_id.id == sale_order.partner_shipping_id.id,"Shipping Address is not correspond with sale order." assert picking.note == sale_order.note,"Note is not correspond with sale order." + assert picking.invoice_state == (sale_order.order_policy=='picking' and '2binvoiced') or 'none',"Invoice policy is not correspond with sale order." assert len(picking.move_lines) == len(sale_order.order_line), "Total move of delivery order are not corresposning with total sale order lines." location_id = sale_order.warehouse_id.lot_stock_id.id output_id = sale_order.warehouse_id.lot_output_id.id From 3dcf4dbca0e6e414e3415b645a75f2bf8a7e0b39 Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Thu, 8 Aug 2013 16:15:11 +0530 Subject: [PATCH 04/28] [IMP] NO prodlot_id on mrp_repair anymore,so remove it temporary bzr revid: rma@tinyerp.com-20130808104511-9d9gq2f7mvpr9fn4 --- addons/mrp_repair/report/order.rml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp_repair/report/order.rml b/addons/mrp_repair/report/order.rml index 202ed6e4684..1b0cbe99d4a 100644 --- a/addons/mrp_repair/report/order.rml +++ b/addons/mrp_repair/report/order.rml @@ -256,7 +256,7 @@ [[ o.product_id.name or '' ]] - [[ o.prodlot_id.name or ' ' ]] + [[ ' ' ]], [[ formatLang(o.guarantee_limit,date = True) ]] From 493712552031509af3ad819f8b5cd7abbb3982cc Mon Sep 17 00:00:00 2001 From: "Pooja Zankhariya (OpenERP)" Date: Mon, 2 Sep 2013 12:58:57 +0530 Subject: [PATCH 05/28] [IMP]Improved function in mrp py bzr revid: pza@tinyerp.com-20130902072857-rmfnwq8fg6rnwhmf --- addons/mrp/mrp.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 15d034e0010..0553974690a 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -454,11 +454,12 @@ class mrp_production(osv.osv): def _moves_assigned(self, cr, uid, ids, name, arg, context=None): """ Test whether all the consume lines are assigned """ - res = True + res = {} for production in self.browse(cr, uid, ids, context=context): + res[production.id] = True states = [x.state != 'assigned' for x in production.move_lines if x] if any(states) or len(states) == 0: - return False + res[production.id] = False return res From 8523c16a260def4c5979685529b431dde51c2abd Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Wed, 4 Sep 2013 14:10:09 +0530 Subject: [PATCH 06/28] [IMP] add required field location_id bzr revid: rma@tinyerp.com-20130904084009-ec0kd0g7bizzn69d --- addons/purchase_requisition/purchase_requisition.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py index 6d08d163696..40b2455871c 100644 --- a/addons/purchase_requisition/purchase_requisition.py +++ b/addons/purchase_requisition/purchase_requisition.py @@ -142,7 +142,7 @@ class purchase_requisition(osv.osv): 'date_order': requisition.date_end or fields.date.context_today(self, cr, uid, context=context), 'partner_id': supplier.id, 'pricelist_id': supplier_pricelist, - #'location_id': location_id, + 'location_id': supplier.property_stock_supplier.id, 'company_id': requisition.company_id.id, 'fiscal_position': supplier.property_account_position and supplier.property_account_position.id or False, 'requisition_id': requisition.id, From 1de64720e5d0398b02c597e88fc2445887f206ea Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Wed, 4 Sep 2013 15:15:42 +0530 Subject: [PATCH 07/28] [IMP] remove extra changes bzr revid: rma@tinyerp.com-20130904094542-9jvq742bhcrf6frp --- addons/mrp_repair/report/order.rml | 2 +- addons/point_of_sale/point_of_sale.py | 1 + addons/purchase/purchase.py | 1 + addons/stock_invoice_directly/test/stock_invoice_directly.yml | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/mrp_repair/report/order.rml b/addons/mrp_repair/report/order.rml index 1b0cbe99d4a..e0f89a14b73 100644 --- a/addons/mrp_repair/report/order.rml +++ b/addons/mrp_repair/report/order.rml @@ -256,7 +256,7 @@ [[ o.product_id.name or '' ]] - [[ ' ' ]], + [[ o.prodlot_id.name or ' ' ]] [[ formatLang(o.guarantee_limit,date = True) ]] diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 4f216106f28..4767d90f188 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -714,6 +714,7 @@ class pos_order(osv.osv): 'company_id': order.company_id.id, 'move_type': 'direct', 'note': order.note or "", + 'invoice_state': 'none', }, context=context) self.write(cr, uid, [order.id], {'picking_id': picking_id}, context=context) location_id = picking_type.default_location_src_id.id diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 41d946ba671..84c915bd130 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -672,6 +672,7 @@ class purchase_order(osv.osv): 'origin': order.name + ((order.origin and (':' + order.origin)) or ''), 'date': self.date_to_datetime(cr, uid, order.date_order, context), 'partner_id': order.dest_address_id.id or order.partner_id.id, + 'invoice_state': '2binvoiced' if order.invoice_method == 'picking' else 'none', 'partner_id': order.dest_address_id.id or order.partner_id.id, 'purchase_id': order.id, 'company_id': order.company_id.id, diff --git a/addons/stock_invoice_directly/test/stock_invoice_directly.yml b/addons/stock_invoice_directly/test/stock_invoice_directly.yml index a061e41c095..5e2daaccf4f 100644 --- a/addons/stock_invoice_directly/test/stock_invoice_directly.yml +++ b/addons/stock_invoice_directly/test/stock_invoice_directly.yml @@ -6,6 +6,7 @@ - !record {model: stock.picking, id: stock_picking_out0}: partner_id: base.res_partner_address_22 + invoice_state: 2binvoiced move_lines: - company_id: base.main_company location_id: stock.stock_location_stock From 8456731094b031ec67affe360fc31d1137b9dc8d Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Wed, 4 Sep 2013 15:22:28 +0530 Subject: [PATCH 08/28] [IMP] code optimize bzr revid: rma@tinyerp.com-20130904095228-66c98cs8xe9qhkm4 --- addons/mrp_repair/mrp_repair.py | 1 + addons/mrp_repair/report/order.rml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 6e747c9624c..7d4b96559f7 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -525,6 +525,7 @@ class mrp_repair(osv.osv): 'move_type': 'one', 'partner_id': repair.address_id and repair.address_id.id or False, 'note': repair.internal_notes, + 'invoice_state': 'none', 'picking_type_id': self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'picking_type_out', context=context).id }) move_id = move_obj.create(cr, uid, { diff --git a/addons/mrp_repair/report/order.rml b/addons/mrp_repair/report/order.rml index e0f89a14b73..202ed6e4684 100644 --- a/addons/mrp_repair/report/order.rml +++ b/addons/mrp_repair/report/order.rml @@ -256,7 +256,7 @@ [[ o.product_id.name or '' ]] - [[ o.prodlot_id.name or ' ' ]] + [[ o.prodlot_id.name or ' ' ]] [[ formatLang(o.guarantee_limit,date = True) ]] From dc152e121b8cb4195f28a3a3ca54f8b32e069464 Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Thu, 5 Sep 2013 11:07:25 +0530 Subject: [PATCH 09/28] [IMP] update location_id for requisition bzr revid: rma@tinyerp.com-20130905053725-s5ip43hlwg0ojnr5 --- addons/purchase_requisition/purchase_requisition.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py index 40b2455871c..a0a6b7797af 100644 --- a/addons/purchase_requisition/purchase_requisition.py +++ b/addons/purchase_requisition/purchase_requisition.py @@ -142,7 +142,7 @@ class purchase_requisition(osv.osv): 'date_order': requisition.date_end or fields.date.context_today(self, cr, uid, context=context), 'partner_id': supplier.id, 'pricelist_id': supplier_pricelist, - 'location_id': supplier.property_stock_supplier.id, + 'location_id': requisition.warehouse_id.lot_stock_id.id, 'company_id': requisition.company_id.id, 'fiscal_position': supplier.property_account_position and supplier.property_account_position.id or False, 'requisition_id': requisition.id, From 46548dfb5e5212657cf0dedc4ab3031e8eda9ca7 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Fri, 6 Sep 2013 10:07:58 +0200 Subject: [PATCH 10/28] [FIX]all mandatory field in picking_type_data should be filled bzr revid: csn@openerp.com-20130906080758-xdprd4av4pe6db4f --- addons/stock/stock_data.xml | 2 ++ addons/stock_complex_routes/stock_complex_routes.xml | 1 + addons/stock_multi_warehouse/stock_multi_warehouse.yml | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/stock/stock_data.xml b/addons/stock/stock_data.xml index b591263f4b2..1fd0f864ef3 100644 --- a/addons/stock/stock_data.xml +++ b/addons/stock/stock_data.xml @@ -120,6 +120,8 @@ Internal Transfers + + internal diff --git a/addons/stock_complex_routes/stock_complex_routes.xml b/addons/stock_complex_routes/stock_complex_routes.xml index f2c71735527..0591622dbe7 100644 --- a/addons/stock_complex_routes/stock_complex_routes.xml +++ b/addons/stock_complex_routes/stock_complex_routes.xml @@ -15,6 +15,7 @@ dropship incoming + diff --git a/addons/stock_multi_warehouse/stock_multi_warehouse.yml b/addons/stock_multi_warehouse/stock_multi_warehouse.yml index 94f192bbbd6..aea7a0e1e7f 100644 --- a/addons/stock_multi_warehouse/stock_multi_warehouse.yml +++ b/addons/stock_multi_warehouse/stock_multi_warehouse.yml @@ -79,7 +79,7 @@ code_id: internal sequence_id: stock.seq_picking_type_internal warehouse_id: wh_panama_santiago - default_location_src_id: location_panama_santiago_input + default_location_src_id: location_panama_santiago_stock default_location_dest_id: location_panama_santiago_stock - Create Location structure of Warehouse Panama Main @@ -142,7 +142,7 @@ code_id: internal sequence_id: stock.seq_picking_type_internal warehouse_id: wh_panama_main - default_location_src_id: location_panama_main_input + default_location_src_id: location_panama_main_stock default_location_dest_id: location_panama_main_stock - Create Location structure of Warehouse Dubai From 0dc363f7d4ffd41e3364859ae0a8a64a2638bfbe Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 6 Sep 2013 10:44:09 +0200 Subject: [PATCH 11/28] [FIX] purchase: fifo price.yml + fix in action_assign (wrong uom qty conversion) bzr revid: qdp-launchpad@openerp.com-20130906084409-ro0atvrcxh8b6nep --- addons/purchase/test/fifo_price.yml | 2 +- addons/stock/stock.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/purchase/test/fifo_price.yml b/addons/purchase/test/fifo_price.yml index 3c45cd1c9c1..42e8897eb01 100644 --- a/addons/purchase/test/fifo_price.yml +++ b/addons/purchase/test/fifo_price.yml @@ -190,7 +190,7 @@ Process the reception of purchase order with usd - !python {model: stock.picking}: | - pick_obj = self.pool.get('stock.picking').browse(cr, uid, ref("purchase_order_fifo_usd")) + pick_obj = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo_usd")).picking_ids[0] pick_obj.do_partial(context=context) - We create delivery order of 49.5 kg diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 87f29cc6124..6923044dc4e 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -231,7 +231,6 @@ class stock_quant(osv.osv): result += self._quants_get_lifo(cr, uid, location, product, qty, domain, prefered_order=prefered_order, context=context) else: raise osv.except_osv(_('Error!'), _('Removal strategy %s not implemented.' % (removal_strategy,))) - print 'Quant get result', result return result # @@ -1441,7 +1440,7 @@ class stock_move(osv.osv): done.append(move.id) continue else: - qty = uom_obj._compute_qty(cr, uid, move.product_uom.id, move.product_qty, move.product_id.uom_id.id) + qty = move.product_qty dp = [] for m2 in move.move_orig_ids: for q in m2.quant_ids: From f0f8fcb46e3bb94b9d4b3c5993c01fbd52eec639 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 6 Sep 2013 10:59:03 +0200 Subject: [PATCH 12/28] [FIX] purchase: removed annoying deprecation warning on trg_trigger bzr revid: qdp-launchpad@openerp.com-20130906085903-2cmc6fckttdyw7xf --- addons/purchase/stock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index ef1d5107093..34d8c8df595 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -33,9 +33,9 @@ class stock_move(osv.osv): if isinstance(ids, (int, long)): ids = [ids] res = super(stock_move, self).write(cr, uid, ids, vals, context=context) - wf_service = netsvc.LocalService('workflow') + from openerp import workflow for id in ids: - wf_service.trg_trigger(uid, 'stock.move', id, cr) + workflow.trg_trigger(uid, 'stock.move', id, cr) return res # From 4952b96ff7ce2c369a48388b3e3242ca0067a00f Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Fri, 6 Sep 2013 11:57:26 +0200 Subject: [PATCH 13/28] [IMP] Add store on package company_id and add owner, add parent_left/right store bzr revid: jco@openerp.com-20130906095726-ozz6lohbujidgm23 --- addons/stock/procurement.py | 9 ++++----- addons/stock/stock.py | 26 +++++++++++++++++++++----- addons/stock/stock_view.xml | 3 ++- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/addons/stock/procurement.py b/addons/stock/procurement.py index c9d89816983..fbc1fb69f83 100644 --- a/addons/stock/procurement.py +++ b/addons/stock/procurement.py @@ -173,7 +173,7 @@ class procurement_order(osv.osv): 'product_uom': product.uom_id.id, 'location_id': location_id, 'company_id': warehouse.company_id.id, - 'procure_method': 'make_to_order',} + } def create_automatic_op(self, cr, uid, context=None): """ @@ -204,7 +204,7 @@ class procurement_order(osv.osv): product = product_obj.browse(cr, uid, [product_read['id']], context=context)[0] if product.supply_method == 'buy': - location_id = warehouse.lot_input_id.id + location_id = warehouse.lot_stock_id.id elif product.supply_method == 'produce': location_id = warehouse.lot_stock_id.id else: @@ -212,8 +212,8 @@ class procurement_order(osv.osv): proc_id = proc_obj.create(cr, uid, self._prepare_automatic_op_procurement(cr, uid, product, warehouse, location_id, context=context), context=context) - self.signal_button_confirm(cr, uid, [proc_id]) - self.signal_button_check(cr, uid, [proc_id]) + self.assign(cr, uid, [proc_id]) + self.run(cr, uid, [proc_id]) return True def _get_orderpoint_date_planned(self, cr, uid, orderpoint, start_date, context=None): @@ -229,7 +229,6 @@ class procurement_order(osv.osv): 'company_id': orderpoint.company_id.id, 'product_uom': orderpoint.product_uom.id, 'location_id': orderpoint.location_id.id, - 'procure_method': 'make_to_order', 'origin': orderpoint.name} def _product_virtual_get(self, cr, uid, order_point): diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 6923044dc4e..5d3c79417e5 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1950,7 +1950,10 @@ class stock_package(osv.osv): """ _name = "stock.quant.package" _description = "Physical Packages" - _order = 'name' + _parent_name = "parent_id" + _parent_store = True + _parent_order = 'name' + _order = 'parent_left' def name_get(self, cr, uid, ids, context=None): res = self._complete_name(cr, uid, ids, 'complete_name', None, context=context) @@ -1985,16 +1988,20 @@ class stock_package(osv.osv): res.add(pack.parent_id.id) return list(res) + # TODO: Problem when package is empty! + # def _get_package_info(self, cr, uid, ids, name, args, context=None): default_company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id res = {}.fromkeys(ids, {'location_id': False, 'company_id': default_company_id}) for pack in self.browse(cr, uid, ids, context=context): if pack.quant_ids: res[pack.id]['location_id'] = pack.quant_ids[0].location_id.id + res[pack.id]['owner_id'] = pack.quant_ids[0].owner_id and pack.quant_ids[0].owner_id.id or False res[pack.id]['company_id'] = pack.quant_ids[0].company_id.id elif pack.children_ids: - res[pack.id]['location_id'] = pack.children_ids[0].location_id.id - res[pack.id]['company_id'] = pack.children_ids[0].company_id.id + res[pack.id]['location_id'] = pack.children_ids[0].location_id and pack.children_ids[0].location_id.id or False + res[pack.id]['owner_id'] = pack.children_ids[0].owner_id and pack.children_ids[0].owner_id.id or False + res[pack.id]['company_id'] = pack.children_ids[0].company_id and pack.children_ids[0].company_id.id or False return res _columns = { @@ -2006,12 +2013,21 @@ class stock_package(osv.osv): 'location_id': fields.function(_get_package_info, type='many2one', relation='stock.location', string='Location', multi="package", store={ 'stock.quant': (_get_packages, ['location_id'], 10), - 'stock.quant.package': (_get_packages_to_relocate, ['children_ids', 'quant_ids', 'parent_id'], 10), + 'stock.quant.package': (_get_packages_to_relocate, ['quant_ids', 'children_ids', 'parent_id'], 10), }, readonly=True), 'quant_ids': fields.one2many('stock.quant', 'package_id', 'Bulk Content'), 'parent_id': fields.many2one('stock.quant.package', 'Parent Package', help="The package containing this item"), 'children_ids': fields.one2many('stock.quant.package', 'parent_id', 'Contained Packages'), - 'company_id': fields.function(_get_package_info, type="many2one", relation='res.company', string='Company', multi="package"), + 'company_id': fields.function(_get_package_info, type="many2one", relation='res.company', string='Company', multi="package", + store={ + 'stock.quant': (_get_packages, ['company_id'], 10), + 'stock.quant.package': (_get_packages_to_relocate, ['quant_ids', 'children_ids', 'parent_id'], 10), + }, readonly=True), + 'owner_id': fields.function(_get_package_info, type='many2one', relation='res.partner', string='Owner', multi="package", + store={ + 'stock.quant': (_get_packages, ['owner_id'], 10), + 'stock.quant.package': (_get_packages_to_relocate, ['quant_ids', 'children_ids', 'parent_id'], 10), + }, readonly=True), } _defaults = { 'name': lambda self, cr, uid, context: self.pool.get('ir.sequence').get(cr, uid, 'stock.quant.package') or _('Unknown Pack') diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index f5f7f6532fb..928d6b2ca21 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -614,7 +614,7 @@ - + @@ -1725,6 +1725,7 @@ + From 4899e29bd2a705e1474747624b550c7b1c7916cb Mon Sep 17 00:00:00 2001 From: "Pooja Zankhariya (OpenERP)" Date: Fri, 6 Sep 2013 15:47:28 +0530 Subject: [PATCH 14/28] [IMP]Improved Code bzr revid: pza@tinyerp.com-20130906101728-wr9oi2wv54jhgzux --- addons/delivery/stock.py | 6 ++++-- addons/stock_account/stock.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/delivery/stock.py b/addons/delivery/stock.py index 3c1440cf951..d09481117e3 100644 --- a/addons/delivery/stock.py +++ b/addons/delivery/stock.py @@ -123,16 +123,18 @@ class stock_picking(osv.osv): group=False, type='out_invoice', context=None): invoice_obj = self.pool.get('account.invoice') picking_obj = self.pool.get('stock.picking') + move_obj = self.pool.get('stock.move') invoice_line_obj = self.pool.get('account.invoice.line') result = super(stock_picking, self).action_invoice_create(cr, uid, ids, journal_id=journal_id, group=group, type=type, context=context) - for picking in picking_obj.browse(cr, uid, result, context=context): - invoice = invoice_obj.browse(cr, uid, picking.id, context=context) + for picking in picking_obj.browse(cr, uid, ids, context=context): + invoice = invoice_obj.browse(cr, uid, result, context=context) invoice_line = self._prepare_shipping_invoice_line(cr, uid, picking, invoice, context=context) if invoice_line: invoice_line_obj.create(cr, uid, invoice_line) invoice_obj.button_compute(cr, uid, [invoice.id], context=context) + move_obj.write(cr, uid, [x.id for x in picking.move_lines], {'invoice_state': 'invoiced'}, context=context) return result def _get_default_uom(self,cr,uid,c): uom_categ, uom_categ_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'product', 'product_uom_categ_kgm') diff --git a/addons/stock_account/stock.py b/addons/stock_account/stock.py index ff48e865737..8a8066e6521 100644 --- a/addons/stock_account/stock.py +++ b/addons/stock_account/stock.py @@ -113,7 +113,7 @@ class stock_picking(osv.osv): store={ 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['state'], 10), - 'stock.move': (__get_picking_move, ['picking_id'], 10), + 'stock.move': (__get_picking_move, ['picking_id', 'invoice_state'], 10), }, ), } From a4433a15ffed1d84b10943184e9f6980213686f0 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Fri, 6 Sep 2013 12:37:59 +0200 Subject: [PATCH 15/28] [IMP] Should not take a rule from any route, but a global rule finally bzr revid: jco@openerp.com-20130906103759-0irq12jnthz18no9 --- addons/stock_location/stock_location.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock_location/stock_location.py b/addons/stock_location/stock_location.py index 4b3d32d9fcc..5a4f4b8a9f1 100644 --- a/addons/stock_location/stock_location.py +++ b/addons/stock_location/stock_location.py @@ -171,7 +171,7 @@ class procurement_order(osv.osv): route_ids = [x.id for x in procurement.route_ids] + [x.id for x in procurement.product_id.route_ids] res = self.pool.get('procurement.rule').search(cr, uid, domain + [('route_id', 'in', route_ids)], order = 'route_sequence, sequence', context=context) if not res: - res = self.pool.get('procurement.rule').search(cr, uid, domain, order='sequence', context=context) + res = self.pool.get('procurement.rule').search(cr, uid, domain + [('route_id', '=', False)], order='sequence', context=context) return res From f5ad729ab5c1ee6b9b9bfbf48e6aef36dddfd329 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Fri, 6 Sep 2013 13:54:02 +0200 Subject: [PATCH 16/28] [IMP] Add checkboxes on routes bzr revid: jco@openerp.com-20130906115402-195wsif9wg6z6cgh --- addons/sale_stock_location/sale_stock_location.py | 4 ++-- .../sale_stock_location_view.xml | 15 +++++++++++++-- .../stock_complex_routes/stock_complex_routes.xml | 9 +++++++-- .../test/procurementexception.yml | 2 +- addons/stock_location/stock_location.py | 9 ++++++--- addons/stock_location/stock_location_data.xml | 9 ++++++++- addons/stock_location/stock_location_view.xml | 8 ++++++++ 7 files changed, 45 insertions(+), 11 deletions(-) diff --git a/addons/sale_stock_location/sale_stock_location.py b/addons/sale_stock_location/sale_stock_location.py index 6cbde59ef2d..212b53c5996 100644 --- a/addons/sale_stock_location/sale_stock_location.py +++ b/addons/sale_stock_location/sale_stock_location.py @@ -48,14 +48,14 @@ class sale_order(osv.osv): class sale_order_line(osv.osv): _inherit = 'sale.order.line' _columns = { - 'route_id': fields.many2one('stock.location.route', 'Route', domain=[('sale', '=', True)]), + 'route_id': fields.many2one('stock.location.route', 'Route', domain=[('sale_selectable', '=', True)]), } class stock_location_route(osv.osv): _inherit = "stock.location.route" _columns = { - 'sale':fields.boolean("Can be set on sale order line") + 'sale_selectable':fields.boolean("Selectable on Sales Order Line") } diff --git a/addons/sale_stock_location/sale_stock_location_view.xml b/addons/sale_stock_location/sale_stock_location_view.xml index 7fd0f1853b2..de643a2f917 100644 --- a/addons/sale_stock_location/sale_stock_location_view.xml +++ b/addons/sale_stock_location/sale_stock_location_view.xml @@ -44,10 +44,21 @@ stock.location.route - - + + + + stock.location.route.tree.inherit + + stock.location.route + + + + + + + diff --git a/addons/stock_complex_routes/stock_complex_routes.xml b/addons/stock_complex_routes/stock_complex_routes.xml index 0591622dbe7..496a0144c37 100644 --- a/addons/stock_complex_routes/stock_complex_routes.xml +++ b/addons/stock_complex_routes/stock_complex_routes.xml @@ -23,7 +23,8 @@ Drop Shipping 3 - True + + @@ -40,7 +41,9 @@ Crossdock - True + + + Supplier → Output @@ -50,5 +53,7 @@ + + diff --git a/addons/stock_complex_routes/test/procurementexception.yml b/addons/stock_complex_routes/test/procurementexception.yml index e5c7dbfd72c..018795d1fc7 100644 --- a/addons/stock_complex_routes/test/procurementexception.yml +++ b/addons/stock_complex_routes/test/procurementexception.yml @@ -60,4 +60,4 @@ sale_id = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_route_crossdock")) proc_ids = self.search(cr, uid, [('group_id.name', '=', sale_id.name)]) purchase_id = [proc.purchase_id for proc in self.browse(cr, uid, proc_ids) if proc.purchase_id] - assert purchase_id, 'No Purchase Quotation is created' + assert purchase_id, 'No Purchase Quotation is created' \ No newline at end of file diff --git a/addons/stock_location/stock_location.py b/addons/stock_location/stock_location.py index 5a4f4b8a9f1..46ecd325f52 100644 --- a/addons/stock_location/stock_location.py +++ b/addons/stock_location/stock_location.py @@ -34,6 +34,9 @@ class stock_location_route(osv.osv): 'sequence': fields.integer('Sequence'), 'pull_ids': fields.one2many('procurement.rule', 'route_id', 'Pull Rules'), 'push_ids': fields.one2many('stock.location.path', 'route_id', 'Push Rules'), + 'product_selectable': fields.boolean('Selectable on Product'), + 'product_categ_selectable': fields.boolean('Selectable on Product Category'), + 'warehouse_selectable': fields.boolean('Selectable on Warehouse'), } _defaults = { 'sequence': lambda self,cr,uid,ctx: 0, @@ -42,7 +45,7 @@ class stock_location_route(osv.osv): class stock_warehouse(osv.osv): _inherit = 'stock.warehouse' _columns = { - 'route_id': fields.many2one('stock.location.route', 'Default Routes', help='Default route through the warehouse', required=True), + 'route_id': fields.many2one('stock.location.route', 'Default Routes', domain="[('warehouse_selectable', '=', True)]", help='Default route through the warehouse', required=True), } @@ -201,13 +204,13 @@ class product_removal_strategy(osv.osv): class product_product(osv.osv): _inherit = 'product.product' _columns = { - 'route_ids': fields.many2many('stock.location.route', 'stock_location_route_product', 'product_id', 'route_id', 'Routes'), + 'route_ids': fields.many2many('stock.location.route', 'stock_location_route_product', 'product_id', 'route_id', 'Routes', domain="[('product_selectable', '=', True)]"), } class product_category(osv.osv): _inherit = 'product.category' _columns = { - 'route_ids': fields.many2many('stock.location.route', 'stock_location_route_categ', 'categ_id', 'route_id', 'Routes'), + 'route_ids': fields.many2many('stock.location.route', 'stock_location_route_categ', 'categ_id', 'route_id', 'Routes', domain="[('product_categ_selectable', '=', True)]"), 'removal_strategy_ids': fields.one2many('product.removal', 'product_categ_id', 'Removal Strategies'), #'putaway_strategy_ids': fields.one2many('product.putaway', 'product_categ_id', 'Put Away Strategies'), } diff --git a/addons/stock_location/stock_location_data.xml b/addons/stock_location/stock_location_data.xml index c5f438b920a..042f9571f3f 100644 --- a/addons/stock_location/stock_location_data.xml +++ b/addons/stock_location/stock_location_data.xml @@ -24,6 +24,7 @@ Sale: Ship only 20 + @@ -49,8 +50,10 @@ - Produce or buy on Customer Order + MTO 10 + + @@ -66,6 +69,8 @@ Crossdock 9 + + @@ -81,6 +86,7 @@ Sale: Pack + Ship 15 + @@ -130,6 +136,7 @@ Sale: Pick + Pack + Ship 20 + diff --git a/addons/stock_location/stock_location_view.xml b/addons/stock_location/stock_location_view.xml index c6d441e6930..cfd5a858d82 100644 --- a/addons/stock_location/stock_location_view.xml +++ b/addons/stock_location/stock_location_view.xml @@ -166,6 +166,9 @@ + + + @@ -178,6 +181,11 @@
+ + + + + From 7cace1fb20913294305726872b55c84760fddade Mon Sep 17 00:00:00 2001 From: "Pooja Zankhariya (OpenERP)" Date: Fri, 6 Sep 2013 18:46:37 +0530 Subject: [PATCH 17/28] [IMP]Improved Delivery Code bzr revid: pza@tinyerp.com-20130906131637-sdg9kik868ia2pbu --- addons/delivery/__openerp__.py | 2 +- addons/delivery/report/shipping.py | 11 +++++++++++ addons/delivery/report/shipping.rml | 25 ++++++++----------------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/addons/delivery/__openerp__.py b/addons/delivery/__openerp__.py index 089dc3e14d7..6201668bd90 100644 --- a/addons/delivery/__openerp__.py +++ b/addons/delivery/__openerp__.py @@ -32,7 +32,7 @@ You can define your own carrier and delivery grids for prices. When creating invoices from picking, OpenERP is able to add and compute the shipping line. """, 'author': 'OpenERP SA', - 'depends': ['sale', 'purchase', 'stock_account'], + 'depends': ['sale_stock', 'purchase'], 'data': [ 'security/ir.model.access.csv', 'delivery_report.xml', diff --git a/addons/delivery/report/shipping.py b/addons/delivery/report/shipping.py index 53bdad807c0..2becbc87b47 100644 --- a/addons/delivery/report/shipping.py +++ b/addons/delivery/report/shipping.py @@ -28,8 +28,19 @@ class shipping(report_sxw.rml_parse): super(shipping, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, + 'get_partner_invoice_id': self.get_partner_invoice_info, }) + def get_partner_invoice_info(self, origin): + """This method is used to get information of invoiced partner. + :param: origin: origin of picking + :return: tuple contaning partner name and address of invoiced partner + """ + sale_obj = self.pool.get('sale.order') + sale_id = sale_obj.search(self.cr, self.uid, [('name', '=', origin)])[0] + partner_invoice_id = sale_obj.browse(self.cr, self.uid, sale_id).partner_invoice_id + return partner_invoice_id.name, self.pool.get('res.partner')._display_address(self.cr, self.uid, partner_invoice_id) + report_sxw.report_sxw('report.sale.shipping','stock.picking','addons/delivery/report/shipping.rml',parser=shipping) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/delivery/report/shipping.rml b/addons/delivery/report/shipping.rml index 5a3750e64a8..38e13a27936 100644 --- a/addons/delivery/report/shipping.rml +++ b/addons/delivery/report/shipping.rml @@ -107,14 +107,11 @@ - + Description - - Lot - Quantity @@ -130,12 +127,12 @@ Invoiced to - [[ o.sale_id and o.sale_id.partner_invoice_id and o.sale_id.partner_invoice_id.name or '']] - [[ o.sale_id and o.sale_id.partner_invoice_id and display_address(o.sale_id.partner_invoice_id) ]] + [[ o.origin and get_partner_invoice_id(o.origin)[0] or '' ]] + [[ o.origin and get_partner_invoice_id(o.origin)[1] or '' ]] - [[ o.partner_id and o.partner_id and o.partner_id.name or '' ]] - [[ o.partner_id and o.partner_id and display_address(o.partner_id) ]] + [[ o.partner_id and o.partner_id.name or '' ]] + [[ o.partner_id and display_address(o.partner_id) ]] @@ -165,7 +162,7 @@ - [[ o.sale_id and o.sale_id.name ]] + [[ o.origin or '' ]] [[ formatLang(o.date,date_time=True) ]] @@ -184,14 +181,11 @@ - + Description - - Lot - Quantity @@ -199,14 +193,11 @@
[[repeatIn(o.move_lines,'line')]] - + [[line.product_id.code ]] [[ line.product_id and line.product_id.name or '']] - - [[ (line.prodlot_id and (line.prodlot_id.name + (line.prodlot_id.ref and ('/' + line.prodlot_id.ref) or ''))) or ' ' ]] - [[ formatLang(line.product_qty) ]] [[ line.product_uom and line.product_uom.name ]] From 6c9490d11c85cd836e8458980a684a24e46b393f Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 9 Sep 2013 11:10:56 +0200 Subject: [PATCH 18/28] [FIX] stock: invoice on delivery can be done on picking that aren't linked to a sale order/procurement. It fixes a bug in anlgo saxon yml test also bzr revid: qdp-launchpad@openerp.com-20130909091056-40uvicvymia2yui2 --- .../account_anglo_saxon/test/anglo_saxon.yml | 6 +- addons/stock_account/stock.py | 63 ++++++++++++------- .../wizard/stock_invoice_onshipping.py | 2 - 3 files changed, 41 insertions(+), 30 deletions(-) diff --git a/addons/account_anglo_saxon/test/anglo_saxon.yml b/addons/account_anglo_saxon/test/anglo_saxon.yml index 0a2dcf5f5fc..ca7195cb754 100644 --- a/addons/account_anglo_saxon/test/anglo_saxon.yml +++ b/addons/account_anglo_saxon/test/anglo_saxon.yml @@ -192,7 +192,7 @@ - company_id: base.main_company location_id: stock.stock_location_stock product_id: product.product_product_3 - product_qty: 1.0 + product_uom_qty: 1.0 product_uom: product.product_uom_unit location_dest_id: stock.stock_location_customers invoice_state: 2binvoiced @@ -235,9 +235,7 @@ !python {model: stock.invoice.onshipping}: | wiz_id = self.create(cr, uid, {'invoice_date': '2013-03-04', 'journal_id': ref('account.sales_journal')}, {'active_ids': [ref("stock_picking_out001")], "active_model": "stock.picking"}) - self.create_invoice(cr, uid, [wiz_id], {"lang": "en_US", - "search_default_available": 1, "tz": False, "active_model": "stock.picking", - "contact_display": "partner", "active_ids": [ref("stock_picking_out001")], "active_id": ref("stock_picking_out001")}) + self.create_invoice(cr, uid, [wiz_id], {"active_ids": [ref("stock_picking_out001")], "active_id": ref("stock_picking_out001")}) - I check that the customer invoice is created successfully. - diff --git a/addons/stock_account/stock.py b/addons/stock_account/stock.py index ff48e865737..79075599121 100644 --- a/addons/stock_account/stock.py +++ b/addons/stock_account/stock.py @@ -133,7 +133,7 @@ class stock_picking(osv.osv): for picking in self.browse(cr, uid, ids, context=context): key = group and picking.id or True for move in picking.move_lines: - if move.procurement_id and (move.procurement_id.invoice_state=='2binvoiced'): + if move.procurement_id and (move.procurement_id.invoice_state == '2binvoiced') or move.invoice_state == '2binvoiced': if (move.state <> 'cancel') and not move.scrapped: todo.setdefault(key, []) todo[key].append(move) @@ -146,12 +146,26 @@ class stock_picking(osv.osv): invoice_obj = self.pool.get('account.invoice') invoices = {} for move in moves: - sale_line = move.procurement_id.sale_line_id - sale = sale_line.order_id - partner = sale.partner_invoice_id - - currency_id = sale.pricelist_id.currency_id.id - key = (partner.id, currency_id, sale.company_id.id, sale.user_id and sale.user_id.id or False) + company = move.company_id + account_analytic_id = False + if move.procurement_id: + sale_line = move.procurement_id.sale_line_id + sale = sale_line.order_id + user_id = self.user_id.id + partner = sale.partner_invoice_id + currency_id = sale.pricelist_id.currency_id.id + origin = sale.name + account_analytic_id = sale.project_id and sale.project_id.id or False + unit_price = sale_line.price_unit + discount = sale_line.discount + else: + partner = move.picking_id.partner_id + currency_id = company.currency_id.id + user_id = uid + origin = move.picking_id.name + unit_price = move.product_id.list_price #TODO: use price_get + discount = 0 + key = (partner.id, currency_id, company.id, user_id) if key not in invoices: # Get account and payment terms @@ -163,16 +177,16 @@ class stock_picking(osv.osv): payment_term = partner.property_supplier_payment_term.id or False invoice_id = invoice_obj.create(cr, uid, { - 'origin': sale.name, + 'origin': origin, 'date_invoice': context.get('date_inv', False), - 'user_id': sale.user_id and sale.user_id.id or False, + 'user_id': user_id, 'partner_id': partner.id, 'account_id': account_id, 'payment_term': payment_term, 'type': inv_type, 'fiscal_position': partner.property_account_position.id, - 'company_id': sale.company_id.id, - 'currency_id': sale.pricelist_id.currency_id.id, + 'company_id': company.id, + 'currency_id': currency_id, 'journal_id': journal_id, }, context=context) invoices[key] = invoice_id @@ -206,22 +220,23 @@ class stock_picking(osv.osv): 'product_id': move.product_id.id, 'uos_id': uos_id, 'quantity': quantity, - 'price_unit': sale_line.price_unit, - 'discount': sale_line.discount, - 'invoice_line_tax_id': [(6, 0, [x.id for x in sale_line.tax_id])], - 'account_analytic_id': sale.project_id and sale.project_id.id or False, + 'price_unit': unit_price, + 'discount': discount, + #'invoice_line_tax_id': [(6, 0, [x.id for x in sale_line.tax_id])], TODO add me back + 'account_analytic_id': account_analytic_id, }, context=context) - self.pool.get('sale.order.line').write(cr, uid, [sale_line.id], { - 'invoice_lines': [(4, invoice_line_id)] - }, context=context) - self.pool.get('sale.order').write(cr, uid, [sale.id], { - 'invoice_ids': [(4, invoices[key])], - }) + if move.procurement_id: + self.pool.get('sale.order.line').write(cr, uid, [sale_line.id], { + 'invoice_lines': [(4, invoice_line_id)] + }, context=context) + self.pool.get('sale.order').write(cr, uid, [sale.id], { + 'invoice_ids': [(4, invoices[key])], + }) - self.pool.get('procurement.order').write(cr, uid, [move.procurement_id.id], { - 'invoice_state': 'invoiced', - }, context=context) + self.pool.get('procurement.order').write(cr, uid, [move.procurement_id.id], { + 'invoice_state': 'invoiced', + }, context=context) invoice_obj.button_compute(cr, uid, invoices.values(), context=context, set_total=(inv_type in ('in_invoice', 'in_refund'))) return invoices.values() diff --git a/addons/stock_account/wizard/stock_invoice_onshipping.py b/addons/stock_account/wizard/stock_invoice_onshipping.py index 1231532b684..f600b28f585 100644 --- a/addons/stock_account/wizard/stock_invoice_onshipping.py +++ b/addons/stock_account/wizard/stock_invoice_onshipping.py @@ -71,7 +71,6 @@ class stock_invoice_onshipping(osv.osv_memory): def open_invoice(self, cr, uid, ids, context=None): if context is None: context = {} - print 'Create Invoice', context invoice_ids = self.create_invoice(cr, uid, ids, context=context) if not invoice_ids: raise osv.except_osv(_('Error!'), _('No invoice created!')) @@ -97,7 +96,6 @@ class stock_invoice_onshipping(osv.osv_memory): def create_invoice(self, cr, uid, ids, context=None): context = context or {} - picking_pool = self.pool.get('stock.picking') onshipdata_obj = self.read(cr, uid, ids, ['journal_id', 'group', 'invoice_date', 'inv_type']) From 5d8cd42332d4a9e66c31843ad335c2c42a80013e Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 9 Sep 2013 12:02:29 +0200 Subject: [PATCH 19/28] [FIX] stock: update the standard price of product with cost_method == 'real' on negative quant reconciliation. bzr revid: qdp-launchpad@openerp.com-20130909100229-txuyflkp6iikiesq --- addons/purchase/test/fifo_price.yml | 18 ++++++--- addons/stock/stock.py | 33 ++++++++------- addons/stock_account/stock_account.py | 58 +++++++++++++++------------ 3 files changed, 62 insertions(+), 47 deletions(-) diff --git a/addons/purchase/test/fifo_price.yml b/addons/purchase/test/fifo_price.yml index 42e8897eb01..3bf162ae50a 100644 --- a/addons/purchase/test/fifo_price.yml +++ b/addons/purchase/test/fifo_price.yml @@ -255,9 +255,11 @@ Check rounded price is 150.0 / 1.2834 - !python {model: product.product}: | - assert round(self.browse(cr, uid, ref("product_fifo_icecream")).standard_price) == round(150.0 / 1.2834), "Product price not updated accordingly. %s found instead of %s" %(self.browse(cr, uid, ref("product_fifo_icecream")).standard_price, round(150.0/1.2834)) + product = self.browse(cr, uid, ref("product_fifo_icecream")) + assert round(product.standard_price) == round(150.0 / 1.2834), "Product price not updated accordingly. %s found instead of %s" %(product.standard_price, round(150.0/1.2834)) + assert product.qty_available == 0.0, 'Wrong quantity in stock after first reception' - - Let us create some outs to get negative stock. Create outpicking. We create delivery order of 200 kg, but will pick only 100 kg + Let us create some outs to get negative stock. Create outpicking. We create delivery order of 100 kg. - !record {model: stock.picking, id: outgoing_fifo_shipment_neg}: picking_type_id: stock.picking_type_out @@ -268,12 +270,18 @@ picking_id: outgoing_fifo_shipment_neg product_id: product_fifo_icecream product_uom: product.product_uom_kgm - product_uom_qty: 200.0 + product_uom_qty: 100.0 location_id: stock.stock_location_stock location_dest_id: stock.stock_location_customers picking_type_id: stock.picking_type_out - - Let us create another out of 400 kg, but will pick only 50 kg + Process the delivery of the first outgoing shipment +- + !python {model: stock.picking}: | + picking_obj = self.browse(cr, uid, ref("outgoing_fifo_shipment_neg")) + picking_obj.do_partial(context=context) +- + Let us create another out of 400 kg - !record {model: stock.picking, id: outgoing_fifo_shipment_neg2}: picking_type_id: stock.picking_type_out @@ -292,8 +300,6 @@ Process the delivery of the outgoing shipments - !python {model: stock.picking}: | - picking_obj = self.browse(cr, uid, ref("outgoing_fifo_shipment_neg")) - picking_obj.do_partial(context=context) picking_obj1 = self.browse(cr, uid, ref("outgoing_fifo_shipment_neg2")) picking_obj1.do_partial(context=context) - diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 5d3c79417e5..82b91d8f66c 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -167,6 +167,7 @@ class stock_quant(osv.osv): # Used for negative quants to reconcile after compensated by a new positive one 'propagated_from_id': fields.many2one('stock.quant', 'Linked Quant', help='The negative quant this is coming from'), + 'negative_dest_location_id': fields.many2one('stock.location', 'Destination Location', help='Technical field used to record the destination location of a move that created a negative quant'), } _defaults = { @@ -260,6 +261,7 @@ class stock_quant(osv.osv): negative_vals['location_id'] = move.location_id.id negative_vals['qty'] = -qty negative_vals['cost'] = price_unit + negative_vals['negative_dest_location_id'] = move.location_dest_id.id negative_quant_id = self.create(cr, uid, negative_vals, context=context) vals.update({'propagated_from_id': negative_quant_id}) @@ -283,6 +285,20 @@ class stock_quant(osv.osv): move = m return move + def _reconcile_single_negative_quant(self, cr, uid, to_solve_quant, quant, quant_neg, qty, context=None): + move = self._get_latest_move(cr, uid, to_solve_quant, context=context) + self._quant_split(cr, uid, quant, qty, context=context) + remaining_to_solve_quant = self._quant_split(cr, uid, to_solve_quant, qty, context=context) + remaining_neg_quant = self._quant_split(cr, uid, quant_neg, -qty, context=context) + #if the reconciliation was not complete, we need to link together the remaining parts + if remaining_to_solve_quant and remaining_neg_quant: + self.write(cr, uid, remaining_to_solve_quant.id, {'propagated_from_id': remaining_neg_quant.id}, context=context) + #delete the reconciled quants, as it is replaced by the solving quant + self.unlink(cr, SUPERUSER_ID, [quant_neg.id, to_solve_quant.id], context=context) + #call move_single_quant to ensure recursivity if necessary and do the stock valuation + self.move_single_quant(cr, uid, quant, qty, move, context=context) + return remaining_to_solve_quant + def _quant_reconcile_negative(self, cr, uid, quant, context=None): """ When new quant arrive in a location, try to reconcile it with @@ -292,27 +308,14 @@ class stock_quant(osv.osv): if quant.location_id.usage != 'internal': return False quants = self.quants_get(cr, uid, quant.location_id, quant.product_id, quant.qty, [('qty', '<', '0')], context=context) - result = False for quant_neg, qty in quants: if not quant_neg: continue - result = True to_solve_quant = self.search(cr, uid, [('propagated_from_id', '=', quant_neg.id), ('id', '!=', quant.id)], context=context) if not to_solve_quant: continue to_solve_quant = self.browse(cr, uid, to_solve_quant[0], context=context) - move = self._get_latest_move(cr, uid, to_solve_quant, context=context) - self._quant_split(cr, uid, quant, qty, context=context) - remaining_to_solve_quant = self._quant_split(cr, uid, to_solve_quant, qty, context=context) - remaining_neg_quant = self._quant_split(cr, uid, quant_neg, -qty, context=context) - #if the reconciliation was not complete, we need to link together the remaining parts - if remaining_to_solve_quant and remaining_neg_quant: - self.write(cr, uid, remaining_to_solve_quant.id, {'propagated_from_id': remaining_neg_quant.id}, context=context) - #delete the reconciled quants, as it is replaced by the solving quant - self.unlink(cr, SUPERUSER_ID, [quant_neg.id, to_solve_quant.id], context=context) - #call move_single_quant to ensure recursivity if necessary and do the stock valuation - self.move_single_quant(cr, uid, quant, qty, move, context=context) - return result + self._reconcile_single_negative_quant(cr, uid, to_solve_quant, quant, quant_neg, qty, context=context) def _price_update(self, cr, uid, quant, newprice, context=None): self.write(cr, uid, [quant.id], {'cost': newprice}, context=context) @@ -1508,7 +1511,7 @@ class stock_move(osv.osv): # quants = quant_obj.quants_get(cr, uid, move.location_id, move.product_id, qty, context=context) # quant_obj.quants_move(cr, uid, quants, move, location_dest_id, context=context) # should replace the above 2 lines - domain = ['|', ('reservation_id', '=', False), ('reservation_id', '=', move.id)] + domain = ['|', ('reservation_id', '=', False), ('reservation_id', '=', move.id), ('qty', '>', 0)] prefered_order = 'reservation_id' # if lot_id: # prefered_order = 'lot_id<>' + lot_id + ", " + prefered_order diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py index b4d94433f31..adcf6095ba1 100644 --- a/addons/stock_account/stock_account.py +++ b/addons/stock_account/stock_account.py @@ -19,23 +19,13 @@ # ############################################################################## -from datetime import datetime -from dateutil.relativedelta import relativedelta import time -from operator import itemgetter -from itertools import groupby from openerp.osv import fields, osv from openerp.tools.translate import _ -from openerp import netsvc -from openerp import tools -from openerp.tools import float_compare, DEFAULT_SERVER_DATETIME_FORMAT -import openerp.addons.decimal_precision as dp import logging _logger = logging.getLogger(__name__) - - #---------------------------------------------------------- # Stock Location #---------------------------------------------------------- @@ -44,12 +34,12 @@ class stock_location(osv.osv): _inherit = "stock.location" _columns = { - 'valuation_in_account_id': fields.many2one('account.account', 'Stock Valuation Account (Incoming)', domain = [('type','=','other')], + 'valuation_in_account_id': fields.many2one('account.account', 'Stock Valuation Account (Incoming)', domain=[('type', '=', 'other')], help="Used for real-time inventory valuation. When set on a virtual location (non internal type), " "this account will be used to hold the value of products being moved from an internal location " "into this location, instead of the generic Stock Output Account set on the product. " "This has no effect for internal locations."), - 'valuation_out_account_id': fields.many2one('account.account', 'Stock Valuation Account (Outgoing)', domain = [('type','=','other')], + 'valuation_out_account_id': fields.many2one('account.account', 'Stock Valuation Account (Outgoing)', domain=[('type', '=', 'other')], help="Used for real-time inventory valuation. When set on a virtual location (non internal type), " "this account will be used to hold the value of products being moved out of this location " "and into an internal location, instead of the generic Stock Output Account set on the product. " @@ -63,7 +53,6 @@ class stock_location(osv.osv): class stock_quant(osv.osv): _inherit = "stock.quant" - def _get_inventory_value(self, cr, uid, line, prodbrow, context=None): #TODO: what in case of partner_id if prodbrow[(line.company_id.id, line.product_id.id)].cost_method in ('real'): @@ -170,7 +159,7 @@ class stock_quant(osv.osv): 'name': move.name, 'product_id': quant.product_id.id, 'quantity': quant.qty, - 'product_uom_id': quant.product_id.uom_id.id, + 'product_uom_id': quant.product_id.uom_id.id, 'ref': move.picking_id and move.picking_id.name or False, 'date': time.strftime('%Y-%m-%d'), 'partner_id': partner_id, @@ -181,7 +170,7 @@ class stock_quant(osv.osv): 'name': move.name, 'product_id': quant.product_id.id, 'quantity': quant.qty, - 'product_uom_id': quant.product_id.uom_id.id, + 'product_uom_id': quant.product_id.uom_id.id, 'ref': move.picking_id and move.picking_id.name or False, 'date': time.strftime('%Y-%m-%d'), 'partner_id': partner_id, @@ -197,6 +186,18 @@ class stock_quant(osv.osv): return move_obj.create(cr, uid, {'journal_id': journal_id, 'line_id': move_lines, 'ref': move.picking_id and move.picking_id.name}, context=context) + + def _reconcile_single_negative_quant(self, cr, uid, to_solve_quant, quant, quant_neg, qty, context=None): + move = self._get_latest_move(cr, uid, to_solve_quant, context=context) + quant_neg_position = quant_neg.negative_dest_location_id.usage + remaining_to_solve_quant = super(stock_quant, self)._reconcile_single_negative_quant(cr, uid, to_solve_quant, quant, quant_neg, qty, context=context) + #update the standard price of the product, only if we would have done it if we'd have had enough stock at first, which means + #1) there isn't any negative quant anymore + #2) the product cost's method is 'real' + #3) we just fixed a negative quant caused by an outgoing shipment + if not remaining_to_solve_quant and move.product_id.cost_method == 'real' and quant_neg_position != 'internal': + self.pool.get('stock.move')._store_average_cost_price(cr, uid, move, context=context) + class stock_move(osv.osv): _inherit = "stock.move" @@ -204,6 +205,20 @@ class stock_move(osv.osv): super(stock_move, self).action_done(cr, uid, ids, context=context) self.product_price_update(cr, uid, ids, context=context) + def _store_average_cost_price(self, cr, uid, move, context=None): + ''' move is a browe record ''' + product_obj = self.pool.get('product.product') + if any([q.qty <= 0 for q in move.quant_ids]): + #if there is a negative quant, the standard price shouldn't be updated + return + #Note: here we can't store a quant.cost directly as we may have moved out 2 units (1 unit to 5€ and 1 unit to 7€) and in case of a product return of 1 unit, we can't know which of the 2 costs has to be used (5€ or 7€?). So at that time, thanks to the average valuation price we are storing we will svaluate it at 6€ + average_valuation_price = 0.0 + for q in move.quant_ids: + average_valuation_price += q.qty * q.cost + average_valuation_price = average_valuation_price / move.product_qty + product_obj.write(cr, uid, move.product_id.id, {'standard_price': average_valuation_price}, context=context) + self.write(cr, uid, move.id, {'price_unit': average_valuation_price}, context=context) + def product_price_update(self, cr, uid, ids, context=None): ''' This method adapts the price on the product when necessary @@ -228,14 +243,5 @@ class stock_move(osv.osv): #adapt standard price on outgoing moves if the product cost_method is 'real', so that a return #or an inventory loss is made using the last value used for an outgoing valuation. if move.product_id.cost_method == 'real' and move.location_dest_id.usage != 'internal': - if any([q.qty <= 0 for q in move.quant_ids]): - #if there is a negative quant, the standard price shouldn't be updated - continue - #get the average price of the move - #Note: here we can't use the quant.cost directly as we may have moved out 2 units (1 unit to 5€ and 1 unit to 7€) and in case of a product return of 1 unit, we can't know which of the 2 cost has to be used (5€ or 7€?). So at that time, thanks to the average valuation price we are storing we will svaluate it at 6€ - average_valuation_price = 0.0 - for q in move.quant_ids: - average_valuation_price += q.qty * q.cost - average_valuation_price = average_valuation_price / move.product_qty - product_obj.write(cr, uid, move.product_id.id, {'standard_price': average_valuation_price}, context=context) - self.write(cr, uid, move.id, {'price_unit': average_valuation_price}, context=context) + #store the average price of the move on the move and product form + self._store_average_cost_price(cr, uid, move, context=context) From bfafdbc9906dff1c1377c753195ba602a5d12f87 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 9 Sep 2013 13:31:01 +0200 Subject: [PATCH 20/28] [FIX] stock_account: update the product standard price before calling action_done() bzr revid: qdp-launchpad@openerp.com-20130909113101-d2bhurixb68p0w19 --- addons/stock_account/stock_account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py index adcf6095ba1..f00dc88fa84 100644 --- a/addons/stock_account/stock_account.py +++ b/addons/stock_account/stock_account.py @@ -202,8 +202,8 @@ class stock_move(osv.osv): _inherit = "stock.move" def action_done(self, cr, uid, ids, context=None): - super(stock_move, self).action_done(cr, uid, ids, context=context) self.product_price_update(cr, uid, ids, context=context) + super(stock_move, self).action_done(cr, uid, ids, context=context) def _store_average_cost_price(self, cr, uid, move, context=None): ''' move is a browe record ''' From 30f27b8cbb09be031fcea6f1e4850ba16633e752 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Mon, 9 Sep 2013 13:55:15 +0200 Subject: [PATCH 21/28] [IMP] Move route_ids from product from stock_location to stock and remove supply_method (change with route) bzr revid: jco@openerp.com-20130909115515-7z6ixaxe7bpxxe73 --- .../hr_expense/hr_expense_installer_view.xml | 2 +- addons/mrp/mrp.py | 11 +- addons/mrp/mrp_data.xml | 16 +++ addons/mrp/mrp_view.xml | 23 +--- addons/mrp/procurement.py | 7 +- addons/mrp/stock.py | 100 +++++++++--------- addons/multi_company/multi_company_demo.xml | 1 - addons/product_expiry/product_expiry_demo.xml | 4 - addons/project_mrp/project_mrp_view.xml | 10 -- .../worktask_entry_to_timesheetline_entry.yml | 1 - addons/purchase/purchase.py | 5 +- addons/purchase/purchase_data.xml | 10 +- addons/purchase/purchase_view.xml | 12 --- .../purchase/test/process/run_scheduler.yml | 20 ++-- .../purchase_requisition_view.xml | 2 +- addons/sale/sale.py | 12 ++- addons/sale/sale_demo.xml | 1 - addons/sale_mrp/sale_mrp.py | 4 +- addons/sale_mrp/test/sale_mrp.yml | 13 ++- addons/sale_stock/sale_stock.py | 11 ++ .../sale_stock_location_view.xml | 2 +- addons/stock/procurement.py | 36 +++++-- addons/stock/procurement_demo.xml | 19 ---- addons/stock/product.py | 2 + addons/stock/stock.py | 33 ++++-- addons/stock/stock_data.xml | 21 +++- addons/stock/stock_view.xml | 27 ++++- .../stock_complex_routes.xml | 1 + addons/stock_location/stock_location.py | 24 +---- addons/stock_location/stock_location_data.xml | 92 ++++++++-------- addons/stock_location/stock_location_view.xml | 34 +++--- .../test/stock_location_push_flow.yml | 1 - addons/stock_multi_warehouse/__openerp__.py | 4 +- .../stock_multi_warehouse.yml | 10 +- 34 files changed, 297 insertions(+), 274 deletions(-) diff --git a/addons/hr_expense/hr_expense_installer_view.xml b/addons/hr_expense/hr_expense_installer_view.xml index b897673f4ec..e5187650e1c 100644 --- a/addons/hr_expense/hr_expense_installer_view.xml +++ b/addons/hr_expense/hr_expense_installer_view.xml @@ -27,7 +27,7 @@ product.product form tree,form - + [('hr_expense_ok','=',True)] Define one product for each expense type allowed for an employee (travel by car, hostel, restaurant, etc). If you reimburse the employees at a fixed rate, set a cost and a unit of measure on the product. If you reimburse based on real costs, set the cost at 0.00. The user will set the real price when recording his expense sheet. diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 15d034e0010..363981209d6 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -187,7 +187,7 @@ class mrp_bom(osv.osv): result[bom.id] = [] if bom.bom_lines: continue - ok = ((name=='child_complete_ids') and (bom.product_id.supply_method=='produce')) + ok = ((name=='child_complete_ids')) if (bom.type=='phantom' or ok): sids = bom_obj.search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)]) if sids: @@ -209,11 +209,10 @@ class mrp_bom(osv.osv): continue if line.bom_lines or line.type == 'phantom': continue - if line.product_id.supply_method == 'produce': - if line.product_id.procure_method == 'make_to_stock': - res[line.id] = 'stock' - else: - res[line.id] = 'order' + if line.product_id.procure_method == 'make_to_stock': + res[line.id] = 'stock' + else: + res[line.id] = 'order' return res _columns = { diff --git a/addons/mrp/mrp_data.xml b/addons/mrp/mrp_data.xml index a6b65b7c475..42290edde38 100644 --- a/addons/mrp/mrp_data.xml +++ b/addons/mrp/mrp_data.xml @@ -27,5 +27,21 @@ This application supports complete integration and production scheduling for sto 1 + + + + Manufacture + 5 + + + + Manufacture to stock + manufacture + + + + diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 583669277e2..0e47396cfbd 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -347,7 +347,7 @@ - +