From b4d98b487a81864bcb4928335aa85855374edaf9 Mon Sep 17 00:00:00 2001 From: jke-openerp Date: Thu, 10 Oct 2013 14:03:31 +0200 Subject: [PATCH] merge sto-stoloc data bzr revid: jke@openerp.com-20131010120331-hbhckxnwju1p6mg9 --- addons/stock/__openerp__.py | 4 +++- addons/stock/stock.py | 13 ++++++++----- addons/stock/stock_data.yml | 2 +- addons/stock/stock_demo.xml | 5 ++++- addons/stock/stock_demo.yml | 21 ++++++++++++++------- addons/stock/stock_demo_pre.yml | 18 ++++++++++++++++++ addons/stock/stock_location_data.xml | 2 +- addons/stock/stock_location_demo_cpu1.xml | 1 + addons/stock/stock_location_demo_cpu3.yml | 2 +- addons/stock/stock_orderpoint.xml | 12 ++++++------ addons/stock/stock_orderpoint.yml | 6 ++++++ addons/stock/stock_set_ir_model_data.yml | 11 +++++++++++ 12 files changed, 74 insertions(+), 23 deletions(-) create mode 100644 addons/stock/stock_demo_pre.yml create mode 100644 addons/stock/stock_orderpoint.yml create mode 100644 addons/stock/stock_set_ir_model_data.yml diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py index 725659861e4..ae066b45eac 100644 --- a/addons/stock/__openerp__.py +++ b/addons/stock/__openerp__.py @@ -58,9 +58,11 @@ Dashboard / Reports for Warehouse Management will include: 'category': 'Warehouse Management', 'sequence': 16, 'demo': [ + 'stock_demo_pre.yml', 'stock_demo.xml', 'procurement_demo.xml', 'stock_orderpoint.xml', + 'stock_orderpoint.yml', 'stock_demo.yml', 'stock_location_demo_cpu1.xml', 'stock_location_demo_cpu3.yml', @@ -70,7 +72,7 @@ Dashboard / Reports for Warehouse Management will include: 'security/ir.model.access.csv', 'stock_data.xml', 'stock_data.yml', -# 'stock_location_data.xml', + 'stock_set_ir_model_data.yml', 'wizard/stock_move_view.xml', 'wizard/stock_change_product_qty_view.xml', 'wizard/stock_inventory_merge_view.xml', diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 8b23b15e425..5557319a26b 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1943,9 +1943,8 @@ class stock_inventory(osv.osv): def _default_stock_location(self, cr, uid, context=None): try: - stock_location = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'stock_location_stock') - #stock_location = self.pool.get('stock.warehouse').browse(cr, uid, ref('warehouse0'), context=context).lot_stock_id - return stock_location.id + warehouse = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'warehouse0') + return warehouse.lot_stock_id.id except: return False @@ -2213,8 +2212,12 @@ class stock_warehouse(osv.osv): } 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 + #lot_input_stock = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'stock_location_stock') + try: + warehouse = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'warehouse0') + return warehouse.lot_stock_id.id + except: + return False _defaults = { 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c), diff --git a/addons/stock/stock_data.yml b/addons/stock/stock_data.yml index 230abd5778e..e620c98d0f8 100644 --- a/addons/stock/stock_data.yml +++ b/addons/stock/stock_data.yml @@ -1,6 +1,6 @@ - !python {model: res.partner}: | main_warehouse = self.pool.get('stock.warehouse').browse(cr, uid, ref('warehouse0'), context=context) - print(main_warehouse.name) self.write(cr, uid, ref('base.main_partner'), {'property_stock_customer':main_warehouse.lot_stock_id.id}) + diff --git a/addons/stock/stock_demo.xml b/addons/stock/stock_demo.xml index d872443ad11..ff563fdb667 100644 --- a/addons/stock/stock_demo.xml +++ b/addons/stock/stock_demo.xml @@ -34,6 +34,9 @@ customer + + diff --git a/addons/stock/stock_demo.yml b/addons/stock/stock_demo.yml index 203bf1c797b..2eeb2c02c78 100644 --- a/addons/stock/stock_demo.yml +++ b/addons/stock/stock_demo.yml @@ -66,9 +66,13 @@ prod_lot_id: lot_icecream_1 location_id: location_refrigerator - - !record {model: stock.picking, id: outgoing_shipment}: - location_dest_id: location_delivery_counter - picking_type_id: picking_type_out + Create STOCK_PICKING for OUT +- + !python {model: stock.picking}: | + main_warehouse = self.pool.get('stock.warehouse').browse(cr, uid, ref('warehouse0'), context=context) + my_picking_type_out = main_warehouse.out_type_id.id + create_id = self.create(cr,uid,{'location_dest_id':ref('location_delivery_counter'),'picking_type_id':my_picking_type_out}); + self.pool.get('ir.model.data').create(cr,uid,{'name':'outgoing_shipment','module':'stock', 'model':'stock.picking','res_id':create_id}, context=context) - !record {model: stock.move, id: outgoing_shipment_icecream}: picking_id: outgoing_shipment @@ -78,10 +82,13 @@ location_id: location_refrigerator location_dest_id: location_delivery_counter - - !record {model: stock.picking, id: incomming_shipment}: - partner_id: base.res_partner_address_9 - location_dest_id: location_refrigerator - picking_type_id: picking_type_in + Create STOCK_PICKING for IN +- + !python {model: stock.picking}: | + main_warehouse = self.pool.get('stock.warehouse').browse(cr, uid, ref('warehouse0'), context=context) + my_picking_type = main_warehouse.in_type_id.id + create_id = self.create(cr,uid,{'location_dest_id':ref('location_refrigerator'),'picking_type_id':my_picking_type,'partner_id':ref('base.res_partner_address_9')}); + self.pool.get('ir.model.data').create(cr,uid,{'name':'incomming_shipment','module':'stock', 'model':'stock.picking','res_id':create_id}, context=context) - !record {model: stock.move, id: incomming_shipment_icecream}: picking_id: incomming_shipment diff --git a/addons/stock/stock_demo_pre.yml b/addons/stock/stock_demo_pre.yml new file mode 100644 index 00000000000..b089471d9f7 --- /dev/null +++ b/addons/stock/stock_demo_pre.yml @@ -0,0 +1,18 @@ +- + !record {model: stock.location, id: stock_location_14}: + name: Shelf 2 + posx: 6512 + +- + !record {model: stock.location, id: stock_location_components}: + name: Shelf 1 + posx: 6512 + +- + !python {model: stock.location}: | + main_warehouse = self.pool.get('stock.warehouse').browse(cr, uid, ref('warehouse0'), context=context) + main_stock = main_warehouse.lot_stock_id.id + stock_loc_to_update = self.search(cr, uid, [('posx','=','6512')], context=context) + self.write(cr,uid,stock_loc_to_update,{'location_id':main_stock,'posx':'0'}, context=context) + + diff --git a/addons/stock/stock_location_data.xml b/addons/stock/stock_location_data.xml index 686b3524d90..1501597f482 100644 --- a/addons/stock/stock_location_data.xml +++ b/addons/stock/stock_location_data.xml @@ -3,7 +3,7 @@ - 10.0 @@ -17,7 +17,7 @@ - + 12.0 @@ -25,7 +25,7 @@ - + 50.0 @@ -33,7 +33,7 @@ - + 15.0 @@ -41,7 +41,7 @@ - + 5.0 @@ -49,7 +49,7 @@ - + \ No newline at end of file diff --git a/addons/stock/stock_orderpoint.yml b/addons/stock/stock_orderpoint.yml new file mode 100644 index 00000000000..3c4eb6e9961 --- /dev/null +++ b/addons/stock/stock_orderpoint.yml @@ -0,0 +1,6 @@ +- + !python {model: stock.location}: | + main_warehouse = self.pool.get('stock.warehouse').browse(cr, uid, ref('warehouse0'), context=context) + main_stock = main_warehouse.lot_stock_id.id + stowar_op_ids = self.pool.get('stock.warehouse.orderpoint').search(cr, uid, [], context=context) + self.pool.get('stock.warehouse.orderpoint').write(cr,uid,stowar_op_ids,{'location_id':main_stock}, context=context) diff --git a/addons/stock/stock_set_ir_model_data.yml b/addons/stock/stock_set_ir_model_data.yml new file mode 100644 index 00000000000..c7d55707903 --- /dev/null +++ b/addons/stock/stock_set_ir_model_data.yml @@ -0,0 +1,11 @@ +- + !python {model: ir.model.data, noupdate: True}: | + main_warehouse = self.pool.get('stock.warehouse').browse(cr, uid, ref('warehouse0'), context=context) + self.create(cr,uid,{'name':'stock_location_stock','module':'stock', 'model':'stock.location','res_id':main_warehouse.lot_stock_id.id}, context=context) + self.create(cr,uid,{'name':'stock_location_company','module':'stock', 'model':'stock.location','res_id':main_warehouse.wh_input_stock_loc_id.id}, context=context) + self.create(cr,uid,{'name':'stock_location_output','module':'stock', 'model':'stock.location','res_id':main_warehouse.wh_output_stock_loc_id.id}, context=context) + self.create(cr,uid,{'name':'location_pack_zone','module':'stock', 'model':'stock.location','res_id':main_warehouse.wh_pack_stock_loc_id.id}, context=context) + + self.create(cr,uid,{'name':'picking_type_internal','module':'stock', 'model':'stock.picking.type','res_id':main_warehouse.int_type_id.id}, context=context) + self.create(cr,uid,{'name':'picking_type_in','module':'stock', 'model':'stock.picking.type','res_id':main_warehouse.in_type_id.id}, context=context) + self.create(cr,uid,{'name':'picking_type_out','module':'stock', 'model':'stock.picking.type','res_id':main_warehouse.out_type_id.id}, context=context)