[fix] Message appeared when user forget to add title on Job Portal

This commit is contained in:
Vishal
2017-08-31 17:14:26 +05:30
parent 521acf9df1
commit 4f7412362d
3 changed files with 36 additions and 2 deletions

View File

@@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.website.website_generator import WebsiteGenerator
import foundation
@@ -17,6 +18,9 @@ class PortalJob(WebsiteGenerator):
def validate(self):
if not self.route:
self.route = 'erpnext-jobs/' + self.scrub(self.title)
if not self.title:
frappe.throw(_("Job Title is Mandatory for posting a job"))
def get_list_context(context):
context.allow_guest = True

View File

@@ -0,0 +1,30 @@
/* eslint-disable */
// rename this file from _test_[name] to test_[name] to activate
// and remove above this line
QUnit.test("test: Portal Job", function (assert) {
let done = assert.async();
// number of asserts
assert.expect(1);
let done = assert.async();
frappe.run_serially([
// insert a new Portal Job
() => {
return frappe.tests.make('Portal Job', [
// values to be set
{title: 'test123'},
{company_name:'Test Company'},
{status:'Open'},
{description:'Test Content'},
{contact_number:'123456789'},
{route:'test'}
]);
},
() => cur_frm.save(),
() => {
assert.equal(cur_frm.doc.title, 'test123');
},
() => done()
]);
});

View File

@@ -17,7 +17,7 @@
"is_standard": 1,
"login_required": 1,
"max_attachment_size": 0,
"modified": "2017-03-02 12:09:51.793675",
"modified": "2017-08-31 16:58:13.787406",
"modified_by": "Administrator",
"module": "ERPNext Foundation",
"name": "jobs",
@@ -38,7 +38,7 @@
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 0
"reqd": 1
},
{
"fieldname": "job_type",