Add methods to format number and symbol on Lang

and add format number with symbol on Report

issue10730
review371831002
This commit is contained in:
Maxime Richez
2021-10-04 18:52:01 +02:00
parent e7a3e6ae57
commit 5ba75a8dfe
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -706,7 +706,7 @@
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.D5" office:value-type="string">
<text:p text:style-name="P10"><text:placeholder text:placeholder-type="text">&lt;(format_number(line.quantity, invoice.party.lang, digits=line.unit.digits if line.unit else None) + (line.unit and (&apos; &apos; + line.unit.symbol) or &apos;&apos;)) or &apos;&apos;&gt;</text:placeholder></text:p>
<text:p text:style-name="P10"><text:placeholder text:placeholder-type="text">&lt;format_number_symbol(line.quantity, invoice.party.lang, line.unit, digits=line.unit.digits) if line.unit else format_number(line.quantity, invoice.party.lang)&gt;</text:placeholder></text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.D5" office:value-type="string">
<text:p text:style-name="P11"><text:placeholder text:placeholder-type="text">&lt;format_currency(line.unit_price, invoice.party.lang, invoice.currency, digits=line.__class__.unit_price.digits[1])&gt;</text:placeholder></text:p>
+3 -3
View File
@@ -2302,9 +2302,9 @@ class InvoiceLine(sequence_ordered(), ModelSQL, ModelView, TaxableMixin):
Lang = pool.get('ir.lang')
if self.product:
lang = Lang.get()
prefix = (lang.format(
'%.*f', (self.unit.digits, self.quantity or 0))
+ '%s %s' % (self.unit.symbol, self.product.rec_name))
prefix = (lang.format_number_symbol(
self.quantity or 0, self.unit, digits=self.unit.digits)
+ ' %s' % self.product.rec_name)
elif self.account:
prefix = self.account.rec_name
else: