Bỏ qua để đến Nội dung
Odoo Menu
  • Đăng nhập
  • Dùng thử miễn phí
  • Ứng dụng
    Tài chính
    • Kế toán
    • Hóa đơn
    • Chi phí
    • Bảng tính (BI)
    • Tài liệu
    • Ký tên
    Bán hàng
    • CRM
    • Bán hàng
    • POS Cửa hàng
    • POS Nhà hàng
    • Đăng ký
    • Cho thuê
    Trang web
    • Trình tạo trang web
    • Thương mại điện tử
    • Blog
    • Diễn đàn
    • Trò chuyện trực tiếp
    • Học trực tuyến
    Chuỗi cung ứng
    • Tồn kho
    • Sản xuất
    • PLM
    • Mua hàng
    • Bảo dưỡng
    • Chất lượng
    Nhân sự
    • Nhân viên
    • Tuyển dụng
    • Ngày nghỉ
    • Đánh giá
    • Giới thiệu
    • Đội xe
    Marketing
    • Marketing trên MXH
    • Marketing qua email
    • Marketing qua SMS
    • Sự kiện
    • Tự động hóa Marketing
    • Khảo sát
    Dịch vụ
    • Dự án
    • Bảng chấm công
    • Dịch vụ hiện trường
    • Hỗ trợ
    • Kế hoạch
    • Lịch hẹn
    Năng suất
    • Thảo luận
    • Phê duyệt
    • IoT
    • VoIP
    • Kiến thức
    • WhatsApp
    Ứng dụng của bên thứ ba Studio Odoo Nền tảng Đám mây Odoo
  • Ngành
    Bán lẻ
    • Nhà sách
    • Cửa hàng quần áo
    • Cửa hàng nội thất
    • Cửa hàng tạp hóa
    • Cửa hàng đồ kim khí
    • Cửa hàng đồ chơi
    Ẩm thực & Dịch vụ lưu trú
    • Bar và quán rượu
    • Nhà hàng
    • Đồ ăn nhanh
    • Guest house
    • Nhà phân phối đồ uống
    • Khách sạn
    Bất động sản
    • Công ty môi giới bất động sản
    • Công ty kiến trúc
    • Xây dựng
    • Quản lý bất động sản
    • Làm vườn
    • Hiệp hội chủ sở hữu bất động sản
    Tư vấn
    • Công ty kế toán
    • Đối tác Odoo
    • Công ty marketing
    • Công ty luật
    • Tuyển dụng
    • Thanh tra & chứng nhận
    Sản xuất
    • Dệt may
    • Kim loại
    • Nội thất
    • Ẩm thực
    • Nhà máy bia
    • Quà tặng doanh nghiệp
    Sức khoẻ & fitness
    • CLB thể thao
    • Cửa hàng kính mắt
    • Trung tâm fitness
    • Chuyên gia chăm sóc sức khỏe
    • Hiệu thuốc
    • Tiệm làm tóc
    Thương mại
    • Dịch vụ sửa chữa
    • Phần cứng CNTT & Hỗ trợ
    • Hệ thống năng lượng mặt trời
    • Công ty sản xuất giày
    • Dịch vụ vệ sinh
    • Dịch vụ HVAC
    Khác
    • Tổ chức phi lợi nhuận
    • Cơ quan môi trường
    • Cho thuê biển quảng cáo
    • Nhiếp ảnh
    • Cho thuê xe đạp
    • Đại lý phần mềm
    Xem tất cả ngành
  • Cộng đồng
    Học tập
    • Khóa học
    • Tài liệu
    • Chứng chỉ
    • Đào tạo
    • Blog
    • Podcast
    Thúc đẩy đào tạo
    • Chương trình đào tạo
    • Trò chơi kinh doanh Scale Up!
    • Tham quan Odoo
    Nhận phần mềm
    • Tải xuống
    • So sánh các phiên bản
    • Phiên bản
    Hợp tác
    • Github
    • Diễn đàn
    • Sự kiện
    • Dịch thuật
    • Trở thành đối tác
    • Dịch vụ dành cho Đối tác
    • Đăng ký công ty kế toán của bạn
    Nhận dịch vụ
    • Tìm đối tác
    • Tìm kế toán
    • Gặp chuyên gia hỗ trợ
    • Dịch vụ Triển khai
    • Khách hàng tham khảo
    • Hỗ trợ
    • Nâng cấp
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Nhận một buổi demo
  • Bảng giá
  • Trợ giúp

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

  • CRM
  • e-Commerce
  • Kế toán
  • Tồn kho
  • PoS
  • Dự án
  • MRP
All apps
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Hỗ trợ

Define an unchangeable external id for xml files on data folder

Đăng ký nhận tin

Nhận thông báo khi có hoạt động trên bài viết này

Câu hỏi này đã bị gắn cờ
data.xmlexternal_idodoo12.0
1 Trả lời
8587 Lượt xem
Ảnh đại diện
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
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Paresh Wagh
Câu trả lời hay nhất

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
Ảnh đại diện
Huỷ bỏ
Paulo Matos
Tác giả

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
Tác giả

@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

Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!

Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!

Đăng ký
Bài viết liên quan Trả lời Lượt xem Hoạt động
Expected singleton: hr.emp.travel.location(62, 63)
odoo12.0
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
2
thg 10 25
2003
How to write Record Rule with domain based on the company_dependent Fields Đã xử lý
odoo12.0
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
3
thg 10 23
10786
loan request
odoo12.0
Ảnh đại diện
Ảnh đại diện
1
thg 9 23
4037
sum Colum of based on id
odoo12.0
Ảnh đại diện
Ảnh đại diện
1
thg 5 23
3011
How to make pagination that has a table in qweb
odoo12.0
Ảnh đại diện
Ảnh đại diện
2
thg 4 23
3762
Cộng đồng
  • Khóa học
  • Tài liệu
  • Diễn đàn
Open source
  • Tải xuống
  • Github
  • Runbot
  • Dịch thuật
Dịch vụ
  • Lưu trữ Odoo.sh
  • Hỗ trợ
  • Nâng cấp
  • Phát triển tùy chỉnh
  • Đào tạo
  • Tìm kế toán
  • Tìm đối tác
  • Trở thành đối tác
Giới thiệu công ty
  • Công ty của chúng tôi
  • Tài sản thương hiệu
  • Liên hệ
  • Việc làm
  • Sự kiện
  • Podcast
  • Blog
  • Khách hàng
  • Pháp lý • Riêng tư
  • Bảo mật
الْعَرَبيّة 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 là bộ ứng dụng kinh doanh có open source đáp ứng tất cả các nhu cầu của công ty bạn: CRM, thương mại điện tử, kế toán, tồn kho, POS, quản lý dự án, v.v.

Định hướng giá trị riêng biệt của Odoo là tích hợp hoàn toàn và dễ dàng sử dụng.

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