From 650b25fc23ae7180a16b974bc75f8bbdc2d7e23c Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 28 Jun 2024 20:28:01 +0530 Subject: [PATCH] fix: always post to tax account heads if LCV is booked (cherry picked from commit 0fcd5d51309ed3fd2dfcc16d44d31489990848d1) --- .../stock/doctype/purchase_receipt/purchase_receipt.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 7bbe7b9ff756..7b9067649467 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -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")) @@ -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(