Retention Bonus - menu, validate

This commit is contained in:
Ranjith 2018-05-15 19:17:31 +05:30
parent 7d394c14ce
commit 819c3b1bf6
3 changed files with 20 additions and 5 deletions

View File

@ -106,6 +106,10 @@ def get_data():
"type": "doctype",
"name": "Employee Incentive",
},
{
"type": "doctype",
"name": "Retention Bonus",
},
]
},
{

View File

@ -2,6 +2,15 @@
// For license information, please see license.txt
frappe.ui.form.on('Retention Bonus', {
setup: function(frm) {
frm.set_query("employee", function() {
return {
filters: {
"status": "Active"
}
};
});
},
refresh: function(frm) {
}

View File

@ -5,10 +5,12 @@
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
from frappe.utils import getdate
class RetentionBonus(Document):
def on_submit(self):
pass
def on_cancel(self):
pass
def validate(self):
if frappe.get_value("Employee", self.employee, "status") == "Left":
frappe.throw(_("Cannot create Retention Bonus for left Employees"))
if getdate(self.bonus_payment_date) < getdate():
frappe.throw(_("Bonus Payment Date cannot be a past date"))