please tell me i am not able to do this please how would be domain.
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
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hello Paidy,
Can you explain more conditions?
Also in the project screen is two scenario -
1. Project manager
2. Project Team
Also, there is any field related to the department_id on the project screen?
hi manish yes there is ..i have added department_id to project.project model
Ok so you can add a record rule in the group:
like condition for manager group (assume - project manager can see department wise project)
[('department_id', 'in', user.department_id)]
my domain looks [('department_id','=',user.employee_id.department_id)]...but it is not working
In the project screen - project manager field name is user_id.
so you can try this
[('department_id','=',user_id.employee_id.department_id)]
showing value error manish. there is no user_id
ValueError: <class 'NameError'>: "name 'user_id' is not defined" while evaluating
"[('department_id', 'in', user_id.employee_id.department_id)]"
"[('department_id', '=', user_id.employee_id.department_id.id)]"
you can try this.
small change "[('department_id', '=', 'user_id.employee_id.department_id.id')]....it is worked thanks for your efforts manish
manish now i added more than one department to employee so that based on departments i want to display projects i have added domain[ ('department_id', 'in', ['user_id.employee_id.department_ids'])] but only one department is appearing is my domain correct .in my department_ids field is many2many field it contains 2 departments.
have you added many2many department in project screen or employee screen?
yes added in employee screen please help me i am working on it from morning still i am not able to get it
domain [ ( 'department_id', 'in', user.employee_id.department_ids.ids)]
Try this
[ ( 'your_many2many_filed', 'in', user.employee_id.your_many2many_filed.ids)]
i am not added many2many field in project.project model ..i have added in hr.employee screen.
ur domain throwing error ValueError: Invalid field 'department_ids' in leaf "<osv.ExtendedLeaf: ('department_ids', 'in', []) on project_project (ctx: )>"
You should use record rules. Here is how I did something similar in my own module:
My module had three user groups. Group A, B and C. Records were classified based on their category. Categories A, B and C. A user in groups A and B could see records from categories A and B but could not see records from category C.
Here is the python code I used in my models and the record rule I created to make it happen.
class MyCategories(models.Model):
_name = "my.category"
name = fields.Char(string="Category", required=True)
# You can create your own groups or use existing groups.
groups = fields.Many2many(comodel_name="res.groups", required=True)
class MyModel(models.Model):
_name = "my.model"
# All your other fields...
category = fields.Many2one(string="Category", required=True, comodel_name="my.category")
allowed_groups = fields.Many2many(comodel_name="res.groups", related="category.groups", store=False)
Now that I have the allowed user groups in my model I can create a record rule to filter them out.
<record id="document_access" model="ir.rule"><field name="name">Documents only in the user's categories</field><field name="model_id" ref="model_my_model"/><field name="domain_force">[('allowed_groups', 'in', user.groups_id.ids)]</field></record>
After a brief look at the source code from the project module in Odoo 12 you will probably have to extend "project.project" to add a field which states the department_ids that are allowed to access it. The domain rule will probably look like this:
<field name="domain_force">[('allowed_departments', 'in', user.department_id)]</field>
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 | |
---|---|---|---|---|
Odoo Mail Sending Limit
Đã xử lý
|
|
2
thg 12 23
|
14739 | |
|
0
thg 10 23
|
33 | ||
|
3
thg 10 23
|
788 | ||
|
1
thg 10 23
|
569 | ||
|
1
thg 8 23
|
2469 |
i have added a relation field department_id to project.project model ..and my domain is [('department_id', '=', user.employee_id.department_id.id)]. still i am not able to see projects