For example, i would like to combine into one values from form to create a one string (don't ask why i just need it. My knowledge won't let me :)
I know how to do it in other languages but not Python. Maybe framework allow to do it but i don't know how so please can anyone help me with ?
To merge the fields in one you can use compute on field. for example.
_inherit = 'res.partner' # extending partner model
return self.title or '' + self.name or '' # will return Partner Title + Partner Name(Mr. Openies)
merged_string = fields.Char(compute='merge_string') # adding one field which merges string
Note: Compute field will get computed when the record is getting saved.
you can also refer the odoo new api doc: http://odoo-new-api-guide-line.readthedocs.org/en/latest/fields.html#computed-fields
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
|Asked: 3/31/15, 4:35 AM|
|Seen: 483 times|
|Last updated: 4/5/15, 8:33 PM|