← Back to team overview

credativ team mailing list archive

[Merge] lp:~credativ/openobject-addons/elico-6.1-fixes-gap-analysis-duplicate into lp:~openerp-community/openobject-addons/elico-6.1

 

Tom Pickering has proposed merging lp:~credativ/openobject-addons/elico-6.1-fixes-gap-analysis-duplicate into lp:~openerp-community/openobject-addons/elico-6.1.

Requested reviews:
  OpenERP Community (openerp-community)

For more details, see:
https://code.launchpad.net/~credativ/openobject-addons/elico-6.1-fixes-gap-analysis-duplicate/+merge/218425

This branch enables users to duplicate Gap Analyses.
-- 
https://code.launchpad.net/~credativ/openobject-addons/elico-6.1-fixes-gap-analysis-duplicate/+merge/218425
Your team credativ is subscribed to branch lp:~credativ/openobject-addons/elico-6.1-fixes-gap-analysis-duplicate.
=== modified file 'gap_analysis/gap_analysis.py'
--- gap_analysis/gap_analysis.py	2013-06-22 02:18:01 +0000
+++ gap_analysis/gap_analysis.py	2014-05-06 13:37:19 +0000
@@ -293,8 +293,13 @@
         
     
     def copy(self, cr, uid, id, default=None, context=None):
-        raise osv.except_osv(_('Warning'), _("Copying a Gap Analysis is currently not allowed."))
-        return False
+        if default is None:
+            default = {}
+        if not default.get('reference', False):
+            default.update(reference=self.pool.get('ir.sequence').get(cr, uid, 'gap_analysis'))
+        if not default.get('name', False):
+            default.update(name=_('%s (copy)') % (self.browse(cr, uid, id, context=context).name))
+        return super(gap_analysis, self).copy(cr, uid, id, default, context)
     
     
     def onchange_project_id(self, cr, uid, ids, project_id):
@@ -475,4 +480,4 @@
     
 gap_analysis_line()
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: