I need to create a name for my products; this name will concatenate the values found into 2 or 3 others that already exist: product.name (standard Odoo) + personalized fields.
A solution was given for a different environment: see
Specifically the Saas environment does't allow to create a new field with the function option.
Any direction will be appreciated
UPDATE :
(I tested the following configuration having created 2 fields x_nomcomplet and x_auteur type char on modèle product template modèle d'article)
remove previous server action and create 2 new records with values for fields of server action :
first (for field Action name you can choose what you want):
Action name : Nom complet article
Base Model : Modèle d'article
Action To Do : Execute python code
condition : True
Sequence : 5
notebook python code, add following code:
context = context or {}
for record in self.browse(cr, uid, context.get('active_ids', []), context=context):
value = ""
for val in [record.name, record.x_auteur]:
if val:
value += "%s " % val
pool.get('product.template').write(cr, uid, record.id, {'x_nomcomplet': value[:-1]}, context=context)
at the top right of the form push button "Add in the More menu" (will add buttons to tree and form of the menu product)
second (for field Action name you can choose what you want):
Action name : Nom complet variante
Base Model : Article
Action To Do : Execute python code
condition : True
Sequence : 5
notebook python code, add following code:
context = context or {}
for record in self.browse(cr, uid, context.get('active_ids', []), context=context):
value = ""
for val in [record.product_tmpl_id.name, record.product_tmpl_id.x_auteur]:
if val:
value += "%s " % val
pool.get('product.template').write(cr, uid, record.product_tmpl_id.id, {'x_nomcomplet': value[:-1]}, context=context)
at the top right of the form push button "Add in the More menu" (will add buttons to tree and form of the menu product variant)
test in menus product and variant
@Cyril: yes I have access to this menu and lso to technical features.
I am interested by an automatic behaviour which allows to store the result of the concatenation of 2 or 3 existing fields into a new one. This new field will replace the name of the variants in every views and forms where the variant name is used.
if you check def name_get() in product.py you will see name is concatenated with default_code, you can add any other field with '+' symbol. or are you looking for a new field storing this concatenated value in database?
@John, in mode Odoo online SAAS, no possibility to modify python code or add a new module, to create a field function or related, hard ^^
@ John. From your comment, one can deduct that the concatenation is hard coded. This may appear as an conception error regarding the required flexibility. Many questions on this forum are showing the need to customise!