diff --git a/complaint.py b/complaint.py
index a0aa611670..e876028b8c 100644
--- a/complaint.py
+++ b/complaint.py
@@ -12,6 +12,7 @@ from trytond.pyson import Eval, If, Bool
from trytond.pool import Pool
from trytond.transaction import Transaction
+from trytond.modules.currency.fields import Monetary
from trytond.modules.product import price_digits
@@ -400,19 +401,17 @@ class Action(ModelSQL, ModelView):
'on_change_with_unit')
unit_digits = fields.Function(
fields.Integer('Unit Digits'), 'on_change_with_unit_digits')
- unit_price = fields.Numeric('Unit Price', digits=price_digits,
+ unit_price = Monetary(
+ "Unit Price", currency='currency', digits=price_digits,
states=_line_states, depends=_line_depends,
help='Leave empty for the same price.')
- amount = fields.Function(fields.Numeric(
- "Amount", digits=(16, Eval('currency_digits', 2)),
- depends=['currency_digits']),
+ amount = fields.Function(Monetary(
+ "Amount", 'currency', digits='currency'),
'on_change_with_amount')
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')
result = fields.Reference('Result', selection='get_result', readonly=True)
@@ -488,16 +487,6 @@ class Action(ModelSQL, ModelView):
'account.invoice', 'account.invoice.line'}):
return self.complaint.origin.currency.id
- @fields.depends(
- 'complaint',
- '_parent_complaint.origin_model', '_parent_complaint.origin')
- def on_change_with_currency_digits(self, name=None):
- if (self.complaint
- and self.complaint.origin_model in {
- 'sale.sale', 'sale.line',
- 'account.invoice', 'account.invoice.line'}):
- return self.complaint.origin.currency.digits
-
@classmethod
def get_complaint_states(cls):
pool = Pool()
@@ -658,19 +647,17 @@ class _Action_Line:
fields.Many2One('product.uom', "Unit"), 'on_change_with_unit')
unit_digits = fields.Function(
fields.Integer("Unit Digits"), 'on_change_with_unit_digits')
- unit_price = fields.Numeric(
- "Unit Price", digits=price_digits, states=_states, depends=_depends,
+ unit_price = Monetary(
+ "Unit Price", currency='currency', digits=price_digits,
+ states=_states, depends=_depends,
help='Leave empty for the same price.')
- amount = fields.Function(fields.Numeric(
- "Amount", digits=(16, Eval('currency_digits', 2)),
- depends=['currency_digits']),
+ amount = fields.Function(Monetary(
+ "Amount", currency='currency', digits='currency'),
'on_change_with_amount')
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')
complaint_state = fields.Function(
fields.Selection('get_complaint_states', "Complaint State"),
@@ -710,11 +697,6 @@ class _Action_Line:
if self.action and self.action.currency:
return self.action.currency.id
- @fields.depends('action', '_parent_action.currency')
- def on_change_with_currency_digits(self, name=None):
- if self.action and self.action.currency:
- return self.action.currency.digits
-
@classmethod
def get_complaint_states(cls):
pool = Pool()
diff --git a/view/action_form.xml b/view/action_form.xml
index d22504cb61..774f2c479a 100644
--- a/view/action_form.xml
+++ b/view/action_form.xml
@@ -17,7 +17,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
-
+
diff --git a/view/action_line_form.xml b/view/action_line_form.xml
index 91ac13ab43..e3179c3cd4 100644
--- a/view/action_line_form.xml
+++ b/view/action_line_form.xml
@@ -11,6 +11,6 @@ this repository contains the full copyright notices and license terms. -->
-
-
+
+
diff --git a/view/action_line_list.xml b/view/action_line_list.xml
index 8ab6709149..e3eba3775d 100644
--- a/view/action_line_list.xml
+++ b/view/action_line_list.xml
@@ -5,6 +5,6 @@ this repository contains the full copyright notices and license terms. -->
-
-
+
+
diff --git a/view/action_list.xml b/view/action_list.xml
index 8d40cf1f7d..32628f7a87 100644
--- a/view/action_list.xml
+++ b/view/action_list.xml
@@ -4,6 +4,6 @@ this repository contains the full copyright notices and license terms. -->
-
+