diff --git a/addons/account/account.py b/addons/account/account.py
index bb24aec1748..48e66dd957b 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -3398,7 +3398,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
try:
tmp2 = obj_data.get_object_reference(cr, uid, *ref)
if tmp2:
- self.pool.get(tmp2[0]).write(cr, uid, tmp2[1], {
+ self.pool[tmp2[0]].write(cr, uid, tmp2[1], {
'currency_id': obj_wizard.currency_id.id
})
except ValueError, e:
diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py
index 30bdc2eedac..0802f77f497 100644
--- a/addons/account/account_invoice.py
+++ b/addons/account/account_invoice.py
@@ -313,7 +313,7 @@ class account_invoice(osv.osv):
context = {}
if context.get('active_model', '') in ['res.partner'] and context.get('active_ids', False) and context['active_ids']:
- partner = self.pool.get(context['active_model']).read(cr, uid, context['active_ids'], ['supplier','customer'])[0]
+ partner = self.pool[context['active_model']].read(cr, uid, context['active_ids'], ['supplier','customer'])[0]
if not view_type:
view_id = self.pool.get('ir.ui.view').search(cr, uid, [('name', '=', 'account.invoice.tree')])
view_type = 'tree'
diff --git a/addons/account/wizard/pos_box.py b/addons/account/wizard/pos_box.py
index 49178dfd3ea..810d101eefd 100644
--- a/addons/account/wizard/pos_box.py
+++ b/addons/account/wizard/pos_box.py
@@ -21,7 +21,7 @@ class CashBox(osv.osv_memory):
active_model = context.get('active_model', False) or False
active_ids = context.get('active_ids', []) or []
- records = self.pool.get(active_model).browse(cr, uid, active_ids, context=context)
+ records = self.pool[active_model].browse(cr, uid, active_ids, context=context)
return self._run(cr, uid, ids, records, context=None)
diff --git a/addons/account_analytic_plans/account_analytic_plans.py b/addons/account_analytic_plans/account_analytic_plans.py
index 5834db99cd3..40a227d8ceb 100644
--- a/addons/account_analytic_plans/account_analytic_plans.py
+++ b/addons/account_analytic_plans/account_analytic_plans.py
@@ -40,10 +40,10 @@ class one2many_mod2(fields.one2many):
plan = journal.plan_id
if plan and len(plan.plan_ids) > pnum:
acc_id = plan.plan_ids[pnum].root_analytic_id.id
- ids2 = obj.pool.get(self._obj).search(cr, user, [(self._fields_id,'in',ids),('analytic_account_id','child_of',[acc_id])], limit=self._limit)
+ ids2 = obj.pool[self._obj].search(cr, user, [(self._fields_id,'in',ids),('analytic_account_id','child_of',[acc_id])], limit=self._limit)
if ids2 is None:
- ids2 = obj.pool.get(self._obj).search(cr, user, [(self._fields_id,'in',ids)], limit=self._limit)
- for r in obj.pool.get(self._obj)._read_flat(cr, user, ids2, [self._fields_id], context=context, load='_classic_write'):
+ ids2 = obj.pool[self._obj].search(cr, user, [(self._fields_id,'in',ids)], limit=self._limit)
+ for r in obj.pool[self._obj]._read_flat(cr, user, ids2, [self._fields_id], context=context, load='_classic_write'):
res[r[self._fields_id]].append( r['id'] )
return res
diff --git a/addons/account_payment/report/order.rml b/addons/account_payment/report/order.rml
index ca2315d81b1..07d549db618 100644
--- a/addons/account_payment/report/order.rml
+++ b/addons/account_payment/report/order.rml
@@ -253,7 +253,7 @@
[[ get_invoice_name(line.ml_inv_ref.id) or '-' ]]
- [[line.date=='False' and '-' or formatLang(line.date,date=True) ]]
+ [[not line.date and '-' or formatLang(line.date,date=True) ]]
|
[[ formatLang(line.amount or '-', currency_obj=line.company_currency) ]]
diff --git a/addons/anonymization/anonymization.py b/addons/anonymization/anonymization.py
index de46e2e8d03..025f1f79f70 100644
--- a/addons/anonymization/anonymization.py
+++ b/addons/anonymization/anonymization.py
@@ -411,7 +411,7 @@ class ir_model_fields_anonymize_wizard(osv.osv_memory):
model_name = field.model_id.model
field_name = field.field_id.name
field_type = field.field_id.ttype
- table_name = self.pool.get(model_name)._table
+ table_name = self.pool[model_name]._table
# get the current value
sql = "select id, %s from %s" % (field_name, table_name)
@@ -543,7 +543,7 @@ class ir_model_fields_anonymize_wizard(osv.osv_memory):
fixes = group(fixes, ('model_name', 'field_name'))
for line in data:
- table_name = self.pool.get(line['model_id'])._table if self.pool.get(line['model_id']) else None
+ table_name = self.pool[line['model_id']]._table if line['model_id'] in self.pool else None
# check if custom sql exists:
key = (line['model_id'], line['field_id'])
diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py
index 811c5387697..159baf3a9e7 100644
--- a/addons/audittrail/audittrail.py
+++ b/addons/audittrail/audittrail.py
@@ -70,8 +70,7 @@ class audittrail_rule(osv.osv):
obj_model = self.pool.get('ir.model.data')
#start Loop
for thisrule in self.browse(cr, uid, ids):
- obj = self.pool.get(thisrule.object_id.model)
- if not obj:
+ if thisrule.object_id.model not in self.pool:
raise osv.except_osv(
_('WARNING: audittrail is not part of the pool'),
_('Change audittrail depends -- Setting rule as DRAFT'))
@@ -131,7 +130,7 @@ class audittrail_log(osv.osv):
model_object = resname.object_id
res_id = resname.res_id
if model_object and res_id:
- model_pool = self.pool.get(model_object.model)
+ model_pool = self.pool[model_object.model]
res = model_pool.read(cr, uid, res_id, ['name'])
data[resname.id] = res['name']
else:
@@ -190,7 +189,7 @@ def get_value_text(cr, uid, pool, resource_pool, method, field, value):
field_obj = (resource_pool._all_columns.get(field)).column
if field_obj._type in ('one2many','many2many'):
- data = pool.get(field_obj._obj).name_get(cr, uid, value)
+ data = pool[field_obj._obj].name_get(cr, uid, value)
#return the modifications on x2many fields as a list of names
res = map(lambda x:x[1], data)
elif field_obj._type == 'many2one':
@@ -212,7 +211,7 @@ def create_log_line(cr, uid, log_id, model, lines=None):
if lines is None:
lines = []
pool = openerp.registry(cr.dbname)
- obj_pool = pool.get(model.model)
+ obj_pool = pool[model.model]
model_pool = pool.get('ir.model')
field_pool = pool.get('ir.model.fields')
log_line_pool = pool.get('audittrail.log.line')
@@ -251,7 +250,7 @@ def log_fct(cr, uid_orig, model, method, fct_src, *args, **kw):
@return: Returns result as per method of Object proxy
"""
pool = openerp.registry(cr.dbname)
- resource_pool = pool.get(model)
+ resource_pool = pool[model]
model_pool = pool.get('ir.model')
model_ids = model_pool.search(cr, SUPERUSER_ID, [('model', '=', model)])
model_id = model_ids and model_ids[0] or False
@@ -321,7 +320,7 @@ def get_data(cr, uid, pool, res_ids, model, method):
}
"""
data = {}
- resource_pool = pool.get(model.model)
+ resource_pool = pool[model.model]
# read all the fields of the given resources in super admin mode
for resource in resource_pool.read(cr, SUPERUSER_ID, res_ids):
values = {}
@@ -390,7 +389,7 @@ def prepare_audittrail_log_line(cr, uid, pool, model, resource_id, method, old_v
key: []
}
# loop on all the fields
- for field_name, field_definition in pool.get(model.model)._all_columns.items():
+ for field_name, field_definition in pool[model.model]._all_columns.items():
if field_name in ('__last_update', 'id'):
continue
#if the field_list param is given, skip all the fields not in that list
@@ -457,7 +456,7 @@ def process_data(cr, uid, pool, res_ids, model, method, old_values=None, new_val
# if at least one modification has been found
for model_id, resource_id in lines:
- name = pool.get(model.model).name_get(cr, uid, [resource_id])[0][1]
+ name = pool[model.model].name_get(cr, uid, [resource_id])[0][1]
vals = {
'method': method,
'object_id': model_id,
diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py
index 62c808ed556..9d7d4d34ac4 100644
--- a/addons/base_action_rule/base_action_rule.py
+++ b/addons/base_action_rule/base_action_rule.py
@@ -96,7 +96,7 @@ class base_action_rule(osv.osv):
""" filter the list record_ids that satisfy the action filter """
if record_ids and action_filter:
assert action.model == action_filter.model_id, "Filter model different from action rule model"
- model = self.pool.get(action_filter.model_id)
+ model = self.pool[action_filter.model_id]
domain = [('id', 'in', record_ids)] + eval(action_filter.domain)
ctx = dict(context or {})
ctx.update(eval(action_filter.context))
@@ -106,7 +106,7 @@ class base_action_rule(osv.osv):
def _process(self, cr, uid, action, record_ids, context=None):
""" process the given action on the records """
# execute server actions
- model = self.pool.get(action.model_id.model)
+ model = self.pool[action.model_id.model]
if action.server_action_ids:
server_action_ids = map(int, action.server_action_ids)
for record in model.browse(cr, uid, record_ids, context):
@@ -195,7 +195,7 @@ class base_action_rule(osv.osv):
ids = self.search(cr, SUPERUSER_ID, [])
for action_rule in self.browse(cr, SUPERUSER_ID, ids):
model = action_rule.model_id.model
- model_obj = self.pool.get(model)
+ model_obj = self.pool[model]
if not hasattr(model_obj, 'base_action_ruled'):
model_obj.create = self._wrap_create(model_obj.create, model)
model_obj.write = self._wrap_write(model_obj.write, model)
@@ -232,7 +232,7 @@ class base_action_rule(osv.osv):
last_run = get_datetime(action.last_run) if action.last_run else False
# retrieve all the records that satisfy the action's condition
- model = self.pool.get(action.model_id.model)
+ model = self.pool[action.model_id.model]
domain = []
ctx = dict(context)
if action.filter_id:
diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py
index ca75c9e20fc..fe5ffbc8988 100644
--- a/addons/base_calendar/base_calendar.py
+++ b/addons/base_calendar/base_calendar.py
@@ -591,7 +591,7 @@ property or property parameter."),
for vals in self.browse(cr, uid, ids, context=context):
if vals.ref and vals.ref.user_id:
- mod_obj = self.pool.get(vals.ref._name)
+ mod_obj = self.pool[vals.ref._name]
res=mod_obj.read(cr,uid,[vals.ref.id],['duration','class'],context)
defaults = {'user_id': vals.user_id.id, 'organizer_id': vals.ref.user_id.id,'duration':res[0]['duration'],'class':res[0]['class']}
mod_obj.copy(cr, uid, vals.ref.id, default=defaults, context=context)
@@ -684,7 +684,7 @@ true, it will allow you to hide the event alarm information without removing it.
ir_obj = self.pool.get('ir.model')
model_id = ir_obj.search(cr, uid, [('model', '=', model)])[0]
- model_obj = self.pool.get(model)
+ model_obj = self.pool[model]
for data in model_obj.browse(cr, uid, ids, context=context):
basic_alarm = data.alarm_id
@@ -754,7 +754,7 @@ true, it will allow you to hide the event alarm information without removing it.
alarm_obj = self.pool.get('calendar.alarm')
ir_obj = self.pool.get('ir.model')
model_id = ir_obj.search(cr, uid, [('model', '=', model)])[0]
- model_obj = self.pool.get(model)
+ model_obj = self.pool[model]
for data in model_obj.browse(cr, uid, ids, context=context):
alarm_ids = alarm_obj.search(cr, uid, [('model_id', '=', model_id), ('res_id', '=', data.id)])
if alarm_ids:
@@ -853,7 +853,7 @@ class calendar_alarm(osv.osv):
for alarm in self.browse(cr, uid, alarm_ids, context=context):
next_trigger_date = None
update_vals = {}
- model_obj = self.pool.get(alarm.model_id.model)
+ model_obj = self.pool[alarm.model_id.model]
res_obj = model_obj.browse(cr, uid, alarm.res_id, context=context)
re_dates = []
diff --git a/addons/base_calendar/crm_meeting.py b/addons/base_calendar/crm_meeting.py
index 6010f5ccfca..aa476002abc 100644
--- a/addons/base_calendar/crm_meeting.py
+++ b/addons/base_calendar/crm_meeting.py
@@ -135,7 +135,7 @@ class mail_message(osv.osv):
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):
+ for virtual_id in self.pool[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)
diff --git a/addons/crm_partner_assign/wizard/crm_forward_to_partner.py b/addons/crm_partner_assign/wizard/crm_forward_to_partner.py
index 81cc09d9717..91d462de015 100644
--- a/addons/crm_partner_assign/wizard/crm_forward_to_partner.py
+++ b/addons/crm_partner_assign/wizard/crm_forward_to_partner.py
@@ -86,7 +86,7 @@ class crm_lead_forward_to_partner(osv.TransientModel):
if context is None:
context = {}
if model and model == 'crm.lead' and res_id:
- lead = self.pool.get(model).browse(cr, uid, res_id, context=context)
+ lead = self.pool[model].browse(cr, uid, res_id, context=context)
context['history_mode'] = history_mode
body = self.get_record_data(cr, uid, 'crm.lead', res_id, context=context)['body']
return {'value': {'body': body}}
@@ -110,7 +110,7 @@ class crm_lead_forward_to_partner(osv.TransientModel):
if wizard.model not in ('crm.lead'):
return res
- lead = self.pool.get(wizard.model)
+ lead = self.pool[wizard.model]
lead_ids = wizard.res_id and [wizard.res_id] or []
if wizard.composition_mode == 'mass_mail':
diff --git a/addons/crm_profiling/wizard/open_questionnaire.py b/addons/crm_profiling/wizard/open_questionnaire.py
index cb7ad220e3f..be0d2ef54af 100644
--- a/addons/crm_profiling/wizard/open_questionnaire.py
+++ b/addons/crm_profiling/wizard/open_questionnaire.py
@@ -61,7 +61,7 @@ class open_questionnaire(osv.osv_memory):
for d in data.question_ans_ids:
if d.answer_id:
answers.append(d.answer_id.id)
- self.pool.get(model)._questionnaire_compute(cr, uid, answers, context=context)
+ self.pool[model]._questionnaire_compute(cr, uid, answers, context=context)
return {'type': 'ir.actions.act_window_close'}
diff --git a/addons/document/document.py b/addons/document/document.py
index 9b1fdc1d66b..54f12e204fe 100644
--- a/addons/document/document.py
+++ b/addons/document/document.py
@@ -137,7 +137,7 @@ class document_file(osv.osv):
It is a hack that will try to discover if the mentioned record is
clearly associated with a partner record.
"""
- obj_model = self.pool.get(res_model)
+ obj_model = self.pool[res_model]
if obj_model._name == 'res.partner':
return res_id
elif 'partner_id' in obj_model._columns and obj_model._columns['partner_id']._obj == 'res.partner':
@@ -422,7 +422,6 @@ class document_directory_content(osv.osv):
tname = ''
if content.include_name:
record_name = node.displayname or ''
- # obj = node.context._dirobj.pool.get(model)
if record_name:
tname = (content.prefix or '') + record_name + (content.suffix or '') + (content.extension or '')
else:
@@ -1296,9 +1295,9 @@ class node_res_dir(node_class):
Note that many objects use NULL for a name, so we should
better call the name_search(),name_get() set of methods
"""
- obj = self.context._dirobj.pool.get(self.res_model)
- if not obj:
+ if self.res_model not in self.context._dirobj.pool:
return []
+ obj = self.context._dirobj.pool[self.res_model]
dirobj = self.context._dirobj
uid = self.context.uid
ctx = self.context.context.copy()
@@ -1333,7 +1332,7 @@ class node_res_dir(node_class):
if self.ressource_tree:
object2 = False
if self.resm_id:
- object2 = dirobj.pool.get(self.res_model).browse(cr, uid, self.resm_id) or False
+ object2 = dirobj.pool[self.res_model].browse(cr, uid, self.resm_id) or False
if obj._parent_name in obj.fields_get(cr, uid):
where.append((obj._parent_name,'=',object2 and object2.id or False))
@@ -1504,7 +1503,7 @@ class node_res_obj(node_class):
ctx = self.context.context.copy()
ctx.update(self.dctx)
directory = dirobj.browse(cr, uid, self.dir_id)
- obj = dirobj.pool.get(self.res_model)
+ obj = dirobj.pool[self.res_model]
where = []
res = []
if name:
@@ -1590,7 +1589,7 @@ class node_res_obj(node_class):
uid = self.context.uid
ctx = self.context.context.copy()
ctx.update(self.dctx)
- res_obj = dirobj.pool.get(self.res_model)
+ res_obj = dirobj.pool[self.res_model]
object2 = res_obj.browse(cr, uid, self.res_id) or False
diff --git a/addons/document_webdav/nodes.py b/addons/document_webdav/nodes.py
index 5e819e01754..9a35f3cfe1b 100644
--- a/addons/document_webdav/nodes.py
+++ b/addons/document_webdav/nodes.py
@@ -67,7 +67,7 @@ class node_acl_mixin(object):
"""
ret = par_class.get_dav_props(self, cr)
if prop_model:
- propobj = self.context._dirobj.pool.get(prop_model)
+ propobj = self.context._dirobj.pool[prop_model]
uid = self.context.uid
ctx = self.context.context.copy()
ctx.update(self.dctx)
@@ -105,7 +105,7 @@ class node_acl_mixin(object):
if ret is not None:
return ret
if prop_model:
- propobj = self.context._dirobj.pool.get(prop_model)
+ propobj = self.context._dirobj.pool[prop_model]
uid = self.context.uid
ctx = self.context.context.copy()
ctx.update(self.dctx)
@@ -151,7 +151,7 @@ class node_acl_mixin(object):
assert prop_model
assert res_id
assert isinstance(lock_data, dict), '%r' % lock_data
- propobj = self.context._dirobj.pool.get(prop_model)
+ propobj = self.context._dirobj.pool[prop_model]
uid = self.context.uid
ctx = self.context.context.copy()
ctx.update(self.dctx)
diff --git a/addons/edi/models/edi.py b/addons/edi/models/edi.py
index 239b543e194..bfd59dae15a 100644
--- a/addons/edi/models/edi.py
+++ b/addons/edi/models/edi.py
@@ -106,8 +106,8 @@ class edi(osv.AbstractModel):
"""
edi_list = []
for record in records:
- record_model_obj = self.pool.get(record._name)
- edi_list += record_model_obj.edi_export(cr, uid, [record], context=context)
+ record_model = record._model
+ edi_list += record_model.edi_export(cr, uid, [record], context=context)
return self.serialize(edi_list)
def load_edi(self, cr, uid, edi_documents, context=None):
@@ -131,9 +131,9 @@ class edi(osv.AbstractModel):
"You can install it by connecting as the administrator and opening the configuration assistant.")%(module,))
model = edi_document.get('__import_model') or edi_document.get('__model')
assert model, 'a `__model` or `__import_model` attribute is required in each EDI document.'
- model_obj = self.pool.get(model)
- assert model_obj, 'model `%s` cannot be found, despite module `%s` being available - '\
+ assert model in self.pool, 'model `%s` cannot be found, despite module `%s` being available - '\
'this EDI document seems invalid or unsupported.' % (model,module)
+ model_obj = self.pool[model]
record_id = model_obj.edi_import(cr, uid, edi_document, context=context)
record_action = model_obj._edi_record_display_action(cr, uid, record_id, context=context)
res.append((model, record_id, record_action))
@@ -400,7 +400,7 @@ class EDIMixin(object):
return results
def _edi_get_object_by_name(self, cr, uid, name, model_name, context=None):
- model = self.pool.get(model_name)
+ model = self.pool[model_name]
search_results = model.name_search(cr, uid, name, operator='=', context=context)
if len(search_results) == 1:
return model.browse(cr, uid, search_results[0][0], context=context)
@@ -483,7 +483,7 @@ class EDIMixin(object):
('name','=',ext_id),
('module','in',modules)])
if data_ids:
- model = self.pool.get(model)
+ model = self.pool[model]
data = ir_model_data.browse(cr, uid, data_ids[0], context=context)
if model.exists(cr, uid, [data.res_id]):
return model.browse(cr, uid, data.res_id, context=context)
@@ -519,7 +519,7 @@ class EDIMixin(object):
_logger.debug("%s: Importing EDI relationship [%r,%r] - name not found, creating it.",
self._name, external_id, value)
# also need_new_ext_id here, but already been set above
- model = self.pool.get(model)
+ model = self.pool[model]
res_id, _ = model.name_create(cr, uid, value, context=context)
target = model.browse(cr, uid, res_id, context=context)
else:
@@ -592,7 +592,7 @@ class EDIMixin(object):
# process o2m values, connecting them to their parent on-the-fly
for o2m_field, o2m_value in o2m_todo.iteritems():
field = self._all_columns[o2m_field].column
- dest_model = self.pool.get(field._obj)
+ dest_model = self.pool[field._obj]
for o2m_line in o2m_value:
# link to parent record: expects an (ext_id, name) pair
o2m_line[field._fields_id] = (ext_id_members['full'], record_display[1])
diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py
index ed76b69901c..5993252b72b 100644
--- a/addons/email_template/email_template.py
+++ b/addons/email_template/email_template.py
@@ -89,7 +89,7 @@ class email_template(osv.osv):
template = tools.ustr(template)
record = None
if res_id:
- record = self.pool.get(model).browse(cr, uid, res_id, context=context)
+ record = self.pool[model].browse(cr, uid, res_id, context=context)
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
variables = {
'object': record,
diff --git a/addons/email_template/wizard/email_template_preview.py b/addons/email_template/wizard/email_template_preview.py
index 1cfcf048691..f24c4f13962 100644
--- a/addons/email_template/wizard/email_template_preview.py
+++ b/addons/email_template/wizard/email_template_preview.py
@@ -40,7 +40,7 @@ class email_template_preview(osv.osv_memory):
email_template = self.pool.get('email.template')
template = email_template.browse(cr, uid, int(template_id), context=context)
template_object = template.model_id
- model = self.pool.get(template_object.model)
+ model = self.pool[template_object.model]
record_ids = model.search(cr, uid, [], 0, 10, 'id', context=context)
default_id = context.get('default_res_id')
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index cdb14de1de3..3b060e199c0 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -155,7 +155,7 @@ class google_docs_ir_attachment(osv.osv):
pool_ir_attachment = self.pool.get('ir.attachment')
pool_gdoc_config = self.pool.get('google.docs.config')
name_gdocs = ''
- model_fields_dic = self.pool.get(res_model).read(cr, uid, res_id, [], context=context)
+ model_fields_dic = self.pool[res_model].read(cr, uid, res_id, [], context=context)
# check if a model is configured with a template
google_docs_config = pool_gdoc_config.search(cr, uid, [('model_id', '=', res_model)], context=context)
diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py
index 06af3054b68..a3d3da04f0e 100644
--- a/addons/hr_payroll/hr_payroll.py
+++ b/addons/hr_payroll/hr_payroll.py
@@ -202,8 +202,8 @@ class one2many_mod2(fields.one2many):
res = {}
for id in ids:
res[id] = []
- ids2 = obj.pool.get(self._obj).search(cr, user, [(self._fields_id,'in',ids), ('appears_on_payslip', '=', True)], limit=self._limit)
- for r in obj.pool.get(self._obj)._read_flat(cr, user, ids2, [self._fields_id], context=context, load='_classic_write'):
+ ids2 = obj.pool[self._obj].search(cr, user, [(self._fields_id,'in',ids), ('appears_on_payslip', '=', True)], limit=self._limit)
+ for r in obj.pool[self._obj]._read_flat(cr, user, ids2, [self._fields_id], context=context, load='_classic_write'):
res[r[self._fields_id]].append( r['id'] )
return res
diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py
index 213040d6204..9465980629c 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -389,7 +389,7 @@ class account_coda_import(osv.osv_memory):
if statement['coda_note'] != '':
self.pool.get('account.bank.statement').write(cr, uid, [statement['id']], {'coda_note': statement['coda_note']}, context=context)
model, action_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'action_bank_statement_tree')
- action = self.pool.get(model).browse(cr, uid, action_id, context=context)
+ action = self.pool[model].browse(cr, uid, action_id, context=context)
return {
'name': action.name,
'view_type': action.view_type,
diff --git a/addons/l10n_multilang/l10n_multilang.py b/addons/l10n_multilang/l10n_multilang.py
index 9596b292ff3..b94ff303eae 100644
--- a/addons/l10n_multilang/l10n_multilang.py
+++ b/addons/l10n_multilang/l10n_multilang.py
@@ -78,7 +78,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
else:
#replace the value in the destination object only if it's the user lang
if context.get('lang') == lang:
- self.pool.get(out_obj._name).write(cr, uid, out_ids[j], {in_field: value[in_id]})
+ self.pool[out_obj._name].write(cr, uid, out_ids[j], {in_field: value[in_id]})
else:
_logger.info('Language: %s. Translation from template: there is no translation available for %s!' %(lang, src[in_id]))#out_obj._name))
return True
diff --git a/addons/mail/mail_alias.py b/addons/mail/mail_alias.py
index d5e3b675b56..dab6621824c 100644
--- a/addons/mail/mail_alias.py
+++ b/addons/mail/mail_alias.py
@@ -159,7 +159,7 @@ class mail_alias(osv.Model):
registry = RegistryManager.get(cr.dbname)
mail_alias = registry.get('mail.alias')
- child_class_model = registry.get(child_model_name)
+ child_class_model = registry[child_model_name]
no_alias_ids = child_class_model.search(cr, SUPERUSER_ID, [('alias_id', '=', False)], context={'active_test':False})
# Use read() not browse(), to avoid prefetching uninitialized inherited fields
for obj_data in child_class_model.read(cr, SUPERUSER_ID, no_alias_ids, [alias_key]):
diff --git a/addons/mail/mail_mail.py b/addons/mail/mail_mail.py
index c5a7e227465..8bcc8b0a91c 100644
--- a/addons/mail/mail_mail.py
+++ b/addons/mail/mail_mail.py
@@ -108,8 +108,8 @@ class mail_mail(osv.Model):
res_id = message.res_id
# if model and res_id: try to use ``message_get_reply_to`` that returns the document alias
- if model and res_id and hasattr(self.pool.get(model), 'message_get_reply_to'):
- email_reply_to = self.pool.get(model).message_get_reply_to(cr, uid, [res_id], context=context)[0]
+ if model and res_id and hasattr(self.pool[model], 'message_get_reply_to'):
+ email_reply_to = self.pool[model].message_get_reply_to(cr, uid, [res_id], context=context)[0]
# no alias reply_to -> reply_to will be the email_from, only the email part
if not email_reply_to and values.get('email_from'):
emails = tools.email_split(values.get('email_from'))
@@ -118,7 +118,7 @@ class mail_mail(osv.Model):
# format 'Document name '
if email_reply_to and model and res_id:
- document_name = self.pool.get(model).name_get(cr, SUPERUSER_ID, [res_id], context=context)[0]
+ document_name = self.pool[model].name_get(cr, SUPERUSER_ID, [res_id], context=context)[0]
if document_name:
# sanitize document name
sanitized_doc_name = re.sub(r'[^\w+.]+', '-', document_name[1])
@@ -217,7 +217,7 @@ class mail_mail(osv.Model):
and self.check_access_rights(cr, partner.user_ids[0].id, 'read', raise_exception=False):
related_user = partner.user_ids[0]
try:
- self.pool.get(mail.model).check_access_rule(cr, related_user.id, [mail.res_id], 'read', context=context)
+ self.pool[mail.model].check_access_rule(cr, related_user.id, [mail.res_id], 'read', context=context)
base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url')
# the parameters to encode for the query and fragment part of url
query = {'db': cr.dbname}
diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py
index 8442891f3f9..dd5ebc8b48b 100644
--- a/addons/mail/mail_message.py
+++ b/addons/mail/mail_message.py
@@ -76,9 +76,9 @@ class mail_message(osv.Model):
# TDE note: regroup by model/ids, to have less queries to perform
result = dict.fromkeys(ids, False)
for message in self.read(cr, uid, ids, ['model', 'res_id'], context=context):
- if not message.get('model') or not message.get('res_id') or not self.pool.get(message['model']):
+ if not message.get('model') or not message.get('res_id') or message['model'] not in self.pool:
continue
- result[message['id']] = self.pool.get(message['model']).name_get(cr, SUPERUSER_ID, [message['res_id']], context=context)[0][1]
+ result[message['id']] = self.pool[message['model']].name_get(cr, SUPERUSER_ID, [message['res_id']], context=context)[0][1]
return result
def _get_to_read(self, cr, uid, ids, name, arg, context=None):
@@ -563,7 +563,7 @@ class mail_message(osv.Model):
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)
+ allowed_doc_ids = self.pool[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):
@@ -711,7 +711,7 @@ class mail_message(osv.Model):
model_record_ids = _generate_model_record_ids(message_values, other_ids)
document_related_ids = []
for model, doc_dict in model_record_ids.items():
- model_obj = self.pool.get(model)
+ model_obj = self.pool[model]
mids = model_obj.exists(cr, uid, doc_dict.keys())
if operation in ['create', 'write', 'unlink']:
model_obj.check_access_rights(cr, uid, 'write')
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py
index 778d7d53bd1..3c81af924e5 100644
--- a/addons/mail/mail_thread.py
+++ b/addons/mail/mail_thread.py
@@ -409,7 +409,7 @@ class mail_thread(osv.AbstractModel):
""" Used by the plugin addon, based for plugin_outlook and others. """
ret_dict = {}
for model_name in self.pool.obj_list():
- model = self.pool.get(model_name)
+ model = self.pool[model_name]
if 'mail.thread' in getattr(model, '_inherit', []):
ret_dict[model_name] = model._description
return ret_dict
@@ -478,12 +478,12 @@ class mail_thread(osv.AbstractModel):
if ref_match:
thread_id = int(ref_match.group(1))
model = ref_match.group(2) or model
- model_pool = self.pool.get(model)
- if thread_id and model and model_pool and model_pool.exists(cr, uid, thread_id) \
- and hasattr(model_pool, 'message_update'):
- _logger.debug('Routing mail with Message-Id %s: direct reply to model: %s, thread_id: %s, custom_values: %s, uid: %s',
- message_id, model, thread_id, custom_values, uid)
- return [(model, thread_id, custom_values, uid)]
+ if thread_id and model in self.pool:
+ model_obj = self.pool[model]
+ if model_obj.exists(cr, uid, thread_id) and hasattr(model_obj, 'message_update'):
+ _logger.debug('Routing mail with Message-Id %s: direct reply to model: %s, thread_id: %s, custom_values: %s, uid: %s',
+ message_id, model, thread_id, custom_values, uid)
+ return [(model, thread_id, custom_values, uid)]
# Verify whether this is a reply to a private message
if in_reply_to:
@@ -528,7 +528,7 @@ class mail_thread(osv.AbstractModel):
return routes
# 3. Fallback to the provided parameters, if they work
- model_pool = self.pool.get(model)
+ model_pool = self.pool[model]
if not thread_id:
# Legacy: fallback to matching [ID] in the Subject
match = tools.res_re.search(decode_header(message, 'Subject'))
@@ -611,7 +611,7 @@ class mail_thread(osv.AbstractModel):
if self._name == 'mail.thread':
context.update({'thread_model': model})
if model:
- model_pool = self.pool.get(model)
+ model_pool = self.pool[model]
assert thread_id and hasattr(model_pool, 'message_update') or hasattr(model_pool, 'message_new'), \
"Undeliverable mail with Message-Id %s, model %s does not accept incoming emails" % \
(msg['message_id'], model)
@@ -665,7 +665,7 @@ class mail_thread(osv.AbstractModel):
if isinstance(custom_values, dict):
data = custom_values.copy()
model = context.get('thread_model') or self._name
- model_pool = self.pool.get(model)
+ model_pool = self.pool[model]
fields = model_pool.fields_get(cr, uid, context=context)
if 'name' in fields and not data.get('name'):
data['name'] = msg_dict.get('subject', '')
@@ -942,7 +942,7 @@ class mail_thread(osv.AbstractModel):
model = context.get('thread_model', self._name) if self._name == 'mail.thread' else self._name
if model != self._name:
del context['thread_model']
- return self.pool.get(model).message_post(cr, uid, thread_id, body=body, subject=subject, type=type, subtype=subtype, parent_id=parent_id, attachments=attachments, context=context, content_subtype=content_subtype, **kwargs)
+ return self.pool[model].message_post(cr, uid, thread_id, body=body, subject=subject, type=type, subtype=subtype, parent_id=parent_id, attachments=attachments, context=context, content_subtype=content_subtype, **kwargs)
# 0: Parse email-from, try to find a better author_id based on document's followers for incoming emails
email_from = kwargs.get('email_from')
diff --git a/addons/mail/wizard/invite.py b/addons/mail/wizard/invite.py
index 2eb48f3d998..4ff6584d789 100644
--- a/addons/mail/wizard/invite.py
+++ b/addons/mail/wizard/invite.py
@@ -37,10 +37,10 @@ class invite_wizard(osv.osv_memory):
res_id = result.get('res_id')
if 'message' in fields and model and res_id:
ir_model = self.pool.get('ir.model')
- model_ids = ir_model.search(cr, uid, [('model', '=', self.pool.get(model)._name)], context=context)
+ model_ids = ir_model.search(cr, uid, [('model', '=', self.pool[model]._name)], context=context)
model_name = ir_model.name_get(cr, uid, model_ids, context=context)[0][1]
- document_name = self.pool.get(model).name_get(cr, uid, [res_id], context=context)[0][1]
+ document_name = self.pool[model].name_get(cr, uid, [res_id], context=context)[0][1]
message = _('Hello, %s invited you to follow %s document: %s. ') % (user_name, model_name, document_name)
result['message'] = message
elif 'message' in fields:
@@ -63,7 +63,7 @@ class invite_wizard(osv.osv_memory):
def add_followers(self, cr, uid, ids, context=None):
for wizard in self.browse(cr, uid, ids, context=context):
- model_obj = self.pool.get(wizard.res_model)
+ model_obj = self.pool[wizard.res_model]
document = model_obj.browse(cr, uid, wizard.res_id, context=context)
# filter partner_ids to get the new followers, to avoid sending email to already following partners
diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py
index 66e7149ac6d..b259135b7b7 100644
--- a/addons/mail/wizard/mail_compose_message.py
+++ b/addons/mail/wizard/mail_compose_message.py
@@ -174,7 +174,7 @@ class mail_compose_message(osv.TransientModel):
related to.
:param int res_id: id of the document record this mail is related to
"""
- doc_name_get = self.pool.get(model).name_get(cr, uid, [res_id], context=context)
+ doc_name_get = self.pool[model].name_get(cr, uid, [res_id], context=context)
if doc_name_get:
record_name = doc_name_get[0][1]
else:
@@ -231,7 +231,7 @@ class mail_compose_message(osv.TransientModel):
mass_mail_mode = wizard.composition_mode == 'mass_mail'
if mass_mail_mode: # mass mail: avoid any auto subscription because this could lead to people being follower of plenty of documents
context['mail_create_nosubscribe'] = True
- active_model_pool = self.pool.get(wizard.model if wizard.model else 'mail.thread')
+ active_model_pool = self.pool[wizard.model if wizard.model else 'mail.thread']
# wizard works in batch mode: [res_id] or active_ids
res_ids = active_ids if mass_mail_mode and wizard.model and active_ids else [wizard.res_id]
@@ -313,7 +313,7 @@ class mail_compose_message(osv.TransientModel):
exp = str(match.group()[2:-1]).strip()
result = eval(exp, {
'user': self.pool.get('res.users').browse(cr, uid, uid, context=context),
- 'object': self.pool.get(model).browse(cr, uid, res_id, context=context),
+ 'object': self.pool[model].browse(cr, uid, res_id, context=context),
'context': dict(context), # copy context to prevent side-effects of eval
})
return result and tools.ustr(result) or ''
diff --git a/addons/marketing_campaign/marketing_campaign.py b/addons/marketing_campaign/marketing_campaign.py
index dfa13259383..4aa340d7a14 100644
--- a/addons/marketing_campaign/marketing_campaign.py
+++ b/addons/marketing_campaign/marketing_campaign.py
@@ -165,7 +165,7 @@ Normal - the campaign runs normally and automatically sends all emails and repor
# dead code
def signal(self, cr, uid, model, res_id, signal, run_existing=True, context=None):
- record = self.pool.get(model).browse(cr, uid, res_id, context)
+ record = self.pool[model].browse(cr, uid, res_id, context)
return self._signal(cr, uid, record, signal, run_existing, context)
#dead code
@@ -228,7 +228,7 @@ Normal - the campaign runs normally and automatically sends all emails and repor
if unique_value:
if unique_field.ttype == 'many2one':
unique_value = unique_value.id
- similar_res_ids = self.pool.get(campaign_rec.object_id.model).search(cr, uid,
+ similar_res_ids = self.pool[campaign_rec.object_id.model].search(cr, uid,
[(unique_field.name, '=', unique_value)], context=context)
if similar_res_ids:
duplicate_workitem_domain = [('res_id','in', similar_res_ids),
@@ -349,7 +349,7 @@ class marketing_campaign_segment(osv.osv):
act_ids = self.pool.get('marketing.campaign.activity').search(cr,
uid, [('start', '=', True), ('campaign_id', '=', segment.campaign_id.id)], context=context)
- model_obj = self.pool.get(segment.object_id.model)
+ model_obj = self.pool[segment.object_id.model]
criteria = []
if segment.sync_last_date and segment.sync_mode != 'all':
criteria += [(segment.sync_mode, '>', segment.sync_last_date)]
@@ -594,7 +594,7 @@ class marketing_campaign_workitem(osv.osv):
if not wi.res_id:
continue
- proxy = self.pool.get(wi.object_id.model)
+ proxy = self.pool[wi.object_id.model]
if not proxy.exists(cr, uid, [wi.res_id]):
continue
ng = proxy.name_get(cr, uid, [wi.res_id], context=context)
@@ -628,7 +628,7 @@ class marketing_campaign_workitem(osv.osv):
for id, res_id, model in res:
workitem_map.setdefault(model,{}).setdefault(res_id,set()).add(id)
for model, id_map in workitem_map.iteritems():
- model_pool = self.pool.get(model)
+ model_pool = self.pool[model]
condition_name[0] = model_pool._rec_name
condition = [('id', 'in', id_map.keys()), condition_name]
for res_id in model_pool.search(cr, uid, condition, context=context):
@@ -676,7 +676,7 @@ class marketing_campaign_workitem(osv.osv):
return False
activity = workitem.activity_id
- proxy = self.pool.get(workitem.object_id.model)
+ proxy = self.pool[workitem.object_id.model]
object_id = proxy.browse(cr, uid, workitem.res_id, context=context)
eval_context = {
diff --git a/addons/pad/pad.py b/addons/pad/pad.py
index 90f5354054c..4cd9e91b76e 100644
--- a/addons/pad/pad.py
+++ b/addons/pad/pad.py
@@ -42,7 +42,7 @@ class pad_common(osv.osv_memory):
myPad.createPad(path)
#get attr on the field model
- model = self.pool.get(context["model"])
+ model = self.pool[context["model"]]
field = model._all_columns[context['field_name']]
real_field = field.column.pad_content_field
diff --git a/addons/plugin/plugin_handler.py b/addons/plugin/plugin_handler.py
index 0664af1c92e..b4b5064f2b1 100644
--- a/addons/plugin/plugin_handler.py
+++ b/addons/plugin/plugin_handler.py
@@ -57,7 +57,7 @@ class plugin_handler(osv.osv_memory):
res_id = msg.res_id
model = msg.model
url = self._make_url(cr, uid, res_id, model)
- name = self.pool.get(model).name_get(cr, uid, [res_id])[0][1]
+ name = self.pool[model].name_get(cr, uid, [res_id])[0][1]
return (model,res_id, url,name)
def document_type(self, cr, uid, context=None):
@@ -81,7 +81,7 @@ class plugin_handler(osv.osv_memory):
@return : the result of name_search a list of tuple
[(id, 'name')]
"""
- return self.pool.get(model).name_search(cr, uid, name)
+ return self.pool[model].name_search(cr, uid, name)
def push_message(self, cr, uid, model, email, res_id=0):
"""
@@ -91,7 +91,7 @@ class plugin_handler(osv.osv_memory):
@return Dictionary which contain model , url and resource id.
"""
mail_message = self.pool.get('mail.message')
- model_obj = self.pool.get(model)
+ model_obj = self.pool[model]
msg = self.pool.get('mail.thread').message_parse(cr, uid, email)
message_id = msg.get('message-id')
mail_ids = mail_message.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)])
diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py
index 7e8487b2b2b..5e680833dd6 100644
--- a/addons/point_of_sale/point_of_sale.py
+++ b/addons/point_of_sale/point_of_sale.py
@@ -1279,7 +1279,7 @@ class ean_wizard(osv.osv_memory):
ean13 = openerp.addons.product.product.sanitize_ean13(r.ean13_pattern)
m = context.get('active_model')
m_id = context.get('active_id')
- self.pool.get(m).write(cr,uid,[m_id],{'ean13':ean13})
+ self.pool[m].write(cr,uid,[m_id],{'ean13':ean13})
return { 'type' : 'ir.actions.act_window_close' }
class product_product(osv.osv):
diff --git a/addons/point_of_sale/wizard/pos_box.py b/addons/point_of_sale/wizard/pos_box.py
index 776d962a3a8..471153695f4 100644
--- a/addons/point_of_sale/wizard/pos_box.py
+++ b/addons/point_of_sale/wizard/pos_box.py
@@ -16,7 +16,7 @@ class PosBox(CashBox):
active_ids = context.get('active_ids', []) or []
if active_model == 'pos.session':
- records = self.pool.get(active_model).browse(cr, uid, active_ids, context=context)
+ records = self.pool[active_model].browse(cr, uid, active_ids, context=context)
bank_statements = [record.cash_register_id for record in records if record.cash_register_id]
if not bank_statements:
@@ -41,7 +41,7 @@ class PosBoxIn(PosBox):
active_ids = context.get('active_ids', []) or []
if active_model == 'pos.session':
- session = self.pool.get(active_model).browse(cr, uid, active_ids, context=context)[0]
+ session = self.pool[active_model].browse(cr, uid, active_ids, context=context)[0]
values['ref'] = session.name
return values
@@ -57,7 +57,7 @@ class PosBoxOut(PosBox):
active_ids = context.get('active_ids', []) or []
if active_model == 'pos.session':
- session = self.pool.get(active_model).browse(cr, uid, active_ids, context=context)[0]
+ session = self.pool[active_model].browse(cr, uid, active_ids, context=context)[0]
values['ref'] = session.name
return values
diff --git a/addons/portal/mail_mail.py b/addons/portal/mail_mail.py
index 3810ddd2540..bc982671bfe 100644
--- a/addons/portal/mail_mail.py
+++ b/addons/portal/mail_mail.py
@@ -45,7 +45,7 @@ class mail_mail(osv.Model):
and self.check_access_rights(cr, partner.user_ids[0].id, 'read', raise_exception=False):
related_user = partner.user_ids[0]
try:
- self.pool.get(mail.model).check_access_rule(cr, related_user.id, [mail.res_id], 'read', context=context)
+ self.pool[mail.model].check_access_rule(cr, related_user.id, [mail.res_id], 'read', context=context)
url = partner_obj._get_signup_url_for_action(cr, related_user.id, [partner.id], action='', res_id=mail.res_id, model=mail.model, context=context)[partner.id]
text = _("""Access this document directly in OpenERP""") % url
except except_orm, e:
diff --git a/addons/project/wizard/project_task_delegate.py b/addons/project/wizard/project_task_delegate.py
index bb15c62db1f..bbea5ce2d8f 100644
--- a/addons/project/wizard/project_task_delegate.py
+++ b/addons/project/wizard/project_task_delegate.py
@@ -125,7 +125,7 @@ class project_task_delegate(osv.osv_memory):
action_model, action_id = models_data.get_object_reference(cr, uid, 'project', 'action_view_task')
view_model, task_view_form_id = models_data.get_object_reference(cr, uid, 'project', 'view_task_form2')
view_model, task_view_tree_id = models_data.get_object_reference(cr, uid, 'project', 'view_task_tree2')
- action = self.pool.get(action_model).read(cr, uid, action_id, context=context)
+ action = self.pool[action_model].read(cr, uid, action_id, context=context)
action['res_id'] = delegated_tasks[task_id]
action['view_id'] = False
action['views'] = [(task_view_form_id, 'form'), (task_view_tree_id, 'tree')]
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 6258a18e399..7d73b0169ed 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -371,7 +371,7 @@ class purchase_order(osv.osv):
pick_ids += [picking.id for picking in po.picking_ids]
action_model, action_id = tuple(mod_obj.get_object_reference(cr, uid, 'stock', 'action_picking_tree4'))
- action = self.pool.get(action_model).read(cr, uid, action_id, context=context)
+ action = self.pool[action_model].read(cr, uid, action_id, context=context)
ctx = eval(action['context'])
ctx.update({
'search_default_purchase_id': ids[0]
diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py
index 429a1dc2f08..813a8a80e88 100644
--- a/addons/share/wizard/share_wizard.py
+++ b/addons/share/wizard/share_wizard.py
@@ -205,7 +205,7 @@ class share_wizard(osv.TransientModel):
raise osv.except_osv(_('No email address configured'),
_('You must configure your email address in the user preferences before using the Share button.'))
model, res_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'share', 'action_share_wizard_step1')
- action = self.pool.get(model).read(cr, uid, res_id, context=context)
+ action = self.pool[model].read(cr, uid, res_id, context=context)
action['res_id'] = ids[0]
action.pop('context', '')
return action
@@ -404,7 +404,7 @@ class share_wizard(osv.TransientModel):
local_rel_fields = []
models = [x[1].model for x in relation_fields]
model_obj = self.pool.get('ir.model')
- model_osv = self.pool.get(model.model)
+ model_osv = self.pool[model.model]
for colinfo in model_osv._all_columns.itervalues():
coldef = colinfo.column
coltype = coldef._type
@@ -412,7 +412,7 @@ class share_wizard(osv.TransientModel):
if coltype in ttypes and colinfo.column._obj not in models:
relation_model_id = model_obj.search(cr, UID_ROOT, [('model','=',coldef._obj)])[0]
relation_model_browse = model_obj.browse(cr, UID_ROOT, relation_model_id, context=context)
- relation_osv = self.pool.get(coldef._obj)
+ relation_osv = self.pool[coldef._obj]
if coltype == 'one2many':
# don't record reverse path if it's not a real m2o (that happens, but rarely)
dest_model_ci = relation_osv._all_columns
@@ -422,7 +422,7 @@ class share_wizard(osv.TransientModel):
local_rel_fields.append((relation_field, relation_model_browse))
for parent in relation_osv._inherits:
if parent not in models:
- parent_model = self.pool.get(parent)
+ parent_model = self.pool[parent]
parent_colinfos = parent_model._all_columns
parent_model_browse = model_obj.browse(cr, UID_ROOT,
model_obj.search(cr, UID_ROOT, [('model','=',parent)]))[0]
@@ -458,7 +458,7 @@ class share_wizard(osv.TransientModel):
"""
# obj0 class and its parents
obj0 = [(None, model)]
- model_obj = self.pool.get(model.model)
+ model_obj = self.pool[model.model]
ir_model_obj = self.pool.get('ir.model')
for parent in model_obj._inherits:
parent_model_browse = ir_model_obj.browse(cr, UID_ROOT,
@@ -777,7 +777,7 @@ class share_wizard(osv.TransientModel):
# Record id not found: issue
if res_id <= 0:
raise osv.except_osv(_('Record id not found'), _('The share engine has not been able to fetch a record_id for your invitation.'))
- self.pool.get(model.model).message_subscribe(cr, uid, [res_id], new_ids + existing_ids, context=context)
+ self.pool[model.model].message_subscribe(cr, uid, [res_id], new_ids + existing_ids, context=context)
# self.send_invite_email(cr, uid, wizard_data, context=context)
# self.send_invite_note(cr, uid, model.model, res_id, wizard_data, context=context)
@@ -823,7 +823,7 @@ class share_wizard(osv.TransientModel):
elif tmp_idx == len(wizard_data.result_line_ids)-2:
body += ' and'
body += '.'
- return self.pool.get(model_name).message_post(cr, uid, [res_id], body=body, context=context)
+ return self.pool[model_name].message_post(cr, uid, [res_id], body=body, context=context)
def send_invite_email(self, cr, uid, wizard_data, context=None):
# TDE Note: not updated because will disappear
diff --git a/addons/stock/wizard/stock_invoice_onshipping.py b/addons/stock/wizard/stock_invoice_onshipping.py
index 7c960c5e617..d742ede366d 100644
--- a/addons/stock/wizard/stock_invoice_onshipping.py
+++ b/addons/stock/wizard/stock_invoice_onshipping.py
@@ -39,7 +39,7 @@ class stock_invoice_onshipping(osv.osv_memory):
if not model or 'stock.picking' not in model:
return []
- model_pool = self.pool.get(model)
+ model_pool = self.pool[model]
journal_obj = self.pool.get('account.journal')
res_ids = context and context.get('active_ids', [])
vals = []
@@ -119,7 +119,7 @@ class stock_invoice_onshipping(osv.osv_memory):
elif inv_type == "in_refund":
action_model,action_id = data_pool.get_object_reference(cr, uid, 'account', "action_invoice_tree4")
if action_model:
- action_pool = self.pool.get(action_model)
+ action_pool = self.pool[action_model]
action = action_pool.read(cr, uid, action_id, context=context)
action['domain'] = "[('id','in', ["+','.join(map(str,invoice_ids))+"])]"
return action
diff --git a/addons/subscription/subscription.py b/addons/subscription/subscription.py
index 92bde135bc6..356ab78aadb 100644
--- a/addons/subscription/subscription.py
+++ b/addons/subscription/subscription.py
@@ -115,7 +115,7 @@ class subscription_subscription(osv.osv):
try:
(model_name, id) = row['doc_source'].split(',')
id = int(id)
- model = self.pool.get(model_name)
+ model = self.pool[model_name]
except:
raise osv.except_osv(_('Wrong Source Document !'), _('Please provide another source document.\nThis one does not exist !'))
@@ -136,7 +136,7 @@ class subscription_subscription(osv.osv):
# the subscription is over and we mark it as being done
if remaining == 1:
state = 'done'
- id = self.pool.get(model_name).copy(cr, uid, id, default, context)
+ id = self.pool[model_name].copy(cr, uid, id, default, context)
self.pool.get('subscription.subscription.history').create(cr, uid, {'subscription_id': row['id'], 'date':time.strftime('%Y-%m-%d %H:%M:%S'), 'document_id': model_name+','+str(id)})
self.write(cr, uid, [row['id']], {'state':state})
return True
diff --git a/addons/survey/wizard/survey_answer.py b/addons/survey/wizard/survey_answer.py
index 903937af441..a108388ac8e 100644
--- a/addons/survey/wizard/survey_answer.py
+++ b/addons/survey/wizard/survey_answer.py
@@ -402,9 +402,10 @@ class survey_question_wiz(osv.osv_memory):
sur_response_obj.write(cr, uid, [sur_name_read.response], {'state' : 'done'})
# mark the survey request as done; call 'survey_req_done' on its actual model
- survey_req_obj = self.pool.get(context.get('active_model'))
- if survey_req_obj and hasattr(survey_req_obj, 'survey_req_done'):
- survey_req_obj.survey_req_done(cr, uid, context.get('active_ids', []), context=context)
+ if context.get('active_model') in self.pool:
+ survey_req_obj = self.pool[context.get('active_model')]
+ if hasattr(survey_req_obj, 'survey_req_done'):
+ survey_req_obj.survey_req_done(cr, uid, context.get('active_ids', []), context=context)
if sur_rec.send_response:
survey_data = survey_obj.browse(cr, uid, survey_id)
@@ -609,10 +610,10 @@ class survey_question_wiz(osv.osv_memory):
survey_obj.write(cr, uid, survey_id, {'tot_start_survey' : sur_rec['tot_start_survey'] + 1})
if context.has_key('cur_id'):
if context.has_key('request') and context.get('request',False):
- self.pool.get(context.get('object',False)).write(cr, uid, [int(context.get('cur_id',False))], {'response' : response_id})
- self.pool.get(context.get('object',False)).survey_req_done(cr, uid, [int(context.get('cur_id'))], context)
+ self.pool[context.get('object')].write(cr, uid, [int(context.get('cur_id',False))], {'response' : response_id})
+ self.pool[context.get('object')].survey_req_done(cr, uid, [int(context.get('cur_id'))], context)
else:
- self.pool.get(context.get('object',False)).write(cr, uid, [int(context.get('cur_id',False))], {'response' : response_id})
+ self.pool[context.get('object')].write(cr, uid, [int(context.get('cur_id',False))], {'response' : response_id})
if sur_name_read['store_ans'] and type(safe_eval(sur_name_read['store_ans'])) == dict:
sur_name_read['store_ans'] = safe_eval(sur_name_read['store_ans'])
for key,val in sur_name_read['store_ans'].items():
|