Skip to content

Commit

Permalink
fix: over billing qty along with rate
Browse files Browse the repository at this point in the history
(cherry picked from commit cc96d2b)
  • Loading branch information
GursheenK authored and mergify[bot] committed Feb 29, 2024
1 parent 87596e6 commit 00d410c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,8 +1023,10 @@ def make_item_gl_entries(self, gl_entries):

if provisional_accounting_for_non_stock_items:
if item.purchase_receipt:
provisional_account, pr_base_rate = frappe.get_cached_value(
"Purchase Receipt Item", item.pr_detail, ["provisional_expense_account", "base_rate"]
provisional_account, pr_qty, pr_base_rate = frappe.get_cached_value(
"Purchase Receipt Item",
item.pr_detail,
["provisional_expense_account", "qty", "base_rate"],
)
provisional_account = provisional_account or self.get_company_default(
"default_provisional_account"
Expand Down Expand Up @@ -1056,7 +1058,7 @@ def make_item_gl_entries(self, gl_entries):
self.posting_date,
provisional_account,
reverse=1,
item_amount=(item.qty * pr_base_rate),
item_amount=(min(item.qty, pr_qty) * pr_base_rate),
)

if not self.is_internal_transfer():
Expand Down

0 comments on commit 00d410c

Please sign in to comment.