Перейти к содержимому
Odoo Меню
  • Войти
  • Попробовать бесплатно
  • Модули
    Финансы
    • Бухгалтерия
    • Выставление счетов
    • Расходы
    • Таблицы
    • Документооборот
    • Подпись
    Продажи
    • CRM
    • Продажи
    • POS Магазин
    • POS Ресторан
    • Подписки
    • Аренда
    Вебсайты
    • Конструктор вебсайтов
    • eCommerce
    • Блог
    • Форум
    • Онлайн-чат
    • Электронное обучение
    Логистика
    • Склад
    • Производство
    • PLM
    • Закупки
    • Обслуживание
    • Качество
    Отдел кадров
    • Сотрудники
    • Подбор персонала
    • Отпуска
    • Оценка персонала
    • Реферальная программа
    • Автопарк
    Маркетинг
    • SMM
    • E-mail рассылки
    • СМС рассылки
    • Мероприятия
    • Автоматизация маркетинга
    • Опросы
    Услуги
    • Проекты
    • Табели
    • Выездной сервис
    • Поддержка
    • Планирование
    • Встречи
    Продуктивность
    • Обсуждения
    • Согласование
    • IoT
    • VoIP-телефония
    • Knowledge
    • WhatsApp
    Сторонние приложения Модуль Студия Odoo Платформа Odoo Cloud
  • Индустрии
    Розничная торговля
    • Книжный магазин
    • Магазин одежды
    • Мебельный магазин
    • Продуктовый магазин
    • Строительный магазин
    • Магазин игрушек
    Гостинично-ресторанный бизнес
    • Бар и паб
    • Ресторан
    • Фастфуд
    • Гостевой дом
    • Дистрибьютор напитков
    • Отель
    Недвижимость
    • Агентство недвижимости
    • Архитектурное бюро
    • Строительство
    • Управление недвижимостью
    • Ландшафтный дизайн
    • Товарищество собственников жилья
    Консалтинг
    • Бухгалтерская фирма
    • Партнер Odoo
    • Маркетинговое агентство
    • Юридическая фирма
    • Подбор персонала
    • Аудиторское бюро
    Производство
    • Текстиль
    • Металл
    • Мебель
    • Продукты питания
    • Пивоварня
    • Корпоративные сувениры
    Здоровье и фитнес
    • Спортивный комплекс
    • Магазин оптики
    • Фитнес-клуб
    • Велнес-центр
    • Аптека
    • Салон красоты
    Услуги
    • Специалист по бытовым услугам
    • Продажа и обслуживание IT-оборудования
    • Солнечные энергосистемы
    • Производство обуви
    • Клининг
    • Системы ОВКВ
    Прочее
    • Некоммерческая организация
    • Консалтинг в сфере устойчивого развития
    • Аренда рекламных щитов
    • Бизнес по фотосъемке
    • Прокат велосипедов
    • Реселлер программного обеспечения
    Все индустрии
  • Community
    Обучение
    • Видео уроки
    • Документация
    • Сертификация
    • Тренинг
    • Блог
    • Подкаст
    Образование и развитие
    • Образовательная программа
    • Деловая игра Scale Up!
    • Экскурсия в офис Odoo
    ПО
    • Скачать
    • Сравнить версии
    • Релизы
    Сотрудничество
    • Github
    • Форум
    • Мероприятия
    • Перевод
    • Стать партнером
    • Услуги для партнеров
    • Зарегистрировать бухгалтерскую фирму
    Услуги
    • Найти партнера
    • Найти бухгалтера
    • Встреча с экспертом
    • Услуги по внедрению
    • Отзывы клиентов
    • Поддержка
    • Обновления
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Заказать демонстрацию
  • Цены
  • Поддержка

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

  • CRM
  • e-Commerce
  • Бухгалтерия
  • Склад
  • PoS
  • Проекты
  • MRP
All apps
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Помощь

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

Подписаться

Получайте уведомления о появлении активности в этом посте

Этот вопрос был отмечен
v8saasmergefields.function
8 Ответы
8318 Представления
Аватар
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
Аватар
Отменить
michel Guénard
Автор

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

michel Guénard
Автор

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
Автор

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

Аватар
Cyril Gaspard (GEM)
Лучший ответ

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
Аватар
Отменить
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
Автор

@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
Автор

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

Аватар
yellow
Лучший ответ

Thank you for this process I didn't know !

1
Аватар
Отменить
Не оставайтесь в стороне – присоединяйтесь к обсуждению!

Создайте аккаунт сегодня, чтобы получить доступ к эксклюзивным функциям и стать частью нашего замечательного сообщества!

Регистрация
Похожие посты Ответы Просмотры Активность
Company logo in website builder Решено
v8 saas website_builder
Аватар
Аватар
Аватар
Аватар
4
июл. 16
2191
[8.0] How to translate fields.function with store to the new api
v8 api fields.function
Аватар
Аватар
1
июл. 15
8882
How can I show the Currency of a Sales Order on the printed PDF? Решено
v8 saas sales_order
Аватар
1
июн. 15
7333
How to apply website translation imported through PO file?
v8 saas translation
Аватар
0
мар. 15
4891
[FORUM] Customize (or hide) the "About This Forum" panel Решено
v8 saas forum
Аватар
Аватар
1
мар. 15
4005
Сообщество
  • Видео уроки
  • Документация
  • Форум
Открытый исходный код
  • Скачать
  • Github
  • Runbot
  • Перевод
Услуги
  • Хостинг Odoo.sh
  • Поддержка
  • Обновление
  • Индивидуальные решения по доработке
  • Образование
  • Найти бухгалтера
  • Найти партнера
  • Стать партнером
О нас
  • Наша компания
  • Активы бренда
  • Cвяжитесь с нами
  • Вакансии
  • Мероприятия
  • Подкаст
  • Блог
  • Клиенты
  • Правовые документы • Конфиденциальность
  • Безопасность
الْعَرَبيّة 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 – это набор бизнес-модулей с открытым исходным кодом, который закроет все потребности вашей компании: CRM, E-commerce, Бухгалтерия, Склад, POS, управление проектами и др.

Odoo сочетает в себе простоту использования и полную интеграцию всех бизнес-процессов в одной системе.

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