diff options
| author | Fabien Pinckaers <fp@tinyerp.com> | 2013-11-30 16:46:59 +0100 |
|---|---|---|
| committer | Fabien Pinckaers <fp@tinyerp.com> | 2013-11-30 16:46:59 +0100 |
| commit | ed7623fc4564372cf38a1d961012b090ce07bc01 (patch) | |
| tree | 89e7f07a0f810af19708476532a24561a7fa54d3 /addons/mail/update.py | |
| parent | 56eb2c06078e82eee1a86869857d6ce85f0b864a (diff) | |
[IMP] Performance improvement: improved cache with context, better get_object
bzr revid: fp@tinyerp.com-20131130154659-uqis34x2cemmocly
Diffstat (limited to 'addons/mail/update.py')
| -rw-r--r-- | addons/mail/update.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/addons/mail/update.py b/addons/mail/update.py index bcf9bb8c7c9..3d07ce739ab 100644 --- a/addons/mail/update.py +++ b/addons/mail/update.py @@ -94,13 +94,11 @@ class publisher_warranty_contract(osv.osv): # old behavior based on res.log; now on mail.message, that is not necessarily installed IMD = self.pool['ir.model.data'] user = self.pool['res.users'].browse(cr, SUPERUSER_ID, SUPERUSER_ID) - try: - poster = IMD.get_object(cr, SUPERUSER_ID, 'mail', 'group_all_employees') - except ValueError: - # Cannot found group, post the message on the wall of the admin - poster = user + poster = IMD.get_object(cr, SUPERUSER_ID, 'mail', 'group_all_employees') if not poster.exists(): - return True + if not user.exists(): + return True + poster = user for message in result["messages"]: try: poster.message_post(body=message, subtype='mt_comment', partner_ids=[user.partner_id.id]) |
