[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
This commit is contained in:
jke-openerp 2013-10-29 08:48:15 +01:00
parent db7bcd1dd9
commit 2c65def713
9 changed files with 67 additions and 37 deletions

View File

@ -523,7 +523,40 @@
</xpath>
</field>
</record>
<record id="product_template_form_view_inherit" model="ir.ui.view">
<field name="name">product.template.form.view.inherited</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='warranty']" position="before">
<label for="produce_delay"/>
<div>
<field name="produce_delay" class="oe_inline"/> days
</div>
</xpath>
</field>
</record>
<record id="view_normal_procurement_locations_form_inherited" model="ir.ui.view">
<field name="name">product.normal.procurement.locations.inherited</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='procurement_uom']" position="before">
<group name="delay" string="Delays" attrs="{'invisible':[('type','=','service')]}">
<label for="produce_delay" />
<div attrs="{'invisible':[('type','=','service')]}">
<field name="produce_delay" class="oe_inline"/> days
</div>
</group>
</xpath>
<xpath expr="//field[@name='standard_price']" position="after">
<field name="active" />
</xpath>
</field>
</record>
<record id="product_supply_method_produce" model="ir.actions.act_window">
<field name="name">Products</field>
<field name="res_model">product.product</field>

View File

@ -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:

View File

@ -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,

View File

@ -738,11 +738,7 @@
</page>
<page string="Procurement &amp; Locations">
<group>
<group name="delay" string="Delays">
<label for="produce_delay"/>
<div>
<field name="produce_delay" class="oe_inline"/> days
</div>
<group name="delay" string="Delays">
<field name="warranty"/>
</group>
</group>

View File

@ -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})

View File

@ -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 <em>%s</em> <b>created</b>.") % (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

View File

@ -1879,6 +1879,7 @@
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='general']" position="after" >
<newline/>
<group string="Supply Chain Information">
@ -1893,37 +1894,28 @@
<button string="Orderpoints" name="%(product_open_orderpoint)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}"/>
</xpath>
<group name="procurement_uom" position="before">
<group name="delay" string="Delays">
<label for="produce_delay" attrs="{'invisible':[('type','=','service')]}"/>
<div attrs="{'invisible':[('type','=','service')]}">
<field name="produce_delay" class="oe_inline"/> days
</div>
<field name="active"/>
</group>
</group>
<xpath expr="//group[@string='Sale Conditions']" position="inside">
<label for="sale_delay"/>
<div>
<field name="sale_delay" class="oe_inline"/> days
</div>
</xpath>
<group name="status" position="after" version="7.0">
</xpath>
<xpath expr="//group[@name='status']" position="after" version="7.0">
<group name="store" string="Storage Location" attrs="{'invisible':[('type','=','service')]}">
<field name="loc_rack"/>
<field name="loc_row"/>
<field name="loc_case"/>
</group>
</group>
<group name="Weights" position="before">
<group name="store" groups="stock.group_locations" string="Counter-Part Locations Properties">
<field name="property_stock_procurement" attrs="{'readonly':[('type','=','service')]}" domain="[('usage','=','procurement')]"/>
<field name="property_stock_production" attrs="{'readonly':[('type','=','service')]}" domain="[('usage','=','production')]"/>
<field name="property_stock_inventory" attrs="{'readonly':[('type','=','service')]}" domain="[('usage','=','inventory')]"/>
</group>
</group>
</xpath>
<xpath expr="//group[@name='Weights']" position="before">
<group name="store" groups="stock.group_locations" string="Counter-Part Locations Properties">
<field name="property_stock_procurement" attrs="{'readonly':[('type','=','service')]}" domain="[('usage','=','procurement')]"/>
<field name="property_stock_production" attrs="{'readonly':[('type','=','service')]}" domain="[('usage','=','production')]"/>
<field name="property_stock_inventory" attrs="{'readonly':[('type','=','service')]}" domain="[('usage','=','inventory')]"/>
</group>
</xpath>
</field>
</record>

View File

@ -33,7 +33,7 @@ class stock_change_product_qty(osv.osv_memory):
'lot_id': fields.many2one('stock.production.lot', 'Serial Number', domain="[('product_id','=',product_id)]"),
'location_id': fields.many2one('stock.location', 'Location', required=True, domain="[('usage', '=', 'internal')]"),
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
if context is None: context = {}
fvg = super(stock_change_product_qty, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
@ -65,7 +65,7 @@ class stock_change_product_qty(osv.osv_memory):
try:
model, location_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'stock_location_stock')
self.pool.get('stock.location').check_access_rule(cr, uid, [location_id], 'read', context=context)
except (orm.except_orm, ValueError):
except (orm.except_orm, ValueError):
location_id = False
res.update({'location_id': location_id})
return res

View File

@ -94,13 +94,14 @@ class stock_return_picking(osv.osv_memory):
#Create new picking for returned products
pick_type_id = pick.picking_type_id.return_picking_type_id and pick.picking_type_id.return_picking_type_id.id or pick.picking_type_id.id
new_picking = pick_obj.copy(cr, uid, pick.id, {
'move_lines': [],
'picking_type_id': pick_type_id,
'state': 'draft',
'origin': pick.name,
})
},context=context)
for data_get in data_obj.browse(cr, uid, data['product_return_moves'], context=context):
move = data_get.move_id
if not move: