project_sharing_views.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <record id="project_sharing_inherit_project_task_view_form" model="ir.ui.view">
  4. <field name="name">project.sharing.project.task.view.form.inherit</field>
  5. <field name="model">project.task</field>
  6. <field name="inherit_id" ref="project.project_sharing_project_task_view_form"/>
  7. <field name="arch" type="xml">
  8. <xpath expr="//field[@name='child_ids']/tree/field[@name='portal_user_names']" position="after">
  9. <field name="planned_hours" widget="timesheet_uom_no_toggle" sum="Initially Planned Hours" optional="hide"/>
  10. <field name="effective_hours" widget="timesheet_uom" sum="Effective Hours" optional="hide"/>
  11. <field name="subtask_effective_hours" string="Sub-tasks Hours Spent" widget="timesheet_uom" sum="Sub-tasks Hours Spent" optional="hide"/>
  12. <field name="total_hours_spent" string="Total Hours" widget="timesheet_uom" sum="Total Hours" optional="hide"/>
  13. <field name="remaining_hours" widget="timesheet_uom" sum="Remaining Hours" optional="hide" decoration-danger="progress &gt;= 100" decoration-warning="progress &gt;= 80 and progress &lt; 100"/>
  14. <field name="progress" widget="progressbar" optional="hide"/>
  15. </xpath>
  16. <xpath expr="//notebook/page[@name='description_page']" position="after">
  17. <field name="analytic_account_active" invisible="1"/>
  18. <field name="allow_timesheets" invisible="1"/>
  19. <field name="encode_uom_in_days" invisible="1"/>
  20. <field name="subtask_count" invisible="1"/>
  21. <page string="Timesheets" id="timesheets_tab" attrs="{'invisible': [('allow_timesheets', '=', False)]}">
  22. <group>
  23. <group>
  24. <div colspan="2">
  25. <label for="planned_hours" string="Allocated Hours" class="me-2" attrs="{'invisible': [('encode_uom_in_days', '=', True)]}"/>
  26. <label for="planned_hours" string="Allocated Days" class="me-2" attrs="{'invisible': [('encode_uom_in_days', '=', False)]}"/>
  27. <field name="planned_hours" class="o_field_float_time oe_inline ms-2" widget="timesheet_uom_no_toggle"/>
  28. <span attrs="{'invisible': ['|', ('allow_subtasks', '=', False), ('subtask_count', '=', 0)]}">
  29. (incl. <field name="subtask_planned_hours" nolabel="1" groups="project.group_subtask_project" widget="timesheet_uom_no_toggle" class="oe_inline"/> on
  30. <span class="fw-bold text-dark"> Sub-tasks</span>)
  31. </span>
  32. </div>
  33. </group>
  34. <group>
  35. <field name="progress" widget="progressbar"/>
  36. </group>
  37. </group>
  38. <field name="timesheet_ids" mode="tree,kanban"
  39. attrs="{'invisible': [('analytic_account_active', '=', False)]}">
  40. <tree string="Timesheet Activities" default_order="date" no_open="1" create="false" delete="0">
  41. <field name="date"/>
  42. <field name="employee_id"/>
  43. <field name="name"/>
  44. <field name="unit_amount" widget="timesheet_uom" decoration-danger="unit_amount &gt; 24"/>
  45. </tree>
  46. <kanban class="o_kanban_mobile">
  47. <field name="date"/>
  48. <field name="employee_id"/>
  49. <field name="name"/>
  50. <field name="unit_amount" decoration-danger="unit_amount &gt; 24"/>
  51. <field name="project_id"/>
  52. <templates>
  53. <t t-name="kanban-box">
  54. <div t-attf-class="oe_kanban_card oe_kanban_global_click">
  55. <div class="row">
  56. <div class="col-6">
  57. <strong><span><t t-esc="record.employee_id.value"/></span></strong>
  58. </div>
  59. <div class="col-6 float-end text-end">
  60. <strong><t t-esc="record.date.value"/></strong>
  61. </div>
  62. </div>
  63. <div class="row">
  64. <div class="col-6 text-muted">
  65. <span><t t-esc="record.name.value"/></span>
  66. </div>
  67. <div class="col-6">
  68. <span class="float-end text-end">
  69. <field name="unit_amount" widget="float_time"/>
  70. </span>
  71. </div>
  72. </div>
  73. </div>
  74. </t>
  75. </templates>
  76. </kanban>
  77. </field>
  78. <group attrs="{'invisible': [('analytic_account_active', '=', False)]}">
  79. <group class="oe_subtotal_footer oe_right" name="project_hours">
  80. <span class="o_td_label float-start">
  81. <label class="fw-bold" for="effective_hours" string="Hours Spent" attrs="{'invisible': [('encode_uom_in_days', '=', True)]}"/>
  82. <label class="fw-bold" for="effective_hours" string="Days Spent" attrs="{'invisible': [('encode_uom_in_days', '=', False)]}"/>
  83. </span>
  84. <field name="effective_hours" widget="timesheet_uom" nolabel="1"/>
  85. <!-- remove o_form_subtask_button class from master-->
  86. <button name="action_view_subtask_timesheet" type="object" class="o_form_subtask_button ps-0 border-0 oe_inline oe_link mb-2 o_td_label float-start" attrs="{'invisible' : ['|', ('allow_subtasks', '=', False), ('subtask_effective_hours', '=', 0.0)]}">
  87. <span class="text-nowrap" attrs="{'invisible' : [('encode_uom_in_days', '=', True)]}">Hours Spent on Sub-tasks:</span>
  88. <span class="text-nowrap" attrs="{'invisible' : [('encode_uom_in_days', '=', False)]}">Days Spent on Sub-tasks:</span>
  89. </button>
  90. <field name="subtask_effective_hours" class="mt-2" widget="timesheet_uom"
  91. attrs="{'invisible' : ['|', ('allow_subtasks', '=', False), ('subtask_effective_hours', '=', 0.0)]}" nolabel="1"/>
  92. <span id="total_hours_spent_label" attrs="{'invisible': ['|', ('allow_subtasks', '=', False), ('subtask_effective_hours', '=', 0.0)]}" class="o_td_label float-start">
  93. <label class="fw-bold" for="total_hours_spent" string="Total Hours"
  94. attrs="{'invisible': [('encode_uom_in_days', '=', True)]}"/>
  95. <label class="fw-bold" for="total_hours_spent" string="Total Days"
  96. attrs="{'invisible': [('encode_uom_in_days', '=', False)]}"/>
  97. </span>
  98. <field name="total_hours_spent" widget="timesheet_uom" class="oe_subtotal_footer_separator" nolabel="1"
  99. attrs="{'invisible' : ['|', ('allow_subtasks', '=', False), ('subtask_effective_hours', '=', 0.0)]}" />
  100. <span class="o_td_label float-start">
  101. <label class="fw-bold" for="remaining_hours" string="Remaining Hours"
  102. attrs="{'invisible': ['|', '|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', True), ('remaining_hours', '&lt;', 0)]}"/>
  103. <label class="fw-bold" for="remaining_hours" string="Remaining Days"
  104. attrs="{'invisible': ['|', '|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', False), ('remaining_hours', '&lt;', 0)]}"/>
  105. <label class="fw-bold text-danger" for="remaining_hours" string="Remaining Hours"
  106. attrs="{'invisible': ['|', '|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', True), ('remaining_hours', '&gt;=', 0)]}"/>
  107. <label class="fw-bold text-danger" for="remaining_hours" string="Remaining Days"
  108. attrs="{'invisible': ['|', '|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', False), ('remaining_hours', '&gt;=', 0)]}"/>
  109. </span>
  110. <field name="remaining_hours" widget="timesheet_uom" class="oe_subtotal_footer_separator"
  111. attrs="{'invisible' : [('planned_hours', '=', 0.0)]}" nolabel="1"/>
  112. </group>
  113. </group>
  114. </page>
  115. </xpath>
  116. </field>
  117. </record>
  118. <record id="project_sharing_kanban_inherit_project_task_view_kanban" model="ir.ui.view">
  119. <field name="name">project.sharing.project.task.timesheet.kanban.inherited</field>
  120. <field name="model">project.task</field>
  121. <field name="inherit_id" ref="project.project_sharing_project_task_view_kanban"/>
  122. <field name="arch" type="xml">
  123. <templates position="before">
  124. <field name="progress" />
  125. <field name="remaining_hours" />
  126. <field name="planned_hours" />
  127. <field name="allow_timesheets"/>
  128. <field name="encode_uom_in_days" invisible="1"/>
  129. </templates>
  130. <div class="oe_kanban_bottom_left" position="inside">
  131. <t name="planned_hours" t-if="record.planned_hours.raw_value &gt; 0 and record.allow_timesheets.raw_value">
  132. <t t-set="badge" t-value="'border border-success'"/>
  133. <t t-set="badge" t-value="'border border-warning'" t-if="record.progress.raw_value &gt;= 80 and record.progress.raw_value &lt;= 100"/>
  134. <t t-set="badge" t-value="'border border-danger'" t-if="record.remaining_hours.raw_value &lt; 0"/>
  135. <t t-set="title" t-value="'Remaining days'" t-if="record.encode_uom_in_days.raw_value"/>
  136. <t t-set="title" t-value="'Remaining hours'" t-else=""/>
  137. <div t-attf-class="oe_kanban_align badge {{ badge }}" t-att-title="title">
  138. <field name="remaining_hours" widget="timesheet_uom" />
  139. </div>
  140. </t>
  141. </div>
  142. </field>
  143. </record>
  144. <record id="project_sharing_inherit_project_task_view_tree" model="ir.ui.view">
  145. <field name="name">project.task.tree.inherited</field>
  146. <field name="model">project.task</field>
  147. <field name="inherit_id" ref="project.project_sharing_project_task_view_tree" />
  148. <field name="arch" type="xml">
  149. <field name="portal_user_names" position="after">
  150. <field name="allow_subtasks" invisible="1"/>
  151. <field name="allow_timesheets" invisible="1"/>
  152. <field name="planned_hours" widget="timesheet_uom_no_toggle" sum="Initially Planned Hours" optional="hide" attrs="{'column_invisible': [('allow_timesheets', '=', False)]}"/>
  153. <field name="effective_hours" widget="timesheet_uom" sum="Effective Hours" optional="hide" attrs="{'column_invisible': [('allow_timesheets', '=', False)]}"/>
  154. <field name="subtask_effective_hours" widget="timesheet_uom" attrs="{'column_invisible' : ['|', ('allow_subtasks', '=', False), ('allow_timesheets', '=', False)]}" optional="hide"/>
  155. <field name="total_hours_spent" widget="timesheet_uom" attrs="{'column_invisible' : ['|', ('allow_subtasks', '=', False), ('allow_timesheets', '=', False)]}" optional="hide"/>
  156. <field name="remaining_hours" widget="timesheet_uom" sum="Remaining Hours" optional="hide" decoration-danger="progress &gt;= 100" decoration-warning="progress &gt;= 80 and progress &lt; 100" attrs="{'column_invisible': [('allow_timesheets', '=', False)]}"/>
  157. <field name="progress" widget="progressbar" attrs="{'column_invisible': [('allow_timesheets', '=', False)]}" optional="hide"/>
  158. </field>
  159. </field>
  160. </record>
  161. <record id="project_sharing_project_task_view_search_inherit_timesheet" model="ir.ui.view">
  162. <field name="name">project.sharing.project.task.view.search.inherit.timesheet</field>
  163. <field name="model">project.task</field>
  164. <field name="inherit_id" ref="project.project_sharing_project_task_view_search"/>
  165. <field name="arch" type="xml">
  166. <xpath expr="//filter[@name='late']" position='after'>
  167. <filter string="Tasks in Overtime" name="overtime" domain="[('overtime', '&gt;', 0)]"/>
  168. <filter string="Tasks Soon in Overtime" name="remaining_hours_percentage" domain="[('remaining_hours_percentage', '&lt;=', 0.2)]"/>
  169. </xpath>
  170. </field>
  171. </record>
  172. </odoo>