Add symbol widget

issue9059
review276871002
This commit is contained in:
Cédric Krier
2020-10-09 19:09:05 +02:00
parent ec6c13c545
commit 2c1530e1b7
5 changed files with 20 additions and 13 deletions
+3 -3
View File
@@ -7,15 +7,15 @@ this repository contains the full copyright notices and license terms. -->
<label name="product"/>
<field name="product"/>
<label name="list_price"/>
<field name="list_price"/>
<field name="list_price" symbol="currency"/>
<newline/>
</xpath>
<xpath expr="/form/notebook/page[@id='general']/field[@name='total_effort']"
position="after">
<newline/>
<label name="cost"/>
<field name="cost"/>
<field name="cost" symbol="currency"/>
<label name="revenue"/>
<field name="revenue"/>
<field name="revenue" symbol="currency"/>
</xpath>
</data>
+3 -3
View File
@@ -4,8 +4,8 @@ this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/tree/field[@name='total_effort']" position="after">
<field name="product"/>
<field name="list_price"/>
<field name="revenue"/>
<field name="cost"/>
<field name="list_price" symbol="currency"/>
<field name="revenue" symbol="currency"/>
<field name="cost" symbol="currency"/>
</xpath>
</data>
+2 -2
View File
@@ -4,7 +4,7 @@ this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/tree/field[@name='total_effort']" position="after">
<field name="product"/>
<field name="list_price"/>
<field name="cost"/>
<field name="list_price" symbol="currency"/>
<field name="cost" symbol="currency"/>
</xpath>
</data>
+3 -3
View File
@@ -4,8 +4,8 @@ this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/tree/field[@name='total_effort']" position="after">
<field name="product"/>
<field name="list_price"/>
<field name="revenue"/>
<field name="cost"/>
<field name="list_price" symbol="currency"/>
<field name="revenue" symbol="currency"/>
<field name="cost" symbol="currency"/>
</xpath>
</data>
+9 -2
View File
@@ -28,6 +28,8 @@ class Work(metaclass=PoolMeta):
cost = fields.Function(fields.Numeric('Cost',
digits=(16, Eval('currency_digits', 2)),
depends=['currency_digits']), 'get_total')
currency = fields.Function(fields.Many2One('currency.currency',
'Currency'), 'on_change_with_currency')
currency_digits = fields.Function(fields.Integer('Currency Digits'),
'on_change_with_currency_digits')
@@ -165,9 +167,14 @@ class Work(metaclass=PoolMeta):
return revenues
@fields.depends('company')
def on_change_with_currency_digits(self, name=None):
def on_change_with_currency(self, name=None):
if self.company:
return self.company.currency.digits
return self.company.currency.id
@fields.depends('currency')
def on_change_with_currency_digits(self, name=None):
if self.currency:
return self.currency.digits
return 2
@staticmethod