[FIX]: crm*: Fixed problem of duplicating cases with history and date open/close
authorrpa (Open ERP) <rpa@tinyerp.com>
Tue, 17 Aug 2010 12:54:00 +0000 (18:24 +0530)
committerrpa (Open ERP) <rpa@tinyerp.com>
Tue, 17 Aug 2010 12:54:00 +0000 (18:24 +0530)
lp bug: https://launchpad.net/bugs/615257 fixed

bzr revid: rpa@tinyerp.com-20100817125400-je0u3im8x945cxig

addons/crm/crm.py
addons/crm/crm_lead.py
addons/crm/crm_meeting.py
addons/crm/crm_phonecall.py
addons/crm_claim/crm_claim.py
addons/crm_fundraising/crm_fundraising.py
addons/crm_helpdesk/crm_helpdesk.py
addons/hr_recruitment/hr_recruitment.py
addons/project_issue/project_issue.py

index ee182bd..12edce6 100644 (file)
@@ -73,6 +73,35 @@ class crm_case(object):
             return False
         return user.address_id.partner_id.id
 
+    def copy(self, cr, uid, id, default=None, context=None):
+        """
+        Overrides orm copy method.
+        @param self: the object pointer
+        @param cr: the current row, from the database cursor,
+        @param uid: the current user’s ID for security checks,
+        @param id: Id of mailgate thread
+        @param default: Dictionary of default values for copy.
+        @param context: A standard dictionary for contextual values
+        """
+        if context is None:
+            context = {}
+        if default is None:
+            default = {}
+
+        default.update({
+                    'message_ids': [], 
+                })
+        if hasattr(self, '_columns'):
+            if self._columns.get('date_closed'):
+                default.update({
+                    'date_closed': False, 
+                })
+            if self._columns.get('date_open'):
+                default.update({
+                    'date_open': False
+                })
+        return super(osv.osv, self).copy(cr, uid, id, default, context=context)
+    
     def _get_default_email(self, cr, uid, context):
         """Gives default email address for current user
         @param self: The object pointer
index 6702e86..763e96b 100644 (file)
@@ -36,7 +36,7 @@ CRM_LEAD_PENDING_STATES = (
     crm.AVAILABLE_STATES[4][0], # Pending
 )
 
-class crm_lead(osv.osv, crm_case):
+class crm_lead(crm_case, osv.osv):
     """ CRM Lead Case """
     _name = "crm.lead"
     _description = "Lead"
index 798f746..d8acbff 100644 (file)
@@ -26,18 +26,18 @@ from osv import fields, osv
 from tools.translate import _
 import time
 
-class crm_lead(osv.osv, crm_case):
+class crm_lead(crm_case, osv.osv):
     """ CRM Leads """
     _name = 'crm.lead'
 crm_lead()
 
-class crm_phonecall(osv.osv, crm_case):
+class crm_phonecall(crm_case, osv.osv):
     """ CRM Phonecall """
     _name = 'crm.phonecall'
 crm_phonecall()
 
 
-class crm_meeting(osv.osv, crm_case):
+class crm_meeting(crm_case, osv.osv):
     """ CRM Meeting Cases """
 
     _name = 'crm.meeting'
index e44d0ed..18a6daa 100644 (file)
@@ -26,7 +26,7 @@ import crm
 import time
 from datetime import datetime, timedelta
 
-class crm_phonecall(osv.osv, crm_case):
+class crm_phonecall(crm_case, osv.osv):
     """ Phonecall Cases """
 
     _name = "crm.phonecall"
index 9e7954e..81a98a7 100644 (file)
@@ -23,7 +23,7 @@ from osv import fields, osv
 from crm import crm
 import time
 
-class crm_claim(osv.osv, crm.crm_case):
+class crm_claim(crm.crm_case, osv.osv):
     """
     Crm claim
     """
index 962fae0..df7bc4a 100644 (file)
@@ -22,7 +22,7 @@
 from osv import fields, osv, orm
 from crm import crm
 
-class crm_fundraising(osv.osv, crm.crm_case):
+class crm_fundraising(crm.crm_case, osv.osv):
     """ Fund Raising Cases """
 
     _name = "crm.fundraising"
index 9c223c7..f2570a8 100644 (file)
@@ -23,7 +23,7 @@ from crm import crm
 from osv import fields, osv
 import time
 
-class crm_helpdesk(osv.osv, crm.crm_case):
+class crm_helpdesk(crm.crm_case, osv.osv):
     """ Helpdesk Cases """
 
     _name = "crm.helpdesk"
index fca2688..4a8cd5d 100644 (file)
@@ -75,7 +75,7 @@ class hr_recruitment_degree(osv.osv):
     }
 hr_recruitment_degree()
 
-class hr_applicant(osv.osv, crm.crm_case):
+class hr_applicant(crm.crm_case, osv.osv):
     _name = "hr.applicant"
     _description = "Applicant"
     _order = "id desc"
index dc065bc..fb03359 100644 (file)
@@ -34,7 +34,7 @@ from osv.orm import except_orm
 from tools.translate import _
 import tools
 
-class project_issue(osv.osv, crm.crm_case):
+class project_issue(crm.crm_case, osv.osv):
     _name = "project.issue"
     _description = "Project Issue"
     _order = "priority, id desc"