Skip to content

Commit

Permalink
fix: always post to tax account heads if LCV is booked
Browse files Browse the repository at this point in the history
(cherry picked from commit 0fcd5d5)
  • Loading branch information
ruthra-kumar authored and mergify[bot] committed Jul 3, 2024
1 parent d5366c5 commit 650b25f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,13 @@ def add_provisional_gl_entry(
posting_date=posting_date,
)

def is_landed_cost_booked_for_any_item(self) -> bool:
for x in self.items:
if x.landed_cost_voucher_amount != 0:
return True

return False

def make_tax_gl_entries(self, gl_entries, via_landed_cost_voucher=False):
negative_expense_to_be_booked = sum([flt(d.item_tax_amount) for d in self.get("items")])
is_asset_pr = any(d.is_fixed_asset for d in self.get("items"))
Expand Down Expand Up @@ -696,7 +703,7 @@ def make_tax_gl_entries(self, gl_entries, via_landed_cost_voucher=False):
i = 1
for tax in self.get("taxes"):
if valuation_tax.get(tax.name):
if via_landed_cost_voucher:
if via_landed_cost_voucher or self.is_landed_cost_booked_for_any_item():
account = tax.account_head
else:
negative_expense_booked_in_pi = frappe.db.sql(
Expand Down

0 comments on commit 650b25f

Please sign in to comment.