Debian Codegraph @

addons/sale_project/views/project_task_views.xml

raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <odoo>
3
4 <record id="project.action_view_task" model="ir.actions.act_window">
5 <field name="context">{'sale_show_partner_name': True, 'search_default_my_tasks': 1}</field>
6 </record>
7
8 <record id="project.action_view_my_task" model="ir.actions.act_window">
9 <field name="context">{'search_default_open_tasks': 1, 'my_tasks': 1, 'default_user_ids': [(4, uid)], 'sale_show_partner_name': True}</field>
10 </record>
11
12 <record id="project.action_view_all_task" model="ir.actions.act_window">
13 <field name="context">{'search_default_open_tasks': 1, 'default_user_ids': [(4, uid)], 'sale_show_partner_name': True}</field>
14 </record>
15
16 <record id="project.action_project_task_user_tree" model="ir.actions.act_window">
17 <field name="context">{'group_by': [], 'graph_measure': '__count__', 'sale_show_partner_name': True}</field>
18 </record>
19
20 <record id="project_project_view_inherit_project_filter" model="ir.ui.view">
21 <field name="name">project.project.select.inherit.project</field>
22 <field name="model">project.project</field>
23 <field name="inherit_id" ref="project.view_project_project_filter"/>
24 <field name="arch" type="xml">
25 <xpath expr="//field[@name='partner_id']" position="after">
26 <field name="sale_order_id" invisible="context.get('default_is_template')"/>
27 </xpath>
28 </field>
29 </record>
30
31 <record id="project_project_view_tree_inherit_sale_project" model="ir.ui.view">
32 <field name="name">project.project.list.inherit.sale.project</field>
33 <field name="model">project.project</field>
34 <field name="inherit_id" ref="project.view_project"/>
35 <field name="priority">50</field>
36 <field name="arch" type="xml">
37 <xpath expr="//field[@name='partner_id']" position="after">
38 <field name="sale_line_id" optional="hide" readonly="1"/>
39 <field name="allow_billable" column_invisible="True"/>
40 </xpath>
41 <xpath expr="//field[@name='partner_id']" position="attributes">
42 <attribute name="invisible">not allow_billable or is_template</attribute>
43 </xpath>
44 </field>
45 </record>
46
47 <record id="view_edit_project_inherit_form" model="ir.ui.view">
48 <field name="name">project.project.view.inherit</field>
49 <field name="model">project.project</field>
50 <field name="inherit_id" ref="project.edit_project"/>
51 <field name="arch" type="xml">
52 <div name="button_box" position="inside">
53 <field name="display_sales_stat_buttons" invisible="1"/>
54 <field name="allow_billable" invisible="1" />
55 <field name="privacy_visibility" invisible="1" />
56 <button class="oe_stat_button" type="object" name="action_customer_preview" icon="fa-globe icon" invisible="not partner_id or not allow_billable or privacy_visibility not in ['invited_users', 'portal'] or is_template">
57 <div class="o_field_widget o_stat_info">
58 <span class="o_stat_text">Preview</span>
59 </div>
60 </button>
61 <button
62 class="oe_stat_button"
63 type="object"
64 name="action_view_sos"
65 icon="fa-dollar"
66 invisible="not display_sales_stat_buttons or sale_order_count == 0 or is_template"
67 groups="sales_team.group_sale_salesman_all_leads"
68 context="{
69 'create_for_project_id': id,
70 'default_project_id': id,
71 'default_partner_id': partner_id
72 }">
73 <div class="o_field_widget o_stat_info">
74 <span class="o_stat_value">
75 <field name="sale_order_count" nolabel="1"/>
76 </span>
77 <span class="o_stat_text">
78 Sales Orders
79 </span>
80 </div>
81 </button>
82 <button
83 class="oe_stat_button"
84 type="object"
85 name="action_view_sos"
86 icon="fa-dollar"
87 invisible="not display_sales_stat_buttons or sale_order_count != 0 or is_template"
88 groups="sales_team.group_sale_salesman_all_leads"
89 context="{
90 'create_for_project_id': id,
91 'default_project_id': id,
92 'default_partner_id': partner_id
93 }">
94 <div class="o_field_widget o_stat_info">
95 <span class="o_stat_text">
96 <span class="o_stat_value">0</span> Sales Order
97 </span>
98 <span class="o_stat_text">
99 Make Billable
100 </span>
101 </div>
102 </button>
103 </div>
104 <xpath expr="//header" position="inside">
105 <field name="has_any_so_to_invoice" invisible="1"/>
106 <field name="has_any_so_with_nothing_to_invoice" invisible="1"/>
107 </xpath>
108 <xpath expr="//field[@name='partner_id']" position="attributes">
109 <attribute name="invisible">not allow_billable or is_template</attribute>
110 </xpath>
111 <xpath expr="//group[@name='group_time_managment']" position="before">
112 <group name="group_sales_invoicing" string="Sales &amp; Invoicing" col="1" class="row mt16 o_settings_container col-lg-6">
113 <div>
114 <setting class="col-lg-12" help="Invoice your time and material to customers" id="allow_billable_container">
115 <field name="allow_billable"/>
116 </setting>
117 </div>
118 </group>
119 </xpath>
120 <xpath expr="//page[@name='settings']//field[@name='privacy_visibility']" position="after">
121 <field name="reinvoiced_sale_order_id" invisible="not allow_billable or not partner_id or is_template" context="{'default_partner_id': partner_id}"/>
122 <label for="sale_line_id" invisible="not allow_billable or not partner_id or is_template"/>
123 <div
124 class="o_row"
125 invisible="not allow_billable or not partner_id or is_template">
126 <field name="sale_line_id"
127 groups="!sales_team.group_sale_salesman"
128 options="{'no_create': True, 'no_edit': True, 'delete': False, 'no_open': True}"/>
129 <field name="sale_line_id"
130 groups="sales_team.group_sale_salesman"
131 options="{'no_create': True}"
132 />
133 <span
134 class="fa fa-exclamation-triangle text-warning"
135 title="The sales order associated with this project has been cancelled. We recommend either updating the sales order item or cancelling this project in alignment with the cancellation of the sales order."
136 invisible="sale_order_state != 'cancel'"/>
137 </div>
138 <field name="sale_order_state" invisible="1"/>
139 </xpath>
140 </field>
141 </record>
142
143 <record id="view_sale_project_quick_create_task_form" model="ir.ui.view">
144 <field name="name">project.task.view.inherit</field>
145 <field name="model">project.task</field>
146 <field name="inherit_id" ref="project.quick_create_task_form"/>
147 <field name="arch" type="xml">
148 <xpath expr="//field[@name='project_id']" position="attributes">
149 <attribute name="context">{'default_allow_billable': True, 'default_type_ids': [(4, context.get('default_stage_id', False))]}
150 </attribute>
151 </xpath>
152 </field>
153 </record>
154
155 <record id="view_sale_project_inherit_form" model="ir.ui.view">
156 <field name="name">project.task.view.inherit</field>
157 <field name="model">project.task</field>
158 <field name="inherit_id" ref="project.view_task_form2"/>
159 <field name="priority">100</field>
160 <field name="arch" type="xml">
161 <xpath expr="//span[@id='start_rating_buttons']" position="before">
162 <button class="oe_stat_button"
163 type="object" name="action_view_so" icon="fa-dollar"
164 invisible="not sale_order_id or has_template_ancestor or has_project_template"
165 groups="sales_team.group_sale_salesman">
166 <div class="o_stat_info">
167 <span class="o_stat_text">Sales Order</span>
168 </div>
169 </button>
170 </xpath>
171 <xpath expr="//field[@name='milestone_id']" position="attributes">
172 <attribute name="context">{'default_project_id': project_id, 'default_sale_line_id': sale_line_id}</attribute>
173 </xpath>
174 <xpath expr="//field[@name='partner_id']" position="attributes">
175 <attribute name="invisible">not allow_billable or has_template_ancestor or has_project_template</attribute>
176 </xpath>
177 <xpath expr="//field[@name='partner_id']" position="after">
178 <field name="project_sale_order_id" invisible="1"/>
179 <field name="sale_order_id" invisible="True" groups="sales_team.group_sale_salesman"/>
180 <label for="sale_line_id" invisible="not allow_billable or not project_id or not partner_id or has_template_ancestor or has_project_template"/>
181 <div
182 name="sale_line_div"
183 class="o_row"
184 invisible="not allow_billable or not project_id or not partner_id or has_template_ancestor or has_project_template">
185 <field name="sale_line_id"
186 groups="!sales_team.group_sale_salesman"
187 string="Sales Order Item"
188 options='{"no_open": True}'
189 readonly="1"
190 invisible="not sale_line_id"/>
191 <field name="sale_line_id"
192 groups="sales_team.group_sale_salesman"
193 string="Sales Order Item"
194 options="{'no_create': True}"
195 readonly="0"
196 context="{
197 'so_form_view_ref': 'sale_project.view_order_simple_form',
198 'create_for_task_id': id,
199 'default_partner_id': partner_id,
200 'default_company_id': company_id,
201 'default_project_id': project_id,
202 'with_price_unit': True,
203 'dialog_size': 'large',
204 }"
205 widget="so_line_create_button"
206 placeholder="Non-billable"/>
207 <span
208 class="fa fa-exclamation-triangle text-warning"
209 title="The sales order associated with this task has been cancelled. We recommend either updating the sales order item or cancelling this task in alignment with the cancellation of the sales order."
210 invisible="sale_order_state != 'cancel'"/>
211 </div>
212 <field name="allow_billable" invisible="1"/>
213 <field name="sale_order_state" invisible="1"/>
214 </xpath>
215 <xpath expr="//field[@name='child_ids']/list/field[@name='partner_id']" position="after">
216 <field name="sale_line_id"
217 optional="hide"
218 options='{"no_create": True}'
219 context="{'create': False, 'edit': False, 'delete': False, 'with_price_unit': True}"
220 placeholder="Non-billable"
221 groups="sales_team.group_sale_salesman"
222 invisible="not allow_billable"
223 column_invisible="parent.has_template_ancestor or parent.has_project_template"/>
224 <field name="sale_line_id" optional="hide" options="{'no_open': True}" readonly="1" groups="!sales_team.group_sale_salesman" column_invisible="parent.has_template_ancestor or parent.has_project_template"/>
225 <field name="allow_billable" column_invisible="True"/>
226 </xpath>
227 <xpath expr="//field[@name='child_ids']/list/field[@name='partner_id']" position="attributes">
228 <attribute name="column_invisible">not parent.allow_billable</attribute>
229 <attribute name="invisible">not allow_billable</attribute>
230 </xpath>
231 <xpath expr="//field[@name='depend_on_ids']/list/field[@name='partner_id']" position="after">
232 <field name="sale_line_id" optional="hide" readonly="1" groups="sales_team.group_sale_salesman" column_invisible="parent.has_template_ancestor or parent.has_project_template"/>
233 <field name="sale_line_id" optional="hide" options="{'no_open': True}" readonly="1" groups="!sales_team.group_sale_salesman" column_invisible="parent.has_template_ancestor or parent.has_project_template"/>
234 <field name="allow_billable" column_invisible="True"/>
235 </xpath>
236 <xpath expr="//field[@name='depend_on_ids']/list/field[@name='partner_id']" position="attributes">
237 <attribute name="column_invisible">not parent.allow_billable</attribute>
238 <attribute name="invisible">not allow_billable</attribute>
239 </xpath>
240 <field name="project_id" position="attributes">
241 <attribute name="context">{'default_allow_billable': True}</attribute>
242 </field>
243 </field>
244 </record>
245
246 <record id="project_task_view_tree_main_base" model="ir.ui.view">
247 <field name="name">project.task.main.list.inherit</field>
248 <field name="model">project.task</field>
249 <field name="inherit_id" ref="project.project_task_view_tree_main_base"/>
250 <field name="arch" type="xml">
251 <field name="partner_id" position="after">
252 <field name="allow_billable" column_invisible="True"/>
253 </field>
254 <field name="partner_id" position="attributes">
255 <attribute name="column_invisible">context.get('hide_partner') or context.get('default_is_template')</attribute>
256 <attribute name="invisible">not allow_billable</attribute>
257 </field>
258 </field>
259 </record>
260
261 <record id="view_task_tree2_inherit_sale_project" model="ir.ui.view">
262 <field name="name">project.task.form.inherit.sale.project</field>
263 <field name="model">project.task</field>
264 <field name="inherit_id" ref="project.project_task_view_tree_base"/>
265 <field name="arch" type="xml">
266 <xpath expr="//field[@name='partner_id']" position="after">
267 <field name="sale_line_id" optional="hide" groups="sales_team.group_sale_salesman" options="{'no_create': True}" column_invisible="not context.get('allow_billable') or context.get('template_project')"/>
268 <field name="sale_line_id" optional="hide" options="{'no_open': True}" readonly="1" groups="!sales_team.group_sale_salesman" column_invisible="not context.get('allow_billable') or context.get('template_project')"/>
269 </xpath>
270 </field>
271 </record>
272
273 <record id="project_task_view_search" model="ir.ui.view">
274 <field name="name">project.task.search.inherit</field>
275 <field name="model">project.task</field>
276 <field name="inherit_id" ref="project.view_task_search_form_project_base"/>
277 <field name="arch" type="xml">
278 <field name="partner_id" position="after">
279 <field name="sale_order_id"
280 filter_domain="['|', ('sale_order_id', 'ilike', self), ('sale_line_id', 'ilike', self)]"
281 invisible="context.get('template_project')"/>
282 </field>
283 <field name="partner_id" position="attributes">
284 <attribute name="invisible">context.get('hide_partner') or context.get('template_project')</attribute>
285 </field>
286 <filter name="customer" position="attributes">
287 <attribute name="invisible">context.get('hide_partner') or context.get('template_project')</attribute>
288 </filter>
289 </field>
290 </record>
291
292 <record id="project_milestone_view_form" model="ir.ui.view">
293 <field name="name">project.milestone.view.form.inherit</field>
294 <field name="model">project.milestone</field>
295 <field name="inherit_id" ref="project.project_milestone_view_form"/>
296 <field name="arch" type="xml">
297 <xpath expr="//group[@name='main_details']" position="after">
298 <field name="allow_billable" invisible="1"/>
299 <group invisible="not allow_billable">
300 <field name="project_partner_id" invisible="1"/>
301 <field name="sale_line_id" groups="!sales_team.group_sale_salesman" placeholder="Non-billable" options="{'no_open': True}" readonly="1"/>
302 <field name="sale_line_id" groups="sales_team.group_sale_salesman" options="{'no_create': True}" placeholder="Non-billable" readonly="0"/>
303 <label for="quantity_percentage" invisible="not sale_line_id"/>
304 <div class="col-6" invisible="not sale_line_id">
305 <field name="quantity_percentage" groups="!sales_team.group_sale_salesman" widget="percentage" readonly="1" class="mw-25"/>
306 <field name="quantity_percentage" class="mw-25" groups="sales_team.group_sale_salesman"
307 widget="percentage" decoration-danger="quantity_percentage &lt; 0 or 1 &lt; quantity_percentage" readonly="0"/>
308 <span>
309 (<field name="product_uom_qty" class="mw-25" decoration-danger="quantity_percentage &lt; 0 or 1 &lt; quantity_percentage"/>
310 <field name="product_uom_id" class="w-auto text-end" groups="uom.group_uom" options="{'no_open': True}"/>
311 <span>)</span>
312 </span>
313 </div>
314 </group>
315 </xpath>
316 <xpath expr="//button[@name='%(project.action_view_task_from_milestone)d']" position="before">
317 <button name="action_view_sale_order" type="object" class="oe_stat_button" icon="fa-dollar" invisible="not sale_line_id">
318 <div class="o_stat_info">
319 <span class="o_stat_text">Sales Order</span>
320 </div>
321 </button>
322 </xpath>
323 </field>
324 </record>
325
326 <record id="project_milestone_view_tree" model="ir.ui.view">
327 <field name="name">project.milestone.view.list.inherit</field>
328 <field name="model">project.milestone</field>
329 <field name="inherit_id" ref="project.project_milestone_view_tree"/>
330 <field name="mode">primary</field>
331 <field name="arch" type="xml">
332 <xpath expr="//field[@name='name']" position="after">
333 <field name="project_partner_id" column_invisible="True"/>
334 <field name="allow_billable" column_invisible="True"/>
335 <field name="sale_line_id" options="{'no_open': True}" placeholder="Non-billable" readonly="1" groups="!sales_team.group_sale_salesman"/>
336 <field name="sale_line_id" options="{'no_create': True}" placeholder="Non-billable" groups="sales_team.group_sale_salesman"/>
337 <field name="quantity_percentage" string="Quantity (%)" widget="percentage" readonly="not sale_line_id" groups="!sales_team.group_sale_salesman"/>
338 <field name="quantity_percentage" string="Quantity (%)" widget="percentage" readonly="not sale_line_id" groups="sales_team.group_sale_salesman"/>
339 <field name="product_uom_qty" optional="hide" groups="!sales_team.group_sale_salesman" readonly="1"/>
340 <field name="product_uom_qty" optional="hide" groups="sales_team.group_sale_salesman"/>
341 </xpath>
342 <xpath expr="//button[@name='action_view_tasks']" position="after">
343 <button name="action_view_sale_order" type="object" string="View Sales Order"
344 class="btn btn-link float-end" invisible="not sale_line_id"/>
345 </xpath>
346 </field>
347 </record>
348
349 <!-- Views for 'Tasks' stat button via Contact form -->
350 <record id="view_task_form_res_partner" model="ir.ui.view">
351 <field name="name">project.task.form.res.partner.inherit.sale_project</field>
352 <field name="model">project.task</field>
353 <field name="inherit_id" ref="project.view_task_form_res_partner"/>
354 <field name="arch" type="xml">
355 <xpath expr="//group//field[@name='project_id']" position="attributes">
356 <attribute name="domain">['&amp;', ('allow_billable', '=', True), '&amp;',('active', '=', True), '|', ('company_id', '=', False), ('company_id', '=?', company_id)]</attribute>
357 </xpath>
358 </field>
359 </record>
360
361 <record id="quick_create_task_form_res_partner" model="ir.ui.view">
362 <field name="name">project.task.form.quick_create.res.partner.inherit.sale_project</field>
363 <field name="model">project.task</field>
364 <field name="inherit_id" ref="project.quick_create_task_form_res_partner"/>
365 <field name="arch" type="xml">
366 <xpath expr="//group//field[@name='project_id']" position="attributes">
367 <attribute name="domain">[('allow_billable', '=', True), ('type_ids', 'in', context['default_stage_id'])] if context.get('default_stage_id') else []</attribute>
368 </xpath>
369 </field>
370 </record>
371
372 <record id="project_milestone_view_kanban_inherit_sale_project" model="ir.ui.view">
373 <field name="name">project.milestone.view.kanban.inherit</field>
374 <field name="model">project.milestone</field>
375 <field name="inherit_id" ref="project.project_milestone_view_kanban"/>
376 <field name="arch" type="xml">
377 <field name="is_deadline_exceeded" position="after">
378 <field name="quantity_percentage"/>
379 </field>
380 <xpath expr="//field[@name='name']" position="after">
381 <t t-if="record.sale_line_display_name.raw_value and record.quantity_percentage.raw_value">
382 <field name="sale_line_display_name"/>(
383 <field name="quantity_percentage" widget="percentage" class="d-contents"/>)
384 </t>
385 </xpath>
386 </field>
387 </record>
388 </odoo>