Files
enterprise-addons/project_account_budget/views/project_update_templates.xml
T

56 lines
3.0 KiB
XML

<?xml version="1.0"?>
<odoo>
<template id="project_update_default_description" inherit_id="project.project_update_default_description">
<xpath expr="//div[@name='milestone']" position="before">
<div name="budget" t-if="project.total_budget_amount and project.account_id and user.has_group('account.group_account_readonly')">
<br/>
<h3 class="fw-bolder mt-4"><u>Budget</u></h3>
<t t-if="budget.get('budget_type') == 'revenue'"><t t-out="budget['percentage']"/>% (<t t-out="format_monetary(budget['total']['spent'])"/>) of the <t t-out="format_monetary(project.total_budget_amount)"/> projected profit has been realized. <t t-out="budget['remaining_budget_percentage']"/>% (<t t-out="format_monetary(project.total_budget_amount - budget['total']['spent'])"/>) of the profit is still expected.</t>
<t t-else=""><t t-out="budget['percentage']"/>% (<t t-out="format_monetary(budget['total']['spent'])"/>) of the <t t-out="format_monetary(project.total_budget_amount)"/> budget has been spent. <t t-out="budget['remaining_budget_percentage']"/>% (<t t-out="format_monetary(project.total_budget_amount - abs(budget['total']['spent']))"/>) of the budget is remaining.</t>
<div t-if="budget['data']" name="budget_detail" class="mt-4">
<table class="table table-striped">
<thead class="border-2 border-start-0 border-end-0">
<tr>
<th class="fw-bolder">Accounts</th>
<th class="fw-bolder text-end">Allocated</th>
<th class="fw-bolder text-end">Spent</th>
<th class="fw-bolder text-end">Remaining</th>
</tr>
</thead>
<tbody>
<t t-foreach="budget['data']" t-as="budget_item">
<tr>
<td t-if="budget_item['name']" t-out="budget_item['name']"/><td t-else="">No Accounts</td>
<td class="text-end" t-out="format_monetary(budget_item['allocated'])"/>
<td class="text-end" t-out="format_monetary(budget_item['spent'])"/>
<td t-attf-class="#{ 'text-success' if budget_item['progress'] &gt; 0 else 'text-danger'}" style="text-align: right;">
<t t-out="format_monetary(budget_item['allocated'] - budget_item['spent'])"/>
</td>
</tr>
<t t-foreach="budget_item['budgets']" t-as="budget_data">
<tr>
<td><span class="ms-3"><small t-out="budget_data['name']"/></span></td>
<td class="text-end"><small t-out="format_monetary(budget_data['allocated'])"/></td>
<td class="text-end"><small t-out="format_monetary(budget_data['spent'])"/></td>
<td t-attf-class="#{ 'text-success' if budget_data['progress'] &gt; 0 else 'text-danger'}" style="text-align: right;">
<t><small t-out="format_monetary(budget_data['allocated'] - budget_data['spent'])"/></t>
</td>
</tr>
</t>
</t>
</tbody>
<tfoot>
<td class="fw-bolder text-end">Total</td>
<td class="fw-bolder text-end" t-out="format_monetary(budget['total']['allocated'])"/>
<td class="fw-bolder text-end" t-out="format_monetary(budget['total']['spent'])"/>
<td t-attf-class="#{ 'text-success' if budget['total']['progress'] &gt; 0 else 'text-danger'}" style="text-align: right; font-weight: bold;">
<t t-out="format_monetary(budget['total']['allocated'] - budget['total']['spent'])"/>
</td>
</tfoot>
</table>
</div>
</div>
</xpath>
</template>
</odoo>