assert len(ids) == 1
document = self.browse(cr, uid, ids[0], context=context)
partner = document.partner_id
- if partner.id not in document.message_follower_ids:
+ if partner not in document.message_follower_ids:
self.message_subscribe(cr, uid, ids, [partner.id], context=context)
return super(sale_order, self).action_button_confirm(cr, uid, ids, context=context)
# fetch the partner's id and subscribe the partner to the invoice
for invoice in self.browse(cr, uid, ids, context=context):
partner = invoice.partner_id
- if partner.id not in invoice.message_follower_ids:
+ if partner not in invoice.message_follower_ids:
self.message_subscribe(cr, uid, [invoice.id], [partner.id], context=context)
return super(account_invoice, self).invoice_validate(cr, uid, ids, context=context)
order = so_obj.browse(cr, uid, mail.res_id, context=context)
partner = order.partner_id
# Add the customer in the SO as follower
- if partner.id not in order.message_follower_ids:
+ if partner not in order.message_follower_ids:
so_obj.message_subscribe(cr, uid, [mail.res_id], [partner.id], context=context)
# Add all recipients of the email as followers
for p in mail.partner_ids:
- if p.id not in order.message_follower_ids:
+ if p not in order.message_follower_ids:
so_obj.message_subscribe(cr, uid, [mail.res_id], [p.id], context=context)
return super(mail_mail, self)._postprocess_sent_message(cr, uid, mail=mail, context=context, mail_sent=mail_sent)
if invoice.type != 'out_invoice':
continue
# subscribe the partner to the invoice
- if invoice.partner_id.id not in invoice.message_follower_ids:
+ if invoice.partner_id not in invoice.message_follower_ids:
self.message_subscribe(cr, uid, [invoice.id], [invoice.partner_id.id], context=context)
for line in invoice.invoice_line:
if line.product_id.email_template_id:
yield self._browse(self.env, (id,))
def __contains__(self, item):
- """ Test whether `item` is a subset of `self` or a field name. """
- if isinstance(item, BaseModel):
- if self._name == item._name:
- return set(item._ids) <= set(self._ids)
- raise except_orm("ValueError", "Mixing apples and oranges: %s in %s" % (item, self))
- if isinstance(item, basestring):
+ """ Test whether `item` (record or field name) is an element of `self`.
+ In the first case, the test is fully equivalent to::
+
+ any(item == record for record in self)
+ """
+ if isinstance(item, BaseModel) and self._name == item._name:
+ return len(item) == 1 and item.id in self._ids
+ elif isinstance(item, basestring):
return item in self._fields
- return item in self.ids
+ else:
+ raise except_orm("ValueError", "Mixing apples and oranges: %s in %s" % (item, self))
def __add__(self, other):
""" Return the concatenation of two recordsets. """