refactor(minor): use virtual docfield for created_at (previously enqueued_at) field
This commit is contained in:
parent
cb796a4e64
commit
c0b3928ac1
2 changed files with 14 additions and 9 deletions
|
|
@ -7,7 +7,7 @@
|
|||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"status",
|
||||
"enqueued_at",
|
||||
"created_at",
|
||||
"enqueued_by",
|
||||
"job_id",
|
||||
"column_break_5",
|
||||
|
|
@ -62,12 +62,6 @@
|
|||
"fieldname": "section_break_8",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "enqueued_at",
|
||||
"fieldtype": "Datetime",
|
||||
"label": "Enqueued At",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "enqueued_by",
|
||||
"fieldtype": "Data",
|
||||
|
|
@ -79,11 +73,18 @@
|
|||
"fieldtype": "Datetime",
|
||||
"label": "Ended At",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "created_at",
|
||||
"fieldtype": "Datetime",
|
||||
"is_virtual": 1,
|
||||
"label": "Created At",
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2022-10-06 01:11:11.835985",
|
||||
"modified": "2022-10-06 01:57:19.253609",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "Submission Queue",
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ from frappe.utils import now
|
|||
|
||||
|
||||
class SubmissionQueue(Document):
|
||||
@property
|
||||
def created_at(self):
|
||||
return self.creation
|
||||
|
||||
def insert(self, to_be_queued_doc: Document, action: str):
|
||||
self.to_be_queued_doc = to_be_queued_doc
|
||||
self.action_for_queuing = action
|
||||
|
|
@ -32,7 +36,7 @@ class SubmissionQueue(Document):
|
|||
frappe.db.set_value(
|
||||
self.doctype,
|
||||
self.name,
|
||||
{"job_id": job.id, "enqueued_at": now()},
|
||||
{"job_id": job.id},
|
||||
update_modified=False,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue