diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-02-23 19:40:03 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-02-23 19:40:03 +0100 |
| commit | 387b2acfcbfd5d4525ef8453e0c1999753246576 (patch) | |
| tree | e4ebf82d0bfba7591f65c469ef693a5080603257 /odoo/fields.py | |
| parent | 773a631a77cff77758dbd58ba5730c53e7020e7b (diff) | |
| parent | 1730dca101616135dfdc0073520e92506b52a0b0 (diff) | |
[MERGE] forward port branch saas-11 up to 1730dca1016
Diffstat (limited to 'odoo/fields.py')
| -rw-r--r-- | odoo/fields.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/odoo/fields.py b/odoo/fields.py index 9f6e03e8495..c004b640cd2 100644 --- a/odoo/fields.py +++ b/odoo/fields.py @@ -1219,13 +1219,14 @@ class Monetary(Field): _description_currency_field = property(attrgetter('currency_field')) _description_group_operator = property(attrgetter('group_operator')) - def _setup_regular_base(self, model): - super(Monetary, self)._setup_regular_base(model) - if not self.currency_field: - self.currency_field = 'currency_id' - def _setup_regular_full(self, model): super(Monetary, self)._setup_regular_full(model) + if not self.currency_field: + # pick a default, trying in order: 'currency_id', 'x_currency_id' + if 'currency_id' in model._fields: + self.currency_field = 'currency_id' + elif 'x_currency_id' in model._fields: + self.currency_field = 'x_currency_id' assert self.currency_field in model._fields, \ "Field %s with unknown currency_field %r" % (self, self.currency_field) |
