mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-13 22:51:49 +00:00
fix(subcontracting): savepoint Purchase Receipt submit in make_purchase_receipt (Postgres)
Same submit()/add_comment-in-except shape as the PO->SCO mapper: on Postgres a failed submit aborts the transaction so the follow-on Comment insert raises InFailedSqlTransaction; MariaDB continues. Savepoint + rollback before add_comment. No-op on MariaDB.
This commit is contained in:
@@ -125,9 +125,11 @@ def make_purchase_receipt(
|
||||
target_doc.save()
|
||||
|
||||
if submit and frappe.has_permission(target_doc.doctype, "submit", target_doc):
|
||||
frappe.db.savepoint("submit_subcontracting_receipt")
|
||||
try:
|
||||
target_doc.submit()
|
||||
except Exception as e:
|
||||
frappe.db.rollback(save_point="submit_subcontracting_receipt")
|
||||
target_doc.add_comment("Comment", _("Submit Action Failed") + "<br><br>" + str(e))
|
||||
|
||||
if notify:
|
||||
|
||||
Reference in New Issue
Block a user