Skip to content

Commit

Permalink
[IMP] maintenance_project: Add groups="project.group_project_user" to…
Browse files Browse the repository at this point in the history
… project/task fields

TT50829
  • Loading branch information
victoralmau committed Sep 16, 2024
1 parent 6700604 commit 8098005
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
4 changes: 3 additions & 1 deletion maintenance_project/tests/test_maintenance_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def setUpClass(cls):
cls.project1 = cls.env["project.project"].create({"name": "My project"})
cls.project_demo = cls.env.ref("maintenance_project.project_project_1")
new_test_user(
cls.env, login="test-user", groups="maintenance.group_equipment_manager"
cls.env,
login="test-user",
groups="maintenance.group_equipment_manager,project.group_project_user",
)
new_test_user(
cls.env,
Expand Down
16 changes: 10 additions & 6 deletions maintenance_project/views/maintenance_equipment_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<field name="inherit_id" ref="maintenance.hr_equipment_view_search" />
<field name="arch" type="xml">
<xpath expr="//field[@name='owner_user_id']" position="after">
<field name="project_id" />
<field name="project_id" groups="project.group_project_user" />
</xpath>
</field>
</record>
Expand All @@ -14,7 +14,7 @@
<field name="inherit_id" ref="maintenance.hr_equipment_view_tree" />
<field name="arch" type="xml">
<xpath expr="//field[@name='category_id']" position="after">
<field name="project_id" />
<field name="project_id" groups="project.group_project_user" />
</xpath>
</field>
</record>
Expand All @@ -23,10 +23,13 @@
<field name="inherit_id" ref="maintenance.hr_equipment_view_kanban" />
<field name="arch" type="xml">
<xpath expr="//field[@name='activity_state']" position="after">
<field name="project_id" />
<field name="project_id" groups="project.group_project_user" />
</xpath>
<xpath expr="//div[hasclass('o_kanban_record_body')]" position="inside">
<div t-if="record.project_id.raw_value">
<div
t-if="record.project_id.raw_value"
groups="project.group_project_user"
>
<small>Project: <t t-raw="record.project_id.value" /></small>
</div>
</xpath>
Expand All @@ -38,11 +41,11 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='location']" position="after">
<field name="project_id" invisible="1" />
<label for="project_id" />
<label for="project_id" groups="project.group_project_user" />
<div>
<field
name="project_id"
groups="project.group_project_manager"
groups="project.group_project_user"
class="oe_inline"
/>
<button
Expand All @@ -62,6 +65,7 @@
name="preventive_default_task_id"
domain="[('project_id', '=', project_id)]"
context="{'default_project_id': project_id}"
groups="project.group_project_user"
/>
</group>
</xpath>
Expand Down
16 changes: 11 additions & 5 deletions maintenance_project/views/maintenance_request_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<field name="inherit_id" ref="maintenance.hr_equipment_request_view_search" />
<field name="arch" type="xml">
<xpath expr="//field[@name='maintenance_team_id']" position="after">
<field name="project_id" />
<field name="project_id" groups="project.group_project_user" />
</xpath>
</field>
</record>
Expand All @@ -14,7 +14,7 @@
<field name="inherit_id" ref="maintenance.hr_equipment_request_view_tree" />
<field name="arch" type="xml">
<xpath expr="//field[@name='category_id']" position="after">
<field name="project_id" />
<field name="project_id" groups="project.group_project_user" />
</xpath>
</field>
</record>
Expand All @@ -23,10 +23,13 @@
<field name="inherit_id" ref="maintenance.hr_equipment_request_view_kanban" />
<field name="arch" type="xml">
<xpath expr="//field[@name='activity_state']" position="after">
<field name="project_id" />
<field name="project_id" groups="project.group_project_user" />
</xpath>
<xpath expr="//div[hasclass('o_kanban_record_body')]" position="inside">
<div t-if="record.project_id.raw_value">
<div
t-if="record.project_id.raw_value"
groups="project.group_project_user"
>
<small>Project: <t t-raw="record.project_id.value" /></small>
</div>
</xpath>
Expand All @@ -37,11 +40,14 @@
<field name="inherit_id" ref="maintenance.hr_equipment_request_view_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='priority']" position="after">
<field name="project_id" />
<field name="project_id" invisible="1" />
<field name="project_id" groups="project.group_project_user" />
<field name="task_id" invisible="1" />
<field
name="task_id"
domain="[('project_id', '=', project_id)]"
context="{'default_project_id': project_id}"
groups="project.group_project_user"
/>
</xpath>
</field>
Expand Down

0 comments on commit 8098005

Please sign in to comment.