From 555f425da1b695d13bccd09b08bb0142ff3f0db8 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 22 Apr 2019 20:24:31 +0530 Subject: [PATCH] fix: Test case and styling fixes --- erpnext/buying/doctype/purchase_order/purchase_order.js | 4 ++-- erpnext/selling/doctype/sales_order/sales_order.js | 4 ++-- erpnext/selling/doctype/sales_order/sales_order.py | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 489e2860e9..e63ef605b0 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -139,13 +139,13 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( }, __('Create')) } - if (doc.docstatus == 1 && !doc.inter_company_order_reference) { + if (doc.docstatus === 1 && !doc.inter_company_order_reference) { let me = this; frappe.model.with_doc("Supplier", me.frm.doc.supplier, () => { let supplier = frappe.model.get_doc("Supplier", me.frm.doc.supplier); let internal = supplier.is_internal_supplier; let disabled = supplier.disabled; - if (internal == 1 && disabled == 0) { + if (internal === 1 && disabled === 0) { me.frm.add_custom_button("Inter Company Order", function() { me.make_inter_company_order(me.frm); }, __('Create')); diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index 064748d706..dc22b5b0fe 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -205,13 +205,13 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( }, __('Create')) } - if (doc.docstatus == 1 && !doc.inter_company_order_reference) { + if (doc.docstatus === 1 && !doc.inter_company_order_reference) { let me = this; frappe.model.with_doc("Customer", me.frm.doc.customer, () => { let customer = frappe.model.get_doc("Customer", me.frm.doc.customer); let internal = customer.is_internal_customer; let disabled = customer.disabled; - if (internal == 1 && disabled == 0) { + if (internal === 1 && disabled === 0) { me.frm.add_custom_button("Inter Company Order", function() { me.make_inter_company_order(); }, __('Create')); diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 25740d238b..6b51b9670c 100755 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -478,7 +478,7 @@ def validate_inter_company_party(doctype, party, company, inter_company_order_re elif frappe.db.get_value(partytype, {"name": party, internal: 1}, "name") == party: companies = frappe.db.sql("""select company from `tabAllowed To Transact With` - where parenttype = '{0}' and parent = '{1}'""".format(partytype, party), as_list = 1) + where parenttype = '{0}' and parent = '{1}'""".format(partytype, party), as_list = 1) #nosec companies = [d[0] for d in companies] if not company in companies: frappe.throw(_("{0} not allowed to transact with {1}. Please change the Company.").format(partytype, company)) @@ -805,6 +805,7 @@ def make_purchase_order_for_drop_shipment(source_name, for_supplier=None, target target.apply_discount_on = "" target.additional_discount_percentage = 0.0 target.discount_amount = 0.0 + target.inter_company_order_reference = "" default_price_list = frappe.get_value("Supplier", supplier, "default_price_list") if default_price_list: