[CLEAN] product: cleaned product template copy method improvements
bzr revid: tde@openerp.com-20140121122139-j4jmr3jfbaoaamyj
This commit is contained in:
parent
b3fa81982b
commit
14bdf21b17
|
@ -473,11 +473,9 @@ class product_template(osv.osv):
|
||||||
def copy(self, cr, uid, id, default=None, context=None):
|
def copy(self, cr, uid, id, default=None, context=None):
|
||||||
if default is None:
|
if default is None:
|
||||||
default = {}
|
default = {}
|
||||||
#TOFIX: it should be pass default={'name': _("%s (copy)") % (template['name'])}.
|
template = self.browse(cr, uid, id, context=context)
|
||||||
template = self.read(cr, uid, id, ['name'], context=context)
|
default['name'] = _("%s (copy)") % (template['name'])
|
||||||
res = super(product_template, self).copy(cr, uid, id, default=default, context=context)
|
return super(product_template, self).copy(cr, uid, id, default=default, context=context)
|
||||||
self.write(cr, uid, res, {'name': _("%s (copy)") % (template['name'])}, context=context)
|
|
||||||
return res
|
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'product.template', context=c),
|
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'product.template', context=c),
|
||||||
|
|
Loading…
Reference in New Issue