[IMP] base_calendar: get_recurrent_ids is the wrapper and should be remove in trunk (to have only private method

bzr revid: mat@openerp.com-20140109112023-ya2cogqnyiv6hsht
This commit is contained in:
Martin Trigaux 2014-01-09 12:20:23 +01:00
parent 76d4ec6a37
commit 72ad1a0c08
2 changed files with 10 additions and 10 deletions

View File

@ -1172,14 +1172,15 @@ rule or repeating pattern of time to exclude from the recurring rule."),
(_check_closing_date, 'Error ! End date cannot be set before start date.', ['date_deadline']),
]
def _get_recurrent_ids(self, cr, uid, select, domain, limit=100, order=False, context=None):
"""Wrapper for get_recurrent_ids to add 'order' parameter
@param order: The fields (comma separated, format "FIELD {DESC|ASC}") on which the events should be sorted"""
ctx = dict(context or {}, order=order)
return self.get_recurrent_ids(cr, uid, select, domain, limit=limit, context=ctx)
# TODO for trunk: remove get_recurrent_ids
def get_recurrent_ids(self, cr, uid, select, domain, limit=100, context=None):
"""Wrapper for _get_recurrent_ids to get the 'order' parameter from the context"""
if not context:
context = {}
order = context.get('order', self._order)
return self._get_recurrent_ids(cr, uid, select, domain, limit=limit, order=order, context=context)
# TODO for trunk: remove _get_recurrent_ids and add 'order' as standart parameter instead of adding it in context
def get_recurrent_ids(self, cr, uid, select, domain, limit=100, order=None, context=None):
def _get_recurrent_ids(self, cr, uid, select, domain, limit=100, order=None, context=None):
"""Gives virtual event ids for recurring events based on value of Recurrence Rule
This method gives ids of dates that comes between start date and end date of calendar views
@param self: The object pointer
@ -1189,7 +1190,6 @@ rule or repeating pattern of time to exclude from the recurring rule."),
@param order: The fields (comma separated, format "FIELD {DESC|ASC}") on which the events should be sorted"""
if not context:
context = {}
order = context.get('order', False)
result = []
result_data = []
@ -1414,7 +1414,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
#offset, limit, order and count must be treated separately as we may need to deal with virtual ids
if context.get('virtual_id', True):
res = super(calendar_event, self).search(cr, uid, new_args, offset=0, limit=0, order=None, context=context, count=False)
res = self.get_recurrent_ids(cr, uid, res, args, limit, order=order, context=context)
res = self._get_recurrent_ids(cr, uid, res, args, limit, order=order, context=context)
else:
res = super(calendar_event, self).search(cr, uid, new_args, offset=offset, limit=limit, order=order, context=context, count=count)

View File

@ -135,7 +135,7 @@ class mail_message(osv.osv):
def _find_allowed_model_wise(self, cr, uid, doc_model, doc_dict, context=None):
if doc_model == 'crm.meeting':
for virtual_id in self.pool.get(doc_model).get_recurrent_ids(cr, uid, doc_dict.keys(), [], context=context):
for virtual_id in self.pool.get(doc_model)._get_recurrent_ids(cr, uid, doc_dict.keys(), [], context=context):
doc_dict.setdefault(virtual_id, doc_dict[get_real_ids(virtual_id)])
return super(mail_message, self)._find_allowed_model_wise(cr, uid, doc_model, doc_dict, context=context)