[REF] consistent, grepable ir.values object naming.

bzr revid: vmt@openerp.com-20110516153331-vusrrgr3hvlcyei0
This commit is contained in:
Vo Minh Thu 2011-05-16 17:33:31 +02:00
parent a931e398bf
commit a37a4404fb
6 changed files with 15 additions and 10 deletions

View File

@ -2686,7 +2686,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
analytic_journal_obj = self.pool.get('account.analytic.journal') analytic_journal_obj = self.pool.get('account.analytic.journal')
obj_tax_code = self.pool.get('account.tax.code') obj_tax_code = self.pool.get('account.tax.code')
obj_tax_code_template = self.pool.get('account.tax.code.template') obj_tax_code_template = self.pool.get('account.tax.code.template')
ir_values = self.pool.get('ir.values') ir_values_obj = self.pool.get('ir.values')
# Creating Account # Creating Account
obj_acc_root = obj_multi.chart_template_id.account_root_id obj_acc_root = obj_multi.chart_template_id.account_root_id
tax_code_root_id = obj_multi.chart_template_id.tax_code_root_id.id tax_code_root_id = obj_multi.chart_template_id.tax_code_root_id.id
@ -3022,10 +3022,10 @@ class wizard_multi_charts_accounts(osv.osv_memory):
obj_ac_fp.create(cr, uid, vals_acc) obj_ac_fp.create(cr, uid, vals_acc)
if obj_multi.sale_tax: if obj_multi.sale_tax:
ir_values.set(cr, uid, key='default', key2=False, name="taxes_id", company=obj_multi.company_id.id, ir_values_obj.set(cr, uid, key='default', key2=False, name="taxes_id", company=obj_multi.company_id.id,
models =[('product.product',False)], value=[tax_template_to_tax[obj_multi.sale_tax.id]]) models =[('product.product',False)], value=[tax_template_to_tax[obj_multi.sale_tax.id]])
if obj_multi.purchase_tax: if obj_multi.purchase_tax:
ir_values.set(cr, uid, key='default', key2=False, name="supplier_taxes_id", company=obj_multi.company_id.id, ir_values_obj.set(cr, uid, key='default', key2=False, name="supplier_taxes_id", company=obj_multi.company_id.id,
models =[('product.product',False)], value=[tax_template_to_tax[obj_multi.purchase_tax.id]]) models =[('product.product',False)], value=[tax_template_to_tax[obj_multi.purchase_tax.id]])
wizard_multi_charts_accounts() wizard_multi_charts_accounts()

View File

@ -549,7 +549,8 @@ class account_invoice(osv.osv):
journal_ids = obj_journal.search(cr, uid, [('company_id','=',company_id), ('type', '=', journal_type)]) journal_ids = obj_journal.search(cr, uid, [('company_id','=',company_id), ('type', '=', journal_type)])
if journal_ids: if journal_ids:
val['journal_id'] = journal_ids[0] val['journal_id'] = journal_ids[0]
res_journal_default = self.pool.get('ir.values').get(cr, uid, 'default', 'type=%s' % (type), ['account.invoice']) ir_values_obj = self.pool.get('ir.values')
res_journal_default = ir_values_obj.get(cr, uid, 'default', 'type=%s' % (type), ['account.invoice'])
for r in res_journal_default: for r in res_journal_default:
if r[1] == 'journal_id' and r[2] in journal_ids: if r[1] == 'journal_id' and r[2] in journal_ids:
val['journal_id'] = r[2] val['journal_id'] = r[2]

View File

@ -75,7 +75,8 @@ class account_sequence_installer(osv.osv_memory):
j_ids.append(journal.id) j_ids.append(journal.id)
if j_ids: if j_ids:
jou_obj.write(cr, uid, j_ids, {'internal_sequence_id': ir_seq}) jou_obj.write(cr, uid, j_ids, {'internal_sequence_id': ir_seq})
self.pool.get('ir.values').set(cr, uid, key='default', key2=False, name='internal_sequence_id', models =[('account.journal', False)], value=ir_seq) ir_values_obj = self.pool.get('ir.values')
ir_values_obj.set(cr, uid, key='default', key2=False, name='internal_sequence_id', models =[('account.journal', False)], value=ir_seq)
return res return res
account_sequence_installer() account_sequence_installer()

View File

@ -105,7 +105,7 @@ class audittrail_rule(osv.osv):
@return: True @return: True
""" """
obj_action = self.pool.get('ir.actions.act_window') obj_action = self.pool.get('ir.actions.act_window')
val_obj = self.pool.get('ir.values') ir_values_obj = self.pool.get('ir.values')
value='' value=''
#start Loop #start Loop
for thisrule in self.browse(cr, uid, ids): for thisrule in self.browse(cr, uid, ids):
@ -116,7 +116,7 @@ class audittrail_rule(osv.osv):
if w_id: if w_id:
obj_action.unlink(cr, uid, w_id) obj_action.unlink(cr, uid, w_id)
value = "ir.actions.act_window" + ',' + str(w_id[0]) value = "ir.actions.act_window" + ',' + str(w_id[0])
val_id = val_obj.search(cr, uid, [('model', '=', thisrule.object_id.model), ('value', '=', value)]) val_id = ir_values_obj.search(cr, uid, [('model', '=', thisrule.object_id.model), ('value', '=', value)])
if val_id: if val_id:
res = ir.ir_del(cr, uid, val_id[0]) res = ir.ir_del(cr, uid, val_id[0])
self.write(cr, uid, [thisrule.id], {"state": "draft"}) self.write(cr, uid, [thisrule.id], {"state": "draft"})

View File

@ -280,7 +280,8 @@ This is useful for CRM leads for example"),
'target': 'new', 'target': 'new',
'auto_refresh':1 'auto_refresh':1
}, context) }, context)
vals['ref_ir_value'] = self.pool.get('ir.values').create(cr, uid, { ir_values_obj = self.pool.get('ir.values')
vals['ref_ir_value'] = ir_values_obj.create(cr, uid, {
'name': _('Send Mail (%s)') % template_obj.name, 'name': _('Send Mail (%s)') % template_obj.name,
'model': src_obj, 'model': src_obj,
'key2': 'client_action_multi', 'key2': 'client_action_multi',
@ -299,7 +300,8 @@ This is useful for CRM leads for example"),
if template.ref_ir_act_window: if template.ref_ir_act_window:
self.pool.get('ir.actions.act_window').unlink(cr, uid, template.ref_ir_act_window.id, context) self.pool.get('ir.actions.act_window').unlink(cr, uid, template.ref_ir_act_window.id, context)
if template.ref_ir_value: if template.ref_ir_value:
self.pool.get('ir.values').unlink(cr, uid, template.ref_ir_value.id, context) ir_values_obj = self.pool.get('ir.values')
ir_values_obj.unlink(cr, uid, template.ref_ir_value.id, context)
except: except:
raise osv.except_osv(_("Warning"), _("Deletion of Record failed")) raise osv.except_osv(_("Warning"), _("Deletion of Record failed"))

View File

@ -66,7 +66,8 @@ class report_webkit_actions(osv.osv_memory):
context.get('active_id'), context.get('active_id'),
context=context context=context
) )
ids = self.pool.get('ir.values').search( ir_values_obj = self.pool.get('ir.values')
ids = ir_values_obj.search(
cr, cr,
uid, uid,
[('value','=',report.type+','+str(context.get('active_id')))] [('value','=',report.type+','+str(context.get('active_id')))]