Is there anyone who can tell me how to do it ?
I would like to merge 3 or 4 fields to make a combined (product) name.
For example in product.form.view i would like to create a product name based on fields added by my module.
field name="name" while writing should contain (field="brand" + field="model" + field="size" + ... depends what i want to add into the name)
I'm trying but nothing works as i want. Can anyone explain a bit how should it look like ?
Hello Robert, I think you can use "onchange" methods (Python/server side code) for this purpose.
Onchange methods are invoked when the transient value of a field is modified (e.g.: edit field and change focus) and provide the ability to update other fields as a side effect. You can also assign the same onchange method for different fields (old 7.x API clarification).
You can review how they work by creating leaves for employees. After modifying the 'date_from' or 'date_to' fields, the 'number of days' field is automatically updated. You can find the underlying onchange implementation (old 7.x API notation) here: https://github.com/odoo/odoo/blob/8.0/addons/hr_holidays/hr_holidays.py#L278
Here are some reference links:
* Old 7.x API: https://doc.odoo.com/trunk/server/06_misc_on_change_tips/
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/24/15, 5:46 AM|
|Seen: 518 times|
|Last updated: 4/5/15, 8:33 PM|