From c8cb96a38fb811d9a7f1a8355d5071726087be49 Mon Sep 17 00:00:00 2001 From: GangaManoj Date: Thu, 13 May 2021 04:04:52 +0530 Subject: [PATCH] feat(Asset Repair): Add Warehouse field --- .../assets/doctype/asset_repair/asset_repair.json | 9 ++++++++- erpnext/assets/doctype/asset_repair/asset_repair.py | 12 ++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/erpnext/assets/doctype/asset_repair/asset_repair.json b/erpnext/assets/doctype/asset_repair/asset_repair.json index df9ab7d63b..ed7708c8df 100644 --- a/erpnext/assets/doctype/asset_repair/asset_repair.json +++ b/erpnext/assets/doctype/asset_repair/asset_repair.json @@ -28,6 +28,7 @@ "payable_account", "total_repair_cost", "stock_consumption_details_section", + "warehouse", "stock_items", "section_break_9", "description", @@ -211,12 +212,18 @@ "fieldname": "total_repair_cost", "fieldtype": "Currency", "label": "Total Repair Cost" + }, + { + "fieldname": "warehouse", + "fieldtype": "Link", + "label": "Warehouse", + "options": "Warehouse" } ], "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2021-05-13 02:40:57.953076", + "modified": "2021-05-13 03:50:39.146322", "modified_by": "Administrator", "module": "Assets", "name": "Asset Repair", diff --git a/erpnext/assets/doctype/asset_repair/asset_repair.py b/erpnext/assets/doctype/asset_repair/asset_repair.py index dcad1c6181..ed022fd808 100644 --- a/erpnext/assets/doctype/asset_repair/asset_repair.py +++ b/erpnext/assets/doctype/asset_repair/asset_repair.py @@ -17,7 +17,6 @@ class AssetRepair(Document): self.update_status() self.set_total_value() # change later - self.check_stock_items() self.calculate_total_repair_cost() def update_status(self): @@ -30,11 +29,6 @@ class AssetRepair(Document): for item in self.stock_items: item.total_value = flt(item.valuation_rate) * flt(item.consumed_quantity) - def check_stock_items(self): - if self.stock_consumption: - if not self.stock_items: - frappe.throw(_("Please enter Stock Items consumed during Asset Repair.")) - def calculate_total_repair_cost(self): self.total_repair_cost = self.repair_cost if self.stock_consumption: @@ -43,6 +37,7 @@ class AssetRepair(Document): def on_submit(self): self.check_repair_status() + self.check_stock_items() self.check_for_payable_account() self.check_for_cost_center() @@ -53,6 +48,11 @@ class AssetRepair(Document): if self.repair_status == "Pending": frappe.throw(_("Please update Repair Status.")) + def check_stock_items(self): + if self.stock_consumption: + if not self.stock_items: + frappe.throw(_("Please enter Stock Items consumed during Asset Repair.")) + def check_for_payable_account(self): if not self.payable_account: frappe.throw(_("Please enter Payable Account."))