[FIX]calandar-event:validation
authorPinakin Nayi (OpenERP) <pna@tinyerp.com>
Wed, 4 Jul 2012 12:06:49 +0000 (17:36 +0530)
committerPinakin Nayi (OpenERP) <pna@tinyerp.com>
Wed, 4 Jul 2012 12:06:49 +0000 (17:36 +0530)
lp bug: https://launchpad.net/bugs/1020561 fixed

bzr revid: pna@tinyerp.com-20120704120649-5tm4qlducduc52ff

addons/base_calendar/base_calendar.py

index bbededc..cc2ee08 100644 (file)
@@ -1111,6 +1111,16 @@ rule or repeating pattern of time to exclude from the recurring rule."),
             'user_id': lambda self, cr, uid, ctx: uid,
             'organizer': default_organizer,
     }
+    
+    def _check_closing_date(self, cr, uid, ids, context=None):
+        for event in self.browse(cr, uid, ids, context=context):
+            if event.date_deadline < event.date:
+                return False
+        return True
+
+    _constraints = [
+        (_check_closing_date, 'Error ! Closing Date cannot be set before Beginning Date.', ['date_deadline']),
+    ]
 
     def get_recurrent_ids(self, cr, uid, select, domain, limit=100, context=None):
         """Gives virtual event ids for recurring events based on value of Recurrence Rule