Hi, I have 2 dates (from date and to date) in hand. I would like to know if there's another record in the table that falls on the same range. I use openerp search function to do that
below is my code. Kindly see if my date search with operator <= is correct and is there anything that i wrongly understood.
exist_ids = self.search(cr, uid, [('partner_id','=',customer),('sys_conf_name','ilike',sys_conf_name.strip()),('contract_start_date','<=',cont_start_date),('contract_end_date','>=',cont_end_date)]) if exist_ids: raise osv.except_osv(_('Error!!'), "Already there exist a Contract for the same customer, same product and the same date range!!")
Thanks for your time.
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: 9/26/13, 9:46 AM|
|Seen: 805 times|
|Last updated: 3/16/15, 8:10 AM|