Esempio n. 1
0
    def validate(self):
        self.validate_new_leaves_allocated_value()
        self.check_existing_leave_allocation()
        if not self.total_leaves_allocated:
            self.total_leaves_allocated = self.new_leaves_allocated

        set_employee_name(self)
Esempio n. 2
0
	def validate(self):
		self.validate_new_leaves_allocated_value()
		self.check_existing_leave_allocation()
		if not self.total_leaves_allocated:
			self.total_leaves_allocated = self.new_leaves_allocated

		set_employee_name(self)
Esempio n. 3
0
	def validate(self):
		validate_fiscal_year(self.posting_date, self.fiscal_year, _("Posting Date"), self)
		self.validate_sanctioned_amount()
		self.validate_expense_approver()
		self.validate_task()
		self.calculate_total_amount()
		set_employee_name(self)
Esempio n. 4
0
 def validate(self):
     self.validate_period()
     self.validate_allocation_overlap()
     self.validate_lwp()
     set_employee_name(self)
     self.set_total_leaves_allocated()
     self.validate_leave_days_and_dates()
Esempio n. 5
0
 def validate(self):
     self.get_priority()
     self.validate_amount()
     for e in self.get('employees'):
         set_employee_name(e)
     self.validate_date()
     self.strip_condition_and_formula_fields()
    def validate(self):
        set_employee_name(self)
        self.get_leave_details_for_encashment(
            self.encashable_days, encashment_amount=self.encashment_amount)

        if not self.encashment_date:
            self.encashment_date = getdate(nowdate())
Esempio n. 7
0
    def validate(self):
        set_employee_name(self)
        self.get_leave_details_for_encashment()
        self.validate_salary_structure()

        if not self.encashment_date:
            self.encashment_date = getdate(nowdate())
Esempio n. 8
0
 def validate(self):
     self.validate_sanctioned_amount()
     self.validate_expense_approver()
     self.calculate_total_amount()
     set_employee_name(self)
     if self.task and not self.project:
         self.project = frappe.db.get_value("Task", self.task, "project")
Esempio n. 9
0
 def validate(self):
     self.validate_sanctioned_amount()
     self.validate_expense_approver()
     self.calculate_total_amount()
     set_employee_name(self)
     if self.task and not self.project:
         self.project = frappe.db.get_value("Task", self.task, "project")
Esempio n. 10
0
    def validate(self):
        #frappe.errprint("in validate")
        from datetime import datetime
        from frappe.utils import money_in_words
        d1 = datetime.strptime(self.from_date, "%Y-%m-%d")
        d2 = datetime.strptime(self.to_date, "%Y-%m-%d")
        diff = abs((d2 - d1).days)
        #frappe.errprint(diff)
        self.check_existing()
        self.validate_attendance()
        if not (len(self.get("earning_details"))
                or len(self.get("deduction_details"))):
            self.get_emp_and_leave_details(diff)
        else:
            self.get_leave_details(diff, self.leave_without_pay)

        if not self.net_pay:
            self.calculate_net_pay()

        company_currency = get_company_currency(self.company)
        #frappe.errprint(company_currency)
        self.total_in_words = money_in_words(self.rounded_total,
                                             company_currency)
        #frappe.errprint(self.total_in_words)
        set_employee_name(self)
Esempio n. 11
0
def validate_overide(self):
    if not self.status:
        self.status = "Draft"

    set_employee_name(self)
    validate_dates(self)
    calculate_total_override(self)
def validate(self, func):
	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:
		self.previous_doc = None

	set_employee_name(self)

	self.validate_dates()
	self.validate_balance_leaves()
#	self.validate_leave_overlap()
	validate_leave_overlap(self)
	self.validate_max_days()
	self.show_block_day_warning()
	self.validate_block_days()
	self.validate_salary_processed_days()
	#	#self.validate_leave_approver()
	self.validate_attendance()


	if (self.workflow_state == "Applied" and self.approver_1_email != "-n/a-"):
		self.leave_approver = self.approver_1_email

	if (self.workflow_state == "Approved by Supervisor" and self.approver_2_email != "-n/a-"):
		self.leave_approver = self.approver_2_email
	if (self.workflow_state == "Approved by Senior Mgr" and self.approver_3_email != "-n/a-"):
		self.leave_approver = self.approver_3_email

	if (self.workflow_state == "Approved"): 
		self.status = "Approved"
	if (self.workflow_state == "Rejected"): 
		self.status = "Rejected"
	if (self.workflow_state == "Cancelled"): 
		self.status = "Open"
