diff --git a/statement.py b/statement.py
index 10980db4b6..19b11f8ff0 100644
--- a/statement.py
+++ b/statement.py
@@ -86,6 +86,8 @@ class Statement(Workflow, ModelSQL, ModelView):
'readonly': (Eval('state') != 'draft') | Eval('lines', [0]),
},
depends=['state', 'company'])
+ 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')
date = fields.Date('Date', required=True, select=True)
@@ -236,6 +238,11 @@ class Statement(Workflow, ModelSQL, ModelView):
statement, = statements
self.start_balance = statement.end_balance
+ @fields.depends('journal')
+ def on_change_with_currency(self, name=None):
+ if self.journal:
+ return self.journal.currency.id
+
@fields.depends('journal')
def on_change_with_currency_digits(self, name=None):
if self.journal:
@@ -667,9 +674,12 @@ def origin_mixin(_states, _depends):
"Date", required=True, states=_states, depends=_depends)
amount = fields.Numeric(
"Amount", required=True,
- digits=(16, Eval('_parent_statement', {})
- .get('currency_digits', 2)),
- states=_states, depends=_depends)
+ digits=(16, Eval('currency_digits', 2)),
+ states=_states, depends=_depends + ['currency_digits'])
+ 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')
party = fields.Many2One(
'party.party', "Party", states=_states, depends=_depends)
account = fields.Many2One(
@@ -706,6 +716,16 @@ def origin_mixin(_states, _depends):
def search_company(cls, name, clause):
return [('statement.' + clause[0],) + tuple(clause[1:])]
+ @fields.depends('statement', '_parent_statement.journal')
+ def on_change_with_currency(self, name=None):
+ if self.statement and self.statement.journal:
+ return self.statement.journal.currency.id
+
+ @fields.depends('statement', '_parent_statement.journal')
+ def on_change_with_currency_digits(self, name=None):
+ if self.statement and self.statement.journal:
+ return self.statement.journal.currency.digits
+
return Mixin
diff --git a/view/statement_form.xml b/view/statement_form.xml
index 7df721474b..86f7d19f52 100644
--- a/view/statement_form.xml
+++ b/view/statement_form.xml
@@ -10,14 +10,14 @@ this repository contains the full copyright notices and license terms. -->
-
+
-
+
-
+
-
+
diff --git a/view/statement_line_form.xml b/view/statement_line_form.xml
index e5ad083c83..a9f4938bf3 100644
--- a/view/statement_line_form.xml
+++ b/view/statement_line_form.xml
@@ -11,7 +11,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
diff --git a/view/statement_line_tree.xml b/view/statement_line_tree.xml
index 94df7207ca..7aea585b81 100644
--- a/view/statement_line_tree.xml
+++ b/view/statement_line_tree.xml
@@ -5,7 +5,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
diff --git a/view/statement_line_tree_editable.xml b/view/statement_line_tree_editable.xml
index 93abb22c4f..e5a329980a 100644
--- a/view/statement_line_tree_editable.xml
+++ b/view/statement_line_tree_editable.xml
@@ -5,7 +5,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
diff --git a/view/statement_origin_form.xml b/view/statement_origin_form.xml
index 538487109b..64e0783a76 100644
--- a/view/statement_origin_form.xml
+++ b/view/statement_origin_form.xml
@@ -11,9 +11,9 @@ this repository contains the full copyright notices and license terms. -->
-
+
-
+
diff --git a/view/statement_origin_tree.xml b/view/statement_origin_tree.xml
index 4f53a009ae..d4be2f540c 100644
--- a/view/statement_origin_tree.xml
+++ b/view/statement_origin_tree.xml
@@ -5,8 +5,8 @@ this repository contains the full copyright notices and license terms. -->
-
-
+
+