Merge branch 'develop' into develop
diff --git a/erpnext/manufacturing/doctype/blanket_order/blanket_order.js b/erpnext/manufacturing/doctype/blanket_order/blanket_order.js
index 0bbf689..b6ad276 100644
--- a/erpnext/manufacturing/doctype/blanket_order/blanket_order.js
+++ b/erpnext/manufacturing/doctype/blanket_order/blanket_order.js
@@ -51,11 +51,20 @@
set_tc_name_filter: function(frm) {
if (frm.doc.blanket_order_type === 'Selling') {
+ frm.set_df_property("customer","reqd", 1)
+ frm.set_df_property("supplier","reqd", 0)
+ frm.set_value("supplier", "")
+
frm.set_query("tc_name", function() {
return { filters: { selling: 1 } };
});
}
if (frm.doc.blanket_order_type === 'Purchasing') {
+ frm.set_df_property("supplier","reqd", 1)
+ frm.set_df_property("customer","reqd", 0)
+ frm.set_value("customer", "")
+
+
frm.set_query("tc_name", function() {
return { filters: { buying: 1 } };
});
diff --git a/erpnext/manufacturing/doctype/blanket_order/blanket_order.json b/erpnext/manufacturing/doctype/blanket_order/blanket_order.json
index 570d435..260e0b8 100644
--- a/erpnext/manufacturing/doctype/blanket_order/blanket_order.json
+++ b/erpnext/manufacturing/doctype/blanket_order/blanket_order.json
@@ -88,7 +88,8 @@
"fieldname": "company",
"fieldtype": "Link",
"label": "Company",
- "options": "Company"
+ "options": "Company",
+ "reqd": 1
},
{
"fieldname": "section_break_12",
@@ -128,7 +129,7 @@
}
],
"is_submittable": 1,
- "modified": "2019-06-19 11:59:09.279607",
+ "modified": "2019-10-16 13:38:32.302316",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Blanket Order",
diff --git a/erpnext/manufacturing/doctype/blanket_order/blanket_order.py b/erpnext/manufacturing/doctype/blanket_order/blanket_order.py
index 822c7fc..faed707 100644
--- a/erpnext/manufacturing/doctype/blanket_order/blanket_order.py
+++ b/erpnext/manufacturing/doctype/blanket_order/blanket_order.py
@@ -4,13 +4,21 @@
from __future__ import unicode_literals
import frappe
-from frappe.utils import flt
+from frappe import _
+from frappe.utils import flt, getdate
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
from erpnext.stock.doctype.item.item import get_item_defaults
class BlanketOrder(Document):
+ def validate(self):
+ self.validate_dates()
+
+ def validate_dates(self):
+ if getdate(self.from_date) > getdate(self.to_date):
+ frappe.throw(_("From date cannot be greater than To date"))
+
def update_ordered_qty(self):
ref_doctype = "Sales Order" if self.blanket_order_type == "Selling" else "Purchase Order"
item_ordered_qty = frappe._dict(frappe.db.sql("""