diff --git a/erpnext/manufacturing/doctype/blanket_order/blanket_order.json b/erpnext/manufacturing/doctype/blanket_order/blanket_order.json index 84e0816834..d529ae2f0d 100644 --- a/erpnext/manufacturing/doctype/blanket_order/blanket_order.json +++ b/erpnext/manufacturing/doctype/blanket_order/blanket_order.json @@ -139,7 +139,7 @@ "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, - "read_only": 0, + "read_only": 1, "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, @@ -208,7 +208,7 @@ "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, - "read_only": 0, + "read_only": 1, "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, @@ -452,7 +452,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-06-14 18:06:48.009635", + "modified": "2018-06-27 15:01:05.314631", "modified_by": "Administrator", "module": "Manufacturing", "name": "Blanket Order", @@ -487,5 +487,6 @@ "sort_field": "modified", "sort_order": "DESC", "track_changes": 1, - "track_seen": 0 + "track_seen": 0, + "track_views": 0 } \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/blanket_order/blanket_order.py b/erpnext/manufacturing/doctype/blanket_order/blanket_order.py index 5381abfe0a..822c7fcc1a 100644 --- a/erpnext/manufacturing/doctype/blanket_order/blanket_order.py +++ b/erpnext/manufacturing/doctype/blanket_order/blanket_order.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals import frappe +from frappe.utils import flt from frappe.model.document import Document from frappe.model.mapper import get_mapped_doc from erpnext.stock.doctype.item.item import get_item_defaults @@ -28,7 +29,8 @@ class BlanketOrder(Document): @frappe.whitelist() def make_sales_order(source_name): def update_item(source, target, source_parent): - target.qty = source.get("qty") - source.get("ordered_qty") + target_qty = source.get("qty") - source.get("ordered_qty") + target.qty = target_qty if not flt(target_qty) < 0 else 0 item = get_item_defaults(target.item_code, source_parent.company) if item: target.item_name = item.get("item_name") @@ -53,7 +55,8 @@ def make_sales_order(source_name): @frappe.whitelist() def make_purchase_order(source_name): def update_item(source, target, source_parent): - target.qty = source.get("qty") - source.get("ordered_qty") + target_qty = source.get("qty") - source.get("ordered_qty") + target.qty = target_qty if not flt(target_qty) < 0 else 0 item = get_item_defaults(target.item_code, source_parent.company) if item: target.item_name = item.get("item_name") diff --git a/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.js b/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.js new file mode 100644 index 0000000000..51a0d94841 --- /dev/null +++ b/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Blanket Order", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Blanket Order + () => frappe.tests.make('Blanket Order', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +});