From a43a6cfd344d8bebe6aefeadfb8a8203ed191521 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 10 Aug 2011 16:33:49 +0530 Subject: [PATCH] [IMP]: account: l10n fullness and inheritancy: Removed If loop because its not needed and removed some intermediate variable bzr revid: ron@tinyerp.com-20110810110349-g5qy6lmex8s57jk3 --- addons/account/account.py | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 5108f2284af..85f282fde6e 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2667,28 +2667,20 @@ class account_fiscal_position_template(osv.osv): obj_ac_fp = self.pool.get('account.fiscal.position.account') obj_fiscal_position = self.pool.get('account.fiscal.position') fp_ids = self.search(cr, uid, [('chart_template_id', '=', chart_temp_id)]) - if fp_ids: - for position in self.browse(cr, uid, fp_ids, context=context): - vals_fp = { - 'company_id': company_id, - 'name': position.name, - } - new_fp = obj_fiscal_position.create(cr, uid, vals_fp) - - for tax in position.tax_ids: - vals_tax = { - 'tax_src_id': taxes_ids['tax_template_ref'][tax.tax_src_id.id], - 'tax_dest_id': tax.tax_dest_id and taxes_ids['tax_template_ref'][tax.tax_dest_id.id] or False, - 'position_id': new_fp, - } - obj_tax_fp.create(cr, uid, vals_tax) - for acc in position.account_ids: - vals_acc = { - 'account_src_id': acc_template_ref[acc.account_src_id.id], - 'account_dest_id': acc_template_ref[acc.account_dest_id.id], - 'position_id': new_fp, - } - obj_ac_fp.create(cr, uid, vals_acc) + for position in self.browse(cr, uid, fp_ids, context=context): + new_fp = obj_fiscal_position.create(cr, uid, {'company_id': company_id, 'name': position.name}) + for tax in position.tax_ids: + obj_tax_fp.create(cr, uid, { + 'tax_src_id': taxes_ids['tax_template_ref'][tax.tax_src_id.id], + 'tax_dest_id': tax.tax_dest_id and taxes_ids['tax_template_ref'][tax.tax_dest_id.id] or False, + 'position_id': new_fp + }) + for acc in position.account_ids: + obj_ac_fp.create(cr, uid, { + 'account_src_id': acc_template_ref[acc.account_src_id.id], + 'account_dest_id': acc_template_ref[acc.account_dest_id.id], + 'position_id': new_fp + }) return {} account_fiscal_position_template()