From 5888531e5c1cf358dd37ab5e3bd78c4031f3bf96 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 6 Jan 2012 12:11:49 +0100 Subject: [PATCH 1/4] [FIX] account: fixed the generation of tax from sale and purchase rates in wizard bzr revid: qdp-launchpad@openerp.com-20120106111149-ztmuqg58980a0tu3 --- addons/account/account.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 6589ec724a2..432a90a653e 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -3265,14 +3265,20 @@ class wizard_multi_charts_accounts(osv.osv_memory): obj_tax_temp = self.pool.get('account.tax.template') chart_template = obj_wizard.chart_template_id vals = {} + # get the ids of all the parents of the selected account chart template + current_chart_template = chart_template + all_parents = [current_chart_template.id] + while current_chart_template.parent_id: + current_chart_template = current_chart_template.parent_id + all_parents.append(current_chart_template.id) # create tax templates and tax code templates from purchase_tax_rate and sale_tax_rate fields if not chart_template.complete_tax_set: - if obj_wizard.sale_tax: - value = obj_wizard.sale_tax_rate - obj_tax_temp.write(cr, uid, [obj_wizard.sale_tax.id], {'amount': value/100.0, 'name': _('Tax %.2f%%') % value}) - if obj_wizard.purchase_tax: - value = obj_wizard.purchase_tax_rate - obj_tax_temp.write(cr, uid, [obj_wizard.purchase_tax.id], {'amount': value/100.0, 'name': _('Purchase Tax %.2f%%') % value}) + value = obj_wizard.sale_tax_rate + ref_tax_ids = obj_tax_temp.search(cr, uid, [('type_tax_use','in', ('sale','all')), ('chart_template_id', 'in', all_parents)], context=context, order="sequence, id desc", limit=1) + obj_tax_temp.write(cr, uid, ref_tax_ids, {'amount': value/100.0, 'name': _('Tax %.2f%%') % value}) + value = obj_wizard.purchase_tax_rate + ref_tax_ids = obj_tax_temp.search(cr, uid, [('type_tax_use','in', ('purchase','all')), ('chart_template_id', 'in', all_parents)], context=context, order="sequence, id desc", limit=1) + obj_tax_temp.write(cr, uid, ref_tax_ids, {'amount': value/100.0, 'name': _('Purchase Tax %.2f%%') % value}) return True def execute(self, cr, uid, ids, context=None): From 77cd2d2608cfc45e194cf46aa42ed72405590d0b Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 6 Jan 2012 12:13:30 +0100 Subject: [PATCH 2/4] [IMP] l10n_us: added a minimal set for COT, taxes and fiscal positions. Removed sign on account.account.type (field does not exist anymore. It is hanlded by the financial reports) bzr revid: qdp-launchpad@openerp.com-20120106111330-zn783lc6fz4nptr8 --- addons/l10n_us/__openerp__.py | 2 + .../l10n_us/account_chart_template_after.xml | 14 +-- addons/l10n_us/account_tax_code_template.xml | 95 +++++++++++++++++++ addons/l10n_us/account_tax_template.xml | 93 ++++++++++++++++++ addons/l10n_us/l10n_us_account_type.xml | 18 +--- 5 files changed, 197 insertions(+), 25 deletions(-) create mode 100644 addons/l10n_us/account_tax_code_template.xml create mode 100644 addons/l10n_us/account_tax_template.xml diff --git a/addons/l10n_us/__openerp__.py b/addons/l10n_us/__openerp__.py index f497b4f5ddf..273a4fe1d17 100644 --- a/addons/l10n_us/__openerp__.py +++ b/addons/l10n_us/__openerp__.py @@ -35,6 +35,8 @@ "l10n_us_account_type.xml", 'account_chart_template.xml', 'account.account.template.csv', + 'account_tax_code_template.xml', + 'account_tax_template.xml', 'account_chart_template_after.xml', 'l10n_us_wizard.xml' ], diff --git a/addons/l10n_us/account_chart_template_after.xml b/addons/l10n_us/account_chart_template_after.xml index 20fbcb80859..3c570126fcd 100644 --- a/addons/l10n_us/account_chart_template_after.xml +++ b/addons/l10n_us/account_chart_template_after.xml @@ -2,47 +2,37 @@ - - Tax Template - - + - - - - - - - - + diff --git a/addons/l10n_us/account_tax_code_template.xml b/addons/l10n_us/account_tax_code_template.xml new file mode 100644 index 00000000000..e6265b206fe --- /dev/null +++ b/addons/l10n_us/account_tax_code_template.xml @@ -0,0 +1,95 @@ + + + + + + + + + Plan Fees + + + + Tax Balance to Pay + + + + + + Tax Received + + + + + + Tax Received at default rate + + + + + + Tax Received Rate X (Exempt) + + + + + + + Tax Paid + + + + + Tax Paid at default rate + + + + + Tax Paid Rate X (Exempt) + + + + + + + + + + Tax Bases + + + + + Taxable Purchases Base + + + + + Taxable Purchases at default rate + + + + + Taxable Purchases Type X (Exempt) + + + + + + + Base of Taxable Sales + + + + + Taxable Sales at default rate + + + + + Taxable Sales Type X (Exempt) + + + + + diff --git a/addons/l10n_us/account_tax_template.xml b/addons/l10n_us/account_tax_template.xml new file mode 100644 index 00000000000..4c0dc45c08f --- /dev/null +++ b/addons/l10n_us/account_tax_template.xml @@ -0,0 +1,93 @@ + + + + + + default purchase tax + + 1 + percent + + + + + purchase + + + + + Exempted Tax (Purchase) + + 10 + percent + + + + + purchase + + + + + + + default sale tax + + 1 + percent + + + + + sale + + + + + Exempted Tax (Sale) + + 10 + percent + + + + + sale + + + + + + + + + + Normal Taxes + + + + + Tax Exempt + + + + + + + + + + + + + + + + + + + + + + + diff --git a/addons/l10n_us/l10n_us_account_type.xml b/addons/l10n_us/l10n_us_account_type.xml index 989916a49ac..1b64a4e6487 100644 --- a/addons/l10n_us/l10n_us_account_type.xml +++ b/addons/l10n_us/l10n_us_account_type.xml @@ -60,41 +60,35 @@ account -pay liability unreconciled - Credit Card credit -card - liability + liability balance - Current Liability current -liability - liability + liability balance - Other Current Liability other current -liability - liability - + liability balance Long term Liability long term -liability - liability - + liability balance Liability liability - liability - + liability balance @@ -111,14 +105,12 @@ income income none - Other Income other -income income none - From 76e3032ee759aa2ccadcc7775b5c49d1abe39e44 Mon Sep 17 00:00:00 2001 From: "Dhara (OpenERP)" <> Date: Fri, 6 Jan 2012 18:38:41 +0530 Subject: [PATCH 3/4] [FIX] reference for the tax template bzr revid: dhara_openerp-20120106130841-w988cm87052pqnax --- addons/l10n_us/account_tax_template.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_us/account_tax_template.xml b/addons/l10n_us/account_tax_template.xml index 4c0dc45c08f..3dbdc903889 100644 --- a/addons/l10n_us/account_tax_template.xml +++ b/addons/l10n_us/account_tax_template.xml @@ -83,7 +83,7 @@ - + From ca98b4a23575d6125962f19ed4ea93956a37e3c9 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 6 Jan 2012 14:33:03 +0100 Subject: [PATCH 4/4] [FIX] l10n_us: fiscal position bzr revid: qdp-launchpad@openerp.com-20120106133303-3p405o8c93868eju --- addons/l10n_us/account_tax_template.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/l10n_us/account_tax_template.xml b/addons/l10n_us/account_tax_template.xml index 3dbdc903889..bb15368878e 100644 --- a/addons/l10n_us/account_tax_template.xml +++ b/addons/l10n_us/account_tax_template.xml @@ -61,12 +61,12 @@ - + Normal Taxes - + Tax Exempt @@ -77,13 +77,13 @@ - + - +