I created custom object from Setting->Technical->Database Structure.
And I can't defined field name in 'name' must be 'x_name'.
When I called this in view it show 'object_name, object_id' like below image.
http://i.imgur.com/cENOGo7.png
How i can fix this?
I read some topic in this forum. It said to defined '_rec_name' but my workflow not follow those. How I can do in my workflow.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilità
- Magazzino
- PoS
- Project
- MRP
La domanda è stata contrassegnata
Hello Gobman,
@Bole is 100 % correct,here we use name_get method for custom many2one field
here i give one example of name get_method hope this code is very help full
class hobbies_hobbies(osv.osv):
_name = 'hobbies.hobbies'
_columns = {
'name' : fields.char('Hobby Name'),
'place' : fields.char('Place'),
'code' : fields.char('Code'),
}
def name_get(self, cr, uid, ids, context=None):
res = super(hobbies_hobbies, self).name_get(cr, uid, ids, context=context)
final_result = []
if ids:
for hobbies in self.browse(cr, uid, ids,context=context):
hobbies_data = hobbies.name or ""
hobbies_data += " ["
hobbies_data += hobbies.code or ""
hobbies_data += "] "
final_result.append((hobbies.id, hobbies_data))
return final_result
else:
return res
if you find this answer helpful, please give me a thumbs up vote
Regards,
Ankit H Gandhi
in your new object you need the result of _name_get method.
by default _name_get will show field name
if some other field shoud be used for representing name, then you define it in _rec_name = 'other_field'
and if you want name to be shown as combination of few field values then you need to define
_name_get method
all this should be done in py file defining the object....
hope it helps...
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
Registrati