Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How to merge several fields into a new one -using the V8 Saas environment and related tools?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
v8saasmergefields.function
8 Răspunsuri
8314 Vizualizări
Imagine profil
michel Guénard

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 


Merging fields into one

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

1
Imagine profil
Abandonează
michel Guénard
Autor

@Cyril: yes I have access to this menu and lso to technical features.

michel Guénard
Autor

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.

John

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?

Cyril Gaspard (GEM)

@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 ^^

michel Guénard
Autor

@ 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!

Imagine profil
Cyril Gaspard (GEM)
Cel mai bun răspuns

only solution I know for SAAS odoo version to execute new python code is to use a server action, which will add button "Update name"  (see after) to the form in mode edit at the top menu button "More" AND list view at the top menu button "More" (to perform execution to all selected lines) of the object define in your server action, buttons which will execute your python code.


my example :

I will set to the field name of product template object (menu product),  computation of fields type and default code (verify you have values for that fields else "/" will be set, because this field is required, even if there is always a value for field type, but perhaps this will be not the case for your need)


go to menu configuration/Technical/Actions/Server Actions

create a new record with values for fields of server action :

Action name : Update name

Base Model : Product template

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):

    name = ""

    for val in [record.type, record.default_code]:

        if val:

            name += "%s " % val

    if name:

        name = name[:-1]

    elif not record.name:

        name = "/"

    pool.get('product.template').write(cr, uid, record.id, {'name': name}, context=context)



at the top right of the server action form push button "Add in the More menu" (will add buttons to tree and form of the object)

save server action


go to menu sales/products/product variants, choose a product, open form in edit mode, at the top menu button More push "Update name", name of your product has changed as "value_field_type value_default_code" (update browser page if it was already opened)

enjoy !


bye

 


2
Imagine profil
Abandonează
Cyril Gaspard (GEM)

Hi, I tested and updated code in your first post, follow instructions step by step, tested then should work for you too, bye

michel Guénard
Autor

@Cyril: many thanks; it works as expected; however -when the concatenation leads to a long string, then an error message warns that the length is too long for the field; and the field size cannot be changed because it is a base field.

Cyril Gaspard (GEM)

Hi, change lenght of youy file x_nomcomplet in menu configuration/technical/structure de la base de données/champs, search/open form of field x_nomcomplet, in field "Taille" in the form, remove the value if there is one to have a varchar (dynamic lenght), bye

Cyril Gaspard (GEM)

no news ?

michel Guénard
Autor

Sorry Cyril; I had a highly busy period since you last advice and no time left to fine tune the issue as per your directions. I will do it in a few days. I have another issue to solve and I was thinking you - Cyril - could help me: I need to create a server action on the product. template object and adding it to the "more options" menu; this action will generate the Ean13 cusotmized value for a whole series of products; it needs to use the values of another field already present in the database and convert them into the EAN13. I know how to create the button itself but I am unable to code the python code to be added to the notebook. I have asked the question on this forum but no answer; therefore my call to you If you will. Regards

Imagine profil
yellow
Cel mai bun răspuns

Thank you for this process I didn't know !

1
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Company logo in website builder Rezolvat
v8 saas website_builder
Imagine profil
Imagine profil
Imagine profil
Imagine profil
4
iul. 16
2191
[8.0] How to translate fields.function with store to the new api
v8 api fields.function
Imagine profil
Imagine profil
1
iul. 15
8882
How can I show the Currency of a Sales Order on the printed PDF? Rezolvat
v8 saas sales_order
Imagine profil
1
iun. 15
7329
How to apply website translation imported through PO file?
v8 saas translation
Imagine profil
0
mar. 15
4889
[FORUM] Customize (or hide) the "About This Forum" panel Rezolvat
v8 saas forum
Imagine profil
Imagine profil
1
mar. 15
4005
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now