refactor(journal entry): replace raw SQL with query builder to unlink asset value adjustment

(cherry picked from commit 5f00239bba)
This commit is contained in:
Navin-S-R
2026-01-11 19:25:22 +05:30
committed by Mergify
parent dae6adfe13
commit 426516a1ee

View File

@@ -448,11 +448,12 @@ class JournalEntry(AccountsController):
frappe.db.set_value("Journal Entry", self.name, "inter_company_journal_entry_reference", "")
def unlink_asset_adjustment_entry(self):
frappe.db.sql(
""" update `tabAsset Value Adjustment`
set journal_entry = null where journal_entry = %s""",
self.name,
)
AssetValueAdjustment = frappe.qb.DocType("Asset Value Adjustment")
(
frappe.qb.update(AssetValueAdjustment)
.set(AssetValueAdjustment.journal_entry, None)
.where(AssetValueAdjustment.journal_entry == self.name)
).run()
def validate_party(self):
for d in self.get("accounts"):