Merge pull request #12435 from tundebabzy/packing-slip-msg
Better validation message in Packing Slip
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
index 55d8639..fd5241b 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
@@ -23,10 +23,10 @@
"options": "Customer Group"
},
{
- "fieldname":"credit_days_based_on",
- "label": __("Credit Days Based On"),
- "fieldtype": "Select",
- "options": "\nFixed Days\nLast Day of the Next Month"
+ "fieldname":"payment_terms_template",
+ "label": __("Payment Terms Template"),
+ "fieldtype": "Link",
+ "options": "Payment Terms Template"
},
{
"fieldtype": "Break",
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
index 522abe8..0732b7d 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
@@ -283,9 +283,9 @@
where exists(select name from `tabCustomer Group` where lft >= {0} and rgt <= {1}
and name=tabCustomer.customer_group))""".format(lft, rgt))
- if self.filters.get("credit_days_based_on"):
- conditions.append("party in (select name from tabCustomer where credit_days_based_on=%s)")
- values.append(self.filters.get("credit_days_based_on"))
+ if self.filters.get("payment_terms_template"):
+ conditions.append("party in (select name from tabCustomer where payment_terms=%s)")
+ values.append(self.filters.get("payment_terms_template"))
return " and ".join(conditions), values
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index a36810f..d7d23b3 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -281,6 +281,12 @@
# delete mode of payment account
frappe.db.sql("delete from `tabMode of Payment Account` where company=%s", self.name)
+ # delete BOMs
+ boms = frappe.db.sql_list("select name from tabBOM where company=%s", self.name)
+ frappe.db.sql("delete from tabBOM where company=%s", self.name)
+ for dt in ("BOM Operation", "BOM Item", "BOM Scrap Item", "BOM Explosion Item"):
+ frappe.db.sql("delete from `tab%s` where parent in (%s)"""
+ % (dt, ', '.join(['%s']*len(boms))), tuple(boms))
@frappe.whitelist()
def enqueue_replace_abbr(company, old, new):