Skip to content

Commit

Permalink
feat: Add new doctype for Job offer Term Template (#1089) (#1236)
Browse files Browse the repository at this point in the history
* feat: Create new doctype for offer term

* fix: Update job offer

* feat: Add title field in term template

* fix: add default perm for HR Manager, clear table on selecting template

- fix naming, child table fieldnames should be plural

---------

Co-authored-by: Rucha Mahabal <[email protected]>
(cherry picked from commit dfb9712)

Co-authored-by: Niraj Gautam <[email protected]>
  • Loading branch information
mergify[bot] and niraj2477 authored Dec 29, 2023
1 parent 35c6982 commit 4d38033
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 1 deletion.
12 changes: 12 additions & 0 deletions hrms/hr/doctype/job_offer/job_offer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ frappe.ui.form.on("Job Offer", {
}
});
},
job_offer_term_template: function (frm) {
if (!frm.doc.job_offer_term_template) return;

frappe.db.get_doc("Job Offer Term Template", frm.doc.job_offer_term_template).then((doc) => {
frm.clear_table("offer_terms");
doc.offer_terms.forEach((term) => {
frm.add_child("offer_terms", term);
})
refresh_field("offer_terms");
})

},

refresh: function (frm) {
if ((!frm.doc.__islocal) && (frm.doc.status == 'Accepted')
Expand Down
9 changes: 8 additions & 1 deletion hrms/hr/doctype/job_offer/job_offer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"designation",
"company",
"section_break_4",
"job_offer_term_template",
"offer_terms",
"section_break_14",
"select_terms",
Expand Down Expand Up @@ -156,11 +157,17 @@
"options": "Job Offer",
"print_hide": 1,
"read_only": 1
},
{
"fieldname": "job_offer_term_template",
"fieldtype": "Link",
"label": "Job Offer Term Template",
"options": "Job Offer Term Template"
}
],
"is_submittable": 1,
"links": [],
"modified": "2020-06-25 00:56:24.756395",
"modified": "2023-11-21 13:41:22.022838",
"modified_by": "Administrator",
"module": "HR",
"name": "Job Offer",
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt

// frappe.ui.form.on("Job Offer Term Template", {
// refresh(frm) {

// },
// });
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"actions": [],
"allow_rename": 1,
"autoname": "field:title",
"creation": "2023-11-21 13:39:20.882706",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"title",
"offer_terms"
],
"fields": [
{
"fieldname": "title",
"fieldtype": "Data",
"label": "Title",
"unique": 1
},
{
"fieldname": "offer_terms",
"fieldtype": "Table",
"label": "Offer Terms",
"options": "Job Offer Term"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-12-29 13:08:24.269275",
"modified_by": "Administrator",
"module": "HR",
"name": "Job Offer Term Template",
"naming_rule": "By fieldname",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "HR Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document


class JobOfferTermTemplate(Document):
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase


class TestJobOfferTermTemplate(FrappeTestCase):
pass

0 comments on commit 4d38033

Please sign in to comment.