so i have a model with 2 diff menu items 1 menu is suppose to display all records in the model while 2nd menu needs to show only the record created by the user
how will i achieve this i cant use record rule as the record rule gets applied to the entire model and if i try to put domain on the action i cant directly access the logged in user like i can in record rule. i can access it by making a computed field that fetches current user and then match it with create_uid but since it is a computed field i cant use it in domain unless i store it but storing it causes other issues can any one suggest a solution for this
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- ลูกค้าสัมพันธ์
- e-Commerce
- ระบบบัญชี
- สินค้าคงคลัง
- PoS
- Project
- MRP
คำถามนี้ถูกตั้งค่าสถานะ
Hi Hassan Aamer,
You can achieve your requirement by following these steps:
Define Actions in Your XML File:
Add the following code to your XML file to create two separate actions:
one for all records and one for records created by the logged-in user.
// Code in comment
I Hope this information proves helpful to you.
Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari
1. Add a below code in your xml file
<record id="action_all_records" model="ir.actions.act_window">
<field name="name">All Records</field>
<field name="res_model">your_model_name</field>
<field name="view_mode">tree,form</field>
<field name="domain">[]</field>
</record>
<record id="action_my_records" model="ir.actions.act_window">
<field name="name">My Records</field>
<field name="res_model">your_model_name</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('create_uid', '=', uid)]</field>
</record>
2. Add a menu item in xml file
<menuitem
id="menu_all_records"
name="All Records"
action="action_all_records"
parent="if applicable"/>
<menuitem
id="menu_my_records"
name="My Records"
action="action_my_records"
parent="if applicable"/>
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
|
0
ก.ย. 24
|
1200 | ||
|
1
ก.ย. 24
|
2622 | ||
|
0
ก.ค. 24
|
1172 | ||
|
1
ก.ค. 24
|
1296 | ||
|
2
ส.ค. 25
|
203 |