I am trying to compare year from date picker with a year in dropdown (hardcoded year), so if it doesnt match "show error".
This is my code:
def _check_year_match(self, cr, uid, ids, context=None):
holiday_year = self.pool.get('holiday')
holiday_date_year = self.pool.get('holiday.line')
hol_year1 = holiday_year.browse(cr, uid,,context=context)
hol_year2 = holiday_date_year.search(cr, uid,,context=context)
cal_year = hol_year2.date_start('%Y',hol_year2.date_start(datetime, "%Y"))
for x in cal_year.browse(cr, uid, sr_ids, context=context):
if x.id != ids:
for self_obj in self.browse(cr, uid, ids, context=context):
if x.holiday_id == self_obj.holiday_id and x.year != cal_year:
I know this is some junk I have written. Please help.
Or is there a way where I can have a option to select only date and month.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 1/10/15, 3:04 AM|
|Seen: 503 times|
|Last updated: 3/16/15, 8:10 AM|