[fix] unset default customer group (#10689)

* [fix] unset default customer group

* added __init__.py file for patch v8.9 directory
This commit is contained in:
Rushabh Mehta 2017-09-14 15:03:45 +05:30 committed by Makarand Bauskar
parent a6d78ef842
commit bf8e331135
6 changed files with 19 additions and 4 deletions

View File

@ -434,4 +434,5 @@ erpnext.patches.v8_6.set_write_permission_for_quotation_for_sales_manager
erpnext.patches.v8_5.remove_project_type_property_setter
erpnext.patches.v8_7.add_more_gst_fields
erpnext.patches.v8_7.fix_purchase_receipt_status
erpnext.patches.v8_6.rename_bom_update_tool
erpnext.patches.v8_6.rename_bom_update_tool
erpnext.patches.v8_9.set_default_customer_group

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,6 @@
import frappe
def execute():
selling_settings = frappe.get_single('Selling Settings')
selling_settings.set_default_customer_group_and_territory()
selling_settings.save()

View File

@ -8,6 +8,7 @@ import frappe
import frappe.defaults
from frappe.utils import cint
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
from frappe.utils.nestedset import get_root_of
from frappe.model.document import Document
@ -31,3 +32,9 @@ class SellingSettings(Document):
for doctype in ("Sales Order", "Sales Invoice", "Delivery Note"):
make_property_setter(doctype, "tax_id", "hidden", self.hide_tax_id, "Check")
make_property_setter(doctype, "tax_id", "print_hide", self.hide_tax_id, "Check")
def set_default_customer_group_and_territory(self):
if not self.customer_group:
self.customer_group = get_root_of('Customer Group')
if not self.territory:
self.territory = get_root_of('Territory')

View File

@ -176,6 +176,7 @@ def set_defaults(args):
selling_settings.so_required = "No"
selling_settings.dn_required = "No"
selling_settings.allow_multiple_items = 1
selling_settings.set_default_customer_group_and_territory()
selling_settings.save()
buying_settings = frappe.get_doc("Buying Settings")

View File

@ -4,7 +4,6 @@
from __future__ import unicode_literals
import frappe
from frappe.utils.nestedset import get_root_of
def boot_session(bootinfo):
"""boot session - send website info if guest"""
@ -17,9 +16,9 @@ def boot_session(bootinfo):
load_country_and_currency(bootinfo)
bootinfo.sysdefaults.territory = frappe.db.get_single_value('Selling Settings',
'territory') or get_root_of('Territory')
'territory')
bootinfo.sysdefaults.customer_group = frappe.db.get_single_value('Selling Settings',
'customer_group') or get_root_of('Customer Group')
'customer_group')
bootinfo.notification_settings = frappe.get_doc("Notification Control",
"Notification Control")