fix(Patch): only insert expression key if not exists

This commit is contained in:
Sumit Bhanushali 2024-12-09 12:36:11 +05:30
parent 839477e422
commit 5b8bde97bb

View file

@ -56,4 +56,8 @@ def execute():
current = current[0].get("current")
for uniq_expr in uniq_exprs:
(frappe.qb.into(Series).columns("name", "current").insert(uniq_expr, current + 1)).run()
expr_exists = (frappe.qb.from_(Series).select("*").where(Series.name == uniq_expr)).run(
as_dict=True
)
if not expr_exists:
(frappe.qb.into(Series).columns("name", "current").insert(uniq_expr, current + 1)).run()