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ợ

[ODOO 10] "Unknown field in domain" error when inheriting a view to add sub-fields

Đă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ờ
viewsfieldsinheritanceone2many
1 Trả lời
8076 Lượt xem
Ảnh đại diện
Maxime MARAIS

Hi,

I created a new class inheriting stock.pack.operation. This class adds a One2many field named carrier_pack and an Integer field named carrier_pack_count. The field carrier_pack_count is a computed value, returning the number of objects in the field carrier_pack. The class is well installed and I can find both fields with the developer tools via the Technical>Database>Models menu.

I also try to display an icon in the list of operations of a stock.picking view. I created a new ir.ui.view <record> inheriting stock.view_picking_form. This form targets "//form/sheet/notebook/page/field[@name='pack_operation_product_ids']/tree" and adds some code as follows:

<field name="arch" type="xml">    <xpath expr="//form/sheet/notebook/page/field[@name='pack_operation_product_ids']/tree" position="inside">        <button type="object" name="show_pack" string="Pack expedited" icon="fa-truck" attrs="{'invisible': [('carrier_pack_count', '!=', 0)]}"/>    </xpath></field>

given the //form/sheet/notebook/page/field[@name='pack_operation_product_ids']/tree is :

<field name="pack_operation_product_ids" options="{'reload_on_button': True}" context="{'default_picking_id': id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id}" mode="tree,kanban">    <tree editable="bottom" decoration-muted="result_package_id" decoration-danger="qty_done&gt;product_qty" decoration-success="qty_done==product_qty and state!='done' and not result_package_id">        <field name="package_id" groups="stock.group_tracking_lot" invisible="1"/>        <field name="product_id" required="1" attrs="{'readonly': [('fresh_record', '=', False)]}"/>        <field name="fresh_record" invisible="1"/>        <field name="product_uom_id" attrs="{'readonly': [('fresh_record', '=', False)]}" groups="product.group_uom"/>        <field name="lots_visible" invisible="1"/>        <!-- [...] -->        <button name="split_lot" string="Lot Split" type="object" icon="fa-list" groups="stock.group_production_lot"            attrs="{'invisible': ['|', ('lots_visible', '=', False), ('state', 'not in', ['confirmed', 'assigned', 'waiting', 'partially_available','done'])]}"/>        <button name="show_details" string="Modify" type="object" icon="fa-pencil" groups="stock.group_stock_multi_locations"            states="confirmed,assigned,waiting,partially_available"/>    </tree><!-- [...] --></field>

adding my new button results in having the following code:

<!-- [...] -->        <button name="split_lot" string="Lot Split" type="object" icon="fa-list" groups="stock.group_production_lot"            attrs="{'invisible': ['|', ('lots_visible', '=', False), ('state', 'not in', ['confirmed', 'assigned', 'waiting', 'partially_available','done'])]}"/>        <button name="show_details" string="Modify" type="object" icon="fa-pencil" groups="stock.group_stock_multi_locations"            states="confirmed,assigned,waiting,partially_available"/>

<button type="object" name="show_pack" string="Pack expedited" icon="fa-truck" attrs="{'invisible': [('carrier_pack_count', '!=', 0)]}"/> </tree>

<!-- [...] -->

Fields like lots_visible or state used in attrs are well considered as belonging to one of the current pack_operation_product_ids parent field as expected. But the carrier_pack_count used in attrs="{'invisible': [('carrier_pack_count', '!=', 0)]}" defined in my inheriting view IS NOT.

Odoo displays the following error message :

Unknown field carrier_pack_count in domain [["carrier_pack_count","!=",0]]

Do I miss something? Is this a bug? How to fix this issue?

Thanks.


0
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Krimi Shah
Câu trả lời hay nhất

Hi Maxime Marais,

I think you need first give the field carrier_pack_count in view with which the domain can work properly.
Or else, please post the whole code so we can figure out properly.

Regards,

Krimi

1
Ảnh đại diện
Huỷ bỏ
Maxime MARAIS
Tác giả

Hi Krimi.

carrier_pack_count is expected to be in the view. The field carrier_pack_count is added by my add-on, inheriting from stock.pack.operation model. I'm sure it is, I can see browsing the models with the developer tools.

The parent view is composed like this :

<FIELD name="pack_operation_product_ids" options="{'reload_on_button': True}" context="{'default_picking_id': id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id}" mode="tree,kanban">

<TREE editable="bottom" decoration-muted="result_package_id" decoration-danger="qty_done&gt;product_qty" decoration-success="qty_done==product_qty and state!='done' and not result_package_id">

<FIELD name="package_id" groups="stock.group_tracking_lot" invisible="1"/>

<FIELD name="product_id" required="1" attrs="{'readonly': [('fresh_record', '=', False)]}"/>

<!-- [...] -->

</TREE>

<!-- [...] -->

</FIELD>

I simply add a new button in the tree above.

Looping on pack_operation_product_ids, the tree in it is in the stock.pack.operation domain (the class stock.picking defines pack_operation_product_ids as a One2many fields pointing to stock.pack.operation, the view loops on each stock.pack.operation referenced by stock.picking).

Fields named package_id, product_id, etc. are properties of stock.pack.operation, as well as my carrier_pack_count defined in my model expending stock.pack.operation.

I cannot figure out why Odoo displays carrier_pack_count as being part of stock.pack.operation model (as well as package_id, product_id, etc.) but cannot access it when displaying the view.

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
Help with XPath and View Inheritance Đã xử lý
views fields inheritance xpath
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
4
thg 8 21
70220
How to add a field on an existing tab? Đã xử lý
views fields inheritance tabs
Ảnh đại diện
Ảnh đại diện
2
thg 3 15
8233
How to access to fields from other object ? Đã xử lý
views fields one2many relation
Ảnh đại diện
Ảnh đại diện
1
thg 3 15
9153
View inheritance hiding a field
views inheritance
Ảnh đại diện
Ảnh đại diện
1
thg 11 24
2620
Change the Position of field in Xpath Đã xử lý
views inheritance
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
5
thg 7 24
95892
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