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ợ

How to Group Records in an Inherited View in Odoo 18 Without Errors?

Đă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ờ
viewsgroup_by
3926 Lượt xem
Ảnh đại diện
Dani Sanchez

I am trying to better organize my XML code in Odoo 18 by grouping records in a more structured way.

1. Currently, I have multiple fields with the groups attribute, but I want to know if there’s a better way to group permissions by record.


<odoo>

<record id="view_repair_order_list_custom" model="ir.ui.view">

<field name="name">repair.order.list.custom</field>

<field name="model">repair.order</field>

<field name="inherit_id" ref="repair.view_repair_order_tree" />

<field name="arch" type="xml">

<xpath expr="//list" position="attributes">

<attribute name="action">action_open_ticket_with_popup</attribute>

</xpath>


<xpath expr="//list" position="replace">

<list edit="0" string="Repair Orders" decoration-info="state == 'draft'"

create="1" delete="0" expand="1">

<!-- Campos para el grupo Mining con disable-click -->

<field name="name" readonly="1" string="Repair Reference" class="disable-click"

groups="custom_repair_module.group_mining,custom_repair_module.group_micro" />

<field name="schedule_date" string="Scheduled Date" widget="remaining_days"

readonly="1"

class="disable-click" groups="custom_repair_module.group_mining" />

<field name="product_id" string="Product to Repair" readonly="1"

class="disable-click"

groups="custom_repair_module.group_mining,custom_repair_module.group_micro" />

<field name="lot_id" string="Serial Number" readonly="1" class="disable-click"

groups="custom_repair_module.group_mining,custom_repair_module.group_micro" />

<field name="lot_ref" string="Position" readonly="1" class="disable-click"

groups="custom_repair_module.group_mining,custom_repair_module.group_micro" />

<field name="state" class="col-6 text-end disable-click"

widget="label_selection"

readonly="1"

groups="custom_repair_module.group_mining,custom_repair_module.group_micro"

options="{'classes': {

'draft': 'info',

'confirmed': 'light',

'under_repair': 'warning',

'ready_for_rack': 'dark',

'done': 'success',

'cancel': 'danger'

}}" />

<field name="tag_ids" widget="many2many_tags"

options="{'color_field': 'color'}"

class="col-12 text-center disable-click"

groups="custom_repair_module.group_micro" />

<button name="action_open_ticket_with_popup" type="object"

string="Open Ticket"

icon="fa-ticket" class="oe_stat_button w-100% col-12"

groups="custom_repair_module.group_mining"

invisible="state not in ('draft', 'ready_for_rack')" />


<button string="No action available for this state" type="object"

class="disable-click text-muted oe_stat_button w-100% col-12"

groups="custom_repair_module.group_mining"

invisible="state in ('draft', 'ready_for_rack')" />

<button name="action_open_ticket_with_popup" type="object" string="Open Ticket"

icon="fa-ticket" class="oe_stat_button w-100% col-12"

groups="custom_repair_module.group_micro"

invisible="state not in ('confirmed')" />

<button string="No action available for this state" type="object"

class="disable-click text-muted oe_stat_button w-100% col-12"

groups="custom_repair_module.group_micro" invisible="state in ('confirmed')" /> <!--

Campos para otros grupos (sin disable-click) -->

<field name="name" readonly="1" string="Repair Reference"

groups="custom_repair_module.group_noc" />

<field name="schedule_date" string="Scheduled Date" widget="remaining_days"

readonly="1"

groups="custom_repair_module.group_noc" />

<field name="product_id" string="Product to Repair" readonly="1"

groups="custom_repair_module.group_noc" />

<field name="lot_id" string="Serial Number" readonly="1"

groups="custom_repair_module.group_noc" />

<field name="lot_ref" string="Position" readonly="1"

groups="custom_repair_module.group_noc" />

<field name="state" class="col-6 text-end" widget="label_selection"

readonly="1"

groups="custom_repair_module.group_noc"

options="{'classes': {

'draft': 'info',

'confirmed': 'light',

'under_repair': 'warning',

'ready_for_rack': 'dark',

'done': 'success',

'cancel': 'danger'

}}" />

<field name="tag_ids" widget="many2many_tags"

options="{'color_field': 'color'}"

groups="custom_repair_module.group_noc" />

</list>

</xpath>


</field>

</record>


<!-- Reglas de seguridad -->

<!-- Restricción para el grupo Mining -->

<record id="repair_order_rule_mining" model="ir.rule">

<field name="name">Restrict Mining Users</field>

<field name="model_id" ref="repair.model_repair_order" />

<field name="domain_force">[(1, '=', 1)]</field>

<field name="groups" eval="[(4, ref('custom_repair_module.group_mining'))]" />

</record>


<!-- Permiso completo para el grupo NOC -->

<record id="repair_order_rule_noc" model="ir.rule">

<field name="name">Allow NOC Users</field>

<field name="model_id" ref="repair.model_repair_order" />

<field name="domain_force">[(1, '=', 1)]</field>

<field name="groups" eval="[(4, ref('custom_repair_module.group_noc'))]" />

</record>

</odoo>


2. I tried using groups_id inside the <record>, like this:

<field name="groups_id" eval="[(6, 0, [ref('base.group_manager')])]"/>

But I get the following error:

“An inherited view cannot have ‘groups’ defined in the record. Use the ‘groups’ attribute inside the view definition.”


My goal is to group permissions and configurations by record instead of referencing groups multiple times within fields and buttons.


How can I properly structure my code to apply group restrictions in a more organized way and avoid this error?

0
Ảnh đại diện
Huỷ bỏ
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
Order view after a group by
views group_by orderby
Ảnh đại diện
Ảnh đại diện
2
thg 1 21
6030
Select multiple elements with XPath Đã xử lý
views
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
5
thg 8 24
48201
Customize the label of "None" group in a group_by operations
group_by
Ảnh đại diện
0
thg 9 25
2453
Filter out (hide) lines in tree component Đã xử lý
views
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
2
thg 4 24
3471
What are the different types of views available in Odoo? Đã xử lý
views
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
3
thg 6 23
7906
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