Advertisement
rht_odoo

[QW][3884410]purchase_info_on_sale_invoice

Apr 24th, 2024 (edited)
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.86 KB | None | 0 0
  1. <data>
  2.     <!--
  3.    # Done by RHT on the 22/04/2024
  4.    # Reviewed by EMI on the 24/04/2024
  5.    # Review: https://pastebin.com/cfnuAawB
  6.    # Task: https://www.odoo.com/web#id=3884410&cids=1&menu_id=4720&action=333&active_id=5686&model=project.task&view_type=form
  7.    # Need: Have the purchase price of the line and the total for accounting purposes: Accounting is done on external system and for 2nd hand business; vat is paid on profit so needs to know what this is foe each sales
  8.    -->
  9.     <xpath expr="//t[@t-foreach='lines']" position="before">
  10.         <!-- subtotal_purchase_sum will compute the sum of my sale and purchase subtotal in the loop -->
  11.         <t t-set="subtotal_purchase_sum" t-value="0"/>
  12.         <t t-set="subtotal_sale_sum" t-value="0"/>
  13.     </xpath>
  14.     <xpath expr="//th[@name='th_subtotal']" position="after">
  15.         <!-- add a header for the total purchase price -->
  16.         <th name="th_subtotal_purchase" class="text-end">
  17.             Total Achat
  18.         </th>
  19.     </xpath>
  20.     <xpath expr="//td[@name='td_subtotal']" position="after">
  21.          <!-- add a column for the total purchase price -->
  22.         <td name="td_subtotal_purchase" class="text-end o_price_total">
  23.             <t t-set="subtotal_purchase" t-value="line.quantity*line.x_studio_purchase_price"/>
  24.             <!-- subtotal_purchase_sum is increased by that amount and subtotal_sale_sum by the subtotal of the line-->
  25.             <t t-set="subtotal_purchase_sum" t-value="subtotal_purchase_sum + subtotal_purchase"/>
  26.             <t t-set="subtotal_sale_sum" t-value="subtotal_sale_sum + line.price_subtotal"/>
  27.             <span class="text-nowrap" t-esc="subtotal_purchase">27.00</span>
  28.         </td>    
  29.     </xpath>
  30.     <xpath expr="//div[@id='total']" position="before">
  31.         <!-- add the total purchase amount -->
  32.         <div>
  33.             <tr class="border-black o_subtotal">
  34.                 <td>
  35.                     <strong>Total Achat HTVA</strong>
  36.                 </td>
  37.                 <td class="text-end">
  38.                     <span t-att-class="oe_subtotal_footer_separator" t-esc="subtotal_purchase_sum" t-options="{'widget': 'monetary' , 'display_currency': o.currency_id, 'precision': 2}">27.00</span>
  39.                 </td>
  40.             </tr>
  41.         </div>
  42.          <!-- add the profit: sale amount - purchase amount -->
  43.         <div>
  44.             <tr class="border-black o_subtotal">
  45.                 <td>
  46.                     <strong>Profit HTVA</strong>
  47.                 </td>
  48.                 <td class="text-end">
  49.                     <t t-set="profit" t-value="subtotal_sale_sum-subtotal_purchase_sum"/>
  50.                     <span t-att-class="oe_subtotal_footer_separator" t-esc="profit" t-options="{'widget': 'monetary', 'display_currency': o.currency_id, 'precision': 2}">27.00</span>
  51.                 </td>
  52.             </tr>
  53.         </div>
  54.     </xpath>
  55. </data>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement