Skip to Content
Odoo Меню
  • Увійти
  • Спробуйте це безкоштовно
  • Додатки
    Фінанси
    • Бухоблік
    • Виставлення рахунку
    • Витрати
    • Електронні таблиці (BI)
    • Документи
    • Підпис
    Продажі
    • CRM
    • Продажі
    • POS Магазин
    • POS Ресторан
    • Підписки
    • Оренда
    Веб-сайти
    • Конструктор веб-сайту
    • Електронна комерція
    • Блог
    • Форум
    • Живий чат
    • Електронне навчання
    Ланцюг поставок
    • Склад
    • Виробництво
    • PLM
    • Купівлі
    • Технічне обслуговування
    • Якість
    Кадри
    • Співробітники
    • Рекрутинг
    • Відпустки
    • Оцінювання
    • Рекомендації
    • Автотранспорт
    Маркетинг
    • Маркетинг соцмереж
    • Email-маркетинг
    • SMS-маркетинг
    • Події
    • Автом. маркетингу
    • Опитування
    Послуги
    • Проект
    • Табелі
    • Виїзне обслуговування
    • Служба підтримки
    • Планування
    • Призначення
    Продуктивність
    • Обговорення
    • Схвалення
    • IoT
    • IP-телефонія
    • База знань
    • WhatsApp
    Сторонні модулі Odoo Studio Платформа Odoo Cloud
  • Сфери
    Роздрібна торгівля
    • Книжковий магазин
    • Магазин одягу
    • Магазин меблів
    • Продуктовий магазин
    • Магазин будівельних матеріалів
    • Магазин іграшок
    Food & Hospitality
    • Бар та паб
    • Ресторан
    • Фастфуд
    • Guest House
    • Дистриб'ютор напоїв
    • Hotel
    Нерухомість
    • Real Estate Agency
    • Архітектурна фірма
    • Будівництво
    • Управління нерухомістю
    • Садівництво
    • Асоціація власників нерухомості
    Консалтинг
    • Бухгалтерська компанія
    • Партнер Odoo
    • Агенція маркетингу
    • Юридична фірма
    • Придбання Талантів
    • Аудит та сертифікація
    Виробництво
    • Textile
    • Metal
    • Меблі
    • Їжа
    • Brewery
    • Корпоративні подарунки
    Здоров'я & Фітнес
    • Спортивний клуб
    • Оптика
    • Фітнес-центр
    • Практики здоров'я
    • Аптека
    • Салон краси
    Trades
    • Ремонтник
    • IT-обладнання та Підтримка
    • Системи сонячної енергії
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Інші
    • Nonprofit Organization
    • Екологічна агенція
    • Оренда білбордів
    • Фотографія
    • Лізинг велосипедів
    • Реселлер програмного забезпечення
    Browse all Industries
  • Спільнота
    Навчання
    • Навчальний посібник
    • Документація
    • Сертифікації
    • Тренування
    • Блог
    • Подкаст
    Сприяйте Освіті
    • Програма навчання
    • Бізнес гра Scale Up!
    • Відвідайте Odoo
    Отримайте програмне забезпечення
    • Завантаження
    • Порівняйте версії
    • Релізи
    Співпрацюйте
    • Github
    • Форум
    • Події
    • Переклади
    • Стати партнером
    • Services for Partners
    • Зареєструйте вашу бухгалтерську фірму
    Отримайте послуги
    • Знайдіть партнера
    • Знайдіть бухгалтера
    • Зустріньтеся з консультантом
    • Послуги з впровадження
    • Референси клієнтів
    • Підтримка
    • Оновлення
    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
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
All Posts Люди Значки
Мітки (View all)
odoo accounting v14 pos v15
Про цей форум
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
All Posts Люди Значки
Мітки (View all)
odoo accounting v14 pos v15
Про цей форум
Допомога

Define an unchangeable external id for xml files on data folder

Підписатися

Отримуйте сповіщення про активність щодо цієї публікації

Це запитання позначене
data.xmlexternal_idodoo12.0
1 Відповісти
8584 Переглядів
Аватар
Paulo Matos

Hello everyone,

I am working with Odoo v12 and having some problems on understanding "external IDs".
As per my understanding, an external ID is created on 2 situations:

1- When we create a record (by installing a module, adding data to tables, etc.), Odoo takes care of it automatically. In this case the external ID name is provided by Odoo itself;
 2- On a custom module by "forcing" the external ID name using the "<record id...>"

So, based on that, I have created the following external id for my account data for a localization module:

      <record id="ao_1161" model="account.account.template">
           <field name="code">11.6.1</field>
           <field name="reconcile" eval="False"/>
           <field name="name">Taras e vasilhame</field>
           <field name="user_type_id" ref="account.data_account_type_current_assets"/>
           <field name="chart_template_id" ref="ao_chart_template"/>
      </record>

So, if I correctly understood the external ID functionality, when my module is installed, this record for this specific account will have the following external ID:

          module_name.ao_1161

The problem is that when I install my module, I can see that the external ID for this record is:

          module_name.1_ao_1161

This is raising a problem because all modules I use that depends on this specific record are failing to install because they refer to "module_name.ao_1161" and it does not exist on the database...

Note: This is only happening with the accounts from my chart of accounts. Other external IDs are kept as defined on xml, for instance:

      <record id="money_sale_journal" model="account.journal">
            <field name="name">Sale Money Sales</field>
            <field name="code">VDC</field>
            <field name="type">sale</field>
            <field name="sequence_number_next">1</field>
            <field name="sequence_id" ref="sequence_customer_moneysale"/>
            <field name="default_debit_account_id" ref="l10n_ao_account.ao_6111"/>
            <field name="default_credit_account_id" ref="l10n_ao_account.ao_6111"/>
      </record>

