This commit is contained in:
Shreya 2018-01-22 12:14:51 +05:30
parent fc0e8e5c6a
commit dd66bc03c7
7 changed files with 11 additions and 70 deletions

View File

@ -58,14 +58,12 @@ jobs:
- stage: test
script:
- set -e
- bench execute erpnext.patches.v10_0.workflow_leave_application.execute
- bench run-tests
env: Server Side Test
- # stage
script:
- bench --verbose run-setup-wizard-ui-test
- bench execute erpnext.setup.utils.enable_all_roles_and_domains
- bench execute erpnext.patches.v10_0.workflow_leave_application.execute
- bench run-ui-tests --app erpnext
env: Client Side Test
- # stage

View File

@ -29,6 +29,7 @@ frappe.ui.form.on("Leave Application", {
refresh: function(frm) {
if (frm.is_new()) {
frm.set_value("workflow_state", "Open");
frm.trigger("calculate_total_days");
}
},

View File

@ -44,66 +44,6 @@
"set_only_once": 1,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "Open",
"fieldname": "status",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Status",
"length": 0,
"no_copy": 1,
"options": "Open\nApproved\nRejected",
"permlevel": 1,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_12",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@ -796,7 +736,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 3,
"modified": "2018-01-16 00:21:59.025871",
"modified": "2018-01-22 12:10:40.757274",
"modified_by": "Administrator",
"module": "HR",
"name": "Leave Application",
@ -887,9 +827,9 @@
{
"amend": 1,
"apply_user_permissions": 0,
"cancel": 0,
"cancel": 1,
"create": 0,
"delete": 0,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,

View File

@ -24,6 +24,7 @@ class LeaveApplication(Document):
return _("{0}: From {0} of type {1}").format(self.workflow_state, self.employee_name, self.leave_type)
def validate(self):
if self.get("__islocal"): self.workflow_state = 'Open'
if not getattr(self, "__islocal", None) and frappe.db.exists(self.doctype, self.name):
self.previous_doc = frappe.get_value(self.doctype, self.name, "leave_approver", as_dict=True)
else:
@ -180,9 +181,9 @@ class LeaveApplication(Document):
self.throw_overlap_error(d)
def throw_overlap_error(self, d):
msg = _("Employee {0} has already applied for {1} between {2} and {3}").format(self.employee,
msg = _("Employee {0} has already applied for {1} between {2} and {3} : ").format(self.employee,
d['leave_type'], formatdate(d['from_date']), formatdate(d['to_date'])) \
+ """ <br><b><a href="#Form/Leave Application/{0}">{0}</a></b>""".format(d["name"])
+ """ <b><a href="#Form/Leave Application/{0}">{0}</a></b>""".format(d["name"])
frappe.throw(msg, OverlapError)
def get_total_leaves_on_half_day(self):

View File

@ -1,6 +1,5 @@
frappe.listview_settings['Leave Application'] = {
add_fields: ["workflow_state", "leave_type", "employee", "employee_name", "total_leave_days", "from_date", "to_date"],
filters:[["workflow_state","!=", "Rejected"]],
get_indicator: function(doc) {
return [__(doc.workflow_state), frappe.utils.guess_colour(doc.workflow_state),
"workflow_state,=," + doc.workflow_state];

View File

@ -48,4 +48,3 @@ def execute():
}).insert(ignore_permissions=True)
frappe.db.sql("""update `tabLeave Application` set workflow_state = status""")
# frappe.db.sql("""alter table `tabLeave Application` drop column status""")

View File

@ -169,5 +169,8 @@ input[type=number]::-webkit-outer-spin-button {
height: 60px;
}
.grand-total .grand-total-value {
font-size: 24px;
font-size: 18px;
}
.rounded-total-value {
font-size: 18px;
}