diff --git a/erpnext/__version__.py b/erpnext/__version__.py index 3a54c17e0ff..2a74e2987ed 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1,2 +1,2 @@ from __future__ import unicode_literals -__version__ = '6.3.0' +__version__ = '6.3.1' diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.py b/erpnext/accounts/doctype/tax_rule/tax_rule.py index bcbd5595d40..bff18980b62 100644 --- a/erpnext/accounts/doctype/tax_rule/tax_rule.py +++ b/erpnext/accounts/doctype/tax_rule/tax_rule.py @@ -18,32 +18,24 @@ class TaxRule(Document): def validate(self): self.validate_tax_template() - self.validate_customer_group() - self.validate_supplier_type() self.validate_date() self.validate_filters() def validate_tax_template(self): if self.tax_type== "Sales": self.purchase_tax_template = self.supplier = self.supplier_type= None + if self.customer: + self.customer_group = None + else: self.sales_tax_template= self.customer = self.customer_group= None + if self.supplier: + self.supplier_type = None + if not (self.sales_tax_template or self.purchase_tax_template): frappe.throw(_("Tax Template is mandatory.")) - def validate_customer_group(self): - if self.customer and self.customer_group: - if not frappe.db.get_value("Customer", self.customer, "customer_group") == self.customer_group: - frappe.throw(_("Customer {0} does not belong to customer group {1}"). \ - format(self.customer, self.customer_group), IncorrectCustomerGroup) - - def validate_supplier_type(self): - if self.supplier and self.supplier_type: - if not frappe.db.get_value("Supplier", self.supplier, "supplier_type") == self.supplier_type: - frappe.throw(_("Supplier {0} does not belong to Supplier Type {1}"). \ - format(self.supplier, self.supplier_type), IncorrectSupplierType) - def validate_date(self): if self.from_date and self.to_date and self.from_date > self.to_date: frappe.throw(_("From Date cannot be greater than To Date")) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index f6daf77072c..e5e3903980f 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -29,7 +29,7 @@ blogs. """ app_icon = "icon-th" app_color = "#e74c3c" -app_version = "6.3.0" +app_version = "6.3.1" github_link = "https://github.com/frappe/erpnext" error_report_email = "support@erpnext.com" diff --git a/erpnext/patches/v5_8/tax_rule.py b/erpnext/patches/v5_8/tax_rule.py index b710ddcbe44..80a23642935 100644 --- a/erpnext/patches/v5_8/tax_rule.py +++ b/erpnext/patches/v5_8/tax_rule.py @@ -5,23 +5,25 @@ from __future__ import unicode_literals import frappe def execute(): - customers = frappe.db.sql("""select name, default_taxes_and_charges from tabCustomer where + frappe.reload_doc("accounts", "doctype", "tax_rule") + + customers = frappe.db.sql("""select name, default_taxes_and_charges from tabCustomer where ifnull(default_taxes_and_charges, '') != '' """, as_dict=1) - + for d in customers: tr = frappe.new_doc("Tax Rule") tr.tax_type = "Sales" tr.customer = d.name tr.sales_tax_template = d.default_taxes_and_charges tr.save() - - suppliers = frappe.db.sql("""select name, default_taxes_and_charges from tabSupplier where + + suppliers = frappe.db.sql("""select name, default_taxes_and_charges from tabSupplier where ifnull(default_taxes_and_charges, '') != '' """, as_dict=1) - + for d in suppliers: tr = frappe.new_doc("Tax Rule") tr.tax_type = "Purchase" tr.supplier = d.name tr.purchase_tax_template = d.default_taxes_and_charges - tr.save() \ No newline at end of file + tr.save() diff --git a/erpnext/patches/v6_3/convert_applicable_territory.py b/erpnext/patches/v6_3/convert_applicable_territory.py index 483bf8a5957..b693ce5c3f5 100644 --- a/erpnext/patches/v6_3/convert_applicable_territory.py +++ b/erpnext/patches/v6_3/convert_applicable_territory.py @@ -1,12 +1,15 @@ import frappe def execute(): + frappe.reload_doc("stock", "doctype", "price_list_country") + frappe.reload_doc("accounts", "doctype", "shipping_rule_country") + frappe.reload_doctype("Price List") + frappe.reload_doctype("Shipping Rule") + # for price list countries = frappe.db.sql_list("select name from tabCountry") for doctype in ("Price List", "Shipping Rule"): - frappe.reload_doctype(doctype) - for at in frappe.db.sql("""select name, parent, territory from `tabApplicable Territory` where parenttype = %s """, doctype, as_dict=True): if at.territory in countries: diff --git a/setup.py b/setup.py index 0b523227c76..a6c21646079 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = "6.3.0" +version = "6.3.1" with open("requirements.txt", "r") as f: install_requires = f.readlines()