purchase_order_templates.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <template id="report_purchaseorder_document">
  4. <t t-call="web.external_layout">
  5. <t t-set="o" t-value="o.with_context(lang=o.partner_id.lang)"/>
  6. <t t-set="address">
  7. <div t-field="o.partner_id"
  8. t-options='{"widget": "contact", "fields": ["address", "name", "phone", "vat"], "no_marker": True, "phone_icons": True}'/>
  9. </t>
  10. <t t-if="o.dest_address_id">
  11. <t t-set="information_block">
  12. <strong>Shipping address:</strong>
  13. <div t-if="o.dest_address_id">
  14. <div t-field="o.dest_address_id"
  15. t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}' name="purchase_shipping_address"/>
  16. </div>
  17. </t>
  18. </t>
  19. <div class="page">
  20. <div class="oe_structure"/>
  21. <div class="mt-4">
  22. <h2 t-if="o.state in ['draft', 'sent', 'to approve']">Request for Quotation #<span t-field="o.name"/></h2>
  23. <h2 t-if="o.state in ['purchase', 'done']">Purchase Order #<span t-field="o.name"/></h2>
  24. <h2 t-if="o.state == 'cancel'">Cancelled Purchase Order #<span t-field="o.name"/></h2>
  25. </div>
  26. <div id="informations" class="row mt-4 mb32">
  27. <div t-if="o.user_id" class="col-3 bm-2">
  28. <strong>Purchase Representative:</strong>
  29. <p t-field="o.user_id" class="m-0"/>
  30. </div>
  31. <div t-if="o.partner_ref" class="col-3 bm-2">
  32. <strong>Your Order Reference:</strong>
  33. <p t-field="o.partner_ref" class="m-0"/>
  34. </div>
  35. <div t-if="o.state in ['purchase','done'] and o.date_approve" class="col-3 bm-2">
  36. <strong>Order Date:</strong>
  37. <p t-field="o.date_approve" class="m-0"/>
  38. </div>
  39. <div t-elif="o.date_order" class="col-3 bm-2">
  40. <strong >Order Deadline:</strong>
  41. <p t-field="o.date_order" class="m-0"/>
  42. </div>
  43. </div>
  44. <table class="table table-sm o_main_table table-borderless mt-4">
  45. <thead style="display: table-row-group">
  46. <tr>
  47. <th name="th_description"><strong>Description</strong></th>
  48. <th name="th_taxes"><strong>Taxes</strong></th>
  49. <th name="th_date_req" class="text-center"><strong>Date Req.</strong></th>
  50. <th name="th_quantity" class="text-end"><strong>Qty</strong></th>
  51. <th name="th_price_unit" class="text-end"><strong>Unit Price</strong></th>
  52. <th name="th_amount" class="text-end"><strong>Amount</strong></th>
  53. </tr>
  54. </thead>
  55. <tbody>
  56. <t t-set="current_subtotal" t-value="0"/>
  57. <t t-foreach="o.order_line" t-as="line">
  58. <t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
  59. <t t-set="current_subtotal" t-value="current_subtotal + line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
  60. <tr t-att-class="'bg-200 fw-bold o_line_section' if line.display_type == 'line_section' else 'fst-italic o_line_note' if line.display_type == 'line_note' else ''">
  61. <t t-if="not line.display_type">
  62. <td id="product">
  63. <span t-field="line.name"/>
  64. </td>
  65. <td name="td_taxes">
  66. <span t-esc="', '.join(map(lambda x: x.description or x.name, line.taxes_id))"/>
  67. </td>
  68. <td class="text-center">
  69. <span t-field="line.date_planned"/>
  70. </td>
  71. <td class="text-end">
  72. <span t-field="line.product_qty"/>
  73. <span t-field="line.product_uom.name" groups="uom.group_uom"/>
  74. </td>
  75. <td class="text-end">
  76. <span t-field="line.price_unit"/>
  77. </td>
  78. <td class="text-end">
  79. <span t-field="line.price_subtotal"
  80. t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
  81. </td>
  82. </t>
  83. <t t-if="line.display_type == 'line_section'">
  84. <td colspan="99" id="section">
  85. <span t-field="line.name"/>
  86. </td>
  87. <t t-set="current_section" t-value="line"/>
  88. <t t-set="current_subtotal" t-value="0"/>
  89. </t>
  90. <t t-if="line.display_type == 'line_note'">
  91. <td colspan="99" id="note">
  92. <span t-field="line.name"/>
  93. </td>
  94. </t>
  95. </tr>
  96. <t t-if="current_section and (line_last or o.order_line[line_index+1].display_type == 'line_section')">
  97. <tr class="is-subtotal text-end">
  98. <td colspan="99" id="subtotal">
  99. <strong class="mr16">Subtotal</strong>
  100. <span
  101. t-esc="current_subtotal"
  102. t-options='{"widget": "monetary", "display_currency": o.currency_id}'
  103. />
  104. </td>
  105. </tr>
  106. </t>
  107. </t>
  108. </tbody>
  109. </table>
  110. <div id="total" class="row justify-content-end">
  111. <div class="col-4">
  112. <table class="table table-sm table-borderless">
  113. <t t-set="tax_totals" t-value="o.tax_totals"/>
  114. <t t-call="account.document_tax_totals"/>
  115. </table>
  116. </div>
  117. </div>
  118. <p t-field="o.notes" class="mt-4"/>
  119. <div class="oe_structure"/>
  120. </div>
  121. </t>
  122. </template>
  123. <template id="report_purchaseorder">
  124. <t t-call="web.html_container">
  125. <t t-foreach="docs" t-as="o">
  126. <t t-call="purchase.report_purchaseorder_document" t-lang="o.partner_id.lang"/>
  127. </t>
  128. </t>
  129. </template>
  130. </odoo>