diff options
| author | Raphael Collet <rco@openerp.com> | 2016-08-12 09:55:21 +0200 |
|---|---|---|
| committer | Raphael Collet <rco@openerp.com> | 2016-08-16 09:55:46 +0200 |
| commit | 38e7a1318a2b1cf43aaa66b197da176eddb23f63 (patch) | |
| tree | 35bad6beda44e42964f97f6a1325ca97b662eb2e /addons | |
| parent | ffdafd3f8a6a18f2af9d5aa7f2446c299cb71967 (diff) | |
[REM] most uses of `self.pool`
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/mail/models/mail_message.py | 2 | ||||
| -rw-r--r-- | addons/mail/models/mail_template.py | 2 | ||||
| -rw-r--r-- | addons/mail/models/mail_thread.py | 9 | ||||
| -rw-r--r-- | addons/mail/models/res_partner.py | 2 | ||||
| -rw-r--r-- | addons/mail/models/res_users.py | 2 | ||||
| -rw-r--r-- | addons/mail/wizard/invite.py | 2 | ||||
| -rw-r--r-- | addons/mail/wizard/mail_compose_message.py | 2 | ||||
| -rw-r--r-- | addons/stock_account/models/stock.py | 2 | ||||
| -rw-r--r-- | addons/stock_calendar/models/resource.py | 4 | ||||
| -rw-r--r-- | addons/website/models/ir_http.py | 2 |
10 files changed, 14 insertions, 15 deletions
diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py index cc3bc3d886b..fd3b15e409d 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -656,7 +656,7 @@ class Message(models.Model): SUPERUSER_ID, to be sure to have the record name correctly stored. """ model = values.get('model', self.env.context.get('default_model')) res_id = values.get('res_id', self.env.context.get('default_res_id')) - if not model or not res_id or model not in self.pool: + if not model or not res_id or model not in self.env: return False return self.env[model].sudo().browse(res_id).name_get()[0][1] diff --git a/addons/mail/models/mail_template.py b/addons/mail/models/mail_template.py index 6e6f03e2797..e44f0b3ed59 100644 --- a/addons/mail/models/mail_template.py +++ b/addons/mail/models/mail_template.py @@ -497,7 +497,7 @@ class MailTemplate(models.Model): report_service = report.report_name if report.report_type in ['qweb-html', 'qweb-pdf']: - result, format = self.pool['report'].get_pdf(self._cr, self._uid, [res_id], report_service, context=Template._context), 'pdf' + result, format = Template.env['report'].get_pdf([res_id], report_service), 'pdf' else: result, format = odoo_report.render_report(self._cr, self._uid, [res_id], report_service, {'model': template.model}, Template._context) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index e88024b17fc..3980ebd4b3f 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -786,8 +786,7 @@ class MailThread(models.AbstractModel): def message_capable_models(self): """ Used by the plugin addon, based for plugin_outlook and others. """ ret_dict = {} - for model_name in self.pool.obj_list(): - model = self.pool[model_name] + for model_name, model in self.env.iteritems(): if hasattr(model, "message_process") and hasattr(model, "message_post"): ret_dict[model_name] = model._description return ret_dict @@ -846,9 +845,9 @@ class MailThread(models.AbstractModel): message_id, route, message) # Wrong model - if model and model not in self.pool: + if model and model not in self.env: if assert_model: - assert model in self.pool, 'Routing: unknown target model %s' % model + assert model in self.env, 'Routing: unknown target model %s' % model _warn('unknown target model %s' % model) return () @@ -1025,7 +1024,7 @@ class MailThread(models.AbstractModel): # do not match forwarded emails from another OpenERP system (thread_id collision!) if local_hostname == reply_hostname: thread_id, model = reply_thread_id, reply_model - if thread_id and model in self.pool: + if thread_id and model in self.env: record = self.env[model].browse(thread_id) compat_mail_msg_ids = MailMessage.search([ ('message_id', '=', False), diff --git a/addons/mail/models/res_partner.py b/addons/mail/models/res_partner.py index 6d624ed0517..2e47dacc1dc 100644 --- a/addons/mail/models/res_partner.py +++ b/addons/mail/models/res_partner.py @@ -96,7 +96,7 @@ class Partner(models.Model): # custom values custom_values = dict() - if message.model and message.res_id and self.pool.get(message.model) and hasattr(self.pool[message.model], 'message_get_email_values'): + if message.res_id and message.model in self.env and hasattr(self.env[message.model], 'message_get_email_values'): custom_values = self.env[message.model].browse(message.res_id).message_get_email_values(message) mail_values = { diff --git a/addons/mail/models/res_users.py b/addons/mail/models/res_users.py index e188b9f9e75..9e4294df3cd 100644 --- a/addons/mail/models/res_users.py +++ b/addons/mail/models/res_users.py @@ -115,7 +115,7 @@ class Users(models.Model): @api.multi def message_partner_info_from_emails(self, emails, link_mail=False): - return self.pool.get('mail.thread').message_partner_info_from_emails(emails, link_mail=link_mail) + return self.env['mail.thread'].message_partner_info_from_emails(emails, link_mail=link_mail) @api.multi def message_get_suggested_recipients(self): diff --git a/addons/mail/wizard/invite.py b/addons/mail/wizard/invite.py index a70b98f53e0..2069f887895 100644 --- a/addons/mail/wizard/invite.py +++ b/addons/mail/wizard/invite.py @@ -18,7 +18,7 @@ class Invite(models.TransientModel): if self._context.get('mail_invite_follower_channel_only'): result['send_mail'] = False if 'message' in fields and model and res_id: - model_name = self.env['ir.model'].search([('model', '=', self.pool[model]._name)]).name_get()[0][1] + model_name = self.env['ir.model'].search([('model', '=', model)]).name_get()[0][1] document_name = self.env[model].browse(res_id).name_get()[0][1] message = _('<div><p>Hello,</p><p>%s invited you to follow %s document: %s.</p></div>') % (user_name, model_name, document_name) result['message'] = message diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index e60ac5db4e7..585d1128a7a 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -65,7 +65,7 @@ class MailComposer(models.TransientModel): result['model'] = result.get('model', self._context.get('active_model')) result['res_id'] = result.get('res_id', self._context.get('active_id')) result['parent_id'] = result.get('parent_id', self._context.get('message_id')) - if 'no_auto_thread' not in result and (not result['model'] or not result['model'] in self.pool or not hasattr(self.env[result['model']], 'message_post')): + if 'no_auto_thread' not in result and (result['model'] not in self.env or not hasattr(self.env[result['model']], 'message_post')): result['no_auto_thread'] = True # default values according to composition mode - NOTE: reply is deprecated, fall back on comment diff --git a/addons/stock_account/models/stock.py b/addons/stock_account/models/stock.py index a9c9d430837..d4992624ddf 100644 --- a/addons/stock_account/models/stock.py +++ b/addons/stock_account/models/stock.py @@ -282,7 +282,7 @@ class StockMove(models.Model): if self.location_id.usage == 'customer' and self.origin_returned_move_id: debit_value = self.origin_returned_move_id.price_unit * qty credit_value = debit_value - partner_id = (self.picking_id.partner_id and self.pool.get('res.partner')._find_accounting_partner(self.picking_id.partner_id).id) or False + partner_id = (self.picking_id.partner_id and self.env['res.partner']._find_accounting_partner(self.picking_id.partner_id).id) or False debit_line_vals = { 'name': self.name, 'product_id': self.product_id.id, diff --git a/addons/stock_calendar/models/resource.py b/addons/stock_calendar/models/resource.py index 0ddec1b0cd5..d63b82a3fb7 100644 --- a/addons/stock_calendar/models/resource.py +++ b/addons/stock_calendar/models/resource.py @@ -97,10 +97,10 @@ class ResourceCalendar(models.Model): for leave in leave_intervals: if len(leave) > 2: current_group = False - att_obj = self.pool.get("resource.calendar.attendance") + Att = self.env["resource.calendar.attendance"] if leave[2]: if len(current_interval) > 2: - current_group = current_interval[2] and att_obj.browse(current_interval[2]).group_id.id or False + current_group = current_interval[2] and Att.browse(current_interval[2]).group_id.id or False if leave[2] != current_group: continue if leave[1] <= current_interval[0]: diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py index be89ca4dcac..6aa299ed4fb 100644 --- a/addons/website/models/ir_http.py +++ b/addons/website/models/ir_http.py @@ -309,7 +309,7 @@ class Http(models.AbstractModel): obj = None if xmlid: obj = env.ref(xmlid, False) - elif id and model in self.pool: + elif id and model in env: obj = env[model].browse(int(id)) if obj and 'website_published' in obj._fields: if env[obj._name].sudo().search([('id', '=', obj.id), ('website_published', '=', True)]): |
