From 2c65def71377c9e6ed818064b2fb1e054f847e1b Mon Sep 17 00:00:00 2001 From: jke-openerp Date: Tue, 29 Oct 2013 08:48:15 +0100 Subject: [PATCH] [FIX] According to [wms] APR's Review from 20131022 - Move lead_time in mrp module, trace back on split delivery bzr revid: jke@openerp.com-20131029074815-mws7cuvqgxr6q2d4 --- addons/mrp/mrp_view.xml | 35 ++++++++++++++++++- addons/mrp/product.py | 5 +++ addons/product/product.py | 6 ++-- addons/product/product_view.xml | 6 +--- addons/sale/sale.py | 2 +- addons/stock/stock.py | 7 +++- addons/stock/stock_view.xml | 34 +++++++----------- .../stock/wizard/stock_change_product_qty.py | 4 +-- addons/stock/wizard/stock_return_picking.py | 5 +-- 9 files changed, 67 insertions(+), 37 deletions(-) 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/stock.py b/addons/stock/stock.py index cab7c43d318..90b4de4d671 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -694,11 +694,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) @@ -710,6 +713,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): @@ -800,6 +804,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 @@ -3077,7 +3082,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 @@