Skip to content

Commit

Permalink
chore: make status filter MultiSelectList
Browse files Browse the repository at this point in the history
  • Loading branch information
s-aga-r committed Dec 3, 2024
1 parent 218fc4e commit 320ab82
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 23 deletions.
26 changes: 14 additions & 12 deletions mail_client/mail_client/report/mail_tracker/mail_tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,20 @@ frappe.query_reports["Mail Tracker"] = {
{
fieldname: "status",
label: __("Status"),
fieldtype: "Select",
options: [
"",
"Pending",
"Failed",
"Queued",
"Blocked",
"Deferred",
"Bounced",
"Partially Sent",
"Sent",
],
fieldtype: "MultiSelectList",
get_data: (txt) => {
return [
"",
"Pending",
"Failed",
"Queued",
"Blocked",
"Deferred",
"Bounced",
"Partially Sent",
"Sent",
];
},
},
{
fieldname: "domain_name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ def get_data(filters: dict | None = None) -> list[dict]:

for field in [
"name",
"status",
"message_id",
"tracking_id",
]:
if filters.get(field):
query = query.where(OM[field] == filters.get(field))

for field in [
"status",
"domain_name",
"sender",
]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ frappe.query_reports["Outbound Delay"] = {
{
fieldname: "status",
label: __("Status"),
fieldtype: "Select",
options: ["", "Blocked", "Deferred", "Bounced", "Sent"],
fieldtype: "MultiSelectList",
get_data: (txt) => {
return ["", "Blocked", "Deferred", "Bounced", "Sent"];
},
},
{
fieldname: "domain_name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,10 @@ def get_data(filters: dict | None = None) -> list[dict]:
if filters.get(field):
query = query.where(OM[field].isin(filters.get(field)))

for field in ["status", "email"]:
if filters.get(field):
query = query.where(MR[field] == filters.get(field))
if filters.get("email"):
query = query.where(MR["email"] == filters.get("email"))
if filters.get("status"):
query = query.where(MR["status"].isin(filters.get("status")))

user = frappe.session.user
if not is_system_manager(user):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ frappe.query_reports["Outgoing Mail Summary"] = {
{
fieldname: "status",
label: __("Status"),
fieldtype: "Select",
options: ["", "Blocked", "Deferred", "Bounced", "Sent"],
fieldtype: "MultiSelectList",
get_data: (txt) => {
return ["", "Blocked", "Deferred", "Bounced", "Sent"];
},
},
{
fieldname: "domain_name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ def get_data(filters: dict | None = None) -> list[dict]:
if filters.get(field):
query = query.where(OM[field].isin(filters.get(field)))

for field in ["status", "email"]:
if filters.get(field):
query = query.where(MR[field] == filters.get(field))
if filters.get("email"):
query = query.where(MR["email"] == filters.get("email"))
if filters.get("status"):
query = query.where(MR["status"].isin(filters.get("status")))

user = frappe.session.user
if not is_system_manager(user):
Expand Down

0 comments on commit 320ab82

Please sign in to comment.