Skip to content

Commit

Permalink
fix: tax on stock_rbnb on repost of Purchase Receipt
Browse files Browse the repository at this point in the history
(cherry picked from commit 8633080)
  • Loading branch information
ruthra-kumar authored and mergify[bot] committed Jul 10, 2024
1 parent 00e8b86 commit 106c154
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,6 @@ def is_landed_cost_booked_for_any_item(self) -> bool:

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"))
# Cost center-wise amount breakup for other charges included for valuation
valuation_tax = {}
for tax in self.get("taxes"):
Expand All @@ -687,26 +686,10 @@ def make_tax_gl_entries(self, gl_entries, via_landed_cost_voucher=False):
against_account = ", ".join([d.account for d in gl_entries if flt(d.debit) > 0])
total_valuation_amount = sum(valuation_tax.values())
amount_including_divisional_loss = negative_expense_to_be_booked
stock_rbnb = (
self.get("asset_received_but_not_billed")
if is_asset_pr
else self.get_company_default("stock_received_but_not_billed")
)
i = 1
for tax in self.get("taxes"):
if valuation_tax.get(tax.name):
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(
"""select name from `tabPurchase Invoice Item` pi
where docstatus = 1 and purchase_receipt=%s
and exists(select name from `tabGL Entry` where voucher_type='Purchase Invoice'
and voucher_no=pi.parent and account=%s)""",
(self.name, tax.account_head),
)
account = stock_rbnb if negative_expense_booked_in_pi else tax.account_head

account = tax.account_head
if i == len(valuation_tax):
applicable_amount = amount_including_divisional_loss
else:
Expand Down

0 comments on commit 106c154

Please sign in to comment.