From d23835be841d2dd06ff56f3ed4569bf9136de675 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 23 Sep 2016 20:43:23 +0530 Subject: [PATCH] [Feature] Countrywise sales tax template --- .../sales_taxes_and_charges_template.py | 6 + .../setup_wizard/data/country_wise_tax.json | 1380 +++++++++++++++++ erpnext/setup/setup_wizard/setup_wizard.py | 132 +- 3 files changed, 1478 insertions(+), 40 deletions(-) create mode 100644 erpnext/setup/setup_wizard/data/country_wise_tax.json diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py index 28964bb2e5..3947450d5b 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py @@ -4,12 +4,18 @@ from __future__ import unicode_literals import frappe from frappe import _ +from frappe.utils import flt from frappe.model.document import Document from erpnext.controllers.accounts_controller import validate_taxes_and_charges, validate_inclusive_tax class SalesTaxesandChargesTemplate(Document): def validate(self): valdiate_taxes_and_charges_template(self) + + def set_missing_values(self): + for data in self.taxes: + if data.charge_type == 'On Net Total' and flt(data.rate) == 0.0: + data.rate = frappe.db.get_value('Account', data.account_head, 'tax_rate') def valdiate_taxes_and_charges_template(doc): # default should not be disabled diff --git a/erpnext/setup/setup_wizard/data/country_wise_tax.json b/erpnext/setup/setup_wizard/data/country_wise_tax.json new file mode 100644 index 0000000000..06f7f0908b --- /dev/null +++ b/erpnext/setup/setup_wizard/data/country_wise_tax.json @@ -0,0 +1,1380 @@ +{ + "Albania": { + "Albania VAT": { + "account_name": "VAT", + "tax_rate": 20.00 + } + }, + "Algeria": { + "Algeria VAT 17%": { + "account_name": "VAT 17%", + "tax_rate": 17.00, + "default": 1 + }, + "Algeria VAT 7%": { + "account_name": "VAT 7%", + "tax_rate": 7.00 + } + }, + + "Andorra": { + "Andorra VAT": { + "account_name": "VAT", + "tax_rate": 4.50 + } + }, + + "Angola": { + "Angola VAT": { + "account_name": "VAT", + "tax_rate": 10.00 + } + }, + + "Antigua And Barbuda": { + "Antigua & Barbuda Sales Tax": { + "account_name": "ABST", + "tax_rate": 15.00 + } + }, + + "Argentina": { + "Argentina Tax": { + "account_name": "VAT", + "tax_rate": 21.00 + } + }, + + "Armenia": { + "Armenia Tax": { + "account_name": "VAT", + "tax_rate": 20.00 + } + }, + + "Aruba": { + "Aruba Tax": { + "account_name": "VAT", + "tax_rate": 1.50 + } + }, + + "Australia": { + "Australia GST1": { + "account_name": "GST 10%", + "tax_rate": 10.00, + "default": 1 + }, + "Australia GST 2%": { + "account_name": "GST 2%", + "tax_rate": 2 + } + }, + + "Austria": { + "Austria Tax": { + "account_name": "VAT", + "tax_rate": 20.00 + } + }, + + "Azerbaijan": { + "Azerbaijan Tax": { + "account_name": "GST", + "tax_rate": 18.00 + } + }, + + "Bahamas": { + "Bahamas Tax": { + "account_name": "VAT", + "tax_rate": 7.50 + } + }, + + "Bangladesh": { + "Bangladesh Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Barbados": { + "Barbados Tax": { + "account_name": "VAT", + "tax_rate": 17.50 + } + }, + + "Belarus": { + "Belarus Tax": { + "account_name": "VAT", + "tax_rate": 20.00 + } + }, + + "Belgium": { + "Belgium VAT 21%": { + "account_name": "VAT 21%", + "tax_rate": 21.00, + "default": 1 + }, + "Belgium VAT 12%": { + "account_name": "VAT 12%", + "tax_rate": 12 + } + }, + + "Belize": { + "Belize Tax": { + "account_name": "GST", + "tax_rate": 12.50 + } + }, + + "Benin": { + "Benin Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Bhutan": { + "Bhutan Tax": { + "account_name": "VAT", + "tax_rate": 50.00 + } + }, + + "Bolivia": { + "Bolivia Tax": { + "account_name": "VAT", + "tax_rate": 13.00 + } + }, + + "Bosnia and Herzegovina": { + "Bosnia & Herzegovina Tax": { + "account_name": "VAT", + "tax_rate": 17.00 + } + }, + + "Botswana": { + "Botswana Tax": { + "account_name": "VAT", + "tax_rate": 12.00 + } + }, + + "Brazil": { + "Brazil ICMS 19%": { + "account_name": "ICMS 19%", + "tax_rate": 19.00, + "default": 1 + }, + "Brazil ICMS 17%": { + "account_name": "ICMS 17%", + "tax_rate": 17.00 + }, + "Brazil PIS 1.65%": { + "account_name": "PIS 1.65%", + "tax_rate": 1.65 + }, + "Brazil COFINS 7.6%": { + "account_name": "COFINS 7.6%", + "tax_rate": 7.6 + }, + "Brazil COFINS 5.0%": { + "account_name": "ISS 5%", + "tax_rate": 5.0 + } + }, + + "Bulgaria": { + "Bulgaria VAT 20%": { + "account_name": "VAT 20%", + "tax_rate": 20.00, + "default": 1 + }, + "Bulgaria VAT 7%": { + "account_name": "VAT 7%", + "tax_rate": 7.00 + } + }, + + "Burkina Faso": { + "Burkina Faso Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Burundi": { + "Burundi Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Cambodia": { + "Cambodia Tax": { + "account_name": "VAT", + "tax_rate": 10.00 + } + }, + + "Cameroon": { + "Cameroon Tax": { + "account_name": "VAT", + "tax_rate": 19.25 + } + }, + + "Canada": { + "Canada GST 5%": { + "account_name": "GST", + "tax_rate": 5.00, + "default": 1 + }, + "Canada HST 15%": { + "account_name": "HST", + "tax_rate": 15.00 + }, + "Canada PST 8%": { + "account_name": "PST 8%", + "tax_rate": 8.00 + }, + "Canada PST 7%": { + "account_name": "PST 7%", + "tax_rate": 7.00 + }, + "Canada PST 5%": { + "account_name": "PST 5%", + "tax_rate": 5.00 + } + }, + + "Cape Verde": { + "Cape Verde Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Central African Republic": { + "Central African Republic Tax": { + "account_name": "VAT", + "tax_rate": 19.00 + } + }, + + "Chad": { + "Chad Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Chile": { + "Chile Tax": { + "account_name": "VAT", + "tax_rate": 19.00 + } + }, + + "China": { + "China Tax": { + "account_name": "VAT", + "tax_rate": 17.00 + } + }, + + "Colombia": { + "Colombia Tax": { + "account_name": "VAT", + "tax_rate": 16.00 + } + }, + + "Comoros": { + "Comoros Tax": { + "account_name": "VAT", + "tax_rate": 10.00 + } + }, + + "Congo": { + "Congo Tax": { + "account_name": "VAT", + "tax_rate": 16.00 + } + }, + + "Costa Rica": { + "Costa Rica": { + "account_name": "VAT", + "tax_rate": 13.00 + } + }, + + "Croatia": { + "Croatia VAT 25%": { + "account_name": "VAT 25%", + "tax_rate": 25.00, + "default": 1 + }, + "Croatia VAT 10%": { + "account_name": "VAT 10%", + "tax_rate": 10.00 + } + }, + + "Cuba": { + "Cuba Tax": { + "account_name": "VAT", + "tax_rate": 20.00 + } + }, + + "Cyprus": { + "Cyprus Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Czech Republic": { + "Czech Republic VAT 21%": { + "account_name": "VAT 21%", + "tax_rate": 21.00, + "default": 1 + }, + "Czech Republic VAT 15%": { + "account_name": "VAT 15%", + "tax_rate": 15.00 + } + }, + + "Denmark": { + "Denmark Tax": { + "account_name": "VAT", + "tax_rate": 25.00 + } + }, + + "Djibouti": { + "Dijbouti Tax": { + "account_name": "VAT", + "tax_rate": 33.00 + } + }, + + "Dominica": { + "Dominica Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Dominican Republic": { + "Dominican Republic Tax": { + "account_name": "ITBIS", + "tax_rate": 16.00 + } + }, + + "Ecuador": { + "Ecuador Tax": { + "account_name": "VAT", + "tax_rate": 12.00 + } + }, + + "Egypt": { + "Egypt Tax": { + "account_name": "GST", + "tax_rate": 10.00 + } + }, + + "El Salvador": { + "El Salvador Tax": { + "account_name": "VAT", + "tax_rate": 13.00 + } + }, + + "Equatorial Guinea": { + "Equatorial Guinea": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Eritrea": { + "Eritrea Tax": { + "account_name": "VAT", + "tax_rate": 4.00 + } + }, + + "Estonia": { + "Estonia Tax": { + "account_name": "VAT", + "tax_rate": 20.00 + } + }, + + "Ethiopia": { + "Ethiopia Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Fiji": { + "Fiji Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Finland": { + "Finland Tax": { + "account_name": "VAT", + "tax_rate": 24.00 + } + }, + + "France": { + "France VAT 19.6%": { + "account_name": "VAT 19.6%", + "tax_rate": 19.6, + "default": 1 + }, + "France VAT 5.5%": { + "account_name": "VAT 5.5%", + "tax_rate": 5.5 + } + }, + + "Gabon": { + "Gabon Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Gambia": { + "Gambia Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Georgia": { + "Georgia Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Germany": { + "Germany VAT 19%": { + "account_name": "VAT 19%", + "tax_rate": 19.00, + "default": 1 + }, + "Germany VAT 7%": { + "account_name": "VAT 7%", + "tax_rate": 7.00 + } + }, + + "Ghana": { + "Ghana Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Greece": { + "Greece VAT 23%": { + "account_name": "VAT 23%", + "tax_rate": 23.00, + "default": 1 + }, + "Greece VAT 9%": { + "account_name": "VAT 9%", + "tax_rate": 9.00 + } + }, + + "Grenada": { + "Grenada Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Guam": { + "Guam Tax": { + "account_name": "VAT", + "tax_rate": 4.00 + } + }, + + "Guatemala": { + "Guatemala Tax": { + "account_name": "IVA", + "tax_rate": 12.00 + } + }, + + "Guinea": { + "Guinea Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Guyana": { + "Guyana Tax": { + "account_name": "GST", + "tax_rate": 16.00 + } + }, + + "Haiti": { + "Haiti Tax": { + "account_name": "VAT", + "tax_rate": 10.00 + } + }, + + "Honduras": { + "Honduras Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Hungary": { + "Hungary Tax": { + "account_name": "VAT", + "tax_rate": 27.00 + } + }, + + "Iceland": { + "Iceland VAT 25.5%": { + "account_name": "VAT 25.5%", + "tax_rate": 25.5, + "default": 1 + }, + "Iceland VAT 7.5%": { + "account_name": "VAT 7.5%", + "tax_rate": 7.5 + } + }, + + "India": { + "India VAT 5%": { + "account_name": "VAT 5%", + "tax_rate": 5.00, + "default": 1 + }, + "India VAT 4%": { + "account_name": "VAT 4%", + "tax_rate": 4.00 + }, + "India VAT 14%": { + "account_name": "VAT 14%", + "tax_rate": 14.00 + } + }, + + "Indonesia": { + "Indonesia Tax": { + "account_name": "VAT", + "tax_rate": 10.00 + } + }, + + "Iran": { + "Iran Tax": { + "account_name": "VAT", + "tax_rate": 7.00 + } + }, + + "Ireland": { + "Ireland Tax": { + "account_name": "VAT", + "tax_rate": 23.00 + } + }, + + "Isle Of Man": { + "Isle of Man VAT 20%": { + "account_name": "VAT", + "tax_rate": 20.00, + "default": 1 + }, + "Isle of Man VAT 5%": { + "account_name": "VAT", + "tax_rate": 5.00 + } + }, + + "Israel": { + "Israel Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Italy": { + "Italy Tax": { + "account_name": "VAT", + "tax_rate": 22.00 + } + }, + + "Ivory Coast": { + "Ivory Coast": { + "account_name": "Metric", + "tax_rate": 18.00 + } + }, + + "Jamaica": { + "Jamaica Tax": { + "account_name": "GCT", + "tax_rate": 16.50 + } + }, + + "Japan": { + "Japan Tax": { + "account_name": "CT", + "tax_rate": 5.00 + } + }, + + "Jordan": { + "Jordan Tax": { + "account_name": "VAT", + "tax_rate": 16.00 + } + }, + + "Kazakhstan": { + "Kazakhstan Tax": { + "account_name": "VAT", + "tax_rate": 12.00 + } + }, + + "Kenya": { + "Kenya Tax": { + "account_name": "VAT", + "tax_rate": 16.00 + } + }, + + "Kosovo": { + "Kosovo Tax": { + "account_name": "VAT", + "tax_rate": 16.00 + } + }, + + "Kyrgyzstan": { + "Kyrgyztan Tax": { + "account_name": "VAT", + "tax_rate": 12.00 + } + }, + + "Lao People's Democratic Republic": { + "Lao Republic Tax": { + "account_name": "VAT", + "tax_rate": 10.00 + } + }, + + "Latvia": { + "Latvia Tax": { + "account_name": "VAT", + "tax_rate": 20.00 + } + }, + + "Lebanon": { + "Lebanon Tax": { + "account_name": "VAT", + "tax_rate": 10.00 + } + }, + + "Liechtenstein": { + "Liechtenstein Tax": { + "account_name": "VAT", + "tax_rate": 8.00 + } + }, + + "Lithuania": { + "Lithunia Tax": { + "account_name": "VAT", + "tax_rate": 21.00 + } + }, + + "Luxembourg": { + "Luxembourg VAT 15%": { + "account_name": "VAT 15%", + "tax_rate": 15.00, + "default": 1 + }, + "Luxembourg VAT 3%": { + "account_name": "VAT 3%", + "tax_rate": 3.00 + } + }, + + "Macedonia": { + "Macedonia VAT 18%": { + "account_name": "VAT", + "tax_rate": 18.00, + "default": 1 + }, + "Macedonia VAT 5%": { + "account_name": "VAT", + "tax_rate": 5.00 + } + }, + + "Madagascar": { + "Madagascar Tax": { + "account_name": "VAT", + "tax_rate": 20.00 + } + }, + + "Malawi": { + "Malawi Tax": { + "account_name": "VAT", + "tax_rate": 16.50 + } + }, + + "Malaysia": { + "Malaysia GST 6%": { + "account_name": "GST", + "tax_rate": 6.00, + "default": 1 + }, + "Malaysia GST 5%": { + "account_name": "GST", + "tax_rate": 5.00 + }, + "Malaysia GST 10%": { + "account_name": "GST", + "tax_rate": 10.00 + } + }, + + "Mali": { + "Mali Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Malta": { + "Malta Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Mauritania": { + "Mauritania Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Mauritius": { + "Mauritius Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Mexico": { + "Mexico Tax": { + "account_name": "IVA", + "tax_rate": 16.00 + } + }, + + "Micronesia": { + "Micronesia Tax": { + "account_name": "VAT", + "tax_rate": 5.00 + } + }, + + "Moldova": { + "Moldova VAT 20%": { + "account_name": "VAT 20%", + "tax_rate": 20.00, + "default": 1 + }, + "Moldova VAT 8%": { + "account_name": "VAT 8%", + "tax_rate": 8.00 + } + }, + + "Monaco": { + "Monaco Tax 19.6%": { + "account_name": "VAT 19.6%", + "tax_rate": 19.6, + "default": 1 + }, + "Monaco Tax 5.5%": { + "account_name": "VAT 5,5%", + "tax_rate": 5.5 + } + }, + + "Mongolia": { + "Mongolia Tax": { + "account_name": "VAT", + "tax_rate": 10.00 + } + }, + + "Montenegro": { + "Montenegro Tax 17%": { + "account_name": "VAT 17%", + "tax_rate": 17.00, + "default": 1 + }, + "Montenegro Tax 7%": { + "account_name": "VAT 7%", + "tax_rate": 7.00 + } + }, + + "Morocco": { + "Morroco VAT 20%": { + "account_name": "VAT 20%", + "tax_rate": 20.00, + "default": 1 + }, + "Morroco VAT 10%": { + "account_name": "VAT 10%", + "tax_rate": 10.00 + } + }, + + "Mozambique": { + "Mozambique Tax": { + "account_name": "VAT", + "tax_rate": 17.00 + } + }, + + "Myanmar": { + "Myanamar Tax": { + "account_name": "VAT", + "tax_rate": 30.00 + } + }, + + "Namibia": { + "Namibia Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Nepal": { + "Nepal Tax": { + "account_name": "VAT", + "tax_rate": 13.00 + } + }, + + "Netherlands": { + "Netherlands VAT 21%": { + "account_name": "VAT 21%", + "tax_rate": 21.00, + "default": 1 + }, + "Netherlands VAT 6%": { + "account_name": "VAT 6%", + "tax_rate": 6.00 + } + }, + + "New Zealand": { + "New Zealand": { + "account_name": "GST", + "tax_rate": 15.00 + } + }, + + "Nicaragua": { + "Nicaragua Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Nigeria": { + "Nigeria Tax": { + "account_name": "VAT", + "tax_rate": 5 + } + }, + + "North Korea": { + "North Korea": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Norway": { + "Norway VAT 25%": { + "account_name": "VAT 25%", + "tax_rate": 25.00, + "default": 1 + }, + "Norway VAT 12%": { + "account_name": "VAT 12%", + "tax_rate": 12.00 + } + }, + + "Pakistan": { + "Pakistan Tax": { + "account_name": "GST", + "tax_rate": 17.00 + } + }, + + "Panama": { + "Panama Tax": { + "account_name": "VAT", + "tax_rate": 7.00 + } + }, + + "Papua New Guinea": { + "Papua New Guinea Tax": { + "account_name": "VAT", + "tax_rate": 10.00 + } + }, + + "Paraguay": { + "Paraguay Tax": { + "account_name": "VAT", + "tax_rate": 10.00 + } + }, + + "Peru": { + "Peru Tax": { + "account_name": "VAT", + "tax_rate": 16.00 + } + }, + + "Philippines": { + "Philippines Tax": { + "account_name": "VAT", + "tax_rate": 12.00 + } + }, + + "Poland": { + "Poland VAT 23%": { + "account_name": "VAT 23%", + "tax_rate": 23.00, + "default": 1 + }, + "Poland VAT 7%": { + "account_name": "VAT 7%", + "tax_rate": 7 + } + }, + + "Portugal": { + "Portugal Tax": { + "account_name": "VAT", + "tax_rate": 23.00 + } + }, + + "Republic Of The Congo": { + "Congo Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Romania": { + "Romania Tax": { + "account_name": "VAT", + "tax_rate": 24.00 + } + }, + + "Russia": { + "Russia VAT 18%": { + "account_name": "VAT 18%", + "tax_rate": 18.00, + "default": 1 + }, + "Russia VAT 10%": { + "account_name": "VAT 10%", + "tax_rate": 10.00 + } + }, + + "Rwanda": { + "Rwanda Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Senegal": { + "Senegal Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Serbia": { + "Serbia Tax": { + "account_name": "VAT", + "tax_rate": 20.00 + } + }, + + "Seychelles": { + "Seychelles Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Sierra Leone": { + "Sierra Leone Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Singapore": { + "Singapore Tax": { + "account_name": "GST", + "tax_rate": 7.00 + } + }, + + "Slovakia": { + "Slovakia VAT 20%": { + "account_name": "VAT 20%", + "tax_rate": 20.00, + "default": 1 + }, + "Slovakia VAT 10%": { + "account_name": "VAT 10%", + "tax_rate": 10.00 + } + }, + + "Slovenia": { + "Slovenia VAT 22%": { + "account_name": "VAT 22%", + "tax_rate": 22.00, + "default": 1 + }, + "Slovenia VAT 8.5%": { + "account_name": "VAT 8.5%", + "tax_rate": 8.50 + } + }, + + "Solomon Islands": { + "Solomon Islands Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Somalia": { + "Somalia Tax": { + "account_name": "VAT", + "tax_rate": 10.00 + } + }, + + "South Africa": { + "South Africa Tax": { + "account_name": "VAT", + "tax_rate": 14.00 + } + }, + + "South Korea": { + "South Korea Tax": { + "account_name": "VAT", + "tax_rate": 10.00 + } + }, + + "Spain": { + "Spain Tax": { + "account_name": "VAT", + "tax_rate": 21.00 + } + }, + + "Sri Lanka": { + "Sri Lanka Tax": { + "account_name": "VAT", + "tax_rate": 12.00 + } + }, + + "St Lucia": { + "St Lucia Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Sudan": { + "Sudan Tax": { + "account_name": "VAT", + "tax_rate": 10.00 + } + }, + + "Suriname": { + "Suriname Tax": { + "account_name": "VAT", + "tax_rate": 10.00 + } + }, + + "Swaziland": { + "Swaziland tax": { + "account_name": "VAT", + "tax_rate": 14.00 + } + }, + + "Sweden": { + "Sweden Tax": { + "account_name": "VAT", + "tax_rate": 25.00 + } + }, + + "Switzerland": { + "Switzerland VAT 8%": { + "account_name": "VAT 8%", + "tax_rate": 8.00, + "default": 1 + }, + "Switzerland VAT 2.4%": { + "account_name": "VAT 2.4%", + "tax_rate": 2.40 + } + }, + + "Taiwan": { + "Taiwan Tax": { + "account_name": "VAT", + "tax_rate": 5.00 + } + }, + + "Tajikistan": { + "Tajikistan Tax": { + "account_name": "VAT", + "tax_rate": 20 + } + }, + + "Tanzania": { + "Tanzania Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Thailand": { + "Thailand Tax": { + "account_name": "VAT", + "tax_rate": 7.00 + } + }, + + "Togo": { + "Togo Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Tonga": { + "Tonga Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Trinidad And Tobago": { + "Trinidad & Tobago Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + }, + + "Tunisia": { + "Tunisia VAT 18%": { + "account_name": "VAT 18%", + "tax_rate": 18.00, + "default": 1 + }, + "Tunisia VAT 12%": { + "account_name": "VAT 12%", + "tax_rate": 12.00 + }, + "Tunisia VAT 6%": { + "account_name": "VAT 6%", + "tax_rate": 6.00 + } + }, + + "Turkey": { + "Turkey Tax": { + "account_name": "VAT 18%", + "tax_rate": 18.00 + } + }, + + "Turkmenistan": { + "Turkmenistan Tax": { + "account_name": "VAT", + "tax_rate": 20.00 + } + }, + + "Uganda": { + "Uganda Tax": { + "account_name": "VAT", + "tax_rate": 18.00 + } + }, + + "Ukraine": { + "Ukraine Tax": { + "account_name": "VAT", + "tax_rate": 20.00 + } + }, + + "United Kingdom": { + "United Kingdom Tax": { + "account_name": "VAT", + "tax_rate": 20.00 + } + }, + + "United States": { + "US ST 6%": { + "account_name": "ST 6%", + "tax_rate": 6.00, + "default": 1 + }, + "US ST 4%": { + "account_name": "ST 4%", + "tax_rate": 4.00 + }, + "US ST 6.25%": { + "account_name": "ST 6.25%", + "tax_rate": 6.25 + } + }, + + "Uruguay": { + "Uruguay Tax": { + "account_name": "VAT", + "tax_rate": 22.00 + } + }, + + "Uzbekistan": { + "Uzbekistan Tax": { + "account_name": "VAT", + "tax_rate": 20.00 + } + }, + + "Vanuatu": { + "Vanuatu Tax": { + "account_name": "VAT", + "tax_rate": 12.50 + } + }, + + "Venezuela": { + "Venezuela Tax": { + "account_name": "VAT", + "tax_rate": 12.00 + } + }, + + "Vietnam": { + "Vietnam Tax": { + "account_name": "VAT", + "tax_rate": 10.00 + } + }, + + "Yemen": { + "Yemen Tax": { + "account_name": "VAT", + "tax_rate": 5.00 + } + }, + + "Zambia": { + "Zambia Tax": { + "account_name": "VAT", + "tax_rate": 16.00 + } + }, + + "Zimbabwe": { + "Zimbabwe Tax": { + "account_name": "VAT", + "tax_rate": 15.00 + } + } +} \ No newline at end of file diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py index 945dfb116c..2c0c85cbbc 100644 --- a/erpnext/setup/setup_wizard/setup_wizard.py +++ b/erpnext/setup/setup_wizard/setup_wizard.py @@ -4,6 +4,8 @@ from __future__ import unicode_literals import frappe, copy +import os +import json from frappe.utils import cstr, flt, getdate from frappe import _ from frappe.utils.file_manager import save_file @@ -15,57 +17,107 @@ from frappe.core.doctype.communication.comment import add_info_comment from erpnext.setup.setup_wizard.domainify import setup_domain def setup_complete(args=None): - if frappe.db.sql("select name from tabCompany"): - frappe.throw(_("Setup Already Complete!!")) + if frappe.db.sql("select name from tabCompany"): + frappe.throw(_("Setup Already Complete!!")) - install_fixtures.install(args.get("country")) + install_fixtures.install(args.get("country")) - create_price_lists(args) - create_fiscal_year_and_company(args) - create_users(args) - set_defaults(args) - create_territories() - create_feed_and_todo() - create_email_digest() - create_letter_head(args) - create_taxes(args) - create_items(args) - create_customers(args) - create_suppliers(args) + create_price_lists(args) + create_fiscal_year_and_company(args) + create_sales_tax(args) + create_users(args) + set_defaults(args) + create_territories() + create_feed_and_todo() + create_email_digest() + create_letter_head(args) + create_taxes(args) + create_items(args) + create_customers(args) + create_suppliers(args) - if args.domain.lower() == 'education': - create_academic_year() - create_academic_term() - create_program(args) - create_course(args) - create_instructor(args) - create_room(args) + if args.domain.lower() == 'education': + create_academic_year() + create_academic_term() + create_program(args) + create_course(args) + create_instructor(args) + create_room(args) - if args.get('setup_website'): - website_maker(args) + if args.get('setup_website'): + website_maker(args) - create_logo(args) + create_logo(args) - frappe.local.message_log = [] - setup_domain(args.get('domain')) + frappe.local.message_log = [] + setup_domain(args.get('domain')) - frappe.db.commit() - login_as_first_user(args) + frappe.db.commit() + login_as_first_user(args) - frappe.db.commit() - frappe.clear_cache() + frappe.db.commit() + frappe.clear_cache() - if args.get("add_sample_data"): - try: - make_sample_data() - frappe.clear_cache() - except: - # clear message - if frappe.message_log: - frappe.message_log.pop() + if args.get("add_sample_data"): + try: + make_sample_data() + frappe.clear_cache() + except: + # clear message + if frappe.message_log: + frappe.message_log.pop() - pass + pass +def create_sales_tax(args): + country_wise_tax = get_country_wise_tax(args.get("country")) + if len(country_wise_tax)>0: + for sales_tax, tax_data in country_wise_tax.items(): + account = create_account(tax_data, args) + if account: + create_sales_template(sales_tax, account, args) + +def create_account(tax_data, args): + try: + account = frappe.get_doc({ + "doctype": "Account", + "is_group": 0, + "root_type": "Liability", + "company": args.get("company_name"), + "parent_account": "Duties and Taxes - %s"%(args.get('company_abbr')), + "account_name": tax_data.get('account_name'), + "account_type": "Tax", + "tax_rate": tax_data.get('tax_rate'), + "currency": args.get('currency') + }).insert(ignore_permissions=True) + + return account.name + except: + return None + +def create_sales_template(sales_tax, account, args): + sales_tax_template = frappe.get_doc({ + "doctype": "Sales Taxes and Charges Template", + "title": sales_tax, + "company": args.get("company_name"), + "taxes": [{ + "doctype": "Sales Taxes and Charges", + "charge_type": "On Net Total", + "account_head": account, + "description": sales_tax.split("-")[0] + }] + }).insert(ignore_permissions=True) + + sales_tax_template.set_missing_values() + sales_tax_template.save() + +def get_country_wise_tax(country): + data = {} + with open (os.path.join(os.path.dirname(__file__), "data", "country_wise_tax.json")) as countrywise_tax: + data = json.load(countrywise_tax).get(country) + + return data + def create_fiscal_year_and_company(args): if (args.get('fy_start_date')): curr_fiscal_year = get_fy_details(args.get('fy_start_date'), args.get('fy_end_date'))