Skip to Content
Menu
This question has been flagged
2660 Views

py code here i have one asset.cat module i have created one asset name as A and another is B .

in A i have created other names as 1,2 ,in B 3,4 .So i have made many2 one to asset_inspection their i have field asset_type and in tree vies as 'insp_name',

if i select A in tree 'insp_name' i have get only 1,2 ,if i select B in 'insp_name' i have to get 3,4 , how to this operation please post your answer


class asset_inspection(osv.Model):

_name = "asset.inspection"

MAINTENANCE_SELECTION=[

('0','Daily'),

('1','Weekly'),

('2','Fortnight'),

('3','Bi-Monthly'),

('4','Quarterly'),

('5','Half-Yearly'),

('6','Yearly'),

('7','Bi-Yearly'),

]

SHOUTDOWN_SELECTION=[

('0','YES'),

('1','NO'),

]

_columns = {

'inspection_name':fields.char('Inspection Type',),

'freq_sel':fields.selection(MAINTENANCE_SELECTION,'Frequency'),

'shut_down':fields.selection(SHOUTDOWN_SELECTION,'Shout Down'),

'main_type':fields.char('Maintenance Type',),

'insp_id1' : fields.one2many('inspec.grid','insp_id','BoM',),

'ainsp_id1' : fields.one2many('assetinspec.grid','ainsp_id','Asset Maintenance',),

'asset_type': fields.many2one('asset.cat','Asset Categ')

}


asset_inspection()

class inspec_grid(osv.Model):

_name = 'inspec.grid'

_columns = {

'insp_name' : fields.many2one('assetcat.grid','Part'),

'insp_code' : fields.char('Code'),

'insp_quty' : fields.char('Quantity '),

'insp_uom' : fields.char('UoM'),

'insp_id': fields.many2one('asset.inspection','Insp Id'),

}

inspec_grid()

class assetinspec_grid(osv.Model):

_name = 'assetinspec.grid'

_columns = {

'ainsp_name' : fields.char('Asset Name'),

'ainsp_id': fields.many2one('asset.inspection','aInsp Id'),

}

assetinspec_grid()

#-----------------------------------------------------End-------------------------------------------------------------------

#-----------------------------------------------------Asset Categories------------------------------------------------------

class asset_cat(osv.Model):

_name = "asset.cat"

_rec_name="asset_catname"

_columns = {

'asset_catname':fields.char('Asset Type',),

'assetcat_id':fields.one2many('assetcat.grid','ainspcat_id','Asset Name',)

}

asset_cat()

class assetcat_grid(osv.Model):

_name = 'assetcat.grid'

_rec_name='ainspcat_name'

_columns = {

'ainspcat_name' : fields.char('Asset Names'),

'ainspcat_id': fields.many2one('asset.cat','AssetCat ID'),

}

assetcat_grid()

Avatar
Discard
Related Posts Replies Views Activity
0
Oct 21
1459
2
Oct 18
5456
2
Nov 17
3914
0
Nov 17
3055
1
Apr 24
333