From 96b8b110c7e7b84f757e5f8ab794c611dce20713 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 27 Jul 2011 18:23:50 +0530 Subject: [PATCH 01/10] [ADD] account: l10n_multilang:Add Translation from Source object account.tax.code.template to Destination object account.tax.code bzr revid: ron@tinyerp.com-20110727125350-r0acre34pqmxh1uz --- addons/l10n_multilang/l10n_multilang.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/l10n_multilang/l10n_multilang.py b/addons/l10n_multilang/l10n_multilang.py index ff2fd541bcb..bb860b13184 100644 --- a/addons/l10n_multilang/l10n_multilang.py +++ b/addons/l10n_multilang/l10n_multilang.py @@ -90,11 +90,16 @@ class wizard_multi_charts_accounts(osv.osv_memory): obj_mod = self.pool.get('ir.module.module') obj_acc_template = self.pool.get('account.account.template') obj_acc = self.pool.get('account.account') + obj_tax_code_template = self.pool.get('account.tax.code.template') + obj_tax_code = self.pool.get('account.tax.code') + resource_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'l10n_multilang', 'view_translate_message_wizard') company_id = obj_multi.company_id.id acc_template_root_id = obj_multi.chart_template_id.account_root_id.id acc_root_id = obj_acc.search(cr, uid, [('company_id', '=', company_id), ('parent_id', '=', None)])[0] + tax_code_template_root_id = obj_multi.chart_template_id.tax_code_root_id.id + tax_code_root_id = obj_tax_code.search(cr, uid, [('company_id', '=', company_id), ('parent_id', '=', None)])[0] # load languages langs = [] @@ -110,6 +115,11 @@ class wizard_multi_charts_accounts(osv.osv_memory): out_ids = obj_acc.search(cr, uid, [('id', 'child_of', [acc_root_id])], order='id')[1:] warn_msg += self.copy_translations(cr, uid, langs, obj_acc_template, 'name', in_ids, obj_acc, out_ids) + # copy account.tax.code translations + in_ids = obj_tax_code_template.search(cr, uid, [('id', 'child_of', [tax_code_template_root_id])], order='id')[1:] + out_ids = obj_tax_code.search(cr, uid, [('id', 'child_of', [tax_code_root_id])], order='id')[1:] + warn_msg += self.copy_translations(cr, uid, langs, obj_tax_code_template, 'name', in_ids, obj_tax_code, out_ids) + #open new wizard its for displaying warning message if warn_msg: res_id = self.pool.get('translate.message').create(cr, uid, {'message': warn_msg}) From dc9ce6d3c756e0679e95ebf9cbab037ab0de44d3 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Thu, 28 Jul 2011 15:22:58 +0530 Subject: [PATCH 02/10] [ADD] account: l10n_multilang:Add Translation from Source object account.tax.template to Destination object account.tax bzr revid: ron@tinyerp.com-20110728095258-t54nc1k1ciwj6lr0 --- addons/l10n_multilang/l10n_multilang.py | 7 +++++ addons/l10n_multilang/l10n_multilang_test.xml | 29 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/addons/l10n_multilang/l10n_multilang.py b/addons/l10n_multilang/l10n_multilang.py index e7984da075e..5ce90e56dde 100644 --- a/addons/l10n_multilang/l10n_multilang.py +++ b/addons/l10n_multilang/l10n_multilang.py @@ -98,6 +98,8 @@ class wizard_multi_charts_accounts(osv.osv_memory): obj_acc = self.pool.get('account.account') obj_tax_code_template = self.pool.get('account.tax.code.template') obj_tax_code = self.pool.get('account.tax.code') + obj_tax_template = self.pool.get('account.tax.template') + obj_tax = self.pool.get('account.tax') resource_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'l10n_multilang', 'view_translate_message_wizard') @@ -126,6 +128,11 @@ class wizard_multi_charts_accounts(osv.osv_memory): out_ids = obj_tax_code.search(cr, uid, [('id', 'child_of', [tax_code_root_id])], order='id')[1:] warn_msg += self.copy_translations(cr, uid, langs, obj_tax_code_template, 'name', in_ids, obj_tax_code, out_ids) + # copy account.tax translations + in_ids = sorted([x.id for x in obj_multi.chart_template_id.tax_template_ids]) + out_ids = obj_tax.search(cr, uid, [('company_id', '=', company_id)], order='id') + warn_msg += self.copy_translations(cr, uid, langs, obj_tax_template, 'name', in_ids, obj_tax, out_ids) + #open new wizard its for displaying warning message if warn_msg: res_id = self.pool.get('translate.message').create(cr, uid, {'message': warn_msg}) diff --git a/addons/l10n_multilang/l10n_multilang_test.xml b/addons/l10n_multilang/l10n_multilang_test.xml index e813ac1a8b5..b868736002e 100644 --- a/addons/l10n_multilang/l10n_multilang_test.xml +++ b/addons/l10n_multilang/l10n_multilang_test.xml @@ -148,6 +148,35 @@ + + + 10 + VAT-OUT-21-S + VAT 21% + 0.21 + percent + + + + + + 12 + VAT-OUT-4-S + VAT 4% + 0.4 + percent + + + + + 12 + VAT-OUT-12-S + VAT 12% + 0.12 + percent + + + From e51402e60ac65a63b17a5adebf8d797d4490758e Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Thu, 28 Jul 2011 17:11:14 +0530 Subject: [PATCH 03/10] [ADD] account: l10n_multilang:Add Translation from Source object account.fiscal.position.template to Destination object account.fiscal.position bzr revid: ron@tinyerp.com-20110728114114-fnrq019gatadle14 --- addons/l10n_multilang/l10n_multilang.py | 7 +++++++ addons/l10n_multilang/l10n_multilang_test.xml | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/addons/l10n_multilang/l10n_multilang.py b/addons/l10n_multilang/l10n_multilang.py index 5ce90e56dde..3e70ad8c784 100644 --- a/addons/l10n_multilang/l10n_multilang.py +++ b/addons/l10n_multilang/l10n_multilang.py @@ -100,6 +100,8 @@ class wizard_multi_charts_accounts(osv.osv_memory): obj_tax_code = self.pool.get('account.tax.code') obj_tax_template = self.pool.get('account.tax.template') obj_tax = self.pool.get('account.tax') + obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') + obj_fiscal_position = self.pool.get('account.fiscal.position') resource_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'l10n_multilang', 'view_translate_message_wizard') @@ -133,6 +135,11 @@ class wizard_multi_charts_accounts(osv.osv_memory): out_ids = obj_tax.search(cr, uid, [('company_id', '=', company_id)], order='id') warn_msg += self.copy_translations(cr, uid, langs, obj_tax_template, 'name', in_ids, obj_tax, out_ids) + # copy account.fiscal.position translations + in_ids = obj_fiscal_position_template.search(cr, uid, [('chart_template_id', '=', obj_multi.chart_template_id.id)], order='id') + out_ids = obj_fiscal_position.search(cr, uid, [('company_id', '=', company_id)], order='id') + warn_msg += self.copy_translations(cr, uid, langs, obj_fiscal_position_template, 'name', in_ids, obj_fiscal_position, out_ids) + #open new wizard its for displaying warning message if warn_msg: res_id = self.pool.get('translate.message').create(cr, uid, {'message': warn_msg}) diff --git a/addons/l10n_multilang/l10n_multilang_test.xml b/addons/l10n_multilang/l10n_multilang_test.xml index b868736002e..d940d1ac9bd 100644 --- a/addons/l10n_multilang/l10n_multilang_test.xml +++ b/addons/l10n_multilang/l10n_multilang_test.xml @@ -177,6 +177,22 @@ + + + National Regime + + + + + Intra Community Regime + + + + + Extra Community Regime + + + From 85c377915c0cdd78f72518b70e824b1b724f4e1a Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Fri, 29 Jul 2011 11:48:53 +0530 Subject: [PATCH 04/10] [ADD]: account: l10n fullness and inheritancy:1)Add visible field on account chart template 2)Add a domain on the config wizard to display only where this visible is True bzr revid: ron@tinyerp.com-20110729061853-l38k6rv5rz5no4wk --- addons/account/account.py | 16 +++++++++++++--- addons/account/account_view.xml | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 09e61a8325a..8b5473ae9e0 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2476,6 +2476,7 @@ class account_chart_template(osv.osv): _columns={ 'name': fields.char('Name', size=64, required=True), 'parent_id': fields.many2one('account.chart.template', 'Parent Chart Template'), + 'visible': fields.boolean('Can be Visible'), 'account_root_id': fields.many2one('account.account.template', 'Root Account', domain=[('parent_id','=',False)]), 'tax_code_root_id': fields.many2one('account.tax.code.template', 'Root Tax Code', domain=[('parent_id','=',False)]), 'tax_template_ids': fields.one2many('account.tax.template', 'chart_template_id', 'Tax Template List', help='List of all the taxes that have to be installed by the wizard'), @@ -2667,7 +2668,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): if 'seq_journal' in fields: res.update({'seq_journal': True}) - ids = self.pool.get('account.chart.template').search(cr, uid, [], context=context) + ids = self.pool.get('account.chart.template').search(cr, uid, [('visible', '=', True)], context=context) if ids: if 'chart_template_id' in fields: res.update({'chart_template_id': ids[0]}) @@ -2685,7 +2686,11 @@ class wizard_multi_charts_accounts(osv.osv_memory): def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(wizard_multi_charts_accounts, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False) cmp_select = [] - company_ids = self.pool.get('res.company').search(cr, uid, [], context=context) + acc_template_obj = self.pool.get('account.chart.template') + company_obj = self.pool.get('res.company') + + template_ids = acc_template_obj.search(cr, uid, [('visible', '=', True)], context=context) + company_ids = company_obj.search(cr, uid, [], context=context) #display in the widget selection of companies, only the companies that haven't been configured yet (but don't care about the demo chart of accounts) cr.execute("SELECT company_id FROM account_account WHERE active = 't' AND account_account.parent_id IS NULL AND name != %s", ("Chart For Automated Tests",)) configured_cmp = [r[0] for r in cr.fetchall()] @@ -2695,8 +2700,13 @@ class wizard_multi_charts_accounts(osv.osv_memory): res['fields'][field]['domain'] = unconfigured_cmp res['fields'][field]['selection'] = [('', '')] if unconfigured_cmp: - cmp_select = [(line.id, line.name) for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp)] + cmp_select = [(line.id, line.name) for line in company_obj.browse(cr, uid, unconfigured_cmp)] res['fields'][field]['selection'] = cmp_select + if field == 'chart_template_id': + res['fields'][field]['selection'] = [('', '')] + if template_ids: + template_select = [(template.id, template.name) for template in acc_template_obj.browse(cr, uid, template_ids)] + res['fields'][field]['selection'] = template_select return res def execute(self, cr, uid, ids, context=None): diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index aa0c7ae0c87..7bf22cd1d1c 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -2145,6 +2145,7 @@ + From 69928207cca68fcc8c983fa26f08d9f535e1b39d Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Fri, 29 Jul 2011 15:55:48 +0530 Subject: [PATCH 05/10] [IMP]: account: l10n fullness and inheritancy: Improved label and added help text on visible field bzr revid: ron@tinyerp.com-20110729102548-iam282c6f3dkv5st --- addons/account/account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account.py b/addons/account/account.py index 8b5473ae9e0..ffdb75010b5 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2476,7 +2476,7 @@ class account_chart_template(osv.osv): _columns={ 'name': fields.char('Name', size=64, required=True), 'parent_id': fields.many2one('account.chart.template', 'Parent Chart Template'), - 'visible': fields.boolean('Can be Visible'), + 'visible': fields.boolean('Can be Visible?', help="Set this to False if you don't want this template to be used actively in the wizard that generate Chart of Accounts from templates, this is useful when you want to generate accounts of this template only when loading its child template."), 'account_root_id': fields.many2one('account.account.template', 'Root Account', domain=[('parent_id','=',False)]), 'tax_code_root_id': fields.many2one('account.tax.code.template', 'Root Tax Code', domain=[('parent_id','=',False)]), 'tax_template_ids': fields.one2many('account.tax.template', 'chart_template_id', 'Tax Template List', help='List of all the taxes that have to be installed by the wizard'), From 4d8dab977ca4df419da0c5cc90aabfcd35f9c1e8 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Mon, 1 Aug 2011 11:09:33 +0530 Subject: [PATCH 06/10] [ADD]: account: l10n fullness and inheritancy: 1)Add set_tax_complete field in account.chart.template, 2)Add default sale and purchase rates float field in wizard.multi.charts.accounts, 3)If set_tax_complete boolean is False, then instead of the 2 many2one for default sale and purchase taxes, we display the default sale and purchase rates in in the wizard that generate Chart of Accounts from templates 4)Add tracking field only for tracking purpose bzr revid: ron@tinyerp.com-20110801053933-g1quvlsozm34zc20 --- addons/account/account.py | 8 ++++++++ addons/account/account_view.xml | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index ffdb75010b5..ddb3a305842 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2477,6 +2477,7 @@ class account_chart_template(osv.osv): 'name': fields.char('Name', size=64, required=True), 'parent_id': fields.many2one('account.chart.template', 'Parent Chart Template'), 'visible': fields.boolean('Can be Visible?', help="Set this to False if you don't want this template to be used actively in the wizard that generate Chart of Accounts from templates, this is useful when you want to generate accounts of this template only when loading its child template."), + 'set_tax_complete': fields.boolean('Complete Set Of Tax', help="Set this False, then instead of the 2 many2one for default sale and purchase taxes, we display the default sale and purchase rates float field in the wizard"), 'account_root_id': fields.many2one('account.account.template', 'Root Account', domain=[('parent_id','=',False)]), 'tax_code_root_id': fields.many2one('account.tax.code.template', 'Root Tax Code', domain=[('parent_id','=',False)]), 'tax_template_ids': fields.one2many('account.tax.template', 'chart_template_id', 'Tax Template List', help='List of all the taxes that have to be installed by the wizard'), @@ -2635,12 +2636,19 @@ class wizard_multi_charts_accounts(osv.osv_memory): 'seq_journal':fields.boolean('Separated Journal Sequences', help="Check this box if you want to use a different sequence for each created journal. Otherwise, all will use the same sequence."), "sale_tax": fields.many2one("account.tax.template", "Default Sale Tax"), "purchase_tax": fields.many2one("account.tax.template", "Default Purchase Tax"), + 'sale_tax_rate': fields.float('Sale Tax(%)'), + 'purchase_tax_rate': fields.float('Purchase Tax(%)'), + 'tracking': fields.boolean('Tracking'), } def onchange_chart_template_id(self, cr, uid, ids, chart_template_id=False, context=None): res = {} res['value'] = {} + res['value']["tracking"] = False res['value']["sale_tax"] = False res['value']["purchase_tax"] = False + for template in self.pool.get('account.chart.template').browse(cr, uid, [chart_template_id], context=context): + if template.set_tax_complete: + res['value']["tracking"] = True if chart_template_id: # default tax is given by the lowesst sequence. For same sequence we will take the latest created as it will be the case for tax created while isntalling the generic chart of account sale_tax_ids = self.pool.get('account.tax.template').search(cr, uid, [("chart_template_id" diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 7bf22cd1d1c..038cd1550ce 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -2146,6 +2146,7 @@ + @@ -2399,8 +2400,11 @@ - - + + + + +
From 997528cc9a39ff273e3aba2c2e0bb44cd5066bac Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Mon, 1 Aug 2011 11:13:18 +0530 Subject: [PATCH 07/10] [IMP]: account: l10n fullness and inheritancy: Improved help of field set_tax_complete bzr revid: ron@tinyerp.com-20110801054318-9svmdxc6l27cubq6 --- addons/account/account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account.py b/addons/account/account.py index ddb3a305842..0d141d2a68b 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2477,7 +2477,7 @@ class account_chart_template(osv.osv): 'name': fields.char('Name', size=64, required=True), 'parent_id': fields.many2one('account.chart.template', 'Parent Chart Template'), 'visible': fields.boolean('Can be Visible?', help="Set this to False if you don't want this template to be used actively in the wizard that generate Chart of Accounts from templates, this is useful when you want to generate accounts of this template only when loading its child template."), - 'set_tax_complete': fields.boolean('Complete Set Of Tax', help="Set this False, then instead of the 2 many2one for default sale and purchase taxes, we display the default sale and purchase rates float field in the wizard"), + 'set_tax_complete': fields.boolean('Complete Set Of Tax', help="Set this False, then instead of the 2 many2one for default sale and purchase taxes, we display the default sale and purchase rates float field in the wizard that generate Chart of Accounts from templates"), 'account_root_id': fields.many2one('account.account.template', 'Root Account', domain=[('parent_id','=',False)]), 'tax_code_root_id': fields.many2one('account.tax.code.template', 'Root Tax Code', domain=[('parent_id','=',False)]), 'tax_template_ids': fields.one2many('account.tax.template', 'chart_template_id', 'Tax Template List', help='List of all the taxes that have to be installed by the wizard'), From 14aceeae6bb424f01ec13b68857022005a87fc97 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Mon, 1 Aug 2011 15:34:40 +0530 Subject: [PATCH 08/10] [IMP]: account: l10n fullness and inheritancy: Changed field name tracking to complete_tax optimize the code for inconsistent use of quotes in dict bzr revid: ron@tinyerp.com-20110801100440-bjcjzvz47b7o63mp --- addons/account/account.py | 9 +++------ addons/account/account_view.xml | 10 +++++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 0d141d2a68b..ba893a7a497 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2638,17 +2638,14 @@ class wizard_multi_charts_accounts(osv.osv_memory): "purchase_tax": fields.many2one("account.tax.template", "Default Purchase Tax"), 'sale_tax_rate': fields.float('Sale Tax(%)'), 'purchase_tax_rate': fields.float('Purchase Tax(%)'), - 'tracking': fields.boolean('Tracking'), + 'complete_tax': fields.boolean('Complete Tax'), } def onchange_chart_template_id(self, cr, uid, ids, chart_template_id=False, context=None): res = {} - res['value'] = {} - res['value']["tracking"] = False - res['value']["sale_tax"] = False - res['value']["purchase_tax"] = False + res['value'] = {'complete_tax': False, 'sale_tax': False, 'purchase_tax': False} for template in self.pool.get('account.chart.template').browse(cr, uid, [chart_template_id], context=context): if template.set_tax_complete: - res['value']["tracking"] = True + res['value']["complete_tax"] = True if chart_template_id: # default tax is given by the lowesst sequence. For same sequence we will take the latest created as it will be the case for tax created while isntalling the generic chart of account sale_tax_ids = self.pool.get('account.tax.template').search(cr, uid, [("chart_template_id" diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 038cd1550ce..70d59c569e9 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -2400,11 +2400,11 @@ - - - - - + + + + + From 9e95b2ac77b41fab0cb90cbdec13b2f4cc1c7500 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Mon, 1 Aug 2011 17:13:40 +0530 Subject: [PATCH 09/10] [IMP]: account: l10n fullness and inheritancy: optimize the code for inconsistent use of dict on onchange_chart_template_id bzr revid: ron@tinyerp.com-20110801114340-uibvfh42bff44i3l --- addons/account/account.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index ba893a7a497..0f688c2dffe 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2642,19 +2642,16 @@ class wizard_multi_charts_accounts(osv.osv_memory): } def onchange_chart_template_id(self, cr, uid, ids, chart_template_id=False, context=None): res = {} + tax_templ_obj = self.pool.get('account.tax.template') res['value'] = {'complete_tax': False, 'sale_tax': False, 'purchase_tax': False} - for template in self.pool.get('account.chart.template').browse(cr, uid, [chart_template_id], context=context): - if template.set_tax_complete: - res['value']["complete_tax"] = True if chart_template_id: + complete_tax = self.pool.get('account.chart.template').browse(cr, uid, chart_template_id, context=context).set_tax_complete # default tax is given by the lowesst sequence. For same sequence we will take the latest created as it will be the case for tax created while isntalling the generic chart of account - sale_tax_ids = self.pool.get('account.tax.template').search(cr, uid, [("chart_template_id" + sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id" , "=", chart_template_id), ('type_tax_use', 'in', ('sale','all'))], order="sequence, id desc") - purchase_tax_ids = self.pool.get('account.tax.template').search(cr, uid, [("chart_template_id" + purchase_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id" , "=", chart_template_id), ('type_tax_use', 'in', ('purchase','all'))], order="sequence, id desc") - - res['value']["sale_tax"] = sale_tax_ids and sale_tax_ids[0] or False - res['value']["purchase_tax"] = purchase_tax_ids and purchase_tax_ids[0] or False + res['value'] = {'complete_tax': complete_tax, 'sale_tax': sale_tax_ids and sale_tax_ids[0] or False, 'purchase_tax': purchase_tax_ids and purchase_tax_ids[0] or False} return res From 9c32b8cc6afa8312b092a46f735593798447130c Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Tue, 2 Aug 2011 11:46:56 +0530 Subject: [PATCH 10/10] [IMP]: account: l10n fullness and inheritancy: Value false default sale and purchase taxes if we don not have to use/display those fields in the wizard bzr revid: ron@tinyerp.com-20110802061656-jqacqub4hmw1dlya --- addons/account/account.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 0f688c2dffe..9a8854aac76 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2646,12 +2646,14 @@ class wizard_multi_charts_accounts(osv.osv_memory): res['value'] = {'complete_tax': False, 'sale_tax': False, 'purchase_tax': False} if chart_template_id: complete_tax = self.pool.get('account.chart.template').browse(cr, uid, chart_template_id, context=context).set_tax_complete + if complete_tax: # default tax is given by the lowesst sequence. For same sequence we will take the latest created as it will be the case for tax created while isntalling the generic chart of account - sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id" - , "=", chart_template_id), ('type_tax_use', 'in', ('sale','all'))], order="sequence, id desc") - purchase_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id" - , "=", chart_template_id), ('type_tax_use', 'in', ('purchase','all'))], order="sequence, id desc") - res['value'] = {'complete_tax': complete_tax, 'sale_tax': sale_tax_ids and sale_tax_ids[0] or False, 'purchase_tax': purchase_tax_ids and purchase_tax_ids[0] or False} + sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id" + , "=", chart_template_id), ('type_tax_use', 'in', ('sale','all'))], order="sequence, id desc") + purchase_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id" + , "=", chart_template_id), ('type_tax_use', 'in', ('purchase','all'))], order="sequence, id desc") + res['value'].update({'sale_tax': sale_tax_ids and sale_tax_ids[0] or False, 'purchase_tax': purchase_tax_ids and purchase_tax_ids[0] or False}) + res['value'].update({'complete_tax': complete_tax}) return res