Merge pull request #48761 from aerele/exchange-gain-or-loss-on-repost

fix: prevent gain or loss entry cancellation upon reposting
This commit is contained in:
Logesh Periyasamy
2025-08-05 20:55:44 +05:30
committed by GitHub
parent c46b3d4b83
commit a8d17b7590
4 changed files with 58 additions and 5 deletions

View File

@@ -1072,8 +1072,9 @@ class StockController(AccountsController):
make_sl_entries(sl_entries, allow_negative_stock, via_landed_cost_voucher)
update_batch_qty(self.doctype, self.name, via_landed_cost_voucher=via_landed_cost_voucher)
def make_gl_entries_on_cancel(self):
cancel_exchange_gain_loss_journal(frappe._dict(doctype=self.doctype, name=self.name))
def make_gl_entries_on_cancel(self, from_repost=False):
if not from_repost:
cancel_exchange_gain_loss_journal(frappe._dict(doctype=self.doctype, name=self.name))
if frappe.db.sql(
"""select name from `tabGL Entry` where voucher_type=%s
and voucher_no=%s""",