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 e7c102c314
commit 7796b2f634
2 changed files with 4 additions and 6 deletions
+1 -1
View File
@@ -674,7 +674,7 @@
<text:p text:style-name="P24"><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="P12"><text:placeholder text:placeholder-type="text">&lt;(format_number(line.quantity, purchase.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="P12"><text:placeholder text:placeholder-type="text">&lt;format_number_symbol(line.quantity, purchase.party.lang, line.unit, digits=line.unit.digits) if line.unit else format_number(line.quantity, purchase.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="P13"><text:placeholder text:placeholder-type="text">&lt;format_currency(line.unit_price, purchase.party.lang, purchase.currency, digits=line.__class__.unit_price.digits[1])&gt;</text:placeholder></text:p>
+3 -5
View File
@@ -1698,11 +1698,9 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
Lang = pool.get('ir.lang')
if self.product:
lang = Lang.get()
return (lang.format(
'%.*f', (self.unit.digits, self.quantity or 0))
+ '%s %s @ %s' % (
self.unit.symbol, self.product.rec_name,
self.purchase.rec_name))
return (lang.format_number_symbol(
self.quantity or 0, self.unit, digits=self.unit.digits)
+ ' %s @ %s' % (self.product.rec_name, self.purchase.rec_name))
else:
return self.purchase.rec_name