[MERGE] task:583 from lp:~openerp-dev/openobject-addons/uco-dev-addons1

bzr revid: hmo@tinyerp.com-20100423132612-hm9pibk6qzpnm03g
This commit is contained in:
Harry (Open ERP)
2010-04-23 18:56:12 +05:30
2 changed files with 15 additions and 6 deletions
+13 -4
View File
@@ -162,16 +162,25 @@ class mrp_bom(osv.osv):
"""
result = {}
bom_obj = self.pool.get('mrp.bom')
bom_id = context and context.get('active_id', False) or False
cr.execute('select id from mrp_bom')
if all(bom_id != r[0] for r in cr.fetchall()):
ids.sort()
bom_id = ids[0]
bom_parent = bom_obj.browse(cr, uid, bom_id)
for bom in self.browse(cr, uid, ids, context=context):
result[bom.id] = map(lambda x: x.id, bom.bom_lines)
if (bom_parent and bom_parent.multi_level_bom) or bom.id == bom_id:
result[bom.id] = map(lambda x: x.id, bom.bom_lines)
else:
result[bom.id] = []
if bom.bom_lines:
continue
ok = ((name=='child_complete_ids') and (bom.product_id.supply_method=='produce'))
if bom.type=='phantom' or ok:
if (bom.type=='phantom' or ok) and bom_parent.multi_level_bom:
sids = bom_obj.search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)])
if sids:
bom2 = bom_obj.browse(cr, uid, sids[0], context=context)
result[bom.id] += map(lambda x: x.id, bom2.bom_lines)
result[bom.id] += map(lambda x: x.id, bom2.bom_lines)
return result
@@ -267,7 +276,7 @@ class mrp_bom(osv.osv):
v['name'] = prod.name
return {'value': v}
return {}
def _bom_find(self, cr, uid, product_id, product_uom, properties=[]):
""" Finds BoM for particular product and product uom.
@param product_id: Selected product.
+2 -2
View File
@@ -253,13 +253,13 @@
<field name="product_uos" groups="product.group_uos"/>
<field name="product_uos_qty" groups="product.group_uos"/>
<newline/>
<field name="multi_level_bom" invisible="1"/>
<field name="multi_level_bom" />
<field name="type" groups="base.group_extended"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4">
<page string="General Information">
<field colspan="4" name="bom_lines" nolabel="1" widget="one2many_list"/>
<field colspan="4" name="bom_lines" nolabel="1" widget="one2many_list" />
</page>
<page string="Revisions" groups="base.group_extended">
<field colspan="4" name="revision_ids" nolabel="1" widget="one2many_list"/>