_sql_constraints = [
(
"date_init_deb_before_date_init_fin",
- "CHECK(date_init_deb<> date_init_fin)",
+ "CHECK(date_init_deb <= date_init_fin)",
"The date_init_deb should be previous date_init_fin",
),
(
"date_plan_deb_before_date_plan_fin",
- "CHECK(date_plan_deb <> date_plan_fin)",
+ "CHECK(date_plan_deb <= date_plan_fin)",
"The date_plan_deb should be previous date_plan_fin",
),
(
"date_reel_deb_before_date_reel_fin",
- "CHECK(date_reel_deb<> date_reel_fin)",
+ "CHECK(date_reel_deb <= date_reel_fin)",
"The date_reel_deb should be previous date_reel_fin",
),
]
self.write(
cr,
- uid, ids, {
+ uid,
+ ids, {
'date_init_deb' : palier['date_plan_deb'],
'date_init_fin' : palier['date_plan_fin'],
'statut': 'encours'
return self
+ def suspendre(self, cr, uid, ids, context=None):
+ if type(ids) == list:
+ if len(ids) != 1:
+ return # TODO: message d'avertissement
+ ids = ids[0]
+
+ mesurable = self.read(cr, uid, ids, ['statut'], context, context)
+ if mesurable['statut'] != 'encours':
+ return
+ self.write(
+ cr,
+ uid,
+ ids,
+ {'statut': 'suspendu'},
+ context,
+ )
+
+
+
#------------ TRAVAIL CALCUL JOURS OUVRES ------------
@staticmethod
def _get_date_paques(annee):