From ab73a093833386a9f2f09fb0a7d9c77c3946511b Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Thu, 22 Aug 2013 18:37:55 +0530 Subject: [PATCH 01/41] [IMP] chnage the fifo_return_yml bzr revid: rma@tinyerp.com-20130822130755-9kezd43bj39ninxj --- addons/purchase/test/fifo_returns.yml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/addons/purchase/test/fifo_returns.yml b/addons/purchase/test/fifo_returns.yml index 19fa9a6df38..8d32b6e89c7 100644 --- a/addons/purchase/test/fifo_returns.yml +++ b/addons/purchase/test/fifo_returns.yml @@ -46,10 +46,9 @@ - Process the reception of purchase order 1 - - !python {model: stock.partial.picking}: | - pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet1")).picking_ids - partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]}) - self.do_partial(cr, uid, [partial_id]) + !python {model: stock.picking}: | + order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet1")).picking_ids[0] + order.do_partial(context=context) - Check the standard price of the product (fifo icecream) - @@ -62,10 +61,9 @@ - Process the reception of purchase order 2 - - !python {model: stock.partial.picking}: | - pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet2")).picking_ids - partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]}) - self.do_partial(cr, uid, [partial_id]) + !python {model: stock.picking}: | + order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet2")).picking_ids[0] + order.do_partial(context=context) - Return the goods of purchase order 2 - @@ -73,10 +71,6 @@ pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet2")).picking_ids return_id = self.create(cr, uid, {}, context={'active_model':'stock.picking', 'active_id': pick_ids[0].id}) res = self.create_returns(cr, uid, [return_id], context={'active_id': pick_ids[0].id}) - return_move_id = self.pool.get("stock.move").search(cr, uid, [('move_returned_from','=', pick_ids[0].move_lines[0].id)]) - movepick_obj = self.pool.get("stock.partial.move") - movepick_id = movepick_obj.create(cr, uid, {}, context={'active_model': 'stock.move', 'active_ids': return_move_id}) - movepick_obj.do_partial(cr, uid, [movepick_id]) - Check the standard price of the product (fifo return icecream) changed to 70.0 - From c14bdb4f4cab1126df08ee3163d23f3ea6420b15 Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Mon, 26 Aug 2013 17:57:12 +0530 Subject: [PATCH 02/41] [IMP] optimize code bzr revid: rma@tinyerp.com-20130826122712-9sh92a7tytw0h26i --- addons/purchase/test/fifo_returns.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/purchase/test/fifo_returns.yml b/addons/purchase/test/fifo_returns.yml index 8d32b6e89c7..2d7cb61e648 100644 --- a/addons/purchase/test/fifo_returns.yml +++ b/addons/purchase/test/fifo_returns.yml @@ -47,8 +47,8 @@ Process the reception of purchase order 1 - !python {model: stock.picking}: | - order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet1")).picking_ids[0] - order.do_partial(context=context) + picking_id = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet1")).picking_ids[0] + picking_id.do_partial(context=context) - Check the standard price of the product (fifo icecream) - @@ -62,8 +62,8 @@ Process the reception of purchase order 2 - !python {model: stock.picking}: | - order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet2")).picking_ids[0] - order.do_partial(context=context) + picking_id = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet2")).picking_ids[0] + picking_id.do_partial(context=context) - Return the goods of purchase order 2 - From 6ea0eec46998418ace51748df9f9dfbf5100aa02 Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Thu, 29 Aug 2013 18:00:42 +0530 Subject: [PATCH 03/41] [IMP] remove stock.partial.picking errors and improve picking_type_id bzr revid: rma@tinyerp.com-20130829123042-3a9q4xs3gdajgm6f --- addons/purchase/test/fifo_price.yml | 109 ++++++++++++++-------------- 1 file changed, 56 insertions(+), 53 deletions(-) diff --git a/addons/purchase/test/fifo_price.yml b/addons/purchase/test/fifo_price.yml index e6488bcc141..258d523815e 100644 --- a/addons/purchase/test/fifo_price.yml +++ b/addons/purchase/test/fifo_price.yml @@ -53,10 +53,9 @@ - Process the reception of purchase order 1 and set date - - !python {model: stock.partial.picking}: | - pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo1")).picking_ids - partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]}) - self.do_partial(cr, uid, [partial_id]) + !python {model: stock.picking}: | + picking_obj = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo1")).picking_ids[0] + picking_obj.do_partial(context=context) - Check the standard price of the product (fifo icecream) - @@ -69,10 +68,9 @@ - Process the reception of purchase order 2 - - !python {model: stock.partial.picking}: | - pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo2")).picking_ids - partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]}) - self.do_partial(cr, uid, [partial_id]) + !python {model: stock.picking}: | + picking_obj = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo2")).picking_ids[0] + picking_obj.do_partial(context=context) - A purchase order towards the Chicago shop TODO code for receiving - @@ -96,7 +94,7 @@ Let us send some goods - !record {model: stock.picking, id: outgoing_fifo_shipment}: - type: out + picking_type_id: stock.picking_type_out - Picking needs movement from stock - @@ -105,7 +103,9 @@ product_id: product_fifo_icecream product_uom: product.product_uom_kgm product_qty: 20.0 - type: out + location_id: stock.stock_location_stock + location_dest_id: stock.stock_location_customers + picking_type_id: stock.picking_type_out - I assign this outgoing shipment - @@ -114,9 +114,9 @@ - Process the delivery of the outgoing shipment - - !python {model: stock.partial.picking}: | - partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [ref("outgoing_fifo_shipment")], 'default_type':'out'}) - self.do_partial(cr, uid, [partial_id]) + !python {model: stock.picking}: | + pick_obj = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_fifo_shipment")) + pick_obj.do_partial(context=context) - Check product standard price changed to 65.0 - @@ -126,7 +126,7 @@ Do a delivery of an extra 500 g (delivery order) - !record {model: stock.picking, id: outgoing_fifo_shipment_uom}: - type: out + picking_type_id: stock.picking_type_out - Picking needs movement from stock - @@ -134,8 +134,10 @@ picking_id: outgoing_fifo_shipment_uom product_id: product_fifo_icecream product_uom: product.product_uom_gram + location_id: stock.stock_location_stock + location_dest_id: stock.stock_location_customers product_qty: 500.0 - type: out + picking_type_id: stock.picking_type_out - I assign this outgoing shipment - @@ -144,9 +146,9 @@ - Process the delivery of the outgoing shipment - - !python {model: stock.partial.picking}: | - partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [ref("outgoing_fifo_shipment_uom")], 'default_type':'out'}) - self.do_partial(cr, uid, [partial_id]) + !python {model: stock.picking}: | + pick_obj = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_fifo_shipment_uom")) + pick_obj.do_partial(context=context) - Check product price changed to 80.0 - @@ -201,15 +203,14 @@ - Process the reception of purchase order with usd - - !python {model: stock.partial.picking}: | - pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo_usd")).picking_ids - partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]}) - self.do_partial(cr, uid, [partial_id]) + !python {model: stock.picking}: | + pick_obj = self.pool.get('stock.picking').browse(cr, uid, ref("purchase_order_fifo_usd")) + pick_obj.do_partial(context=context) - We create delivery order of 49.5 kg - !record {model: stock.picking, id: outgoing_fifo_shipment_cur}: - type: out + picking_type_id: stock.picking_type_out - Picking needs movement from stock - @@ -218,7 +219,9 @@ product_id: product_fifo_icecream product_uom: product.product_uom_kgm product_qty: 49.5 - type: out + location_id: stock.stock_location_stock + location_dest_id: stock.stock_location_customers + picking_type_id: stock.picking_type_out - I assign this outgoing shipment - @@ -227,9 +230,9 @@ - Process the delivery of the outgoing shipment - - !python {model: stock.partial.picking}: | - partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [ref("outgoing_fifo_shipment_cur")], 'default_type':'out'}) - self.do_partial(cr, uid, [partial_id]) + !python {model: stock.picking}: | + picking_obj = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_fifo_shipment_cur")) + picking_obj.do_partial(context=context) - Check rounded price is 102 euro - @@ -239,7 +242,7 @@ Do a delivery of an extra 10 kg - !record {model: stock.picking, id: outgoing_fifo_shipment_ret}: - type: out + picking_type_id: stock.picking_type_out - Picking needs movement from stock - @@ -248,7 +251,9 @@ product_id: product_fifo_icecream product_uom: product.product_uom_kgm product_qty: 10.0 - type: out + location_id: stock.stock_location_stock + location_dest_id: stock.stock_location_customers + picking_type_id: stock.picking_type_out - I assign this outgoing shipment - @@ -257,9 +262,9 @@ - Process the delivery of the outgoing shipment - - !python {model: stock.partial.picking}: | - partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [ref("outgoing_fifo_shipment_ret")], 'default_type':'out'}) - self.do_partial(cr, uid, [partial_id]) + !python {model: stock.picking}: | + picking_obj = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_fifo_shipment_ret")) + picking_obj.do_partial(context=context) - Check rounded price is 150.0 / 1.2834 - @@ -269,7 +274,7 @@ Let us create some outs to get negative stock. Create outpicking. We create delivery order of 200 kg, but will pick only 100 kg - !record {model: stock.picking, id: outgoing_fifo_shipment_neg}: - type: out + picking_type_id: stock.picking_type_out - Picking needs movement from stock - @@ -278,12 +283,14 @@ product_id: product_fifo_icecream product_uom: product.product_uom_kgm product_qty: 200.0 - type: out + 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 - !record {model: stock.picking, id: outgoing_fifo_shipment_neg2}: - type: out + picking_type_id: stock.picking_type_out - Picking needs movement from stock - @@ -292,19 +299,17 @@ product_id: product_fifo_icecream product_uom: product.product_uom_kgm product_qty: 400.0 - type: out + location_id: stock.stock_location_stock + location_dest_id: stock.stock_location_customers + picking_type_id: stock.picking_type_out - Process the delivery of the outgoing shipments - - !python {model: stock.partial.picking}: | - partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [ref("outgoing_fifo_shipment_neg")], 'default_type':'out'}) - line = self.browse(cr, uid, partial_id, context=context).move_ids[0] - self.pool.get("stock.partial.picking.line").write(cr, uid, [line.id], {'quantity':100}) - self.do_partial(cr, uid, [partial_id]) - partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [ref("outgoing_fifo_shipment_neg2")], 'default_type':'out'}) - line = self.browse(cr, uid, partial_id, context=context).move_ids[0] - self.pool.get("stock.partial.picking.line").write(cr, uid, [line.id], {'quantity':50}) - self.do_partial(cr, uid, [partial_id]) + !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) - Receive purchase order with 50 kg FIFO Ice Cream at 50 euro/kg - @@ -325,10 +330,9 @@ - Process the reception of purchase order 1 - - !python {model: stock.partial.picking}: | - pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo_neg")).picking_ids - partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]}) - self.do_partial(cr, uid, [partial_id]) + !python {model: stock.picking}: | + picking_obj = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo_neg")).picking_ids[0] + picking_obj.do_partial(context=context) - Assert price on product is still the old price as the out move has not been received fully yet - @@ -354,10 +358,9 @@ - Process the reception of purchase order 2 - - !python {model: stock.partial.picking}: | - pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo_neg2")).picking_ids - partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]}) - self.do_partial(cr, uid, [partial_id]) + !python {model: stock.picking}: | + picking_obj = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo_neg2")).picking_ids[0] + picking_obj.do_partial(context=context) - The price of the product should have changed back to 65.0 - From 4e9895ac1bbd4787d2834b4fe770574176a86f49 Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Mon, 2 Sep 2013 17:44:51 +0530 Subject: [PATCH 04/41] [IMP] improve fifo_return_yml bzr revid: rma@tinyerp.com-20130902121451-2dnh6jb3s8pdgmtl --- addons/purchase/test/fifo_returns.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/purchase/test/fifo_returns.yml b/addons/purchase/test/fifo_returns.yml index 2d7cb61e648..64d837b5585 100644 --- a/addons/purchase/test/fifo_returns.yml +++ b/addons/purchase/test/fifo_returns.yml @@ -47,8 +47,8 @@ Process the reception of purchase order 1 - !python {model: stock.picking}: | - picking_id = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet1")).picking_ids[0] - picking_id.do_partial(context=context) + picking_obj = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet1")).picking_ids[0] + self.do_partial(cr,uid,[picking_obj.id], context=context) - Check the standard price of the product (fifo icecream) - @@ -62,8 +62,8 @@ Process the reception of purchase order 2 - !python {model: stock.picking}: | - picking_id = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet2")).picking_ids[0] - picking_id.do_partial(context=context) + picking_obj = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet2")).picking_ids[0] + self.do_partial(cr,uid,[picking_obj.id], context=context) - Return the goods of purchase order 2 - @@ -71,6 +71,7 @@ pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet2")).picking_ids return_id = self.create(cr, uid, {}, context={'active_model':'stock.picking', 'active_id': pick_ids[0].id}) res = self.create_returns(cr, uid, [return_id], context={'active_id': pick_ids[0].id}) + self.pool.get('stock.picking').do_partial(cr, uid, [return_id]) - Check the standard price of the product (fifo return icecream) changed to 70.0 - From 35475907aee21343053b8555728e0a15deca46df Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Tue, 3 Sep 2013 10:01:21 +0200 Subject: [PATCH 05/41] [FIX]stock: improve stock_picking_type view bzr revid: csn@openerp.com-20130903080121-xu0zhp555tvk54u7 --- addons/stock/stock.py | 53 ++++++++++++++++++++++++++++++------- addons/stock/stock_data.xml | 24 +++-------------- addons/stock/stock_view.xml | 33 ++++++++++++++--------- 3 files changed, 68 insertions(+), 42 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 0c34a5085f8..ab05b169f0d 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2285,13 +2285,6 @@ class product_template(osv.osv): 'supply_method': 'buy', } -class stock_picking_code(osv.osv): - _name = "stock.picking.code" - _description = "Will group picking types for kanban view" - _columns = { - 'name': fields.char("Picking Type", translate=True), - } - class stock_picking_type(osv.osv): _name = "stock.picking.type" _description = "The picking type determines the picking view" @@ -2383,17 +2376,56 @@ class stock_picking_type(osv.osv): result[type_id]['latest_picking_waiting'] = cmp(pick.date[:10], time.strftime('%Y-%m-%d')) return result + def onchange_picking_code(self, cr, uid, ids, picking_code=False): + if not picking_code: + return False + + obj_data = self.pool.get('ir.model.data') + stock_loc = obj_data.get_object_reference(cr, uid, 'stock','stock_location_stock')[1] + + result = { + 'default_location_src_id': stock_loc, + 'default_location_dest_id': stock_loc, + } + if picking_code == 'incoming': + result['default_location_src_id'] = obj_data.get_object_reference(cr, uid, 'stock','stock_location_suppliers')[1] + return {'value': result} + if picking_code == 'outgoing': + result['default_location_dest_id'] = obj_data.get_object_reference(cr, uid, 'stock','stock_location_customers')[1] + return {'value': result} + else: + return {'value': result} + + def name_get(self, cr, uid, ids, context=None): + """Overides orm name_get method to display 'Warehouse_name: PickingType_name' """ + if not isinstance(ids, list): + ids = [ids] + res = [] + if not ids: + return res + reads = self.browse(cr, uid, ids, context=context) + for record in reads: + name = record.warehouse_id.name+': '+record.name + res.append((record.id, name)) + return res + + def _default_warehouse(self, cr, uid, context=None): + user = self.pool.get('res.users').browse(cr, uid, uid, context) + res = self.pool.get('stock.warehouse').search(cr, uid, [('company_id', '=', user.company_id.id)], limit=1, context=context) + return res and res[0] or False + _columns = { 'name': fields.char('name', translate=True, required=True), - 'pack': fields.boolean('Pack', help='This picking type needs packing interface'), + 'pack': fields.boolean('Prefill Pack Operations', help='This picking type needs packing interface'), 'auto_force_assign': fields.boolean('Automatic Availability', help='This picking type does\'t need to check for the availability in stock'), 'color': fields.integer('Color Index'), 'delivery': fields.boolean('Print delivery'), 'sequence_id': fields.many2one('ir.sequence', 'Sequence', required=True), 'default_location_src_id': fields.many2one('stock.location', 'Default Source Location'), 'default_location_dest_id': fields.many2one('stock.location', 'Default Destination Location'), - 'code_id': fields.many2one('stock.picking.code', 'Picking type code', required=True), + 'code_id': fields.selection([('incoming', 'Suppliers'), ('outgoing', 'Customers'), ('internal', 'Internal')], 'Picking type code', required=True), 'return_picking_type_id': fields.many2one('stock.picking.type', 'Picking Type for Returns'), + 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True), # Statistics for the kanban view 'weekly_picking': fields.function(_get_picking_data, @@ -2422,4 +2454,7 @@ class stock_picking_type(osv.osv): type='string', multi='_get_picking_history'), } + _defaults = { + 'warehouse_id': _default_warehouse, + } diff --git a/addons/stock/stock_data.xml b/addons/stock/stock_data.xml index ff56e44548f..79d7545f8f4 100644 --- a/addons/stock/stock_data.xml +++ b/addons/stock/stock_data.xml @@ -77,12 +77,6 @@ - - - - @@ -106,24 +100,12 @@ - - Suppliers - - - - Customers - - - - Internal - - Receptions - + incoming True @@ -132,13 +114,13 @@ - + outgoing Internal Transfers - + internal diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index f1d30972148..313fcf90a85 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -1205,18 +1205,27 @@ stock.picking.type
- - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + +
From 8a23802e9e6c3ce95f8bbb24cb126cdaa53897de Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Tue, 3 Sep 2013 11:03:34 +0200 Subject: [PATCH 06/41] [IMP] stock: removed location input and location output on warehouse bzr revid: qdp-launchpad@openerp.com-20130903090334-iqtk4a762volg5s2 --- addons/point_of_sale/point_of_sale.py | 18 +++++++++++++++--- addons/purchase/purchase.py | 6 ------ addons/purchase/purchase_view.xml | 2 +- .../purchase_requisition.py | 11 +---------- .../sale_stock/test/picking_order_policy.yml | 2 -- addons/stock/stock.py | 12 ++---------- addons/stock/stock_data.xml | 2 -- addons/stock/stock_demo.xml | 4 ---- addons/stock/stock_demo.yml | 2 -- addons/stock/stock_view.xml | 4 ---- 10 files changed, 19 insertions(+), 44 deletions(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 591f65cf925..4767d90f188 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -642,6 +642,7 @@ class pos_order(osv.osv): 'invoice_id': fields.many2one('account.invoice', 'Invoice'), 'account_move': fields.many2one('account.move', 'Journal Entry', readonly=True), 'picking_id': fields.many2one('stock.picking', 'Picking', readonly=True), + 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type', required=True), 'note': fields.text('Internal Notes'), 'nb_print': fields.integer('Number of Print', readonly=True), 'pos_reference': fields.char('Receipt Ref', size=64, readonly=True), @@ -660,6 +661,13 @@ class pos_order(osv.osv): return session_record.config_id.pricelist_id and session_record.config_id.pricelist_id.id or False return False + def _get_out_picking_type(self, cr, uid, context=None): + try: + picking_type = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'picking_type_out', context=context) + except: + picking_type = False + return picking_type + _defaults = { 'user_id': lambda self, cr, uid, context: uid, 'state': 'draft', @@ -669,6 +677,7 @@ class pos_order(osv.osv): 'session_id': _default_session, 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id, 'pricelist_id': _default_pricelist, + 'picking_type_id': _get_out_picking_type, } def create(self, cr, uid, values, context=None): @@ -697,18 +706,21 @@ class pos_order(osv.osv): if not order.state=='draft': continue addr = order.partner_id and partner_obj.address_get(cr, uid, [order.partner_id.id], ['delivery']) or {} + picking_type = order.picking_type_id picking_id = picking_obj.create(cr, uid, { 'origin': order.name, 'partner_id': addr.get('delivery',False), - 'picking_type_id': self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'picking_type_out', context=context).id, + 'picking_type_id': picking_type.id, '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 - output_id = order.warehouse_id.lot_output_id.id + location_id = picking_type.default_location_src_id.id + output_id = picking_type.default_location_dest_id.id + if not location_id or not output_id: + raise osv.except_osv(_('Error!'), _('Missing source or destination location for picking type %s. Please configure those fields and try again.' % (picking_type.name,))) for line in order.lines: if line.product_id and line.product_id.type == 'service': diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index ec4144f4cc6..d0876df7ef1 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -308,12 +308,6 @@ class purchase_order(osv.osv): values.update({'location_id': location_id}) return {'value':values} - def onchange_warehouse_id(self, cr, uid, ids, warehouse_id): - if not warehouse_id: - return {} - warehouse = self.pool.get('stock.warehouse').browse(cr, uid, warehouse_id) - return {'value':{'location_id': warehouse.lot_input_id.id, 'dest_address_id': False}} - def onchange_partner_id(self, cr, uid, ids, partner_id): partner = self.pool.get('res.partner') if not partner_id: diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 973757770c4..f152d5ba066 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -196,7 +196,7 @@ - + diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py index 85fda69a65e..6d08d163696 100644 --- a/addons/purchase_requisition/purchase_requisition.py +++ b/addons/purchase_requisition/purchase_requisition.py @@ -136,22 +136,13 @@ class purchase_requisition(osv.osv): return res def _prepare_purchase_order(self, cr, uid, requisition, supplier, context=None): - if not requisition.warehouse_id: - warehouse_obj = self.pool.get('stock.warehouse') - - warehouse_id = warehouse_obj.search(cr, uid, [('company_id', '=', requisition.company_id.id)], context=context) - if not warehouse_id: - raise osv.except_osv(_('Warning!'), _('No warehouse found for this company.')) - location_id = warehouse_obj.browse(cr, uid, warehouse_id, context=context)[0].lot_input_id.id - else: - location_id = requisition.warehouse_id.lot_input_id.id supplier_pricelist = supplier.property_product_pricelist_purchase and supplier.property_product_pricelist_purchase.id or False return { 'origin': requisition.name, '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': location_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, diff --git a/addons/sale_stock/test/picking_order_policy.yml b/addons/sale_stock/test/picking_order_policy.yml index f903d160400..4251c7a98a8 100644 --- a/addons/sale_stock/test/picking_order_policy.yml +++ b/addons/sale_stock/test/picking_order_policy.yml @@ -58,7 +58,6 @@ 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 for move in picking.move_lines: order_line = move.procurement_id.sale_line_id date_planned = datetime.strptime(sale_order.date_order, DEFAULT_SERVER_DATETIME_FORMAT) + relativedelta(days=order_line.delay or 0.0) @@ -72,7 +71,6 @@ assert move.product_packaging.id == order_line.product_packaging.id,"Product packaging is not correspond." assert move.partner_id.id == order_line.address_allotment_id.id or sale_order.partner_shipping_id.id,"Address is not correspond" #assert move.location_id.id == location_id,"Source Location is not correspond." - #assert move.location_dest_id == output_id,"Destination Location is not correspond." assert move.price_unit == order_line.product_id.standard_price or 0.0,"Price Unit is not correspond" - Now, I dispatch delivery order. diff --git a/addons/stock/stock.py b/addons/stock/stock.py index ab05b169f0d..494105a7784 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1921,24 +1921,16 @@ class stock_warehouse(osv.osv): 'name': fields.char('Name', size=128, required=True, select=True), 'company_id': fields.many2one('res.company', 'Company', required=True, select=True), 'partner_id': fields.many2one('res.partner', 'Owner Address'), - 'lot_input_id': fields.many2one('stock.location', 'Location Input', required=True, domain=[('usage', '<>', 'view')]), 'lot_stock_id': fields.many2one('stock.location', 'Location Stock', required=True, domain=[('usage', '=', 'internal')]), - 'lot_output_id': fields.many2one('stock.location', 'Location Output', required=True, domain=[('usage', '<>', 'view')]), } - def _default_lot_input_stock_id(self, cr, uid, context=None): + def _default_stock_id(self, cr, uid, context=None): lot_input_stock = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'stock_location_stock') return lot_input_stock.id - def _default_lot_output_id(self, cr, uid, context=None): - lot_output = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'stock_location_output') - return lot_output.id - _defaults = { 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c), - 'lot_input_id': _default_lot_input_stock_id, - 'lot_stock_id': _default_lot_input_stock_id, - 'lot_output_id': _default_lot_output_id, + 'lot_stock_id': _default_stock_id, } diff --git a/addons/stock/stock_data.xml b/addons/stock/stock_data.xml index 79d7545f8f4..b591263f4b2 100644 --- a/addons/stock/stock_data.xml +++ b/addons/stock/stock_data.xml @@ -210,9 +210,7 @@ watch your stock valuation, and track production lots upstream and downstream (b --> - - diff --git a/addons/stock/stock_demo.xml b/addons/stock/stock_demo.xml index 7d1515c427f..c42e216f636 100644 --- a/addons/stock/stock_demo.xml +++ b/addons/stock/stock_demo.xml @@ -251,20 +251,16 @@ - Chicago Warehouse - - Birmingham Warehouse - diff --git a/addons/stock/stock_demo.yml b/addons/stock/stock_demo.yml index cf8d1f71572..07763ee8cc1 100644 --- a/addons/stock/stock_demo.yml +++ b/addons/stock/stock_demo.yml @@ -22,9 +22,7 @@ - !record {model: stock.warehouse, id: warehouse_icecream}: name: Ice Cream Shop - lot_input_id: location_refrigerator lot_stock_id: location_refrigerator - lot_output_id: location_delivery_counter - !record {model: product.product, id: product_icecream}: default_code: 001 diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 313fcf90a85..d78f825bb1b 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -498,9 +498,7 @@

- - @@ -517,9 +515,7 @@ - - From bbf0113c618748497d165a3650ff9159e90fbd48 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Tue, 3 Sep 2013 11:07:46 +0200 Subject: [PATCH 07/41] [FIX] stock: inventory yaml test bzr revid: qdp-launchpad@openerp.com-20130903090746-64s7pv9fi212pvi3 --- addons/stock/test/inventory.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/test/inventory.yml b/addons/stock/test/inventory.yml index 6afc7e9d4ba..b687aded288 100644 --- a/addons/stock/test/inventory.yml +++ b/addons/stock/test/inventory.yml @@ -83,8 +83,8 @@ !python {model: stock.inventory}: | inv = self.browse(cr, uid, ref('inventory_test1'), context=context) assert inv.line_ids and len(inv.line_ids) == 1, "Wrong number of inventory lines." - assert len(inv.line_ids[0].product_qty) == 10, "Wrong quantity in inventory line." - assert len(inv.line_ids[0].product_id.id) == ref('inventory_product'), "Wrong product in inventory line." + assert inv.line_ids[0].product_qty == 10, "Wrong quantity in inventory line." + assert inv.line_ids[0].product_id.id == ref('inventory_product'), "Wrong product in inventory line." - I modify the inventory line and set the quantity to 20 product on this new inventory - From 82ef7cb00e12a19e6891376d28692debebca7cfd Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Tue, 3 Sep 2013 11:17:26 +0200 Subject: [PATCH 08/41] [FIX] Creating quants only when usage is correct and prefered_order works without <> bzr revid: jco@openerp.com-20130903091726-l8aeona692964nyu --- addons/stock/stock.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 494105a7784..b922a3c5566 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -750,7 +750,7 @@ class stock_picking(osv.osv): qty = move.remaining_qty qty_to_do -= move.remaining_qty - if create and move.location_id != 'internal': + if create and move.location_id.usage != 'internal': # Create quants vals = { 'product_id': move.product_id.id, @@ -841,7 +841,6 @@ class stock_picking(osv.osv): if res2[move] > 0: mov = stock_move_obj.browse(cr, uid, move, context=context) newmove_id = stock_move_obj.split(cr, uid, mov, res2[move], context=context) - stock_move_obj.action_done(cr, uid, extra_moves + [x.id for x in orig_moves], context=context) picking.refresh() self._create_backorder(cr, uid, picking, context=context) @@ -1505,13 +1504,12 @@ class stock_move(osv.osv): # 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)] - prefered_order = 'reservation_id<>' + str(move.id) + prefered_order = 'reservation_id' # if lot_id: # prefered_order = 'lot_id<>' + lot_id + ", " + prefered_order # if pack_id: # prefered_order = 'pack_id<>' + pack_id + ", " + prefered_order quants = quant_obj.quants_get(cr, uid, move.location_id, move.product_id, qty, domain=domain, prefered_order = prefered_order, context=context) - #Will move all quants_get and as such create negative quants quant_obj.quants_move(cr, uid, quants, move, context=context) quant_obj.quants_unreserve(cr, uid, move, context=context) From a19a3ae5b2ae57890fce98c013c34c701f0cb902 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Tue, 3 Sep 2013 11:26:36 +0200 Subject: [PATCH 09/41] [FIX]stock_complex_route: code_id is now a selection bzr revid: csn@openerp.com-20130903092636-l9448und718n8c0q --- addons/stock_complex_routes/stock_complex_routes.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock_complex_routes/stock_complex_routes.xml b/addons/stock_complex_routes/stock_complex_routes.xml index d1850560e5f..f2c71735527 100644 --- a/addons/stock_complex_routes/stock_complex_routes.xml +++ b/addons/stock_complex_routes/stock_complex_routes.xml @@ -14,7 +14,7 @@ dropship - + incoming From 23dfd3bbbcc7c6fb764047a2088b211392fa2473 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Tue, 3 Sep 2013 11:42:14 +0200 Subject: [PATCH 10/41] [FIX]remove required warehouse_id field on stock_picking_type and remove warehouse_id field from route + rename some route for better understanding bzr revid: csn@openerp.com-20130903094214-i4knuovdvfdn0b9m --- addons/stock/stock.py | 6 ++++-- addons/stock_location/stock_location.py | 8 -------- addons/stock_location/stock_location_data.xml | 6 +++--- addons/stock_location/stock_location_view.xml | 10 ---------- 4 files changed, 7 insertions(+), 23 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index b922a3c5566..4e1d4310b6d 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2395,7 +2395,9 @@ class stock_picking_type(osv.osv): return res reads = self.browse(cr, uid, ids, context=context) for record in reads: - name = record.warehouse_id.name+': '+record.name + name = record.name + if record.warehouse_id: + name = record.warehouse_id.name+': '+name res.append((record.id, name)) return res @@ -2415,7 +2417,7 @@ class stock_picking_type(osv.osv): 'default_location_dest_id': fields.many2one('stock.location', 'Default Destination Location'), 'code_id': fields.selection([('incoming', 'Suppliers'), ('outgoing', 'Customers'), ('internal', 'Internal')], 'Picking type code', required=True), 'return_picking_type_id': fields.many2one('stock.picking.type', 'Picking Type for Returns'), - 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True), + 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse'), # Statistics for the kanban view 'weekly_picking': fields.function(_get_picking_data, diff --git a/addons/stock_location/stock_location.py b/addons/stock_location/stock_location.py index e052063cc3c..bedf59baf1e 100644 --- a/addons/stock_location/stock_location.py +++ b/addons/stock_location/stock_location.py @@ -29,28 +29,20 @@ class stock_location_route(osv.osv): _description = "Inventory Routes" _order = 'sequence' - def _default_warehouse(self, cr, uid, context=None): - user = self.pool.get('res.users').browse(cr, uid, uid, context) - res = self.pool.get('stock.warehouse').search(cr, uid, [('company_id', '=', user.company_id.id)], limit=1, context=context) - return res and res[0] or False - _columns = { 'name': fields.char('Route Name', required=True), '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'), - 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse'), } _defaults = { 'sequence': lambda self,cr,uid,ctx: 0, - 'warehouse_id': _default_warehouse, } class stock_warehouse(osv.osv): _inherit = 'stock.warehouse' _columns = { 'route_id': fields.many2one('stock.location.route', 'Default Logistic Route', help='Default route through the warehouse', required=True), - 'route_ids': fields.one2many('stock.location.route', 'warehouse_id', 'All Routes'), } diff --git a/addons/stock_location/stock_location_data.xml b/addons/stock_location/stock_location_data.xml index b282fcbf08c..c5f438b920a 100644 --- a/addons/stock_location/stock_location_data.xml +++ b/addons/stock_location/stock_location_data.xml @@ -22,7 +22,7 @@ --> - Ship only + Sale: Ship only 20 @@ -79,7 +79,7 @@ - Pack + Ship + Sale: Pack + Ship 15 @@ -128,7 +128,7 @@ - Pick + Pack + Ship + Sale: Pick + Pack + Ship 20 diff --git a/addons/stock_location/stock_location_view.xml b/addons/stock_location/stock_location_view.xml index 34213638b84..f74b2d9321b 100644 --- a/addons/stock_location/stock_location_view.xml +++ b/addons/stock_location/stock_location_view.xml @@ -156,14 +156,6 @@ - - - - - - - - @@ -174,7 +166,6 @@ -
@@ -187,7 +178,6 @@
- From 010a830a32cdf47fb9e54ee4f613cf9b9b883a0a Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Tue, 3 Sep 2013 12:11:16 +0200 Subject: [PATCH 11/41] [FIX] stock: yml tests (procrule.yml and move.yml) + [IMP] set mrp_jit as auto_install bzr revid: qdp-launchpad@openerp.com-20130903101116-ruess6702g1xqgsb --- addons/mrp_jit/__openerp__.py | 2 +- addons/mrp_jit/mrp_jit.py | 1 - addons/stock/test/move.yml | 109 ++++++++++++++++++++------------- addons/stock/test/procrule.yml | 9 ++- 4 files changed, 74 insertions(+), 47 deletions(-) diff --git a/addons/mrp_jit/__openerp__.py b/addons/mrp_jit/__openerp__.py index 945ad269db9..b1e4773f99f 100644 --- a/addons/mrp_jit/__openerp__.py +++ b/addons/mrp_jit/__openerp__.py @@ -44,6 +44,6 @@ In that case, you can not use priorities any more on the different picking. 'demo': [], 'test': ['test/mrp_jit.yml'], 'installable': True, - 'auto_install': False, + 'auto_install': True, } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mrp_jit/mrp_jit.py b/addons/mrp_jit/mrp_jit.py index 01d94692a9d..4ad5cca5f20 100644 --- a/addons/mrp_jit/mrp_jit.py +++ b/addons/mrp_jit/mrp_jit.py @@ -27,7 +27,6 @@ class procurement_order(osv.osv): def create(self, cr, uid, vals, context=None): procurement_id = super(procurement_order, self).create(cr, uid, vals, context=context) - # TODO: maybe this is not necessary anymore as we do this already self.run(cr, uid, [procurement_id], context=context) self.check(cr, uid, [procurement_id], context=context) return procurement_id diff --git a/addons/stock/test/move.yml b/addons/stock/test/move.yml index 696ef6f8976..f2fceb4a2b6 100644 --- a/addons/stock/test/move.yml +++ b/addons/stock/test/move.yml @@ -1,9 +1,15 @@ - - I create a move of 5 products from stock to customer + I first create a new product +- + !record {model: product.product, id: move_product}: + name: move prod + type: product +- + In order to test the negative quants, I create a move of 5 products from stock to customer - !record {model: stock.move, id: move_test0}: name: Move Products - product_id: product.product_product_3 + product_id: move_product product_uom_qty: 5 product_uom: product.product_uom_unit product_uos_qty: 5 @@ -16,63 +22,38 @@ !python {model: stock.move}: | self.action_confirm(cr, uid, [ref('move_test0')], context=context) - - I check that the quantity on hand is 18 and virtual is 13 + I check that the quantity on hand is 0 and virtual is -5 - !python {model: product.product}: | context['location'] = False - product = self.browse(cr, uid, ref('product.product_product_3'), context=context) - assert product.qty_available==18, 'Expecting 18 products in stock, got %.2f!' % (product.qty_available,) - assert product.virtual_available==13.0, 'Expecting 13 products in virtual stock, got %.2f!' % (product.virtual_available,) + product = self.browse(cr, uid, ref('move_product'), context=context) + assert product.qty_available == 0, 'Expecting 0 products in stock, got %.2f!' % (product.qty_available,) + assert product.virtual_available == -5.0, 'Expecting -5 products in virtual stock, got %.2f!' % (product.virtual_available,) - I validate the move - !python {model: stock.move}: | self.action_done(cr, uid, [ref('move_test0')], context=context) - - I check that the quantity on hand is 13 and 5 products are at customer location + I check that the quantity on hand is -5 and 5 products are at customer location - !python {model: product.product}: | context['location'] = False - product = self.browse(cr, uid, ref('product.product_product_3'), context=context) - assert product.qty_available==13, 'Expecting 13 products in stock, got %.2f!' % (product.qty_available,) + product = self.browse(cr, uid, ref('move_product'), context=context) + assert product.qty_available == -5, 'Expecting -5 products in stock, got %.2f!' % (product.qty_available,) context['location'] = ref('stock.stock_location_customers') - product = self.browse(cr, uid, ref('product.product_product_3'), context=context) - assert product.qty_available==5, 'Expecting 5 products in customer location, got %.2f!' % (product.qty_available,) + product = self.browse(cr, uid, ref('move_product'), context=context) + assert product.qty_available == 5, 'Expecting 5 products in customer location, got %.2f!' % (product.qty_available,) - - In order to test negative quants, I will deliver 14 products to the customer -- - !record {model: stock.move, id: move_test1}: - name: Move 14 Products - product_id: product.product_product_3 - product_uom_qty: 14 - product_uom: product.product_uom_unit - product_uos_qty: 14 - product_uos: product.product_uom_unit - location_id: stock.stock_location_stock - location_dest_id: stock.stock_location_customers -- - I confirm and validate the move -- - !python {model: stock.move}: | - self.action_confirm(cr, uid, [ref('move_test1')], context=context) - self.action_done(cr, uid, [ref('move_test1')], context=context) -- - I check that the quantity on hand is -2 -- - !python {model: product.product}: | - context['location'] = False - product = self.browse(cr, uid, ref('product.product_product_3'), context=context) - assert product.qty_available == -1, 'Expecting -1 products in stock, got %.2f!' % (product.qty_available,) -- - To compensate negative quants, I will receive 5 products from the supplier + To compensate negative quants, I will receive 15 products from the supplier - !record {model: stock.move, id: move_test2}: name: Move 15 Products - product_id: product.product_product_3 - product_uom_qty: 5 + product_id: move_product + product_uom_qty: 15 product_uom: product.product_uom_unit - product_uos_qty: 5 + product_uos_qty: 15 product_uos: product.product_uom_unit location_id: stock.stock_location_suppliers location_dest_id: stock.stock_location_stock @@ -83,9 +64,51 @@ self.action_confirm(cr, uid, [ref('move_test2')], context=context) self.action_done(cr, uid, [ref('move_test2')], context=context) - - I check that the quantity on hand is 4 + I check that the quantity on hand is 10 - !python {model: product.product}: | context['location'] = False - product = self.browse(cr, uid, ref('product.product_product_3'), context=context) - assert product.qty_available == 4, 'Expecting 4 products in stock, got %.2f!' % (product.qty_available,) + product = self.browse(cr, uid, ref('move_product'), context=context) + assert product.qty_available == 10, 'Expecting 10 products in stock, got %.2f!' % (product.qty_available,) + assert product.virtual_available == 10.0, 'Expecting 10 products in virtual stock, got %.2f!' % (product.virtual_available,) +- + I create a move of 2 products from stock to customer +- + !record {model: stock.move, id: move_test1}: + name: Move Products + product_id: move_product + product_uom_qty: 2 + product_uom: product.product_uom_unit + product_uos_qty: 2 + product_uos: product.product_uom_unit + location_id: stock.stock_location_stock + location_dest_id: stock.stock_location_customers +- + I confirm the move to be processed in the future +- + !python {model: stock.move}: | + self.action_confirm(cr, uid, [ref('move_test1')], context=context) +- + I check that the quantity on hand is 10 and virtual is 8 +- + !python {model: product.product}: | + context['location'] = False + product = self.browse(cr, uid, ref('move_product'), context=context) + assert product.qty_available == 10, 'Expecting 10 products in stock, got %.2f!' % (product.qty_available,) + assert product.virtual_available == 8.0, 'Expecting 8 products in virtual stock, got %.2f!' % (product.virtual_available,) +- + I validate the move +- + !python {model: stock.move}: | + self.action_done(cr, uid, [ref('move_test1')], context=context) +- + I check that the quantity on hand is 8 and 7 products are at customer location +- + !python {model: product.product}: | + context['location'] = False + product = self.browse(cr, uid, ref('move_product'), context=context) + assert product.qty_available == 8, 'Expecting 10 products in stock, got %.2f!' % (product.qty_available,) + + context['location'] = ref('stock.stock_location_customers') + product = self.browse(cr, uid, ref('move_product'), context=context) + assert product.qty_available == 7, 'Expecting 7 products in customer location, got %.2f!' % (product.qty_available,) diff --git a/addons/stock/test/procrule.yml b/addons/stock/test/procrule.yml index 61d1c920bab..0a13ef6f073 100644 --- a/addons/stock/test/procrule.yml +++ b/addons/stock/test/procrule.yml @@ -25,11 +25,16 @@ - !python {model: stock.picking}: | self.action_confirm(cr, uid, [ref('pick_output')]) +- + I run the scheduler. +- + !python {model: procurement.order}: | + self.run_scheduler(cr, uid) - Check a picking was created from stock to output. - !python {model: stock.move }: | picking = self.pool.get("stock.picking").browse(cr, uid, ref("pick_output")) move_id = self.search(cr, uid, [('product_id', '=', ref('product.product_product_3')),('location_id', '=', ref('stock.stock_location_stock')), - ('location_dest_id', '=', ref('stock.stock_location_output'), ('move_dest_id', '=', picking.move_lines[0].id))]) - assert len(move_id) == 1, "It should have created a picking from Stock to Output with the original picking as destination" \ No newline at end of file + ('location_dest_id', '=', ref('stock.stock_location_output')), ('move_dest_id', '=', picking.move_lines[0].id)]) + assert len(move_id) == 1, "It should have created a picking from Stock to Output with the original picking as destination" From 29a396a9a58c1f1d4c344933c715cec936e93618 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Tue, 3 Sep 2013 12:17:36 +0200 Subject: [PATCH 12/41] [IMP] mrp_jit is now installable from warehouse settings bzr revid: qdp-launchpad@openerp.com-20130903101736-nncvdgrdn1f43chu --- addons/mrp/res_config.py | 5 ----- addons/mrp/res_config_view.xml | 4 ---- addons/stock/res_config.py | 5 +++++ addons/stock/res_config_view.xml | 4 ++++ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/mrp/res_config.py b/addons/mrp/res_config.py index 22a14addcd1..840d6c71086 100644 --- a/addons/mrp/res_config.py +++ b/addons/mrp/res_config.py @@ -44,11 +44,6 @@ class mrp_config_settings(osv.osv_memory): Without this module: A + B + C -> D. With this module: A + B + C -> D + E. This installs the module mrp_byproduct."""), - 'module_mrp_jit': fields.boolean("Generate procurement in real time", - help="""This allows Just In Time computation of procurement orders. - All procurement orders will be processed immediately, which could in some - cases entail a small performance impact. - This installs the module mrp_jit."""), 'module_stock_no_autopicking': fields.boolean("Manage manual picking to fulfill manufacturing orders ", help="""This module allows an intermediate picking process to provide raw materials to production orders. For example to manage production made by your suppliers (sub-contracting). diff --git a/addons/mrp/res_config_view.xml b/addons/mrp/res_config_view.xml index 2c7047380a8..25f3e0b0931 100644 --- a/addons/mrp/res_config_view.xml +++ b/addons/mrp/res_config_view.xml @@ -44,10 +44,6 @@