From cc9cf2deaeab015ae310fd590f060ac806c0cd8c Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 31 Aug 2011 12:55:21 +0530 Subject: [PATCH] [IMP]: account: l10n fullness and inheritancy : 1)Passed template_id in generate_account instead of browse record 2)Changed the search method like Loaded the accounts templates only which related to current templates or false bzr revid: ron@tinyerp.com-20110831072521-lqb1aossh75ydzzz --- addons/account/account.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index b134c6aa5dc..387ecf13027 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2376,7 +2376,7 @@ class account_account_template(osv.osv): res.append((record['id'],name )) return res - def generate_account(self, cr, uid, account_root_id, tax_template_ref, code_digits, company_id, context=None): + def generate_account(self, cr, uid, template_id, account_root_id, tax_template_ref, code_digits, company_id, context=None): """ This method for generating accounts from templates. @param cr: A database cursor. @@ -2396,7 +2396,7 @@ class account_account_template(osv.osv): #deactivate the parent_store functionnality on account_account for rapidity purpose ctx = context.copy() ctx.update({'defer_parent_store_computation': True}) - children_acc_template = self.search(cr, uid, [('parent_id','child_of', [account_root_id]),('nocreate','!=',True)], order='id') + children_acc_template = self.search(cr, uid, [('parent_id','child_of', [account_root_id]),'|', ('chart_template_id','=', [template_id]),('chart_template_id','=', False), ('nocreate','!=',True)], order='id') for account_template in self.browse(cr, uid, children_acc_template, context=context): tax_ids = [] for tax in account_template.tax_ids: @@ -3117,7 +3117,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): taxes_ref = obj_tax_temp.generate_tax(cr, uid, tax_templates, tax_code_template_ref, company_id, context=context) # Generating Accounts from templates. - acc_template_ref = obj_acc_template.generate_account(cr, uid, template.account_root_id.id, taxes_ref['tax_template_ref'], code_digits, company_id, context=context) + acc_template_ref = obj_acc_template.generate_account(cr, uid, template_id, template.account_root_id.id, taxes_ref['tax_template_ref'], code_digits, company_id, context=context) # writing account values on tax after creation of accounts for key,value in taxes_ref['account_dict'].items():