Esempio n. 13
0
	def validate_duplicate_record(self):
		res = frappe.db.sql("""select name from `tabAttendance` where employee = %s and att_date = %s
			and name != %s and docstatus = 1""",
			(self.employee, self.att_date, self.name))
		if res:
			frappe.throw(_("Attendance for employee {0} is already marked").format(self.employee))

		set_employee_name(self)
Esempio n. 14
0
	def validate_duplicate_record(self):
		res = frappe.db.sql("""select name from `tabAttendance` where employee = %s and attendance_date = %s
			and name != %s and docstatus = 1""",
			(self.employee, self.attendance_date, self.name))
		if res:
			frappe.throw(_("Attendance for employee {0} is already marked").format(self.employee))

		set_employee_name(self)
Esempio n. 15
0
	def validate(self):
		self.validate_period()
		self.validate_new_leaves_allocated_value()
		self.validate_allocation_overlap()
		self.validate_back_dated_allocation()
		self.validate_total_leaves_allocated()		
		self.set_total_leaves_allocated()
		set_employee_name(self)
Esempio n. 16
0
	def validate(self):
		if not self.status:
			self.status = "Draft"

		set_employee_name(self)
		self.validate_dates()
		self.validate_existing_appraisal()
		self.calculate_total()
Esempio n. 17
0
	def validate(self):
		validate_fiscal_year(self.posting_date, self.fiscal_year, _("Posting Date"), self)
		self.validate_sanctioned_amount()
		self.validate_expense_approver()
		self.calculate_total_amount()
		set_employee_name(self)
		if self.task and not self.project:
			self.project = frappe.db.get_value("Task", self.task, "project")
Esempio n. 18
0
 def validate(self):
     self.validate_period()
     self.validate_new_leaves_allocated_value()
     self.validate_allocation_overlap()
     self.validate_back_dated_allocation()
     self.set_total_leaves_allocated()
     self.validate_total_leaves_allocated()
     set_employee_name(self)
Esempio n. 19
0
 def validate(self):
     validate_fiscal_year(self.posting_date, self.fiscal_year,
                          _("Posting Date"), self)
     self.validate_sanctioned_amount()
     self.validate_expense_approver()
     self.calculate_total_amount()
     set_employee_name(self)
     if self.task and not self.project:
         self.project = frappe.db.get_value("Task", self.task, "project")
Esempio n. 20
0
    def validate_duplicate_record(self):
        res = frappe.db.sql(
            """select name from `tabDeparture` where employee = %s and departure_date = %s
			and name != %s and docstatus = 1""",
            (self.employee, self.departure_date, self.name))
        if res:
            frappe.throw(_("Departure is already marked"))

        set_employee_name(self)
Esempio n. 21
0
    def validate(self):
        if not self.status:
            self.status = "Draft"

        if not self.goals:
            frappe.throw(_("Goals cannot be empty"))

        set_employee_name(self)
        self.validate_dates()
        self.validate_existing_goal_achievement()
Esempio n. 22
0
 def validate(self):
     set_employee_name(self)
     self.validate_dates()
     self.validate_balance_leaves()
     self.validate_leave_overlap()
     self.validate_max_days()
     self.show_block_day_warning()
     self.validate_block_days()
     self.validate_salary_processed_days()
     self.validate_attendance()
Esempio n. 23
0
 def validate(self):
     self.validate_sanctioned_amount()
     self.validate_requisition_approver()
     self.calculate_total_amount()
     set_employee_name(self)
     self.set_requisition_account()
     self.set_receivable_account()
     self.set_cost_center()
     self.set_status()
     if self.task and not self.project:
         self.project = frappe.db.get_value("Task", self.task, "project")
Esempio n. 24
0
	def validate(self):
		if not self.status:
			self.status = "Draft"

		if not self.goals:
			frappe.throw(_("Goals cannot be empty"))

		set_employee_name(self)
		self.validate_dates()
		self.validate_existing_appraisal()
		self.calculate_total()
