From d780f9476d43eb4fd25c852dd4e691002f4a6dcf Mon Sep 17 00:00:00 2001 From: David Beal Date: Tue, 16 Sep 2014 11:56:16 +0200 Subject: [PATCH] [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 --- openerp/addons/base/res/res_currency.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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`. """