fix(Asset Repair): Create GL Entries for each item in Stock Items

This commit is contained in:
GangaManoj 2021-06-18 09:53:18 +05:30
parent 50826f16ee
commit 54cbc8324a

View File

@ -120,11 +120,15 @@ class AssetRepair(AccountsController):
}, item=self) }, item=self)
) )
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')
for item in stock_entry.items:
gl_entries.append( gl_entries.append(
self.get_gl_dict({ self.get_gl_dict({
"account": expense_account, "account": item.expense_account,
"credit": self.total_repair_cost - self.repair_cost, "credit": item.amount,
"credit_in_account_currency": self.total_repair_cost - self.repair_cost, "credit_in_account_currency": item.amount,
"against": repair_and_maintenance_account, "against": repair_and_maintenance_account,
"voucher_type": self.doctype, "voucher_type": self.doctype,
"voucher_no": self.name, "voucher_no": self.name,