From 27bcb2a064b0bbdc284667ba2c2178a16ca32465 Mon Sep 17 00:00:00 2001 From: Afshan <33727827+AfshanKhan@users.noreply.github.com> Date: Tue, 9 Mar 2021 22:25:48 +0530 Subject: [PATCH] fix: renamed "supplier_warehouse" to "set_from_warehouse" (#24816) * fix: reverting and adding new field for supplier warehouse --- .../purchase_invoice/purchase_invoice.json | 16 ++++++++++++++-- .../purchase_invoice/test_purchase_invoice.py | 4 ++-- erpnext/controllers/buying_controller.py | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index 451c936881..18b66375e9 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -58,6 +58,7 @@ "rejected_warehouse", "col_break_warehouse", "set_from_warehouse", + "supplier_warehouse", "is_subcontracted", "items_section", "update_stock", @@ -1350,7 +1351,7 @@ "options": "Company" }, { - "depends_on": "eval:doc.update_stock && (doc.is_subcontracted==\"Yes\" || doc.is_internal_supplier)", + "depends_on": "eval:doc.update_stock && doc.is_internal_supplier", "description": "Sets 'From Warehouse' in each row of the items table.", "fieldname": "set_from_warehouse", "fieldtype": "Link", @@ -1360,13 +1361,24 @@ "print_hide": 1, "print_width": "50px", "width": "50px" + }, + { + "depends_on": "eval:doc.update_stock && doc.is_subcontracted==\"Yes\"", + "fieldname": "supplier_warehouse", + "fieldtype": "Link", + "label": "Supplier Warehouse", + "no_copy": 1, + "options": "Warehouse", + "print_hide": 1, + "print_width": "50px", + "width": "50px" } ], "icon": "fa fa-file-text", "idx": 204, "is_submittable": 1, "links": [], - "modified": "2020-12-26 20:49:03.305063", + "modified": "2021-03-09 21:12:30.422084", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice", diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index 2c088ce2b2..ded293b88d 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -456,7 +456,7 @@ class TestPurchaseInvoice(unittest.TestCase): pi = make_purchase_invoice(company = "_Test Company with perpetual inventory", warehouse= "Stores - TCP1", cost_center = "Main - TCP1", expense_account ="_Test Account Cost for Goods Sold - TCP1") - return_pi = make_purchase_invoice(is_return=1, return_against=pi.name, qty=-2, + return_pi = make_purchase_invoice(is_return=1, return_against=pi.name, qty=-2, company = "_Test Company with perpetual inventory", warehouse= "Stores - TCP1", cost_center = "Main - TCP1", expense_account ="_Test Account Cost for Goods Sold - TCP1") @@ -1031,7 +1031,7 @@ def make_purchase_invoice_against_cost_center(**args): pi.is_return = args.is_return pi.credit_to = args.return_against or "Creditors - _TC" pi.is_subcontracted = args.is_subcontracted or "No" - if args.supplier_warehouse: + if args.supplier_warehouse: pi.supplier_warehouse = "_Test Warehouse 1 - _TC" pi.append("items", { diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index e469838996..219d5295c3 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -278,7 +278,7 @@ class BuyingController(StockController): if self.is_subcontracted == "Yes": if self.doctype in ["Purchase Receipt", "Purchase Invoice"] and not self.supplier_warehouse: - frappe.throw(_("Supplier Warehouse mandatory for sub-contracted Purchase Receipt")) + frappe.throw(_("Supplier Warehouse mandatory for sub-contracted {0}").format(self.doctype)) for item in self.get("items"): if item in self.sub_contracted_items and not item.bom: