Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3848 มุมมอง

Hi,

I have created a module where I have patients. In my database I have two companies, which will use the same module. However, I want each of the companies to have their own patients and the users of company A do not see the patients of company B and vice versa.

I thought that with a server action and a company Many2One field it might help. So right now, every time a user from company A creates a patient, the Many2One field is automatically assigned company A and if the user is from company B, company B is assigned to that field.

How can I get a default filter that cannot be removed from view?

Notes:

  1. All the changes I make with Odoo studio.

  2. In the past I managed to do it by relying on the contacts module, however I have decided that I will only handle suppliers and clients in the Odoo contacts module. I know that the Odoo contact module prevents a user from company A from seeing company B's contacts. I want an exclusive model for patients.


Thanks

อวตาร
ละทิ้ง
ผู้เขียน

Hi Chris, thanks for your reply. 

This guidelines apply for Odoo 12 too?

คำตอบที่ดีที่สุด

Odoo multicompany guidelines are here

You can use Record Rules - something like this:

['|',
     ('company_id', 'in', company_ids),
     ('company_id', '=', False)]
This might also help: Multicompany in Odoo 13 (there are no changes in 14 as far as I know)
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Filter by user company [Odoo 14] แก้ไขแล้ว
1
มี.ค. 24
3088
1
ส.ค. 22
4328
0
มิ.ย. 22
2002
1
ก.ย. 21
2912
0
ส.ค. 21
3109