Esempio n. 25
0
    def validate(self):
        if not self.status:
            self.status = "Draft"

        if not self.goals:
            frappe.throw(_("Goals cannot be empty"))

        set_employee_name(self)
        self.validate_dates()
        self.validate_existing_appraisal()
        self.calculate_total()
Esempio n. 26
0
	def validate(self):
		self.validate_advances()
		self.validate_sanctioned_amount()
		self.calculate_total_amount()
		set_employee_name(self)
		self.set_expense_account(validate=True)
		self.set_payable_account()
		self.set_cost_center()
		self.set_status()
		if self.task and not self.project:
			self.project = frappe.db.get_value("Task", self.task, "project")
Esempio n. 27
0
 def validate(self):
     self.validate_advances()
     self.validate_sanctioned_amount()
     self.calculate_total_amount()
     set_employee_name(self)
     self.set_expense_account(validate=True)
     self.set_payable_account()
     self.set_cost_center()
     self.set_status()
     if self.task and not self.project:
         self.project = frappe.db.get_value("Task", self.task, "project")
	def validate(self):
		set_employee_name(self)
		self.validate_dates()
		self.validate_balance_leaves()
		self.validate_leave_overlap()
		self.validate_max_days()
		self.show_block_day_warning()
		self.validate_block_days()
		self.validate_salary_processed_days()
		self.validate_attendance()
		if frappe.db.get_value("Leave Type", self.leave_type, 'is_optional_leave'):
			self.validate_optional_leave()
		self.validate_applicable_after()
Esempio n. 29
0
	def validate(self):
		set_employee_name(self)
		self.validate_dates()
		self.validate_balance_leaves()
		self.validate_leave_overlap()
		self.validate_max_days()
		self.show_block_day_warning()
		self.validate_block_days()
		self.validate_salary_processed_days()
		self.validate_attendance()
		if frappe.db.get_value("Leave Type", self.leave_type, 'is_optional_leave'):
			self.validate_optional_leave()
		self.validate_applicable_after()
Esempio n. 30
0
	def validate(self):
		self.check_existing()

		if not (len(self.get("earnings")) or len(self.get("deductions"))):
			self.get_emp_and_leave_details()
		else:
			self.get_leave_details(lwp = self.leave_without_pay)

		if not self.net_pay:
			self.calculate_net_pay()

		company_currency = get_company_currency(self.company)
		self.total_in_words = money_in_words(self.rounded_total, company_currency)

		set_employee_name(self)
Esempio n. 31
0
	def validate(self):
		if not getattr(self, "__islocal", None) and frappe.db.exists(self.doctype, self.name):
			self.previous_doc = frappe.db.get_value(self.doctype, self.name, "*", as_dict=True)
		else:
			self.previous_doc = None

		set_employee_name(self)

		self.validate_to_date()
		self.validate_balance_leaves()
		self.validate_leave_overlap()
		self.validate_max_days()
		self.show_block_day_warning()
		self.validate_block_days()
		self.validate_leave_approver()
Esempio n. 32
0
	def validate(self):
		self.check_existing()

		if not (len(self.get("earnings")) or len(self.get("deductions"))):
			self.get_emp_and_leave_details()
		else:
			self.get_leave_details(lwp = self.leave_without_pay)

		if not self.net_pay:
			self.calculate_net_pay()

		company_currency = get_company_currency(self.company)
		self.total_in_words = money_in_words(self.rounded_total, company_currency)

		set_employee_name(self)
	def validate(self):
		if not getattr(self, "__islocal", None) and frappe.db.exists(self.doctype, self.name):
			self.previous_doc = frappe.db.get_value(self.doctype, self.name, "*", as_dict=True)
		else:
			self.previous_doc = None

		set_employee_name(self)

		self.validate_dates()
		self.validate_balance_leaves()
		self.validate_leave_overlap()
		self.validate_max_days()
		self.show_block_day_warning()
		self.validate_block_days()
		self.validate_leave_approver()
