feat(Asset Repair): Add Warehouse field

This commit is contained in:
GangaManoj 2021-05-13 04:04:52 +05:30
parent f2fe55ceeb
commit c8cb96a38f
2 changed files with 14 additions and 7 deletions

View File

@ -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",

View File

@ -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."))