bomimprove

bzr revid: fp@tinyerp.com-20081009204545-i78eg6hm1a6y66sa
This commit is contained in:
Fabien Pinckaers 2008-10-09 22:45:45 +02:00
parent 8ff73903d5
commit 1cb1a6b4f2
3 changed files with 19 additions and 1 deletions

View File

@ -42,7 +42,7 @@
# "process/crm_configuration_process.xml",
],
"active": False,
"installable": True
"installable": False
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -147,11 +147,27 @@ mrp_routing_workcenter()
class mrp_bom(osv.osv):
_name = 'mrp.bom'
_description = 'Bill of Material'
def _compute_type(self, cr, uid, ids, field_name, arg, context):
res = dict(map(lambda x: (x,''), ids))
for line in self.browse(cr, uid, ids):
if line.bom_lines or line.type=='phantom':
continue
if line.type=='phantom' and not line.bom_id:
res[line.id] = 'set'
if line.product_id.supply_method=='produce':
if line.product_id.procure_method=='make_to_stock':
res[line.id] = 'stock'
else:
res[line.id] = 'order'
return res
_columns = {
'name': fields.char('Name', size=64, required=True),
'code': fields.char('Code', size=16),
'active': fields.boolean('Active'),
'type': fields.selection([('normal','Normal BoM'),('phantom','Sets / Phantom')], 'BoM Type', required=True, help="Use a phantom bill of material in lines that have a sub-bom and that have to be automatically computed in one line, without having two production orders."),
'method': fields.function(_compute_type, string='Method', method=True, type='selection', selection=[('',''),('stock','On Stock'),('order','On Order'),('set','Set / Pack')]),
'date_start': fields.date('Valid From', help="Validity of this BoM or component. Keep empty if it's always valid."),
'date_stop': fields.date('Valid Until', help="Validity of this BoM or component. Keep empty if it's always valid."),
'sequence': fields.integer('Sequence'),

View File

@ -261,6 +261,8 @@
<field name="product_uom"/>
<field name="date_start"/>
<field name="date_stop"/>
<field name="method"/>
<field name="type"/>
</tree>
</field>
</record>