Advertisement
rht_odoo

PDF Facture

Mar 29th, 2024 (edited)
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.18 KB | None | 0 0
  1. <data>
  2. <xpath expr="/t[@t-name='account.report_invoice_document']" position="replace" mode="inner">
  3. <t t-call="web.external_layout">
  4. <t t-set="o" t-value="o.with_context(lang=lang)"/>
  5. <t t-set="forced_vat" t-value="o.fiscal_position_id.foreign_vat"/>
  6. <div class="row">
  7. <t t-if="o.partner_shipping_id and (o.partner_shipping_id != o.partner_id)">
  8. <div class="col-6">
  9. <t t-set="information_block">
  10. <div groups="account.group_delivery_invoice_address" name="shipping_address_block">
  11. <strong>Shipping Address:</strong>
  12. <div t-field="o.partner_shipping_id" t-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;], &quot;no_marker&quot;: True}"/>
  13. </div>
  14. </t>
  15. </div>
  16. <div class="col-6" name="address_not_same_as_shipping">
  17. <t t-set="address">
  18. <address class="mb-0" t-field="o.partner_id" t-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;], &quot;no_marker&quot;: True}"/>
  19. <div t-if="o.partner_id.vat" id="partner_vat_address_not_same_as_shipping">
  20. <t t-if="o.company_id.account_fiscal_country_id.vat_label" t-out="o.company_id.account_fiscal_country_id.vat_label" id="inv_tax_id_label"/>
  21. <t t-else="">Tax ID</t>:
  22.  
  23.  
  24. <span t-field="o.partner_id.vat"/>
  25. </div>
  26. </t>
  27. </div>
  28. </t>
  29. <t t-elif="o.partner_shipping_id and (o.partner_shipping_id == o.partner_id)">
  30. <div class="offset-col-6 col-6" name="address_same_as_shipping">
  31. <t t-set="address">
  32. <address class="mb-0" t-field="o.partner_id" t-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;], &quot;no_marker&quot;: True}"/>
  33. <div t-if="o.partner_id.vat" id="partner_vat_address_same_as_shipping">
  34. <t t-if="o.company_id.account_fiscal_country_id.vat_label" t-out="o.company_id.account_fiscal_country_id.vat_label" id="inv_tax_id_label"/>
  35. <t t-else="">Tax ID</t>:
  36.  
  37.  
  38. <span t-field="o.partner_id.vat"/>
  39. </div>
  40. </t>
  41. </div>
  42. </t>
  43. <t t-else="">
  44. <div class="offset-col-6 col-6" name="no_shipping">
  45. <t t-set="address">
  46. <address class="mb-0" t-field="o.partner_id" t-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;], &quot;no_marker&quot;: True}"/>
  47. <div t-if="o.partner_id.vat" id="partner_vat_no_shipping">
  48. <t t-if="o.company_id.account_fiscal_country_id.vat_label" t-out="o.company_id.account_fiscal_country_id.vat_label" id="inv_tax_id_label"/>
  49. <t t-else="">Tax ID</t>:
  50.  
  51.  
  52. <span t-field="o.partner_id.vat"/>
  53. </div>
  54. </t>
  55. </div>
  56. </t>
  57. </div>
  58. <div class="mt-5 clearfix">
  59. <div class="page mb-4">
  60. <h2>
  61. <span t-if="not proforma"/>
  62. <span t-else="">PROFORMA</span>
  63. <span t-if="o.move_type == 'out_invoice' and o.state == 'posted'">Invoice</span>
  64. <span t-elif="o.move_type == 'out_invoice' and o.state == 'draft'">Draft Invoice</span>
  65. <span t-elif="o.move_type == 'out_invoice' and o.state == 'cancel'">Cancelled Invoice</span>
  66. <span t-elif="o.move_type == 'out_refund' and o.state == 'posted'">Credit Note</span>
  67. <span t-elif="o.move_type == 'out_refund' and o.state == 'draft'">Draft Credit Note</span>
  68. <span t-elif="o.move_type == 'out_refund' and o.state == 'cancel'">Cancelled Credit Note</span>
  69. <span t-elif="o.move_type == 'in_refund'">Vendor Credit Note</span>
  70. <span t-elif="o.move_type == 'in_invoice'">Vendor Bill</span>
  71. <span t-if="o.name != '/'" t-field="o.name">INV/2023/0001</span>
  72. </h2>
  73. <div class="oe_structure"/>
  74. <div id="informations" class="row mt-3 mb-1">
  75. <div t-attf-class="#{'col-auto col-3 mw-100' if report_type != 'html' else 'col'} mb-2" t-if="o.invoice_date" name="invoice_date">
  76. <t t-if="o.move_type == 'out_invoice'">
  77. <strong>Invoice Date:</strong>
  78. </t>
  79. <t t-elif="o.move_type == 'out_refund'">
  80. <strong>Credit Note Date:</strong>
  81. </t>
  82. <t t-elif="o.move_type == 'out_receipt'">
  83. <strong>Receipt Date:</strong>
  84. </t>
  85. <t t-else="">
  86. <strong>Date:</strong>
  87. </t>
  88. <br/>
  89. <span t-field="o.invoice_date">2023-09-12</span>
  90. </div>
  91. <div t-attf-class="#{'col-auto col-3 mw-100' if report_type != 'html' else 'col'} mb-2" t-if="o.invoice_date_due and o.move_type == 'out_invoice' and o.state == 'posted'" name="due_date">
  92. <strong>Due Date:</strong>
  93. <br/>
  94. <span t-field="o.invoice_date_due">2023-10-31</span>
  95. </div>
  96. <div t-attf-class="#{'col-auto col-3 mw-100' if report_type != 'html' else 'col'} mb-2" t-if="o.delivery_date" name="delivery_date">
  97. <strong>Delivery Date:</strong>
  98. <br/>
  99. <span t-field="o.delivery_date">2023-09-25</span>
  100. </div>
  101. <div t-attf-class="#{'col-auto col-3 mw-100' if report_type != 'html' else 'col'} mb-2" t-if="o.partner_id.ref" name="customer_code">
  102. <strong>Customer Code:</strong>
  103. <br/>
  104. <span t-field="o.partner_id.ref"/>
  105. </div>
  106. <div t-attf-class="#{'col-auto col-3 mw-100' if report_type != 'html' else 'col'} mb-2" t-if="o.ref" name="reference">
  107. <strong>Reference:</strong>
  108. <br/>
  109. <span t-field="o.ref">INV/2023/00001</span>
  110. </div>
  111. <div t-attf-class="#{'col-auto col-3 mw-100' if report_type != 'html' else 'col'} mb-2" t-if="o.invoice_incoterm_id" name="incoterm_id">
  112. <strong>Incoterm:</strong>
  113. <br/>
  114. <p t-if="o.incoterm_location">
  115. <span t-field="o.invoice_incoterm_id.code"/>
  116. <br/>
  117. <span t-field="o.incoterm_location"/>
  118. </p>
  119. <span t-else="" t-field="o.invoice_incoterm_id.code" class="m-0"/>
  120. </div>
  121. </div>
  122. <t t-set="display_discount" t-value="any(l.discount for l in o.invoice_line_ids)"/>
  123. <div class="oe_structure"/>
  124. <table class="table table-sm o_main_table table-borderless" name="invoice_line_table">
  125. <thead>
  126. <tr>
  127. <th name="th_source" class="text-start">Source</th>
  128. <th name="th_description" class="text-start">Description</th>
  129. <th name="th_delivery_address" t-if="x_studio_show_delivery_address" class="text-start">Adresse de livraison</th>
  130. <th name="th_patient" class="text-start">Patient</th>
  131. <th name="th_delivery_date" class="text-start">Date de sortie</th>
  132. <th name="th_quantity" class="text-end">Quantity</th>
  133. <th name="th_priceunit" t-attf-class="text-end {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">Unit Price</th>
  134. <th name="th_discount" t-if="display_discount" t-attf-class="text-end {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
  135. Disc.%
  136. </th>
  137. <th name="th_taxes" t-attf-class="text-start {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">Taxes</th>
  138. <th name="th_subtotal" class="text-end">
  139. Tax excl.
  140. </th>
  141. </tr>
  142. </thead>
  143. <tbody class="invoice_tbody">
  144. <t t-set="current_subtotal" t-value="0"/>
  145. <t t-set="current_total" t-value="0"/>
  146. <t t-set="lines" t-value="o.invoice_line_ids.sorted(key=lambda l: (-l.sequence, l.date, l.move_name, -l.id), reverse=True)"/>
  147. <t t-foreach="lines" t-as="line">
  148. <t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal"/>
  149. <t t-set="current_total" t-value="current_total + line.price_total"/>
  150. <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 ''">
  151. <t t-if="line.display_type == 'product'" name="account_invoice_line_accountable">
  152. <td name="td_source">
  153. <span t-field="line.sale_line_ids.order_id.name"/>
  154. </td>
  155. <td name="account_invoice_line_name">
  156. <span t-field="line.name" t-options="{'widget': 'text'}">Bacon Burger</span>
  157. </td>
  158. <td name="td_delivery_address" t-if="x_studio_show_delivery_address">
  159. <span t-field="line.x_studio_so_delivery_partner_id"/>
  160. </td>
  161. <td name="td_patient">
  162. <span t-field="line.x_studio_patient_5"/>
  163. </td>
  164. <td name="td_delivery_date">
  165. <span t-field="line.x_studio_date_de_sortie" t-options="{&quot;widget&quot;: &quot;date&quot;}"/>
  166. </td>
  167. <td name="td_quantity" class="text-end">
  168. <span t-field="line.quantity">3.00</span>
  169. <span t-field="line.product_uom_id" groups="uom.group_uom">units</span>
  170. </td>
  171. <td name="td_price_unit" t-attf-class="text-end {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
  172. <span class="text-nowrap" t-field="line.price_unit">9.00</span>
  173. </td>
  174. <td name="td_discount" t-if="display_discount" t-attf-class="text-end {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
  175. <span class="text-nowrap" t-field="line.discount">0</span>
  176. </td>
  177. <td name="td_taxes" t-attf-class="text-start {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
  178. <span t-out="', '.join(map(lambda x: (x.invoice_label or x.name), line.tax_ids))" id="line_tax_ids">Tax 15%</span>
  179. </td>
  180. <td name="td_subtotal" class="text-end o_price_total">
  181. <span class="text-nowrap" t-field="line.price_subtotal">27.00</span>
  182. </td>
  183. </t>
  184. <t t-elif="line.display_type == 'line_section'">
  185. <td colspan="99">
  186. <span t-field="line.name" t-options="{'widget': 'text'}">A section title</span>
  187. </td>
  188. <t t-set="current_section" t-value="line"/>
  189. <t t-set="current_subtotal" t-value="0"/>
  190. </t>
  191. <t t-elif="line.display_type == 'line_note'">
  192. <td colspan="99">
  193. <span t-field="line.name" t-options="{'widget': 'text'}">A note, whose content usually applies to the section or product above.</span>
  194. </td>
  195. </t>
  196. </tr>
  197. <t t-if="current_section and (line_last or lines[line_index+1].display_type == 'line_section')">
  198. <tr class="is-subtotal text-end">
  199. <td colspan="99">
  200. <strong class="mr16">Subtotal</strong>
  201. <span t-out="current_subtotal" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: o.currency_id}">31.05</span>
  202. </td>
  203. </tr>
  204. </t>
  205. </t>
  206. </tbody>
  207. </table>
  208. <div>
  209. <div id="right-elements" t-attf-class="#{'col-5' if report_type != 'html' else 'col-12 col-md-5'} ms-5 d-inline-block float-end">
  210. <div id="total" class="clearfix row">
  211. <div class="ms-auto">
  212. <table class="table table-sm table-borderless avoid-page-break-inside">
  213. <t t-set="tax_totals" t-value="o.tax_totals"/>
  214. <t t-call="account.document_tax_totals"/>
  215. <t t-if="print_with_payments">
  216. <t t-if="o.payment_state != 'invoicing_legacy'">
  217. <t t-set="payments_vals" t-value="o.sudo().invoice_payments_widget and o.sudo().invoice_payments_widget['content'] or []"/>
  218. <t t-foreach="payments_vals" t-as="payment_vals">
  219. <tr t-if="payment_vals['is_exchange'] == 0">
  220. <td>
  221. <i class="oe_form_field text-end oe_payment_label">Paid on
  222.  
  223.  
  224. <t t-out="payment_vals['date']" t-options="{&quot;widget&quot;: &quot;date&quot;}">2021-09-19</t>
  225. </i>
  226. </td>
  227. <td class="text-end">
  228. <span t-out="payment_vals['amount']" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: o.currency_id}">20.00</span>
  229. </td>
  230. </tr>
  231. </t>
  232. <t t-if="len(payments_vals) &gt; 0">
  233. <tr class="border-black">
  234. <td>
  235. <strong>Amount Due</strong>
  236. </td>
  237. <td class="text-end">
  238. <span t-field="o.amount_residual">11.05</span>
  239. </td>
  240. </tr>
  241. </t>
  242. </t>
  243. </t>
  244. </table>
  245. </div>
  246. </div>
  247. <div class="mb-2">
  248. <p class="text-end lh-sm" t-if="o.company_id.display_invoice_amount_total_words">
  249. Total amount in words:
  250.  
  251.  
  252. <br/>
  253. <small class="text-muted lh-sm">
  254. <span t-field="o.amount_total_words">Thirty one dollar and Five cents</span>
  255. </small>
  256. </p>
  257. </div>
  258. <t t-call="account.document_tax_totals_company_currency_template"/>
  259. </div>
  260. <p>
  261. <span t-field="o.company_id.x_studio_html_field_4o9_1hquaj3ji">Factoring</span>
  262. <br/>
  263. </p>
  264. <div id="payment_term" class="clearfix">
  265. <div class="justify-text">
  266. <p t-if="not is_html_empty(o.fiscal_position_id.note)" name="note" class="mb-2">
  267. <br/>
  268. <span t-field="o.fiscal_position_id.note"/>
  269. </p>
  270. </div>
  271. <t t-set="payment_term_details" t-value="o.payment_term_details"/>
  272. <div class="mb-3">
  273. <span id="payment_terms_note_id" t-field="o.invoice_payment_term_id.note" name="payment_term">Payment within 30 calendar days</span>
  274. <br/>
  275. <t t-if="o.invoice_payment_term_id.display_on_invoice and payment_term_details">
  276. <div t-if="o.show_payment_term_details" id="total_payment_term_details_table" class="row">
  277. <div t-attf-class="#{'col-10' if report_type != 'html' else 'col-sm-10 col-md-9'}">
  278. <t t-if="o._is_eligible_for_early_payment_discount(o.currency_id,o.invoice_date)">
  279. <span t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: o.currency_id}" t-out="o.invoice_payment_term_id._get_amount_due_after_discount(o.amount_total, o.amount_tax)">30.00</span> due if paid before
  280.  
  281.  
  282.  
  283. <span t-out="o.invoice_payment_term_id._get_last_discount_date_formatted(o.invoice_date)">2024-01-01</span>
  284. </t>
  285. <t t-if="len(payment_term_details) &gt; 1" t-foreach="payment_term_details" t-as="term">
  286. <div>
  287. <span t-out="term_index + 1">1</span> - Installment of
  288.  
  289.  
  290.  
  291. <t t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: o.currency_id}" t-out="term.get('amount')" class="text-end">31.05</t>
  292. due on
  293.  
  294.  
  295.  
  296. <t t-out="term.get('date')" class="text-start">2024-01-01</t>
  297. </div>
  298. </t>
  299. </div>
  300. </div>
  301. </t>
  302. </div>
  303. <div class="mb-3" t-if="o.move_type in ('out_invoice', 'in_refund') and o.payment_reference">
  304. <p name="payment_communication">
  305. Payment Communication:
  306.  
  307.  
  308. <span class="fw-bold" t-field="o.payment_reference">INV/2023/00001</span>
  309. </p>
  310. </div>
  311. <t t-set="show_qr" t-value="o.display_qr_code and o.amount_residual &gt; 0"/>
  312. <div t-if="not show_qr" name="qr_code_placeholder" class="oe_structure"/>
  313. <div id="qrcode" class="d-flex mb-3 avoid-page-break-inside" t-else="">
  314. <div class="qrcode me-3" id="qrcode_image">
  315. <t t-set="qr_code_url" t-value="o._generate_qr_code(silent_errors=True)"/>
  316. <p t-if="qr_code_url" class="position-relative mb-0">
  317. <img t-att-src="qr_code_url"/>
  318. <img src="/account/static/src/img/Odoo_logo_O.svg" id="qrcode_odoo_logo" class="top-50 start-50 position-absolute bg-white border border-white border-3 rounded-circle"/>
  319. </p>
  320. </div>
  321. <div class="d-inline text-muted lh-sm fst-italic" id="qrcode_info" t-if="qr_code_url">
  322. <p>Scan this QR Code to
  323.  
  324.  
  325. <br/>pay with your mobile
  326.  
  327.  
  328. </p>
  329. </div>
  330. </div>
  331. <div class="text-muted mb-3" t-attf-style="#{'text-align:justify;text-justify:inter-word;' if o.company_id.terms_type != 'html' else ''}" t-if="not is_html_empty(o.narration)" name="comment">
  332. <span t-field="o.narration"/>
  333. </div>
  334. </div>
  335. </div>
  336. </div>
  337. </div>
  338. </t>
  339. </xpath>
  340. </data>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement