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.

1

Merging fields into one

By
Dr Obx
on 3/24/15, 5:46 AM 513 views

Hi guys, 

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 ?


I'm too new in Odoo/Backbone so more than some links i need a description or example. Of course i'll search and learn but .... it's time consuming process :) Anyway, thanx guys. I so appreciate.

Dr Obx
on 3/24/15, 9:31 AM

Guys, basically all i want to do is: in product.form.view must be automatically build from: + ' ' + + ' ' + + more fields if needed. My module creating a groups of fields depending on product type. To avoid a hundreds of fields on the product page because every product require different series of them. That's why i would like to buid a name from these fields to keep a name syntax always the same. I know it's crazy but .... :) So any example .. ? how should it look like ?

Dr Obx
on 3/25/15, 4:14 AM

Still don't know how to do it :( Have anyone some examples how should it look like ?

Dr Obx
on 3/26/15, 5:24 PM

Hi Robert, you can use the "object_merger" module for your requirement Download it from the link: https://www.odoo.com/apps/modules/7.0/object_merger/ [1] 1.Install the module 2.Created the " Object MergerConfiguration " for the product.product object in Settings/Configuration/Object Merger. 3. Created two products (product 1 and product 2 ) 4.Merge the products and "Productr to keep" as product 1. 5.Now you can see some fields of product 2 can be merged in product 1. Like this way you can do for all the objects [1] https://www.odoo.com/apps/modules/7.0/object_merger/

Vasanth
on 3/24/15, 6:37 AM
0
Marvin Taboada
On 3/24/15, 6:33 AM

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/

* New 8.x API: https://www.odoo.com/documentation/8.0/reference/orm.html#onchange-updating-ui-on-the-fly

Regards,

--

Marvin

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

2 follower(s)

Stats

Asked: 3/24/15, 5:46 AM
Seen: 513 times
Last updated: 4/5/15, 8:33 PM