refactor(purchase_order): Use the ORM instead of SQL (#55173)

This commit is contained in:
Loic Oberle
2026-05-23 07:56:23 +02:00
committed by GitHub
parent 3aaa828e32
commit 4d0ee719c0

View File

@@ -406,11 +406,10 @@ class PurchaseOrder(BuyingController):
update_bin_qty(item_code, warehouse, {"ordered_qty": get_ordered_qty(item_code, warehouse)})
def check_modified_date(self):
mod_db = frappe.db.sql("select modified from `tabPurchase Order` where name = %s", self.name)
date_diff = frappe.db.sql(f"select '{mod_db[0][0]}' - '{cstr(self.modified)}' ")
modified_in_db = frappe.db.get_value("Purchase Order", self.name, "modified")
if date_diff and date_diff[0][0]:
msgprint(
if modified_in_db and cstr(modified_in_db) != cstr(self.modified):
frappe.msgprint(
_("{0} {1} has been modified. Please refresh.").format(self.doctype, self.name),
raise_exception=True,
)