diff options
| author | David Beal <david.beal@akretion.com> | 2014-09-16 11:56:16 +0200 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2015-07-09 17:15:30 +0200 |
| commit | d780f9476d43eb4fd25c852dd4e691002f4a6dcf (patch) | |
| tree | 6139c53621b06d06c0a595cbc6e5f2375a4a58e9 | |
| parent | f27acff15a7793ab238394d8f423e95cd020a7c3 (diff) | |
[FIX] res.currency: allow duplication
Currencies must be unique per company.
Therefore, without this revision, adding `(Copy)`
to the currency name on duplication, this
is simply not possible to duplicate a currency.
Closes #2443
| -rw-r--r-- | openerp/addons/base/res/res_currency.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/openerp/addons/base/res/res_currency.py b/openerp/addons/base/res/res_currency.py index f12102d3577..6119de2798f 100644 --- a/openerp/addons/base/res/res_currency.py +++ b/openerp/addons/base/res/res_currency.py @@ -134,6 +134,16 @@ class res_currency(osv.osv): reads = self.read(cr, uid, ids, ['name','symbol'], context=context, load='_classic_write') return [(x['id'], tools.ustr(x['name'])) for x in reads] + def copy(self, cr, uid, id, default=None, context=None): + if context is None: + context = {} + if not default: + default = {} + default.update(name=_("%s (copy)") + % (self.browse(cr, uid, id, context=context).name)) + return super(res_currency, self).copy( + cr, uid, id, default=default, context=context) + @api.v8 def round(self, amount): """ Return `amount` rounded according to currency `self`. """ |
