[REF] consistent, grepable ir.values object naming.
bzr revid: vmt@openerp.com-20110516150534-2524fn6587jir72m
This commit is contained in:
parent
f99e8db427
commit
a931e398bf
|
@ -177,13 +177,13 @@ class ir_ui_menu(osv.osv):
|
|||
|
||||
def _action(self, cursor, user, ids, name, arg, context=None):
|
||||
res = {}
|
||||
values_obj = self.pool.get('ir.values')
|
||||
value_ids = values_obj.search(cursor, user, [
|
||||
ir_values_obj = self.pool.get('ir.values')
|
||||
value_ids = ir_values_obj.search(cursor, user, [
|
||||
('model', '=', self._name), ('key', '=', 'action'),
|
||||
('key2', '=', 'tree_but_open'), ('res_id', 'in', ids)],
|
||||
context=context)
|
||||
values_action = {}
|
||||
for value in values_obj.browse(cursor, user, value_ids, context=context):
|
||||
for value in ir_values_obj.browse(cursor, user, value_ids, context=context):
|
||||
values_action[value.res_id] = value.value
|
||||
for menu_id in ids:
|
||||
res[menu_id] = values_action.get(menu_id, False)
|
||||
|
@ -195,16 +195,16 @@ class ir_ui_menu(osv.osv):
|
|||
ctx = context.copy()
|
||||
if self.CONCURRENCY_CHECK_FIELD in ctx:
|
||||
del ctx[self.CONCURRENCY_CHECK_FIELD]
|
||||
values_obj = self.pool.get('ir.values')
|
||||
values_ids = values_obj.search(cursor, user, [
|
||||
ir_values_obj = self.pool.get('ir.values')
|
||||
values_ids = ir_values_obj.search(cursor, user, [
|
||||
('model', '=', self._name), ('key', '=', 'action'),
|
||||
('key2', '=', 'tree_but_open'), ('res_id', '=', menu_id)],
|
||||
context=context)
|
||||
if values_ids:
|
||||
values_obj.write(cursor, user, values_ids, {'value': value},
|
||||
ir_values_obj.write(cursor, user, values_ids, {'value': value},
|
||||
context=ctx)
|
||||
else:
|
||||
values_obj.create(cursor, user, {
|
||||
ir_values_obj.create(cursor, user, {
|
||||
'name': 'Menuitem',
|
||||
'model': self._name,
|
||||
'value': value,
|
||||
|
|
|
@ -41,12 +41,12 @@ class lang(osv.osv):
|
|||
if not lang:
|
||||
return False
|
||||
lang_ids = self.search(cr, uid, [('code','=', lang)])
|
||||
values_obj = self.pool.get('ir.values')
|
||||
ir_values_obj = self.pool.get('ir.values')
|
||||
if not lang_ids:
|
||||
lang_id = self.load_lang(cr, uid, lang)
|
||||
default_value = values_obj.get(cr, uid, 'default', False, 'res.partner')
|
||||
default_value = ir_values_obj.get(cr, uid, 'default', False, 'res.partner')
|
||||
if not default_value:
|
||||
values_obj.set(cr, uid, 'default', False, 'lang', ['res.partner'], lang)
|
||||
ir_values_obj.set(cr, uid, 'default', False, 'lang', ['res.partner'], lang)
|
||||
return True
|
||||
|
||||
def load_lang(self, cr, uid, lang, lang_name=None):
|
||||
|
|
|
@ -24,16 +24,16 @@ import openerp.osv as osv
|
|||
import openerp.pooler as pooler
|
||||
|
||||
def ir_set(cr, uid, key, key2, name, models, value, replace=True, isobject=False, meta=None):
|
||||
obj = pooler.get_pool(cr.dbname).get('ir.values')
|
||||
return obj.set(cr, uid, key, key2, name, models, value, replace, isobject, meta)
|
||||
ir_values_obj = pooler.get_pool(cr.dbname).get('ir.values')
|
||||
return ir_values_obj.set(cr, uid, key, key2, name, models, value, replace, isobject, meta)
|
||||
|
||||
def ir_del(cr, uid, id):
|
||||
obj = pooler.get_pool(cr.dbname).get('ir.values')
|
||||
return obj.unlink(cr, uid, [id])
|
||||
ir_values_obj = pooler.get_pool(cr.dbname).get('ir.values')
|
||||
return ir_values_obj.unlink(cr, uid, [id])
|
||||
|
||||
def ir_get(cr, uid, key, key2, models, meta=False, context=None, res_id_req=False):
|
||||
obj = pooler.get_pool(cr.dbname).get('ir.values')
|
||||
res = obj.get(cr, uid, key, key2, models, meta=meta, context=context, res_id_req=res_id_req)
|
||||
ir_values_obj = pooler.get_pool(cr.dbname).get('ir.values')
|
||||
res = ir_values_obj.get(cr, uid, key, key2, models, meta=meta, context=context, res_id_req=res_id_req)
|
||||
return res
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -3229,7 +3229,7 @@ class orm(orm_template):
|
|||
|
||||
self.check_access_rule(cr, uid, ids, 'unlink', context=context)
|
||||
pool_model_data = self.pool.get('ir.model.data')
|
||||
pool_ir_values = self.pool.get('ir.values')
|
||||
ir_values_obj = self.pool.get('ir.values')
|
||||
for sub_ids in cr.split_for_in_conditions(ids):
|
||||
cr.execute('delete from ' + self._table + ' ' \
|
||||
'where id IN %s', (sub_ids,))
|
||||
|
@ -3242,11 +3242,11 @@ class orm(orm_template):
|
|||
pool_model_data.unlink(cr, uid, referenced_ids, context=context)
|
||||
|
||||
# For the same reason, removing the record relevant to ir_values
|
||||
ir_value_ids = pool_ir_values.search(cr, uid,
|
||||
ir_value_ids = ir_values_obj.search(cr, uid,
|
||||
['|',('value','in',['%s,%s' % (self._name, sid) for sid in sub_ids]),'&',('res_id','in',list(sub_ids)),('model','=',self._name)],
|
||||
context=context)
|
||||
if ir_value_ids:
|
||||
pool_ir_values.unlink(cr, uid, ir_value_ids, context=context)
|
||||
ir_values_obj.unlink(cr, uid, ir_value_ids, context=context)
|
||||
|
||||
for order, object, store_ids, fields in result_store:
|
||||
if object != self._name:
|
||||
|
|
|
@ -304,9 +304,10 @@ form: module.record_id""" % (xml_id,)
|
|||
self.pool.get('ir.model.data')._unlink(cr, self.uid, d_model, ids)
|
||||
|
||||
def _remove_ir_values(self, cr, name, value, model):
|
||||
ir_value_ids = self.pool.get('ir.values').search(cr, self.uid, [('name','=',name),('value','=',value),('model','=',model)])
|
||||
ir_values_obj = self.pool.get('ir.values')
|
||||
ir_value_ids = ir_values_obj.search(cr, self.uid, [('name','=',name),('value','=',value),('model','=',model)])
|
||||
if ir_value_ids:
|
||||
self.pool.get('ir.values').unlink(cr, self.uid, ir_value_ids)
|
||||
ir_values_obj.unlink(cr, self.uid, ir_value_ids)
|
||||
self.pool.get('ir.model.data')._unlink(cr, self.uid, 'ir.values', ir_value_ids)
|
||||
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue