Пример #1
0
    def default_get(self, fields):
        """ In case someone clicked on 'invite others' wizard in the followers widget, transform virtual ids in real ids """
        if 'default_res_id' in self._context:
            self = self.with_context(
                default_res_id=get_real_ids(self._context['default_res_id']))

        result = super(MailInvite, self).default_get(fields)
        if 'res_id' in result:
            result['res_id'] = get_real_ids(result['res_id'])
        return result
Пример #2
0
 def search(self, args, offset=0, limit=0, order=None, count=False):
     """ Convert the search on real ids in the case it was asked on virtual ids, then call super() """
     args = list(args)
     for index in range(len(args)):
         if args[index][0] == "res_id":
             if isinstance(args[index][2], pycompat.string_types):
                 args[index] = (args[index][0], args[index][1],
                                get_real_ids(args[index][2]))
             elif isinstance(args[index][2], list):
                 args[index] = (args[index][0], args[index][1],
                                [get_real_ids(x) for x in args[index][2]])
     return super(Message, self).search(args,
                                        offset=offset,
                                        limit=limit,
                                        order=order,
                                        count=count)
Пример #3
0
 def search(self, args, offset=0, limit=0, order=None, count=False):
     """ Convert the search on real ids in the case it was asked on virtual ids, then call super() """
     args = list(args)
     if any([leaf for leaf in args if leaf[0] == "res_model" and leaf[2] == 'calendar.event']):
         for index in range(len(args)):
             if args[index][0] == "res_id" and isinstance(args[index][2], pycompat.string_types):
                 args[index] = (args[index][0], args[index][1], get_real_ids(args[index][2]))
     return super(Attachment, self).search(args, offset=offset, limit=limit, order=order, count=count)
Пример #4
0
 def _find_allowed_model_wise(self, doc_model, doc_dict):
     if doc_model == 'calendar.event':
         order = self._context.get('order', self.env[doc_model]._order)
         for virtual_id in self.env[doc_model].browse(
                 doc_dict).get_recurrent_ids([], order=order):
             doc_dict.setdefault(virtual_id,
                                 doc_dict[get_real_ids(virtual_id)])
     return super(Message,
                  self)._find_allowed_model_wise(doc_model, doc_dict)
Пример #5
0
    def get_attendee_detail(self, meeting_id):
        """ Return a list of tuple (id, name, status)
            Used by base_calendar.js : Many2ManyAttendee
        """
        datas = []
        meeting = None
        if meeting_id:
            meeting = self.env['calendar.event'].browse(get_real_ids(meeting_id))

        for partner in self:
            data = partner.name_get()[0]
            data = [data[0], data[1], False, partner.color]
            if meeting:
                for attendee in meeting.attendee_ids:
                    if attendee.partner_id.id == partner.id:
                        data[2] = attendee.state
            datas.append(data)
        return datas
Пример #6
0
 def write(self, vals):
     """ When posting an attachment (new or not), convert the virtual ids in real ids. """
     if isinstance(vals.get('res_id'), pycompat.string_types):
         vals['res_id'] = get_real_ids(vals.get('res_id'))
     return super(Attachment, self).write(vals)