fix(Asset Repair): Add Stock Entry field
This commit is contained in:
parent
4004bcd436
commit
e755c74a60
@ -31,6 +31,7 @@
|
|||||||
"warehouse",
|
"warehouse",
|
||||||
"stock_items",
|
"stock_items",
|
||||||
"total_repair_cost",
|
"total_repair_cost",
|
||||||
|
"stock_entry",
|
||||||
"asset_depreciation_details_section",
|
"asset_depreciation_details_section",
|
||||||
"increase_in_asset_life",
|
"increase_in_asset_life",
|
||||||
"section_break_9",
|
"section_break_9",
|
||||||
@ -118,6 +119,7 @@
|
|||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"default": "0",
|
||||||
"fieldname": "repair_cost",
|
"fieldname": "repair_cost",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Repair Cost"
|
"label": "Repair Cost"
|
||||||
@ -208,11 +210,12 @@
|
|||||||
"label": "Stock Consumption Details"
|
"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.",
|
"description": "Sum of Repair Cost and the total value of all Stock Items consumed during the repair.",
|
||||||
"fieldname": "total_repair_cost",
|
"fieldname": "total_repair_cost",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Total Repair Cost"
|
"label": "Total Repair Cost",
|
||||||
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "stock_consumption",
|
"depends_on": "stock_consumption",
|
||||||
@ -246,12 +249,19 @@
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Company",
|
"label": "Company",
|
||||||
"options": "Company"
|
"options": "Company"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "stock_entry",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Stock Entry",
|
||||||
|
"options": "Stock Entry",
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-06-19 14:04:35.423111",
|
"modified": "2021-06-19 14:47:25.875814",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Assets",
|
"module": "Assets",
|
||||||
"name": "Asset Repair",
|
"name": "Asset Repair",
|
||||||
|
@ -92,6 +92,8 @@ class AssetRepair(AccountsController):
|
|||||||
stock_entry.insert()
|
stock_entry.insert()
|
||||||
stock_entry.submit()
|
stock_entry.submit()
|
||||||
|
|
||||||
|
self.stock_entry = stock_entry.name
|
||||||
|
|
||||||
def on_cancel(self):
|
def on_cancel(self):
|
||||||
self.make_gl_entries(cancel=True)
|
self.make_gl_entries(cancel=True)
|
||||||
|
|
||||||
@ -122,7 +124,7 @@ class AssetRepair(AccountsController):
|
|||||||
|
|
||||||
if self.stock_consumption:
|
if self.stock_consumption:
|
||||||
# creating GL Entries for each row in Stock Items based on the Stock Entry created for it
|
# 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:
|
for item in stock_entry.items:
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
|
Loading…
Reference in New Issue
Block a user