[IMP] Solved xpath replace issues
This commit is contained in:
parent
e292f30258
commit
4933cf35a5
@ -121,10 +121,11 @@ class AccountInvoice(models.Model):
|
||||
values = self.get_maximum_per_amount()
|
||||
if self.discount < 0:
|
||||
raise Warning(_("Discount should be less than Gross Amount"))
|
||||
if self.discount > self.gross_amount:
|
||||
discount = self.discount or self.discount_amount
|
||||
if discount > self.gross_amount:
|
||||
raise Warning(_("Discount (%s) should be less than "
|
||||
"Gross Amount (%s).") % (
|
||||
formatLang(self.env, self.discount, digits=2),
|
||||
formatLang(self.env, discount, digits=2),
|
||||
formatLang(self.env, self.gross_amount, digits=2)))
|
||||
if self.discount > values.get('max_amount', False) \
|
||||
and values.get('check_group', False):
|
||||
|
@ -2,56 +2,57 @@
|
||||
<flectra>
|
||||
<template id="custom_invoice_report_layout" inherit_id="account.report_invoice_document">
|
||||
<xpath expr="//div/div[hasclass('clearfix')]" position="replace">
|
||||
<div id="total" class="row pull-right">
|
||||
<div>
|
||||
<table class="table-condensed" style="min-width: 250px;max-width: 400px;">
|
||||
<tr>
|
||||
<td><strong>Gross Amount</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-field="o.gross_amount" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Discount</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-field="o.discount" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-black">
|
||||
<td><strong>Subtotal</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-field="o.amount_untaxed" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
<t t-set="tax_groups_length" t-value="len(o._get_tax_amount_by_group())"/>
|
||||
<t t-foreach="o._get_tax_amount_by_group()" t-as="amount_by_group">
|
||||
<tr style="border-bottom:1px solid #dddddd;">
|
||||
<t t-if="len(o.tax_line_ids) == 1 and o.amount_untaxed == amount_by_group[2]">
|
||||
<td><span t-esc="amount_by_group[0]"/></td>
|
||||
<td class="text-right">
|
||||
<span t-esc="amount_by_group[1]" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
|
||||
</td>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<td>
|
||||
<span t-esc="amount_by_group[0]"/>
|
||||
<span>&nbsp;<span>on</span>
|
||||
<t t-esc="amount_by_group[2]" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
|
||||
</span>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<span t-esc="amount_by_group[1]" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
|
||||
</td>
|
||||
</t>
|
||||
<div class="clearfix">
|
||||
<div id="total" class="row">
|
||||
<div class="col-xs-4 pull-right">
|
||||
<table class="table table-condensed" style="min-width: 250px;max-width: 400px;">
|
||||
<tr>
|
||||
<td><strong>Gross Amount</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-field="o.gross_amount" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
</t>
|
||||
<tr class="border-black">
|
||||
<td><strong>Total</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-field="o.amount_total" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<tr>
|
||||
<td><strong>Discount</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-field="o.discount" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-black" style="border-bottom:1px solid #dddddd;">
|
||||
<td><strong>Subtotal</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-field="o.amount_untaxed" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
<t t-foreach="o._get_tax_amount_by_group()" t-as="amount_by_group">
|
||||
<tr style="border-bottom:1px solid #dddddd;">
|
||||
<t t-if="len(o.tax_line_ids) == 1 and o.amount_untaxed == amount_by_group[2]">
|
||||
<td><span t-esc="amount_by_group[0]"/></td>
|
||||
<td class="text-right">
|
||||
<span t-esc="amount_by_group[3]"/>
|
||||
</td>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<td>
|
||||
<span t-esc="amount_by_group[0]"/>
|
||||
<span>&nbsp;<span>on</span>
|
||||
<t t-esc="amount_by_group[4]"/>
|
||||
</span>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<span t-esc="amount_by_group[3]" />
|
||||
</td>
|
||||
</t>
|
||||
</tr>
|
||||
</t>
|
||||
<tr class="border-black">
|
||||
<td><strong>Total</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-field="o.amount_total" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
|
@ -2,9 +2,9 @@
|
||||
<flectra>
|
||||
<template id="custom_report_sale_layout" inherit_id="sale.report_saleorder_document">
|
||||
<xpath expr="//div[@name='total']" position="replace">
|
||||
<div class="row">
|
||||
<div class="row" name="total">
|
||||
<div class="col-xs-4 pull-right">
|
||||
<table class="table table-condensed">
|
||||
<table class="table table-condensed" style="min-width: 200px;max-width: 350px;">
|
||||
<tr>
|
||||
<td><strong>Gross Amount</strong></td>
|
||||
<td class="text-right">
|
||||
@ -17,7 +17,42 @@
|
||||
<span t-field="doc.discount" t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-black" style="border-bottom:1px solid #dddddd;">
|
||||
<td><strong>Subtotal</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-field="doc.amount_untaxed"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
<t t-foreach="doc._get_tax_amount_by_group()" t-as="amount_by_group">
|
||||
<tr style="border-bottom:1px solid #dddddd;">
|
||||
<t t-if="amount_by_group[3] == 1 and doc.amount_untaxed == amount_by_group[2]">
|
||||
<td><span t-esc="amount_by_group[0]"/></td>
|
||||
<td class="text-right">
|
||||
<span t-esc="amount_by_group[1]"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</t>
|
||||
<t t-else ="">
|
||||
<td>
|
||||
<span t-esc="amount_by_group[0]"/><span>&nbsp;<span>on</span>&nbsp;<t t-esc="amount_by_group[2]" t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/></span>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<span t-esc="amount_by_group[1]"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</t>
|
||||
</tr>
|
||||
</t>
|
||||
<tr class="border-black">
|
||||
<td><strong>Total</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-field="doc.amount_total"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- <tr class="border-black">
|
||||
<td><strong>Untaxed Amount</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-field="doc.amount_untaxed" t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
|
||||
@ -35,7 +70,7 @@
|
||||
<span t-esc="doc.amount_total or 0.0" t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
--> </table>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
|
Loading…
Reference in New Issue
Block a user