mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-01 15:47:06 +00:00
fix(buying): insert default Supplier Scorecard records with ignore_if_duplicate (Postgres)
make_default_records inserted Scorecard Variable/Standing rows in a loop and swallowed DuplicateEntryError (frappe.NameError). On Postgres the failed insert poisons the txn so the next iteration's insert raises InFailedSqlTransaction. insert(ignore_if_duplicate=True) emits ON CONFLICT DO NOTHING, never poisoning the txn. No-op on MariaDB.
This commit is contained in:
@@ -405,16 +405,10 @@ def get_default_scorecard_standing():
|
|||||||
def make_default_records():
|
def make_default_records():
|
||||||
install_variable_docs = get_default_scorecard_variables()
|
install_variable_docs = get_default_scorecard_variables()
|
||||||
for d in install_variable_docs:
|
for d in install_variable_docs:
|
||||||
try:
|
d["doctype"] = "Supplier Scorecard Variable"
|
||||||
d["doctype"] = "Supplier Scorecard Variable"
|
frappe.get_doc(d).insert(ignore_if_duplicate=True)
|
||||||
frappe.get_doc(d).insert()
|
|
||||||
except frappe.NameError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
install_standing_docs = get_default_scorecard_standing()
|
install_standing_docs = get_default_scorecard_standing()
|
||||||
for d in install_standing_docs:
|
for d in install_standing_docs:
|
||||||
try:
|
d["doctype"] = "Supplier Scorecard Standing"
|
||||||
d["doctype"] = "Supplier Scorecard Standing"
|
frappe.get_doc(d).insert(ignore_if_duplicate=True)
|
||||||
frappe.get_doc(d).insert()
|
|
||||||
except frappe.NameError:
|
|
||||||
pass
|
|
||||||
|
|||||||
Reference in New Issue
Block a user