fix: Add check to skip SO and DN in customer master

This commit is contained in:
Deepesh Garg
2020-03-17 11:43:34 +05:30
parent d9ab412032
commit 6c148ef314
2 changed files with 26 additions and 8 deletions

View File

@@ -412,7 +412,7 @@ class SalesInvoice(SellingController):
if pos:
self.allow_print_before_pay = pos.allow_print_before_pay
if not for_validate:
self.tax_category = pos.get("tax_category")
@@ -534,14 +534,18 @@ class SalesInvoice(SellingController):
"""check in manage account if sales order / delivery note required or not."""
if self.is_return:
return
dic = {'Sales Order':['so_required', 'is_pos'],'Delivery Note':['dn_required', 'update_stock']}
for i in dic:
if frappe.db.get_single_value('Selling Settings', dic[i][0]) == 'Yes':
prev_doc_field_map = {'Sales Order': ['so_required', 'is_pos'],'Delivery Note': ['dn_required', 'update_stock']}
for key, value in iteritems(prev_doc_field_map):
if frappe.db.get_single_value('Selling Settings', value[0]) == 'Yes':
if frappe.get_value('Customer', self.customer, value[0]):
continue
for d in self.get('items'):
is_stock_item = frappe.get_cached_value('Item', d.item_code, 'is_stock_item')
if (d.item_code and is_stock_item == 1\
and not d.get(i.lower().replace(' ','_')) and not self.get(dic[i][1])):
msgprint(_("{0} is mandatory for Item {1}").format(i,d.item_code), raise_exception=1)
if (d.item_code and is_stock_item ==1 and not d.get(key.lower().replace(' ', '_')) and not self.get(value[1])):
msgprint(_("{0} is mandatory for Item {1}").format(key, d.item_code), raise_exception=1)
def validate_proj_cust(self):

View File

@@ -25,6 +25,8 @@
"territory",
"tax_id",
"tax_category",
"so_required",
"dn_required",
"disabled",
"is_internal_customer",
"represents_company",
@@ -466,13 +468,25 @@
"fieldtype": "Table",
"label": "Credit Limit",
"options": "Customer Credit Limit"
},
{
"default": "0",
"fieldname": "so_required",
"fieldtype": "Check",
"label": "Allow Sales Invoice Creation Without Sales Order"
},
{
"default": "0",
"fieldname": "dn_required",
"fieldtype": "Check",
"label": "Allow Sales Invoice Creation Without Delivery Note"
}
],
"icon": "fa fa-user",
"idx": 363,
"image_field": "image",
"links": [],
"modified": "2020-01-29 20:36:37.879581",
"modified": "2020-03-17 11:03:42.706907",
"modified_by": "Administrator",
"module": "Selling",
"name": "Customer",