我想问以下事情
- 我有两个字段,但字段 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 不应相同。你能帮助我吗。请....
谢谢你