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,19 +120,23 @@ class AssetRepair(AccountsController):
}, item=self) }, item=self)
) )
gl_entries.append( if self.stock_consumption:
self.get_gl_dict({ # creating GL Entries for each row in Stock Items based on the Stock Entry created for it
"account": expense_account, stock_entry = frappe.get_last_doc('Stock Entry')
"credit": self.total_repair_cost - self.repair_cost, for item in stock_entry.items:
"credit_in_account_currency": self.total_repair_cost - self.repair_cost, gl_entries.append(
"against": repair_and_maintenance_account, self.get_gl_dict({
"voucher_type": self.doctype, "account": item.expense_account,
"voucher_no": self.name, "credit": item.amount,
"cost_center": self.cost_center, "credit_in_account_currency": item.amount,
"posting_date": getdate(), "against": repair_and_maintenance_account,
"company": self.company "voucher_type": self.doctype,
}, item=self) "voucher_no": self.name,
) "cost_center": self.cost_center,
"posting_date": getdate(),
"company": self.company
}, item=self)
)
gl_entries.append( gl_entries.append(
self.get_gl_dict({ self.get_gl_dict({