fix: job reporting

This commit is contained in:
Jannat Patel
2022-01-11 15:10:31 +05:30
parent 8fff1cd817
commit e214573cd1
11 changed files with 147 additions and 59 deletions

View File

@@ -9,10 +9,10 @@
"field_order": [
"job_title",
"location",
"disabled",
"column_break_5",
"type",
"status",
"job_opportunity_status",
"section_break_6",
"description",
"company_details_section",
@@ -51,19 +51,12 @@
"reqd": 1
},
{
"default": "Pending",
"default": "Open",
"fieldname": "status",
"fieldtype": "Select",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Status",
"options": "Pending\nApproved\nRejected"
},
{
"default": "Open",
"fieldname": "job_opportunity_status",
"fieldtype": "Select",
"label": "Job Opportunity Status",
"options": "Open\nClosed"
},
{
@@ -109,11 +102,17 @@
"fieldtype": "Data",
"label": "Application Form Link",
"reqd": 1
},
{
"default": "0",
"fieldname": "disabled",
"fieldtype": "Check",
"label": "Disabled"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2021-12-30 12:10:08.849547",
"modified": "2022-01-11 14:56:42.509351",
"modified_by": "Administrator",
"module": "Job",
"name": "Job Opportunity",

View File

@@ -1,8 +1,29 @@
# Copyright (c) 2021, Frappe and contributors
# For license information, please see license.txt
# import frappe
import frappe
from frappe.model.document import Document
from frappe.utils.user import get_system_managers
from frappe import _
from frappe.utils import get_link_to_form
class JobOpportunity(Document):
pass
@frappe.whitelist()
def report(job, reason):
args = {
"job": job,
"job_url": get_link_to_form("Job Opportunity", job),
"user": frappe.session.user
}
system_managers = get_system_managers(only_name=True)
user = frappe.db.get_value("User", frappe.session.user, "full_name")
subject = _("User {0} has reported the job post {1}").format(user, job)
frappe.sendmail(
recipients = system_managers,
subject=subject,
header=[subject, "green"],
template = "job_report",
args=args,
now=True)