Skip to content

Commit

Permalink
fix: take quantity into account when setting asset's gross purchase a…
Browse files Browse the repository at this point in the history
…mt (backport #39056) (#39058)

fix: take quantity into account when setting asset's gross purchase amt (#39056)

fix: take quantity into account when setting asset's gross purchase amount
(cherry picked from commit 0346f47)

Co-authored-by: Anand Baburajan <anandbaburajan@gmail.com>
  • Loading branch information
mergify[bot] and anandbaburajan authored Jan 1, 2024
1 parent d8cf994 commit 2e93275
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -1135,11 +1135,17 @@ def make_item_gl_entries(self, gl_entries):
)

assets = frappe.db.get_all(
"Asset", filters={"purchase_invoice": self.name, "item_code": item.item_code}
"Asset",
filters={"purchase_invoice": self.name, "item_code": item.item_code},
fields=["name", "asset_quantity"],
)
for asset in assets:
frappe.db.set_value("Asset", asset.name, "gross_purchase_amount", flt(item.valuation_rate))
frappe.db.set_value("Asset", asset.name, "purchase_receipt_amount", flt(item.valuation_rate))
frappe.db.set_value(
"Asset", asset.name, "gross_purchase_amount", flt(item.valuation_rate) * asset.asset_quantity
)
frappe.db.set_value(
"Asset", asset.name, "purchase_receipt_amount", flt(item.valuation_rate) * asset.asset_quantity
)

def make_stock_adjustment_entry(
self, gl_entries, item, voucher_wise_stock_value, account_currency
Expand Down

0 comments on commit 2e93275

Please sign in to comment.