Esempio n. 34
0
    def validate(self):
        self.set_cost_center()
        self.set_project_from_task()
        self.validate_sanctioned_amount()
        self.validate_employee_advances()
        self.calculate_totals()
        self.validate_outstanding_amount()
        set_employee_name(self)
        self.validate_expense_account(for_validate=True)
        self.validate_purchase_invoices(for_validate=True)

        if cint(self.allocate_advances_automatically):
            self.set_advances()
        self.clear_unallocated_advances("Expense Claim Advance", "advances")

        self.set_status()
Esempio n. 35
0
	def validate(self):
		self.validate_fiscal_year()
		if not getattr(self, "__islocal", None) and frappe.db.exists(self.doctype, self.name):
			self.previous_doc = frappe.db.get_value(self.doctype, self.name, "*", as_dict=True)
		else:
			self.previous_doc = None

		if self.status == "Approved":
			set_employee_name(self)

			self.validate_dates()
			self.validate_balance_leaves()
			self.validate_leave_overlap()
			self.validate_max_days()
			self.show_block_day_warning()
			self.validate_block_days()
			self.validate_salary_processed_days()
			self.validate_leave_approver()
Esempio n. 36
0
	def validate(self):
		frappe.errprint("in the validate")
		from frappe.utils import money_in_words
		self.check_existing()

		if not (len(self.get("earning_details")) or
			len(self.get("deduction_details"))):
				self.get_emp_and_leave_details()
		else:
			self.get_leave_details(self.leave_without_pay)

		if not self.net_pay:
			self.calculate_net_pay()

		company_currency = get_company_currency(self.company)
		self.total_in_words = money_in_words(self.rounded_total, company_currency)

		set_employee_name(self)
Esempio n. 37
0
    def validate(self):
        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:
            self.previous_doc = None

        set_employee_name(self)

        self.validate_dates()
        self.validate_cutoff() #by VHRS
        self.validate_balance_leaves()
        self.validate_leave_overlap()
        self.validate_max_days()
        self.show_block_day_warning()
        self.validate_block_days()
        self.validate_salary_processed_days()
        self.validate_leave_approver()
        # self.validate_attendance()
        self.validate_policy()
Esempio n. 38
0
	def validate(self):
		validate_fiscal_year(self.posting_date, self.fiscal_year, _("Posting Date"), self)
		self.validate_exp_details()
		self.validate_expense_approver()
		set_employee_name(self)
	def validate(self):
		self.validate_fiscal_year()
		self.validate_exp_details()
		self.validate_expense_approver()
		set_employee_name(self)
Esempio n. 40
0
	def validate(self):
		self.validate_amount()
		for e in self.get('employees'):
			set_employee_name(e)
		self.validate_date()
Esempio n. 41
0
 def validate(self):
     self.validate_amount()
     self.validate_joining_date()
     for e in self.get("employees"):
         set_employee_name(e)
Esempio n. 42
0
	def validate(self):
		self.check_overlap()
		self.validate_amount()
		self.validate_employee()
		self.validate_joining_date()
		set_employee_name(self)
Esempio n. 43
0
	def validate(self):
		self.check_existing()
		self.validate_amount()
		self.validate_employee()
		self.validate_joining_date()
		set_employee_name(self)
 def validate(self):
     self.check_overlap()
     self.validate_amount()
     self.validate_employee()
     self.validate_joining_date()
     set_employee_name(self)
Esempio n. 45
0
 def validate(self):
     self.validate_fiscal_year()
     self.validate_exp_details()
     self.validate_expense_approver()
     set_employee_name(self)
Esempio n. 46
0
	def validate(self):
		set_employee_name(self)
		self.get_leave_details_for_encashment()

		if not self.encashment_date:
			self.encashment_date = getdate(nowdate())
Esempio n. 47
0
 def validate(self):
     self.check_existing()
     self.validate_amount()
     self.validate_employee()
     set_employee_name(self)
Esempio n. 48
0
	def validate(self):
		self.validate_amount()
		for e in self.get('employees'):
			set_employee_name(e)
		self.validate_date()
		self.strip_condition_and_formula_fields()
Esempio n. 49
0
 def validate(self):
     self.validate_amount()
     self.validate_joining_date()
     for e in self.get('employees'):
         set_employee_name(e)