From e2f6088ea705d2ba61da0f3628af90bc438c178f Mon Sep 17 00:00:00 2001 From: "nch@tinyerp.com" <> Date: Thu, 13 May 2010 12:33:39 +0530 Subject: [PATCH] [IMP]:configurable acc & tax chart bzr revid: nch@tinyerp.com-20100513070339-6l3dds3jpmvo4wu9 --- addons/account/configurable_account_chart.xml | 2 +- addons/account/installer.py | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/addons/account/configurable_account_chart.xml b/addons/account/configurable_account_chart.xml index 73cb4499e20..658cf2907af 100644 --- a/addons/account/configurable_account_chart.xml +++ b/addons/account/configurable_account_chart.xml @@ -162,7 +162,7 @@ 1105 Cash - other + view diff --git a/addons/account/installer.py b/addons/account/installer.py index 1cbed3cd2a7..de557cd51a0 100644 --- a/addons/account/installer.py +++ b/addons/account/installer.py @@ -396,6 +396,7 @@ class account_installer(osv.osv_memory): company_id = self.pool.get('res.users').browse(cr,uid,[uid],context)[0].company_id for res in self.read(cr,uid,ids): if record.charts == 'configurable': + mod_obj = self.pool.get('ir.model.data') fp = tools.file_open(opj('account','configurable_account_chart.xml')) tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None) fp.close() @@ -407,12 +408,20 @@ class account_installer(osv.osv_memory): p_tax = (res.get('purchase_tax',0.0))/100 tax_val = {} default_tax = [] + + pur_tax_parent = mod_obj._get_id(cr, uid, 'account', 'vat_code_base_purchases') + pur_tax_parent_id = mod_obj.read(cr, uid, [pur_tax_parent], ['res_id'])[0]['res_id'] + + sal_tax_parent = mod_obj._get_id(cr, uid, 'account', 'vat_code_base_sales') + sal_tax_parent_id = mod_obj.read(cr, uid, [sal_tax_parent], ['res_id'])[0]['res_id'] + if s_tax*100 > 0.0: vals_tax_code = { 'name': 'VAT%s%%'%(s_tax*100), 'code': 'VAT%s%%'%(s_tax*100), 'company_id': company_id.id, 'sign': 1, + 'parent_id':sal_tax_parent_id } new_tax_code = self.pool.get('account.tax.code').create(cr,uid,vals_tax_code) sales_tax = obj_tax.create(cr, uid, @@ -420,7 +429,8 @@ class account_installer(osv.osv_memory): 'description':'VAT%s%%'%(s_tax*100), 'amount':s_tax, 'base_code_id':new_tax_code, - 'tax_code_id':new_tax_code + 'tax_code_id':new_tax_code, + 'type_tax_use':'sale' }) tax_val.update({'taxes_id':[(6,0,[sales_tax])]}) default_tax.append(('taxes_id',sales_tax)) @@ -430,6 +440,7 @@ class account_installer(osv.osv_memory): 'code': 'VAT%s%%'%(p_tax*100), 'company_id': company_id.id, 'sign': 1, + 'parent_id':pur_tax_parent_id } new_tax_code = self.pool.get('account.tax.code').create(cr,uid,vals_tax_code) purchase_tax = obj_tax.create(cr, uid, @@ -437,7 +448,8 @@ class account_installer(osv.osv_memory): 'description':'VAT%s%%'%(p_tax*100), 'amount':p_tax, 'base_code_id':new_tax_code, - 'tax_code_id':new_tax_code + 'tax_code_id':new_tax_code, + 'type_tax_use':'purchase' }) tax_val.update({'supplier_taxes_id':[(6,0,[purchase_tax])]}) default_tax.append(('supplier_taxes_id',purchase_tax))