次のことを聞きたい
- 2 つのフィールドがありますが、フィールド A とフィールド B の内容が同じであってはなりません
ここに私のコード:
def _check_date(self,cr,uid,ids,context=None): sessions = self.browse(cr,uid,ids,context=context) check = True for session in sessions: check = check and (not session.depart_date < time.strftime('%Y-%m-%d')) return check def check_date_validation(self,depart_date): check = True check = check and (not depart_date< time.strftime('%Y-%m-%d')) return check _constraints = [(_check_date, 'Date cannot earlier than today',['depart_date'])] def check_constraints(self,cr,uid,id,depart_date,context=None): warning = {} if not self.check_date_validation(depart_date): title = _("Warning Title") message = _("Warning Message") warning = { 'title': title, 'message': message, } depart_date = time.strftime('%Y-%m-%d') else: depart_date = depart_date return {'value': {'depart_date': depart_date},'warning':warning}
その関数の平均日付は現在の日付よりも小さくてはいけませんが ..もう一度作りたいです。フィールド日付 A と B は同じであってはなりません。手伝って頂けますか。お願いします....
ありがとうございました