Skip to Content
Odoo เมนู
  • ลงชื่อเข้าใช้
  • ทดลองใช้ฟรี
  • แอป
    การเงิน
    • ระบบบัญชี
    • ระบบการออกใบแจ้งหนี้
    • ระบบบัญชีรายจ่าย
    • ระบบการจัดการข้อมูลผ่านสเปรดชีต (BI)
    • เอกสาร
    • ระบบลงลายเซ็น
    การขาย
    • ลูกค้าสัมพันธ์
    • การขาย
    • POS ร้านค้า
    • POS ร้านอาหาร
    • ระบบสมัครสมาชิก
    • การเช่า
    การจัดการเว็บไซต์
    • เครื่องมือสร้างเว็บไซต์
    • ระบบการขายออนไลน์
    • บล็อก
    • ฟอรั่ม
    • ไลฟ์แชท
    • ระบบการอบรมออนไลน์
    ซัพพลายเชน
    • คลังสินค้า
    • ระบบการผลิต
    • PLM
    • ระบบการจัดซื้อ
    • การซ่อมบำรุง
    • ระบบจัดการคุณภาพ
    ทรัพยากรบุคคล
    • ข้อมูลพนักงาน
    • ระบบสรรหาบุคลากร
    • ระบบการลา
    • การประเมิน
    • ระบบการแนะนำพนักงาน
    • ระบบจัดการยานพาหนะ
    การตลาด
    • โซเชียลมาร์เก็ตติ้ง
    • การตลาดผ่านอีเมล
    • ระบบการตลาดผ่าน SMS
    • ระบบการจัดงานอีเวนต์
    • การตลาดแบบอัตโนมัติ
    • ระบบแบบสำรวจ
    การบริการ
    • โปรเจกต์
    • ระบบบันทึกเวลา
    • ระบบการจัดการบริการภาคสนาม
    • ระบบดูแลช่วยเหลือ
    • การวางแผน
    • การนัดหมาย
    ประสิทธิผล
    • ระบบแสดงความคิดเห็น
    • ระบบการอนุมัติ
    • ไอโอที
    • VoIP
    • คลังข้อมูล
    • WhatsApp
    แอปพลิเคชันของบุคคลที่สาม Odoo สตูดิโอ แพลตฟอร์มคลาวด์ของ Odoo
  • อุตสาหกรรม
    การค้าปลีก
    • ร้านขายหนังสือ
    • ร้านขายเสื้อผ้า
    • ร้านขายเฟอร์นิเจอร์
    • ร้านขายของชำ
    • ร้านขายฮาร์ดแวร์
    • ร้านขายของเล่น
    Food & Hospitality
    • บาร์และผับ
    • ร้านอาหาร
    • อาหารฟาสต์ฟู้ด
    • Guest House
    • ตัวแทนจำหน่ายเครื่องดื่ม
    • Hotel
    อสังหาริมทรัพย์
    • Real Estate Agency
    • บริษัทสถาปัตยกรรม
    • บริษัทรับเหมา
    • การจัดการอสังหาริมทรัพย์
    • การจัดสวน
    • สมาคมเจ้าของอสังหาริมทรัพย์
    ปรึกษา
    • สำนักงานบัญชี
    • Odoo พาร์ทเนอร์
    • เอเจนซี่การตลาด
    • สำนักงานกฎหมาย
    • บริการสรรหาบุคลากร
    • การตรวจสอบและการรับรอง
    ระบบการผลิต
    • Textile
    • เหล็ก
    • เฟอร์นิเจอร์
    • อาหาร
    • Brewery
    • ของขวัญขององค์กร
    สุขภาพ & ฟิตเนส
    • ชมรมกีฬา
    • ร้านขายแว่นตา
    • ฟิตเนส
    • ผู้ประกอบวิชาชีพด้านสุขภาพ
    • ร้านขายยา
    • ร้านทำผม
    Trades
    • ช่างซ่อม
    • ฮาร์ดแวร์และการสนับสนุนด้านไอที
    • ระบบพลังงานแสงอาทิตย์
    • ช่างทำรองเท้า
    • บริการทำความสะอาด
    • HVAC Services
    อื่น ๆ
    • Nonprofit Organization
    • สำนักงานสิ่งแวดล้อม
    • ร้านเช่าป้ายโฆษณา
    • การถ่ายภาพ
    • ร้านเช่าจักรยาน
    • ตัวแทนจำหน่ายซอฟต์แวร์
    Browse all Industries
  • คอมมูนิตี้
    ศึกษา
    • บทเรียน
    • เอกสารกำกับโปรแกรม
    • การรับรอง
    • การฝึกอบรม
    • บล็อก
    • พอดแคสต์
    เพิ่มศักยภาพให้กับการศึกษา
    • โปรแกรมการศึกษา
    • Scale Up! Business Game
    • เยี่ยมชม 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:

  • ลูกค้าสัมพันธ์
  • e-Commerce
  • ระบบบัญชี
  • สินค้าคงคลัง
  • PoS
  • โปรเจกต์
  • MRP
All apps
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
ช่วยเหลือ

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

ติดตาม

รับการแจ้งเตือนเมื่อมีกิจกรรมในโพสต์นี้

คำถามนี้ถูกตั้งค่าสถานะ
viewsgroup_by
3919 มุมมอง
อวตาร
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
อวตาร
ละทิ้ง
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!

สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!

ลงชื่อ
Related Posts ตอบกลับ มุมมอง กิจกรรม
Order view after a group by
views group_by orderby
อวตาร
อวตาร
2
ม.ค. 21
6029
Select multiple elements with XPath แก้ไขแล้ว
views
อวตาร
อวตาร
อวตาร
อวตาร
อวตาร
5
ส.ค. 24
48200
Customize the label of "None" group in a group_by operations
group_by
อวตาร
0
ก.ย. 25
2452
Filter out (hide) lines in tree component แก้ไขแล้ว
views
อวตาร
อวตาร
อวตาร
2
เม.ย. 24
3471
What are the different types of views available in Odoo? แก้ไขแล้ว
views
อวตาร
อวตาร
อวตาร
อวตาร
3
มิ.ย. 23
7905
คอมมูนิตี้
  • บทเรียน
  • เอกสารกำกับโปรแกรม
  • ฟอรั่ม
โอเพนซอร์ส
  • ดาวน์โหลด
  • 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 eCommerce ระบบบัญชี ระบบสินค้าคงคลัง ระบบการขายหน้าร้าน โปรเจกต์ และ อีกมากมาย

ความเหนือกว่าอันเป็นเอกลักษณ์ของ 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