fix(Asset Repair): Add Stock Entry field

This commit is contained in:
GangaManoj 2021-06-19 14:54:30 +05:30
parent 4004bcd436
commit e755c74a60
2 changed files with 16 additions and 4 deletions

View File

@ -31,6 +31,7 @@
"warehouse",
"stock_items",
"total_repair_cost",
"stock_entry",
"asset_depreciation_details_section",
"increase_in_asset_life",
"section_break_9",
@ -118,6 +119,7 @@
"fieldtype": "Column Break"
},
{
"default": "0",
"fieldname": "repair_cost",
"fieldtype": "Currency",
"label": "Repair Cost"
@ -208,11 +210,12 @@
"label": "Stock Consumption Details"
},
{
"depends_on": "stock_consumption",
"depends_on": "eval: doc.stock_consumption && doc.total_repair_cost > 0",
"description": "Sum of Repair Cost and the total value of all Stock Items consumed during the repair.",
"fieldname": "total_repair_cost",
"fieldtype": "Currency",
"label": "Total Repair Cost"
"label": "Total Repair Cost",
"read_only": 1
},
{
"depends_on": "stock_consumption",
@ -246,12 +249,19 @@
"fieldtype": "Link",
"label": "Company",
"options": "Company"
},
{
"fieldname": "stock_entry",
"fieldtype": "Link",
"label": "Stock Entry",
"options": "Stock Entry",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2021-06-19 14:04:35.423111",
"modified": "2021-06-19 14:47:25.875814",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset Repair",

View File

@ -92,6 +92,8 @@ class AssetRepair(AccountsController):
stock_entry.insert()
stock_entry.submit()
self.stock_entry = stock_entry.name
def on_cancel(self):
self.make_gl_entries(cancel=True)
@ -122,7 +124,7 @@ class AssetRepair(AccountsController):
if self.stock_consumption:
# creating GL Entries for each row in Stock Items based on the Stock Entry created for it
stock_entry = frappe.get_last_doc('Stock Entry')
stock_entry = frappe.get_doc('Stock Entry', self.stock_entry)
for item in stock_entry.items:
gl_entries.append(
self.get_gl_dict({