fix(Asset Repair): Add mandatory_depends_on condition for Purchase Invoice

This commit is contained in:
GangaManoj 2021-06-16 08:18:45 +05:30
parent 17fa121779
commit aff9709525
2 changed files with 2 additions and 6 deletions

View File

@ -241,6 +241,7 @@
"fieldname": "purchase_invoice",
"fieldtype": "Link",
"label": "Purchase Invoice",
"mandatory_depends_on": "eval: doc.repair_status == 'Completed' && doc.repair_cost > 0",
"options": "Purchase Invoice"
},
{
@ -254,7 +255,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2021-06-16 08:02:34.782990",
"modified": "2021-06-16 08:16:07.581813",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset Repair",

View File

@ -45,7 +45,6 @@ class AssetRepair(Document):
self.check_for_stock_items_and_warehouse()
self.decrease_stock_quantity()
if self.capitalize_repair_cost:
self.check_for_purchase_invoice()
self.make_gl_entries()
if frappe.db.get_value('Asset', self.asset, 'calculate_depreciation'):
self.modify_depreciation_schedule()
@ -90,10 +89,6 @@ class AssetRepair(Document):
stock_entry.insert()
stock_entry.submit()
def check_for_purchase_invoice(self):
if not self.purchase_invoice:
frappe.throw(_("Please link Purchase Invoice."))
def on_cancel(self):
self.make_gl_entries(cancel=True)