sale_timesheet_portal_templates.xml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <template id="sale_order_portal_content_inherit" inherit_id="sale.sale_order_portal_template">
  4. <xpath expr="//li[.//a[@id='print_invoice_report']]" position="after">
  5. <li t-if="sale_order.timesheet_count > 0 and sale_order.state in ('sale', 'done')" class="list-group-item flex-grow-1">
  6. <div class="btn-toolbar flex-sm-nowrap justify-content-center">
  7. <div class="btn-group">
  8. <a t-att-href="'/my/timesheets?search_in=so&amp;search=%s' % sale_order.name">View Timesheets</a>
  9. </div>
  10. </div>
  11. </li>
  12. </xpath>
  13. </template>
  14. <template id="portal_my_timesheets_inherit" inherit_id="hr_timesheet.portal_my_timesheets">
  15. <xpath expr="//t[@t-foreach='grouped_timesheets']/tbody/tr[hasclass('table-light')]" position="inside">
  16. <t t-elif="groupby == 'sol'">
  17. <t t-set="sol" t-value="timesheets[0].so_line"/>
  18. <th colspan="5">
  19. <t t-if="sol">
  20. <span t-field="sol.display_name"/>
  21. <t t-if="sol.remaining_hours_available">
  22. <span class="text-muted fw-normal">
  23. <t t-if="is_uom_day">
  24. (<span t-esc="timesheets._convert_hours_to_days(sol.product_uom_qty)" t-options='{"widget": "timesheet_uom"}'></span> Days Ordered, <span t-esc="timesheets._convert_hours_to_days(sol.remaining_hours)" t-options='{"widget": "timesheet_uom"}'></span> Days Remaining)
  25. </t>
  26. <t t-else="">
  27. (<span t-field="sol.product_uom_qty" t-options='{"widget": "float_time"}'></span> <span t-field="sol.product_uom.display_name"></span> Ordered, <span t-field="sol.remaining_hours" t-options='{"widget": "float_time"}'></span> <span t-field="sol.product_uom.display_name"></span> Remaining)
  28. </t>
  29. </span>
  30. </t>
  31. </t>
  32. <t t-else="">
  33. No Sales Order Item
  34. </t>
  35. </th>
  36. <th colspan="1" class="text-end text-muted fw-normal">
  37. <t t-if="is_uom_day">
  38. Total: <span t-esc="timesheets._convert_hours_to_days(hours_spent)" t-options='{"widget": "timesheet_uom"}'/>
  39. </t>
  40. <t t-else="">
  41. Total: <span t-esc="hours_spent" t-options='{"widget": "float_time"}'/>
  42. </t>
  43. </th>
  44. </t>
  45. <t t-elif="groupby == 'so'">
  46. <t t-set="so" t-value="timesheets[0].order_id"/>
  47. <th colspan="6">
  48. <t t-if="so">
  49. <span t-field="so.display_name"/>
  50. </t>
  51. <t t-else="">
  52. No Sales Order
  53. </t>
  54. </th>
  55. <th colspan="1" class="text-end text-muted">
  56. <t t-if="is_uom_day">
  57. Total: <span t-esc="timesheets._convert_hours_to_days(hours_spent)" t-options='{"widget": "timesheet_uom"}'/>
  58. </t>
  59. <t t-else="">
  60. Total: <span t-esc="hours_spent" t-options='{"widget": "float_time"}'/>
  61. </t>
  62. </th>
  63. </t>
  64. <t t-elif="groupby == 'invoice'">
  65. <t t-set="invoice" t-value="timesheets.timesheet_invoice_id"/>
  66. <th colspan="6">
  67. <t t-if="invoice">
  68. <span t-field="invoice.display_name"/>
  69. </t>
  70. <t t-else="">
  71. No Invoice
  72. </t>
  73. </th>
  74. <th colspan="1" class="text-end text-muted">
  75. <t t-if="is_uom_day">
  76. Total: <span t-esc="timesheets._convert_hours_to_days(hours_spent)" t-options='{"widget": "timesheet_uom"}'/>
  77. </t>
  78. <t t-else="">
  79. Total: <span t-esc="hours_spent" t-options='{"widget": "float_time"}'/>
  80. </t>
  81. </th>
  82. </t>
  83. </xpath>
  84. <xpath expr="//thead/tr/th[@t-if='is_uom_day']" position="before">
  85. <th t-if="not groupby == 'sol'">Sales Order Item</th>
  86. </xpath>
  87. <xpath expr="//tbody//td[hasclass('text-end')]" position="before">
  88. <td t-if="not groupby == 'sol'"><span t-field="timesheet.so_line" t-att-title="timesheet.so_line.display_name"></span></td>
  89. </xpath>
  90. </template>
  91. <template id="portal_invoice_page_inherit" inherit_id="account.portal_invoice_page">
  92. <xpath expr="//t[@t-set='entries']/ul/li[.//a[@id='print_invoice_report']]" position="after">
  93. <li class="list-group-item flex-grow-1">
  94. <div class="btn-toolbar flex-sm-nowrap justify-content-center">
  95. <div class="btn-group mb-1">
  96. <a t-if="invoice.move_type == 'out_invoice' and invoice.state in ('draft', 'posted') and invoice.timesheet_count > 0"
  97. target="_blank" t-att-href="'/my/timesheets?search_in=invoice&amp;search=%s' % invoice.name">View Timesheets</a>
  98. </div>
  99. </div>
  100. </li>
  101. </xpath>
  102. </template>
  103. <template id="portal_my_task_inherit" inherit_id="project.portal_my_task">
  104. <xpath expr="//div[@name='portal_my_task_second_column']" position="inside">
  105. <t t-if="task.project_id.allow_billable">
  106. <div t-if="task.sale_order_id"><strong>Sales Order:</strong>
  107. <span t-if="so_accessible"><a t-attf-href="/my/orders/{{ task.sale_order_id.id }}" t-field="task.sale_order_id"></a></span>
  108. <span t-else="" t-field="task.sale_order_id"></span>
  109. </div>
  110. <div t-if="invoices_accessible"><strong>Invoices:</strong>
  111. <span t-foreach="task.sale_order_id.invoice_ids" t-as="invoice_line">
  112. <t t-if="invoice_line.id in invoices_accessible">
  113. <a t-attf-href="/my/invoices/{{ invoice_line.id }}">
  114. <i t-if="invoice_line.state == 'draft'">Draft Invoice</i>
  115. <t t-else="" t-esc="invoice_line.name"/></a>
  116. <span t-if="not invoice_line_last">,</span>
  117. </t>
  118. <t t-else=""><span t-esc="invoice_line.name"></span><span t-if="not invoice_line_last">,</span></t>
  119. </span>
  120. </div>
  121. <div t-if="task.sale_line_id.untaxed_amount_invoiced > 0"><strong>Invoiced:</strong>
  122. <span t-field="task.sale_line_id.untaxed_amount_invoiced"/>
  123. </div>
  124. <div t-if="task.sale_line_id.untaxed_amount_to_invoice > 0"><strong>To invoice:</strong>
  125. <span t-field="task.sale_line_id.untaxed_amount_to_invoice"/>
  126. </div>
  127. </t>
  128. </xpath>
  129. </template>
  130. <template id="portal_timesheet_table_inherit" inherit_id="hr_timesheet.portal_timesheet_table">
  131. <xpath expr="//div[@name='planned_time']" position="after">
  132. <span t-if="task.allow_billable and task.sale_line_id and task.sale_line_id.remaining_hours_available" t-attf-class="{{task.remaining_hours_so &lt; 0 and 'text-danger' or ''}}">
  133. <div t-if="is_uom_day">Remaining Days on SO: <span t-esc="timesheets._convert_hours_to_days(task.remaining_hours_so)" t-options='{"widget": "timesheet_uom"}'/></div>
  134. <div t-else="">Remaining Hours on SO: <span t-esc="task.remaining_hours_so" t-options='{"widget": "float_time"}'/></div>
  135. </span>
  136. </xpath>
  137. </template>
  138. </odoo>