diff --git a/sale.py b/sale.py
index dbb2754426..ac92d2e069 100644
--- a/sale.py
+++ b/sale.py
@@ -14,6 +14,7 @@ from trytond.sendmail import sendmail_transactional
from trytond.transaction import Transaction
from trytond.modules.company.model import CompanyValueMixin
+from trytond.modules.currency.fields import Monetary
class Configuration(metaclass=PoolMeta):
@@ -73,9 +74,9 @@ class GiftCard(ModelSQL, ModelView):
'company': Eval('company', -1),
},
states=_states, depends=_depends + ['company'])
- value = fields.Numeric(
- "Value", digits=(16, Eval('currency_digits', 2)), required=True,
- states=_states, depends=_depends + ['currency_digits'])
+ value = Monetary(
+ "Value", currency='currency', digits='currency', required=True,
+ states=_states, depends=_depends)
currency = fields.Many2One(
'currency.currency', "Currency", required=True,
states=_states, depends=_depends)
@@ -85,9 +86,6 @@ class GiftCard(ModelSQL, ModelView):
spent_on = fields.Reference(
"Spent On", selection='get_spent_on', select=True, readonly=True)
- currency_digits = fields.Function(
- fields.Integer("Currency Digits"), 'on_change_with_currency_digits')
-
del _states
del _depends
@@ -107,11 +105,6 @@ class GiftCard(ModelSQL, ModelView):
def default_company(cls):
return Transaction().context.get('company')
- @fields.depends('currency')
- def on_change_with_currency_digits(self, name=None):
- if self.currency:
- return self.currency.digits
-
@classmethod
def _get_origin(cls):
return ['sale.line', 'stock.move']
diff --git a/tryton.cfg b/tryton.cfg
index 7e5a9cb88c..bb38b72b2f 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -4,6 +4,7 @@ depends:
account
account_invoice
company
+ currency
ir
product
sale
diff --git a/view/gift_card_form.xml b/view/gift_card_form.xml
index 6c78b78118..1e74242b2f 100644
--- a/view/gift_card_form.xml
+++ b/view/gift_card_form.xml
@@ -12,7 +12,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
diff --git a/view/gift_card_list.xml b/view/gift_card_list.xml
index 87bd2fd5fe..c1a444f3f8 100644
--- a/view/gift_card_list.xml
+++ b/view/gift_card_list.xml
@@ -5,6 +5,5 @@ this repository contains the full copyright notices and license terms. -->
-