Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

how to get values od specific field like doing any fielter or onchange please check below code ?

By
shridhar b ivani
on 5/30/15, 2:44 AM 376 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()

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/30/15, 2:44 AM
Seen: 376 times
Last updated: 5/30/15, 2:44 AM