Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

Define an unchangeable external id for xml files on data folder

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
data.xmlexternal_idodoo12.0
1 Svar
8588 Visninger
Avatar
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
Avatar
Kassér
Avatar
Paresh Wagh
Bedste svar

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
Avatar
Kassér
Paulo Matos
Forfatter

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
Forfatter

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

Tilmeld dig
Related Posts Besvarelser Visninger Aktivitet
Expected singleton: hr.emp.travel.location(62, 63)
odoo12.0
Avatar
Avatar
Avatar
2
okt. 25
2003
How to write Record Rule with domain based on the company_dependent Fields Løst
odoo12.0
Avatar
Avatar
Avatar
3
okt. 23
10786
loan request
odoo12.0
Avatar
Avatar
1
sep. 23
4037
sum Colum of based on id
odoo12.0
Avatar
Avatar
1
maj 23
3011
How to make pagination that has a table in qweb
odoo12.0
Avatar
Avatar
2
apr. 23
3762
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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