The external ID for the above record is kept as: module_name.money_sale_journal

Can anyone help me correctly understand how can I keep the original external ID defined on the custom module for the chart of accounts records or other information saved on the "data" folder?

I think is something related with the xml file base location.

The chart of accounts data is on "data" folder under my module structure.
The other xml files (the ones that external ids are preserved) are on "views" folder under my module structure.

So, how can I make the desired records located on "data" to keep the original "external ids"?

Thank you everyone for helping me

Best regards

Paulo

1
Аватар
Відмінити
Аватар
Paresh Wagh
Найкраща відповідь

Hi Paulo: 

The external id, if specified, is retained "as is" by Odoo i.e. when you install the module, the id will be set to "<module>.<record id specified by you>". It does not matter where the file is located. The issue you are facing with the chart of accounts theoretically should not happen. You may want to double check to make sure this is not happening because of a typo.

Also, try specifying the complete name (including the module id) in the record id. This is not a best practice but is an alternate way of specifying the id. For example,

      <record id="module_name.ao_1161" model="account.account.template">

<field name="code">11.6.1</field>
<field name="reconcile" eval="False"/>
<field name="name">Taras e vasilhame</field>
<field name="user_type_id" ref="account.data_account_type_current_assets"/>
<field name="chart_template_id" ref="ao_chart_template"/>
    </record>
1
Аватар
Відмінити
Paulo Matos
Автор

Hi @Paresh,

Tank you very much.

You're right when you say this is not a normal behaviour.

I have doubble checked and all my account are acting like that.

After making some tests, I have found something which seems to be strange to me.

My chart data definition refers to the "account.account.template"

Here, my account data is set as:

<record id="ao_1111" model="account.account.template">.

Note: Tested with "l10n_ao_account.ao_1111" and see no changes on external IDs.

After installing the module, I look for the external IDs (just for the last part) and I see that the accounts are set on both "account.account.template" and "account.account" modules.

Is this correct?

I think "account.account.template" is just a template to be used for future reference, for instance on multicompany environments where Odoo gets the chart data from this model.

The "account.account" module, contains the chart data actually installed for the actual company...

So, my actual working chart of accounts is on "account.account" and this is where the problem is, because on the "account.account", the external ID is changed to "l10n_ao_account.1_ao_1111" and this is where problem resides.

On the "account.account.template", the external ID is kept as "l10n_ao_account.ao_1111" which is correct.

My problem is I want to set default values for a new journal on the "default_debit_account_id" field which is has a relation with "account.account" model.

Even thinking that I have this problem, when I install my module "exactly" from the "module name" (from my localization module with no modules installed), everything runs fine because Odoo will install all required dependencies.

If I try to instal this module on a database with existing modules, for instance "account" module, it fails to install because the external id... "1_ao_1111" is not found.

Thank you

Paulo

Paresh Wagh

Hi Paulo: There seem to be 3 pieces to the puzzle here. Chart Template (account.chart.template), Account Template (account.account.template) and Chart of Accounts (account.account). The 1st two define the core structure of the localization template. The 3rd seems to be a copy that gets created for each company that uses the template. It seems like the "1" in the id of the account.account records you are seeing is referring to the internal (database) id of the main company (res.company).

You may find it beneficial to study how the generic coa localization has been defined in the system. Here's a link to the l10n_generic_coa module.

https://github.com/odoo/odoo/tree/12.0/addons/l10n_generic_coa

Hope this helps.

Paresh Wagh

This link in the same module may also help since it is an example of creating demo data.

https://github.com/odoo/odoo/blob/12.0/addons/l10n_generic_coa/data/account_invoice_demo.xml

Paresh Wagh

This may provide a clue that answers the question you have about how to set the default_debit_account_id.

https://github.com/odoo/odoo/blob/12.0/addons/account/test/account_minimal_test.xml#L223

Paulo Matos
Автор

@Paresh,

You're great my friend.

I will look at every single peace of code here and will update you about what I am missing here.

Thank you once again

Best regards and have great weekend

Paulo

Enjoying the discussion? Don't just read, join in!

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

Реєстрація
Related Posts Відповіді Переглядів Дія
Expected singleton: hr.emp.travel.location(62, 63)
odoo12.0
Аватар
Аватар
Аватар
2
жовт. 25
2001
How to write Record Rule with domain based on the company_dependent Fields Вирішено
odoo12.0
Аватар
Аватар
Аватар
3
жовт. 23
10778
loan request
odoo12.0
Аватар
Аватар
1
вер. 23
4036
sum Colum of based on id
odoo12.0
Аватар
Аватар
1
трав. 23
3009
How to make pagination that has a table in qweb
odoo12.0
Аватар
Аватар
2
квіт. 23
3762
Спільнота
  • Навчальний посібник
  • Документація
  • Форум
Open Source
  • Завантаження
  • Github
  • Runbot
  • Переклади
Послуги
  • Хостинг Odoo.sh
  • Підтримка
  • Оновлення
  • Кастомні доробки
  • Навчання
  • Знайдіть бухгалтера
  • Знайдіть партнера
  • Стати партнером
Про нас
  • Наша компанія
  • Торгові активи
  • Зв'яжіться з нами
  • Вакансії
  • Події
  • Подкаст
  • Блог
  • Клієнти
  • Юридичні документи • Конфіденційність
  • Безпека
الْعَرَبيّة 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, електронна комерція, бухгалтерський облік, склад, точка продажу, управління проектами тощо.

Унікальна пропозиція 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