diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index fbc4bdcc29a..3d6535a103d 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -523,7 +523,40 @@ - + + + product.template.form.view.inherited + product.product + + + + + + + + + product.normal.procurement.locations.inherited + product.product + + + + + + + + + + + + Products product.product diff --git a/addons/mrp/product.py b/addons/mrp/product.py index d7a19c718fa..dcba1d191be 100644 --- a/addons/mrp/product.py +++ b/addons/mrp/product.py @@ -27,6 +27,11 @@ class product_product(osv.osv): _inherit = "product.product" _columns = { "bom_ids": fields.one2many('mrp.bom', 'product_id','Bill of Materials', domain=[('bom_id','=',False)]), + "produce_delay": fields.float('Manufacturing Lead Time', help="Average delay in days to produce this product. In the case of multi-level BOM, the manufacturing lead times of the components will be added."), + } + + _defaults = { + "produce_delay": 1, } def copy(self, cr, uid, id, default=None, context=None): if not default: diff --git a/addons/product/product.py b/addons/product/product.py index e34b4b8e072..46d26adc43d 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -302,8 +302,7 @@ class product_template(osv.osv): 'description_sale': fields.text('Sale Description',translate=True, help="A description of the Product that you want to communicate to your customers. " "This description will be copied to every Sale Order, Delivery Order and Customer Invoice/Refund"), - 'type': fields.selection([('consu', 'Consumable'),('service','Service')], 'Product Type', required=True, help="Consumable are product where you don't manage stock, a service is a non-material product provided by a company or an individual."), - 'produce_delay': fields.float('Manufacturing Lead Time', help="Average delay in days to produce this product. In the case of multi-level BOM, the manufacturing lead times of the components will be added."), + 'type': fields.selection([('consu', 'Consumable'),('service','Service')], 'Product Type', required=True, help="Consumable are product where you don't manage stock, a service is a non-material product provided by a company or an individual."), 'rental': fields.boolean('Can be Rent'), 'categ_id': fields.many2one('product.category','Category', required=True, change_default=True, domain="[('type','=','normal')]" ,help="Select category for the current product"), 'list_price': fields.float('Sale Price', digits_compute=dp.get_precision('Product Price'), help="Base price to compute the customer price. Sometimes called the catalog price."), @@ -368,8 +367,7 @@ class product_template(osv.osv): 'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'product.template', context=c), 'list_price': 1, 'standard_price': 0.0, - 'sale_ok': 1, - 'produce_delay': 1, + 'sale_ok': 1, 'uom_id': _get_uom_id, 'uom_po_id': _get_uom_id, 'uos_coeff': 1.0, diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index 16b85061e56..fd654699b67 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -738,11 +738,7 @@ - - diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 5da4bcf8b71..c45f4810985 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -316,7 +316,7 @@ class sale_order(osv.osv): def create(self, cr, uid, vals, context=None): if context is None: - context = {} + context = {} if vals.get('name', '/') == '/': vals['name'] = self.pool.get('ir.sequence').get(cr, uid, 'sale.order') or '/' context.update({'mail_create_nolog': True}) diff --git a/addons/stock/product.py b/addons/stock/product.py index 7fc77bb8163..191493125a1 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -272,7 +272,7 @@ class product_product(osv.osv): 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') + result = mod_obj.get_object_reference(cr, uid, 'stock', '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)) + "])]" diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 8fb83ef6e4d..3582d9683b3 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -60,11 +60,7 @@ class stock_location(osv.osv): _parent_store = True _parent_order = 'name' _order = 'parent_left' - - # TODO: implement name_search() in a way that matches the results of name_get! - def name_get(self, cr, uid, ids, context=None): - res = self._complete_name(cr, uid, ids, 'complete_name', None, context=context) - return res.items() + _rec_name = 'complete_name' def _complete_name(self, cr, uid, ids, name, args, context=None): """ Forms complete name of location from parent location to child location. @@ -693,11 +689,14 @@ class stock_picking(osv.osv): default['name'] = '/' if not default.get('backorder_id'): default['backorder_id'] = False + return super(stock_picking, self).copy(cr, uid, id, default, context) + def action_confirm(self, cr, uid, ids, context=None): todo = [] todo_force_assign = [] + for picking in self.browse(cr, uid, ids, context=context): if picking.picking_type_id.auto_force_assign: todo_force_assign.append(picking.id) @@ -709,6 +708,7 @@ class stock_picking(osv.osv): if todo_force_assign: self.force_assign(cr, uid, todo_force_assign, context=context) + return True def action_assign(self, cr, uid, ids, *args): @@ -799,6 +799,7 @@ class stock_picking(osv.osv): self.message_post(cr, uid, picking.id, body=_("Back order %s created.") % (back_order_name), context=context) move_obj = self.pool.get("stock.move") move_obj.write(cr, uid, backorder_move_ids, {'picking_id': backorder_id}, context=context) + self.pool.get("stock.picking").action_confirm(cr, uid, [picking.id], context=context) self.action_confirm(cr, uid, [backorder_id], context=context) return backorder_id @@ -3048,7 +3049,7 @@ class stock_pack_operation(osv.osv): _name = "stock.pack.operation" _description = "Packing Operation" - def _get_remaining_qty(self, cr, uid, ids, context=None): + def _get_remaining_qty(self, cr, uid, ids, name, args, context=None): res = {} for ops in self.browse(cr, uid, ids, context=context): qty = ops.product_qty diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index ca2cc7824d4..9e794b89084 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -1879,6 +1879,7 @@ product.product + @@ -1893,37 +1894,28 @@