/
project_task_views.xml
179 lines (171 loc) · 12.4 KB
/
project_task_views.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="project_project_view_form" model="ir.ui.view">
<field name="name">project.project.form.inherit</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="hr_timesheet.project_invoice_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='settings']//field[@name='analytic_account_id']" position="before">
<field name="sale_line_id" groups="!sales_team.group_sale_salesman" options="{'no_create': True, 'no_edit': True, 'delete': False, 'no_open': True}" attrs="{'invisible': ['|', ('allow_billable', '=', False), ('partner_id', '=', False)]}"/>
<field name="sale_line_id" groups="sales_team.group_sale_salesman" options="{'no_create': True, 'no_edit': True, 'delete': False}" attrs="{'invisible': ['|', ('allow_billable', '=', False), ('partner_id', '=', False)]}"/>
</xpath>
<xpath expr="//page[@name='settings']" position="after">
<page name="billing_employee_rate" string="Invoicing" attrs="{'invisible': ['|', ('allow_billable', '=', False), ('partner_id', '=', False)]}">
<field name="sale_line_employee_ids">
<tree editable="bottom">
<field name="company_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="sale_order_id" invisible="1"/>
<field name="employee_id" options="{'no_create': True}" widget="many2one_avatar_user"/>
<field name="sale_line_id" attrs="{'required': True}" options="{'no_create': True}" context="{'search_default_order_id': sale_order_id}"/>
<field name="price_unit" widget="monetary" force_save="1" options="{'currency_field': 'currency_id'}"/>
<field name="display_cost" widget="monetary" options="{'currency_field': 'cost_currency_id'}"/>
<field name="is_cost_changed" invisible="1"/>
<field name="currency_id" invisible="1"/>
<field name="cost_currency_id" invisible="1"/>
</tree>
</field>
</page>
</xpath>
</field>
</record>
<record id="project_project_view_form_simplified_inherit" model="ir.ui.view">
<field name="name">project.project.view.form.simplified.inherit</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="hr_timesheet.project_project_view_form_simplified_inherit_timesheet"/>
<field name="arch" type="xml">
<xpath expr="//setting" position="before">
<field name="company_id" invisible="1"/>
<setting help="Invoice your time and material to customers">
<field name="allow_billable"/>
<div attrs="{'invisible': [('allow_billable', '=', False)]}">
<label for="partner_id"/>
<field name="partner_id" class="ms-1" widget="res_partner_many2one" context="{'res_partner_search_mode': 'customer'}"
options="{'no_create_edit': True, 'no_open': True}"/>
</div>
</setting>
</xpath>
</field>
</record>
<record id="project_project_view_kanban_inherit_sale_timesheet" model="ir.ui.view">
<field name="name">project.project.kanban.inherit.sale.timesheet</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="hr_timesheet.view_project_kanban_inherited"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='allow_timesheets']" position="after">
<field name="allow_billable"/>
<field name="warning_employee_rate" invisible="1"/>
<field name="sale_order_id" invisible="1"/>
<field name="pricing_type" invisible="1"/>
</xpath>
<xpath expr="//div[hasclass('o_kanban_manage_reporting')]" position="inside">
<div role="menuitem" t-if="record.rating_active.raw_value" groups="project.group_project_manager">
<a name="action_view_all_rating" type="object">
Customer Ratings
</a>
</div>
</xpath>
</field>
</record>
<!-- We do a separate inheritance from the base view for the SO button to give the buttons a deterministic order using priorities -->
<record id="project_project_view_kanban_inherit_sale_timesheet_so_button" model="ir.ui.view">
<field name="name">project.project.kanban.inherit.sale.timesheet.so.button</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="project.view_project_kanban"/>
<field name="priority">30</field>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('o_kanban_manage_view')]" position="inside">
<div t-if="record.allow_billable.raw_value and record.sale_order_id.raw_value and record.pricing_type.raw_value != 'task_rate'"
role="menuitem"
groups="sales_team.group_sale_salesman_all_leads">
<a name="action_view_sos" type="object">Sales Orders</a>
</div>
</xpath>
</field>
</record>
<record id="view_task_tree2_inherited" model="ir.ui.view">
<field name="name">project.task.tree.inherited</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="hr_timesheet.view_task_tree2_inherited" />
<field name="arch" type="xml">
<xpath expr="//field[@name='remaining_hours']" position="after">
<field name="sale_line_id" invisible="1"/>
<field name="remaining_hours_available" invisible="1"/>
<field name="remaining_hours_so" attrs="{'invisible': ['|', ('sale_line_id', '=', False), ('remaining_hours_available', '=', False)]}" widget="timesheet_uom" optional="hide"/>
</xpath>
</field>
</record>
<record id="project_task_view_form_inherit_sale_timesheet" model="ir.ui.view">
<field name="name">project.task.form.inherit.timesheet</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_form2"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='user_ids']" position="after">
<field name="is_project_map_empty" invisible="1" groups="hr_timesheet.group_hr_timesheet_user"/>
<field name="has_multi_sol" invisible="1" groups="hr_timesheet.group_hr_timesheet_user"/>
</xpath>
<xpath expr="//field[@name='partner_id']" position="after">
<field name="pricing_type" invisible="1" groups="hr_timesheet.group_hr_timesheet_user"/>
</xpath>
<xpath expr="//field[@name='timesheet_ids']" position="attributes">
<!-- <field name="timesheet_ids"/> is already inside a block groups="hr_timesheet.group_hr_timesheet_user" -->
<attribute name="widget">so_line_one2many</attribute>
</xpath>
<xpath expr="//field[@name='timesheet_ids']/tree" position="inside">
<!-- <field name="timesheet_ids"/> is already inside a block groups="hr_timesheet.group_hr_timesheet_user" -->
<field name="is_so_line_edited" invisible="1" />
</xpath>
<xpath expr="//field[@name='timesheet_ids']/tree/field[@name='unit_amount']" position="before">
<!-- <field name="timesheet_ids"/> is already inside a block groups="hr_timesheet.group_hr_timesheet_user" -->
<field name="timesheet_invoice_id" invisible="1"/>
<field name="so_line" widget="so_line_field" groups="!sales_team.group_sale_salesman"
attrs="{'column_invisible': [('parent.allow_billable', '=', False)], 'readonly': [('readonly_timesheet', '=', True)]}"
context="{'with_remaining_hours': True, 'with_price_unit': True}" options="{'no_create': True, 'no_open': True}"
domain="[('is_service', '=', True), ('order_partner_id', 'child_of', parent.partner_id), ('is_expense', '=', False), ('state', 'in', ['sale', 'done'])]"
optional="hide"/>
<field name="so_line" widget="so_line_field" groups="sales_team.group_sale_salesman"
attrs="{'column_invisible': [('parent.allow_billable', '=', False)], 'readonly': [('readonly_timesheet', '=', True)]}"
context="{'with_remaining_hours': True, 'with_price_unit': True}" options="{'no_create': True, 'no_open': True}"
domain="[('is_service', '=', True), ('order_partner_id', 'child_of', parent.partner_id), ('is_expense', '=', False), ('state', 'in', ['sale', 'done'])]"
optional="hide"/>
</xpath>
<xpath expr="//field[@name='remaining_hours']" position="after">
<t groups="hr_timesheet.group_hr_timesheet_user">
<field name="sale_order_id" invisible="1"/>
<field name="remaining_hours_available" invisible="1"/>
<span id="remaining_hours_so_label" attrs="{'invisible': ['|', '|', '|', '|', ('allow_billable', '=', False), ('sale_order_id', '=', False), ('partner_id', '=', False), ('sale_line_id', '=', False), ('remaining_hours_available', '=', False)]}" class="o_td_label float-start">
<label class="fw-bold" for="remaining_hours_so" string="Remaining Hours on SO"
attrs="{'invisible': ['|', ('encode_uom_in_days', '=', True), ('remaining_hours_so', '<', 0)]}"/>
<label class="fw-bold" for="remaining_hours_so" string="Remaining Days on SO"
attrs="{'invisible': ['|', ('encode_uom_in_days', '=', False), ('remaining_hours_so', '<', 0)]}"/>
<label class="fw-bold text-danger" for="remaining_hours_so" string="Remaining Hours on SO"
attrs="{'invisible': ['|', ('encode_uom_in_days', '=', True), ('remaining_hours_so', '>=', 0)]}"/>
<label class="fw-bold text-danger" for="remaining_hours_so" string="Remaining Days on SO"
attrs="{'invisible': ['|', ('encode_uom_in_days', '=', False), ('remaining_hours_so', '>=', 0)]}"/>
</span>
<field name="remaining_hours_so" nolabel="1" widget="timesheet_uom" attrs="{'invisible': ['|', '|', '|', '|', ('allow_billable', '=', False), ('sale_order_id', '=', False), ('partner_id', '=', False), ('sale_line_id', '=', False), ('remaining_hours_available', '=', False)]}" decoration-danger="remaining_hours_so < 0"></field>
</t>
</xpath>
</field>
</record>
<record id="view_task_form2_inherit_sale_timesheet" model="ir.ui.view">
<field name="name">view.task.form2.inherit</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="sale_project.view_sale_project_inherit_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='sale_line_id'][2]" position="attributes">
<attribute name="context">{'create': False, 'edit': False, 'delete': False, 'with_price_unit': True, 'with_remaining_hours': True}</attribute>
</xpath>
</field>
</record>
<record id="project_task_view_search_inherit_sale_timesheet" model="ir.ui.view">
<field name="name">project.task.view.search.inherit</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="hr_timesheet.project_task_view_search"/>
<field name="arch" type="xml">
<filter name="timesheet_exceeded" position="attributes">
<attribute name="domain">['|', ('overtime', '>', 0), ('remaining_hours_so', '<', 0)]</attribute>
</filter>
</field>
</record>
</odoo>