python - How to use a field to appear in the dropdown of many2one? -
please me when using many2one have combo product names, question how change content of combo , ie instead of product have identifier.
thank you
class saisir.soumission(osv.osv) _columns = { 'numoffre' : fields.char('n° offre'), # want use field apear in many2one 'organisme_s' : fields.char('organisme'), 'taxe' : fields.selection([('12','12 %'),('10','10 %')],'taxe etablissement'), 'observation_s' : fields.text('observation'), 'order_line' : fields.one2many('saisir.soumission.ligne','order_id','soumission_id') } class saisir_soumission_ligne(osv.osv): _name ='saisir.soumission.ligne' def on_change_produit(self, cr, uid, ids, product_id): val = {} prod = self.pool.get('product.product').browse(cr, uid, product_id) if prod: val['prix'] = prod.list_price val['garantie'] = prod.warranty return {'value': val} _columns= { 'order_id': fields.many2one('saisir.soumission', 'order reference'), 'product_id' : fields.many2one('product.product', 'type engin'), 'marque' : fields.char('marque'), 'prix' : fields.float('prix unitaire'), }
set _rec_name
'numoffre'
in model this
class saisir.soumission(osv.osv) _rec_name = 'numoffre' _columns = { 'numoffre' : fields.char('n° offre'), # want use field apear in many2one 'organisme_s' : fields.char('organisme'), 'taxe' : fields.selection([('12','12 %'),('10','10 %')],'taxe etablissement'), 'observation_s' : fields.text('observation'), 'order_line' : fields.one2many('saisir.soumission.ligne','order_id','soumission_id') }
Comments
Post a Comment