project_task_views.xml 13 KB

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