[MERGe] base_calendar + trunk update
bzr revid: qdp-launchpad@openerp.com-20121212175558-jr3n85u523yhcwvv
This commit is contained in:
@@ -1357,7 +1357,15 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
||||
new_arg = (arg[0], arg[1], new_id)
|
||||
new_args.append(new_arg)
|
||||
|
||||
return super(calendar_event, self).search(cr, uid, new_args, offset=offset, limit=limit, order=order, context=context, count=count)
|
||||
#offset, limit and count must be treated separately as we may need to deal with virtual ids
|
||||
res = super(calendar_event, self).search(cr, uid, new_args, offset=0, limit=0, order=order, context=context, count=False)
|
||||
if context.get('virtual_id', True):
|
||||
res = self.get_recurrent_ids(cr, uid, res, new_args, limit, context=context)
|
||||
if count:
|
||||
return len(res)
|
||||
elif limit:
|
||||
return res[offset:offset+limit]
|
||||
return res
|
||||
|
||||
def _get_data(self, cr, uid, id, context=None):
|
||||
return self.read(cr, uid, id,['date', 'date_deadline'])
|
||||
|
||||
@@ -142,6 +142,12 @@ class mail_message(osv.osv):
|
||||
args[index][2] = get_real_ids(args[index][2])
|
||||
return super(mail_message, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count)
|
||||
|
||||
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):
|
||||
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)
|
||||
|
||||
class ir_attachment(osv.osv):
|
||||
_inherit = "ir.attachment"
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
-
|
||||
!python {model: calendar.event}: |
|
||||
ids = self.search(cr, uid, [('date', '>=', '2011-04-30 16:00:00'), ('date', '<=', '2011-05-31 00:00:00')], context={'virtual_id': True} )
|
||||
assert len(ids) == 9
|
||||
assert len(ids) == 9, 'Wrong number of events found'
|
||||
-
|
||||
Now I will make All day event and test it
|
||||
-
|
||||
|
||||
@@ -550,6 +550,20 @@ class mail_message(osv.Model):
|
||||
if not cr.fetchone():
|
||||
cr.execute("""CREATE INDEX mail_message_model_res_id_idx ON mail_message (model, res_id)""")
|
||||
|
||||
def _find_allowed_model_wise(self, cr, uid, doc_model, doc_dict, context=None):
|
||||
doc_ids = doc_dict.keys()
|
||||
allowed_doc_ids = self.pool.get(doc_model).search(cr, uid, [('id', 'in', doc_ids)], context=context)
|
||||
return set([message_id for allowed_doc_id in allowed_doc_ids for message_id in doc_dict[allowed_doc_id]])
|
||||
|
||||
def _find_allowed_doc_ids(self, cr, uid, model_ids, context=None):
|
||||
model_access_obj = self.pool.get('ir.model.access')
|
||||
allowed_ids = set()
|
||||
for doc_model, doc_dict in model_ids.iteritems():
|
||||
if not model_access_obj.check(cr, uid, doc_model, 'read', False):
|
||||
continue
|
||||
allowed_ids |= self._find_allowed_model_wise(cr, uid, doc_model, doc_dict, context=context)
|
||||
return allowed_ids
|
||||
|
||||
def _search(self, cr, uid, args, offset=0, limit=None, order=None,
|
||||
context=None, count=False, access_rights_uid=None):
|
||||
""" Override that adds specific access rights of mail.message, to remove
|
||||
@@ -587,13 +601,7 @@ class mail_message(osv.Model):
|
||||
elif message.get('model') and message.get('res_id'):
|
||||
model_ids.setdefault(message.get('model'), {}).setdefault(message.get('res_id'), set()).add(message.get('id'))
|
||||
|
||||
model_access_obj = self.pool.get('ir.model.access')
|
||||
for doc_model, doc_dict in model_ids.iteritems():
|
||||
if not model_access_obj.check(cr, uid, doc_model, 'read', False):
|
||||
continue
|
||||
doc_ids = doc_dict.keys()
|
||||
allowed_doc_ids = self.pool.get(doc_model).search(cr, uid, [('id', 'in', doc_ids)], context=context)
|
||||
allowed_ids |= set([message_id for allowed_doc_id in allowed_doc_ids for message_id in doc_dict[allowed_doc_id]])
|
||||
allowed_ids = self._find_allowed_doc_ids(cr, uid, model_ids, context=context)
|
||||
|
||||
final_ids = author_ids | partner_ids | allowed_ids
|
||||
if count:
|
||||
|
||||
@@ -17,3 +17,4 @@ access_product_pricelist_partner_manager,product.pricelist partner manager,model
|
||||
access_product_product_employee,product.product employee,model_product_product,base.group_user,1,0,0,0
|
||||
access_product_template_sale_manager,product.template salemanager,model_product_template,base.group_sale_manager,1,1,1,1
|
||||
access_product_product_sale_manager,product.product salemanager,model_product_product,base.group_sale_manager,1,1,1,1
|
||||
access_product_category_sale_manager,product.category salemanager,product.model_product_category,base.group_sale_manager,1,1,1,1
|
||||
|
||||
|
@@ -457,14 +457,14 @@
|
||||
<span t-attf-class="#{red || ''}"><i><field name="date_deadline"/></i></span>
|
||||
</div>
|
||||
<div class="oe_kanban_bottom_right">
|
||||
<div groups="base.group_user">
|
||||
<t groups="base.group_user">
|
||||
<a t-if="record.kanban_state.raw_value === 'normal'" type="object" string="In Progress" name="set_kanban_state_done" class="oe_kanban_status"> </a>
|
||||
<a t-if="record.kanban_state.raw_value === 'done'" type="object" string="Ready for next stage" name="set_kanban_state_blocked" class="oe_kanban_status oe_kanban_status_green"> </a>
|
||||
<a t-if="record.kanban_state.raw_value === 'blocked'" type="object" string="Blocked" name="set_kanban_state_normal" class="oe_kanban_status oe_kanban_status_red"> </a>
|
||||
<a t-if="record.priority.raw_value == 2" type="object" string="Important" name="set_very_high_priority" class="oe_e oe_star_on">7</a>
|
||||
<a t-if="record.priority.raw_value == 1 or record.priority.raw_value == 3 or record.priority.raw_value == 4" type="object" string="Normal" name="set_normal_priority" class="oe_e oe_star_off">7</a>
|
||||
<a t-if="record.priority.raw_value == 0" type="object" string="Very Important" name="set_high_priority" class="oe_e oe_star_very_high_priority">7</a>
|
||||
</div>
|
||||
</t>
|
||||
<img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/>
|
||||
</div>
|
||||
<div class="oe_kanban_footer_left">
|
||||
|
||||
Reference in New Issue
Block a user