diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py index 9cdfd2d6f39..725659861e4 100644 --- a/addons/stock/__openerp__.py +++ b/addons/stock/__openerp__.py @@ -69,7 +69,8 @@ Dashboard / Reports for Warehouse Management will include: 'security/stock_security.xml', 'security/ir.model.access.csv', 'stock_data.xml', - 'stock_location_data.xml', + 'stock_data.yml', +# 'stock_location_data.xml', 'wizard/stock_move_view.xml', 'wizard/stock_change_product_qty_view.xml', 'wizard/stock_inventory_merge_view.xml', diff --git a/addons/stock/product.py b/addons/stock/product.py index 1ebcc4697bf..4883497e77c 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -134,11 +134,10 @@ class product_product(osv.osv): # if field_names in ['incoming_qty', 'outgoing_qty', 'virtual_available']: moves_in = self.pool.get('stock.move').read_group(cr, uid, domain_move_in, ['product_id', 'product_qty'], ['product_id'], context=context) moves_out = self.pool.get('stock.move').read_group(cr, uid, domain_move_out, ['product_id', 'product_qty'], ['product_id'], context=context) - + quants = self.pool.get('stock.quant').read_group(cr, uid, domain_quant, ['product_id', 'qty'], ['product_id'], context=context) - quants = dict(map(lambda x: (x['product_id'][0], x['qty']), quants)) - + moves_in = dict(map(lambda x: (x['product_id'][0], x['product_qty']), moves_in)) moves_out = dict(map(lambda x: (x['product_id'][0], x['product_qty']), moves_out)) @@ -149,7 +148,8 @@ class product_product(osv.osv): 'incoming_qty': moves_in.get(id, 0.0), 'outgoing_qty': moves_out.get(id, 0.0), 'virtual_available': quants.get(id, 0.0) + moves_in.get(id, 0.0) - moves_out.get(id, 0.0), - } + } + return res _columns = { @@ -263,6 +263,20 @@ class product_product(osv.osv): res['fields']['qty_available']['string'] = _('Produced Qty') return res + def action_view_routes(self, cr, uid, ids, context=None): + route_obj = self.pool.get("stock.location.route") + act_obj = self.pool.get('ir.actions.act_window') + mod_obj = self.pool.get('ir.model.data') + product_route_ids = set() + for product in self.browse(cr, uid, ids, context=context): + product_route_ids |= set([r.id for r in product.route_ids]) + product_route_ids |= set([r.id for r in product.categ_id.total_route_ids]) + route_ids = route_obj.search(cr, uid, ['|', ('id', 'in', list(product_route_ids)), ('warehouse_selectable', '=', True)], context=context) + result = mod_obj.get_object_reference(cr, uid, 'stock_location', 'action_routes_form') + id = result and result[1] or False + result = act_obj.read(cr, uid, [id], context=context)[0] + result['domain'] = "[('id','in',[" + ','.join(map(str, route_ids)) + "])]" + return result class product_template(osv.osv): _name = 'product.template' diff --git a/addons/stock/product_view.xml b/addons/stock/product_view.xml index 9c14a150b96..eb67828a7f3 100644 --- a/addons/stock/product_view.xml +++ b/addons/stock/product_view.xml @@ -48,7 +48,7 @@ ir.actions.act_window form tree,form - + @@ -69,7 +69,7 @@ form tree,form - +

diff --git a/addons/stock/stock.py b/addons/stock/stock.py index d8c07356f07..8b23b15e425 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1944,6 +1944,7 @@ 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 except: return False diff --git a/addons/stock/stock_data.xml b/addons/stock/stock_data.xml index df8e99a7bf4..2e6591ba44f 100644 --- a/addons/stock/stock_data.xml +++ b/addons/stock/stock_data.xml @@ -61,6 +61,9 @@ customer + + - + + @@ -150,13 +156,14 @@ watch your stock valuation, and track production lots upstream and downstream (b - - - + + MTO 10 + property_stock_procurement @@ -225,12 +238,14 @@ watch your stock valuation, and track production lots upstream and downstream (b + + - + WH - + Stock orderpoint stock.orderpoint @@ -247,7 +262,7 @@ watch your stock valuation, and track production lots upstream and downstream (b + @@ -259,5 +274,7 @@ watch your stock valuation, and track production lots upstream and downstream (b + + --> diff --git a/addons/stock/stock_data.yml b/addons/stock/stock_data.yml new file mode 100644 index 00000000000..230abd5778e --- /dev/null +++ b/addons/stock/stock_data.yml @@ -0,0 +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_location_data.xml b/addons/stock/stock_location_data.xml index cc83be2dc85..686b3524d90 100644 --- a/addons/stock/stock_location_data.xml +++ b/addons/stock/stock_location_data.xml @@ -3,10 +3,10 @@ - + - + + --> - + diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index d7459f8690b..ed2831479a7 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -1265,7 +1265,7 @@ ir.actions.act_window form tree,form - + {'product_receive': True, 'search_default_future': True} @@ -2080,5 +2080,27 @@ + + + procurement.order.form.view.inherit + + procurement.order + + + + + + + + + product.template.procurement.rule.inherit + product.product + + + +