[MERGE] account, account_voucher: use get_object_reference instead on get_id everywhere( lp:~openerp-commiter/openobject-addons/trunk-dev-addons3-vth)
bzr revid: mra@mra-laptop-20101028120403-0yxkjyt5u3y5vhad
This commit is contained in:
commit
3735592e1f
|
@ -125,8 +125,8 @@ class account_installer(osv.osv_memory):
|
|||
obj_tax_fp = self.pool.get('account.fiscal.position.tax')
|
||||
obj_ac_fp = self.pool.get('account.fiscal.position.account')
|
||||
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'configurable_chart_template')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id']
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account', 'configurable_chart_template')
|
||||
id = result and result[1] or False
|
||||
obj_multi = obj_acc_chart_template.browse(cr, uid, id, context=context)
|
||||
|
||||
record = self.browse(cr, uid, ids, context=context)[0]
|
||||
|
@ -244,17 +244,18 @@ class account_installer(osv.osv_memory):
|
|||
}
|
||||
bank_account = obj_acc.create(cr, uid, b_vals, context=context)
|
||||
|
||||
|
||||
view_id_cash = obj_acc_journal_view.search(cr, uid, [('name', '=', 'Bank/Cash Journal View')], context=context)[0] #why fixed name here?
|
||||
view_id_cur = obj_acc_journal_view.search(cr, uid, [('name', '=', 'Bank/Cash Journal (Multi-Currency) View')], context=context)[0] #Why Fixed name here?
|
||||
|
||||
cash_result = mod_obj._get_id(cr, uid, 'account', 'conf_account_type_cash')
|
||||
cash_type_id = mod_obj.read(cr, uid, [cash_result], ['res_id'], context=context)[0]['res_id']
|
||||
cash_result = mod_obj.get_object_reference(cr, uid, 'account', 'conf_account_type_cash')
|
||||
cash_type_id = cash_result and cash_result[1] or False
|
||||
|
||||
bank_result = mod_obj._get_id(cr, uid, 'account', 'conf_account_type_bnk')
|
||||
bank_type_id = mod_obj.read(cr, uid, [bank_result], ['res_id'], context=context)[0]['res_id']
|
||||
bank_result = mod_obj.get_object_reference(cr, uid, 'account', 'conf_account_type_bnk')
|
||||
bank_type_id = bank_result and bank_result[1] or False
|
||||
|
||||
check_result = mod_obj._get_id(cr, uid, 'account', 'conf_account_type_chk')
|
||||
check_type_id = mod_obj.read(cr, uid, [check_result], ['res_id'], context=context)[0]['res_id']
|
||||
check_result = mod_obj.get_object_reference(cr, uid, 'account', 'conf_account_type_chk')
|
||||
check_type_id = check_result and check_result[1] or False
|
||||
|
||||
# record = self.browse(cr, uid, ids, context=context)[0]
|
||||
code_cnt = 1
|
||||
|
@ -559,8 +560,9 @@ class account_installer(osv.osv_memory):
|
|||
tax_val = {}
|
||||
default_tax = []
|
||||
|
||||
pur_temp_tax = mod_obj._get_id(cr, uid, 'account', 'tax_code_base_purchases')
|
||||
pur_temp_tax_id = mod_obj.read(cr, uid, [pur_temp_tax], ['res_id'], context=context)[0]['res_id']
|
||||
pur_temp_tax = mod_obj.get_object_reference(cr, uid, 'account', 'tax_code_base_purchases')
|
||||
pur_temp_tax_id = pur_temp_tax and pur_temp_tax[1] or False
|
||||
|
||||
pur_temp_tax_names = obj_temp_tax_code.read(cr, uid, [pur_temp_tax_id], ['name'], context=context)
|
||||
pur_tax_parent_name = pur_temp_tax_names and pur_temp_tax_names[0]['name'] or False
|
||||
pur_taxcode_parent_id = obj_tax_code.search(cr, uid, [('name', 'ilike', pur_tax_parent_name)], context=context)
|
||||
|
@ -568,9 +570,8 @@ class account_installer(osv.osv_memory):
|
|||
pur_taxcode_parent_id = pur_taxcode_parent_id[0]
|
||||
else:
|
||||
pur_taxcode_parent_id = False
|
||||
|
||||
pur_temp_tax_paid = mod_obj._get_id(cr, uid, 'account', 'tax_code_input')
|
||||
pur_temp_tax_paid_id = mod_obj.read(cr, uid, [pur_temp_tax_paid], ['res_id'], context=context)[0]['res_id']
|
||||
pur_temp_tax_paid = mod_obj.get_object_reference(cr, uid, 'account', 'tax_code_input')
|
||||
pur_temp_tax_paid_id = pur_temp_tax_paid and pur_temp_tax_paid[1] or False
|
||||
pur_temp_tax_paid_names = obj_temp_tax_code.read(cr, uid, [pur_temp_tax_paid_id], ['name'], context=context)
|
||||
pur_tax_paid_parent_name = pur_temp_tax_names and pur_temp_tax_paid_names[0]['name'] or False
|
||||
pur_taxcode_paid_parent_id = obj_tax_code.search(cr, uid, [('name', 'ilike', pur_tax_paid_parent_name)], context=context)
|
||||
|
@ -579,8 +580,8 @@ class account_installer(osv.osv_memory):
|
|||
else:
|
||||
pur_taxcode_paid_parent_id = False
|
||||
|
||||
sale_temp_tax = mod_obj._get_id(cr, uid, 'account', 'tax_code_base_sales')
|
||||
sale_temp_tax_id = mod_obj.read(cr, uid, [sale_temp_tax], ['res_id'], context=context)[0]['res_id']
|
||||
sale_temp_tax = mod_obj.get_object_reference(cr, uid, 'account', 'tax_code_base_sales')
|
||||
sale_temp_tax_id = sale_temp_tax and sale_temp_tax[1] or False
|
||||
sale_temp_tax_names = obj_temp_tax_code.read(cr, uid, [sale_temp_tax_id], ['name'], context=context)
|
||||
sale_tax_parent_name = sale_temp_tax_names and sale_temp_tax_names[0]['name'] or False
|
||||
sale_taxcode_parent_id = obj_tax_code.search(cr, uid, [('name', 'ilike', sale_tax_parent_name)], context=context)
|
||||
|
@ -589,8 +590,8 @@ class account_installer(osv.osv_memory):
|
|||
else:
|
||||
sale_taxcode_parent_id = False
|
||||
|
||||
sale_temp_tax_paid = mod_obj._get_id(cr, uid, 'account', 'tax_code_output')
|
||||
sale_temp_tax_paid_id = mod_obj.read(cr, uid, [sale_temp_tax_paid], ['res_id'], context=context)[0]['res_id']
|
||||
sale_temp_tax_paid = mod_obj.get_object_reference(cr, uid, 'account', 'tax_code_output')
|
||||
sale_temp_tax_paid_id = sale_temp_tax_paid and sale_temp_tax_paid[1] or False
|
||||
sale_temp_tax_paid_names = obj_temp_tax_code.read(cr, uid, [sale_temp_tax_paid_id], ['name'], context=context)
|
||||
sale_tax_paid_parent_name = sale_temp_tax_paid_names and sale_temp_tax_paid_names[0]['name'] or False
|
||||
sale_taxcode_paid_parent_id = obj_tax_code.search(cr, uid, [('name', 'ilike', sale_tax_paid_parent_name)], context=context)
|
||||
|
|
|
@ -35,8 +35,8 @@ class account_analytic_chart(osv.osv_memory):
|
|||
result_context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'action_account_analytic_account_tree2')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account', 'action_account_analytic_account_tree2')
|
||||
id = result and result[1] or False
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
if data['from_date']:
|
||||
|
|
|
@ -41,8 +41,8 @@ class project_account_analytic_line(osv.osv_memory):
|
|||
domain = [('date','>=',from_date)]
|
||||
elif to_date:
|
||||
domain = [('date','<=',to_date)]
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'view_account_analytic_line_filter')
|
||||
id = mod_obj.read(cr, uid, result, ['res_id'], context=context)
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account', 'view_account_analytic_line_filter')
|
||||
id = result and result[1] or False
|
||||
return {
|
||||
'name': _('Analytic Entries by line'),
|
||||
'view_type': 'form',
|
||||
|
|
|
@ -79,8 +79,8 @@ class account_chart(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'action_account_tree')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id']
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account', 'action_account_tree')
|
||||
id = result and result[1] or False
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
result['periods'] = []
|
||||
if data['period_from'] and data['period_to']:
|
||||
|
|
|
@ -202,8 +202,8 @@ class account_invoice_refund(osv.osv_memory):
|
|||
xml_id = 'action_invoice_tree3'
|
||||
else:
|
||||
xml_id = 'action_invoice_tree4'
|
||||
result = mod_obj._get_id(cr, uid, 'account', xml_id)
|
||||
id = mod_obj.read(cr, uid, result, ['res_id'], context=context)['res_id']
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account', xml_id)
|
||||
id = result and result[1] or False
|
||||
result = act_obj.read(cr, uid, id, context=context)
|
||||
invoice_domain = eval(result['domain'])
|
||||
invoice_domain.append(('id', 'in', created_inv))
|
||||
|
|
|
@ -34,8 +34,8 @@ class account_journal_select(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'action_move_line_select')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account', 'action_move_line_select')
|
||||
id = result and result[1] or False
|
||||
result = act_obj.read(cr, uid, [id])[0]
|
||||
cr.execute('select journal_id, period_id from account_journal_period where id=%s', (context['active_id'],))
|
||||
res = cr.fetchone()
|
||||
|
|
|
@ -160,8 +160,8 @@ class account_move_journal(osv.osv_memory):
|
|||
period = period_pool.browse(cr, uid, ids[0], context=context)
|
||||
name = (period.journal_id.code or '') + ':' + (period.period_id.code or '')
|
||||
|
||||
result = data_pool._get_id(cr, uid, 'account', 'view_account_move_line_filter')
|
||||
res_id = data_pool.browse(cr, uid, result, context=context).res_id
|
||||
result = data_pool.get_object_reference(cr, uid, 'account', 'view_account_move_line_filter')
|
||||
res_id = result and result[1] or False
|
||||
|
||||
return {
|
||||
'name': name,
|
||||
|
|
|
@ -51,8 +51,8 @@ class account_move_line_select(osv.osv_memory):
|
|||
period_ids.append(period.id)
|
||||
domain = str(('period_id', 'in', period_ids))
|
||||
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'action_move_line_tree1')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account', 'action_move_line_tree1')
|
||||
id = result and result[1] or False
|
||||
result = act_obj.read(cr, uid, [id])[0]
|
||||
result['context'] = {
|
||||
'fiscalyear': False,
|
||||
|
|
|
@ -42,8 +42,8 @@ class account_subscription_generate(osv.osv_memory):
|
|||
line_ids = map(lambda x: x[0], cr.fetchall())
|
||||
moves = self.pool.get('account.subscription.line').move_create(cr, uid, line_ids, context=context)
|
||||
moves_created.extend(moves)
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'action_move_line_form')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id']
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account', 'action_move_line_form')
|
||||
id = result and result[1] or False
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
result['domain'] = str([('id','in',moves_created)])
|
||||
return result
|
||||
|
|
|
@ -54,8 +54,8 @@ class account_tax_chart(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'action_tax_code_tree')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id']
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account', 'action_tax_code_tree')
|
||||
id = result and result[1] or False
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
if data['period_id']:
|
||||
fiscalyear_id = period_obj.read(cr, uid, [data['period_id']], context=context)[0]['fiscalyear_id'][0]
|
||||
|
|
|
@ -118,10 +118,10 @@ class account_voucher(osv.osv):
|
|||
if not view_id and context.get('invoice_type', False):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
if context.get('invoice_type') in ('out_invoice', 'out_refund'):
|
||||
result = mod_obj._get_id(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
|
||||
else:
|
||||
result = mod_obj._get_id(cr, uid, 'account_voucher', 'view_vendor_payment_form')
|
||||
result = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id']
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form')
|
||||
result = result and result[1] or False
|
||||
view_id = result
|
||||
res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
|
||||
doc = etree.XML(res['arch'])
|
||||
|
|
Loading…
Reference in New Issue