[REF] ir.ir_{set,get,del}: removed openerp.ir:

- the three functions provided in openerp.ir are simple wrappers around ir_values
- it is easier to directly use ir_values than to keep this module around.

bzr revid: vmt@openerp.com-20110519122752-s3wwq4pwl8wlbori
This commit is contained in:
Vo Minh Thu 2011-05-19 14:27:52 +02:00
parent 261cb1079d
commit aa554efa57
5 changed files with 4 additions and 46 deletions

View File

@ -20,7 +20,6 @@
##############################################################################
import addons
import ir
import loglevels
import netsvc
import osv

View File

@ -24,7 +24,6 @@ import time
from operator import itemgetter
from osv import fields,osv
import ir
import netsvc
from osv.orm import except_orm, browse_record
import tools
@ -746,7 +745,8 @@ class ir_model_data(osv.osv):
cr.execute('select * from ir_values where model=%s and key=%s and name=%s'+where,(model, key, name))
res = cr.fetchone()
if not res:
res = ir.ir_set(cr, uid, key, key2, name, models, value, replace, isobject, meta)
ir_values_obj = pooler.get_pool(cr.dbname).get('ir.values')
res = ir_values_obj.set(cr, uid, key, key2, name, models, value, replace, isobject, meta)
elif xml_id:
cr.execute('UPDATE ir_values set value=%s WHERE model=%s and key=%s and name=%s'+where,(value, model, key, name))
return True

View File

@ -21,7 +21,6 @@
import time
import netsvc
from osv import fields, osv
import ir
from tools.misc import currency
from tools.translate import _

View File

@ -1,40 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import pickle
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):
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):
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):
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:

View File

@ -25,7 +25,6 @@ from openerp.tools.misc import UpdateableStr, UpdateableDict
from openerp.tools.translate import translate
from lxml import etree
import openerp.ir as ir
import openerp.pooler as pooler
from openerp.osv.osv import except_osv
@ -90,7 +89,8 @@ class interface(netsvc.Service):
arch = arch.string
# fetch user-set defaut values for the field... shouldn't we pass it the uid?
defaults = ir.ir_get(cr, uid, 'default', False, [('wizard.'+self.wiz_name, False)])
ir_values_obj = pooler.get_pool(cr.dbname).get('ir.values')
defaults = ir_values_obj.get(cr, uid, 'default', False, [('wizard.'+self.wiz_name, False)])
default_values = dict([(x[1], x[2]) for x in defaults])
for val in fields.keys():
if 'default' in fields[val]: