Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <data>
- <!--
- # Done by RHT on the 22/04/2024
- # Reviewed by EMI on the 24/04/2024
- # Review: https://pastebin.com/cfnuAawB
- # Task: https://www.odoo.com/web#id=3884410&cids=1&menu_id=4720&action=333&active_id=5686&model=project.task&view_type=form
- # 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
- -->
- <xpath expr="//t[@t-foreach='lines']" position="before">
- <!-- subtotal_purchase_sum will compute the sum of my sale and purchase subtotal in the loop -->
- <t t-set="subtotal_purchase_sum" t-value="0"/>
- <t t-set="subtotal_sale_sum" t-value="0"/>
- </xpath>
- <xpath expr="//th[@name='th_subtotal']" position="after">
- <!-- add a header for the total purchase price -->
- <th name="th_subtotal_purchase" class="text-end">
- Total Achat
- </th>
- </xpath>
- <xpath expr="//td[@name='td_subtotal']" position="after">
- <!-- add a column for the total purchase price -->
- <td name="td_subtotal_purchase" class="text-end o_price_total">
- <t t-set="subtotal_purchase" t-value="line.quantity*line.x_studio_purchase_price"/>
- <!-- subtotal_purchase_sum is increased by that amount and subtotal_sale_sum by the subtotal of the line-->
- <t t-set="subtotal_purchase_sum" t-value="subtotal_purchase_sum + subtotal_purchase"/>
- <t t-set="subtotal_sale_sum" t-value="subtotal_sale_sum + line.price_subtotal"/>
- <span class="text-nowrap" t-esc="subtotal_purchase">27.00</span>
- </td>
- </xpath>
- <xpath expr="//div[@id='total']" position="before">
- <!-- add the total purchase amount -->
- <div>
- <tr class="border-black o_subtotal">
- <td>
- <strong>Total Achat HTVA</strong>
- </td>
- <td class="text-end">
- <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>
- </td>
- </tr>
- </div>
- <!-- add the profit: sale amount - purchase amount -->
- <div>
- <tr class="border-black o_subtotal">
- <td>
- <strong>Profit HTVA</strong>
- </td>
- <td class="text-end">
- <t t-set="profit" t-value="subtotal_sale_sum-subtotal_purchase_sum"/>
- <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>
- </td>
- </tr>
- </div>
- </xpath>
- </data>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement