mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
refactor: no copy on summary table and more validations
(cherry picked from commit 55e93b3fe1)
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
"fieldname": "doctypes",
|
"fieldname": "doctypes",
|
||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"label": "Summary",
|
"label": "Summary",
|
||||||
|
"no_copy": 1,
|
||||||
"options": "Transaction Deletion Record Details",
|
"options": "Transaction Deletion Record Details",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
@@ -126,7 +127,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2024-02-05 10:25:28.462255",
|
"modified": "2024-02-05 10:36:34.229864",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Setup",
|
"module": "Setup",
|
||||||
"name": "Transaction Deletion Record",
|
"name": "Transaction Deletion Record",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import frappe
|
|||||||
from frappe import _, qb
|
from frappe import _, qb
|
||||||
from frappe.desk.notifications import clear_notifications
|
from frappe.desk.notifications import clear_notifications
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils import cint, create_batch, get_link_to_form
|
from frappe.utils import cint, comma_and, create_batch, get_link_to_form
|
||||||
|
|
||||||
|
|
||||||
class TransactionDeletionRecord(Document):
|
class TransactionDeletionRecord(Document):
|
||||||
@@ -59,11 +59,16 @@ class TransactionDeletionRecord(Document):
|
|||||||
|
|
||||||
def before_submit(self):
|
def before_submit(self):
|
||||||
if queued_docs := frappe.db.get_all(
|
if queued_docs := frappe.db.get_all(
|
||||||
"Transaction Deletion Record", filters={"company": self.company, "status": "Queued"}
|
"Transaction Deletion Record",
|
||||||
|
filters={"company": self.company, "status": ("in", ["Running", "Queued"]), "docstatus": 1},
|
||||||
|
pluck="name",
|
||||||
):
|
):
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_("There is another document: {0} Queued. Cannot queue multi docs for one company.").format(
|
_(
|
||||||
self.queued_docs
|
"Cannot queue multi docs for one company. {0} is already queued/running for company: {1}"
|
||||||
|
).format(
|
||||||
|
comma_and([get_link_to_form("Transaction Deletion Record", x) for x in queued_docs]),
|
||||||
|
frappe.bold(self.company),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -80,6 +85,7 @@ class TransactionDeletionRecord(Document):
|
|||||||
|
|
||||||
def before_save(self):
|
def before_save(self):
|
||||||
self.status = ""
|
self.status = ""
|
||||||
|
self.doctypes.clear()
|
||||||
self.reset_task_flags()
|
self.reset_task_flags()
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user