예제 #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)
예제 #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)
예제 #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)
예제 #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()
예제 #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()
예제 #6
0
    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())
예제 #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())
예제 #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")
예제 #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")
예제 #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)
예제 #11
0
def validate_overide(self):
    if not self.status:
        self.status = "Draft"

    set_employee_name(self)
    validate_dates(self)
    calculate_total_override(self)
예제 #12
0
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"
예제 #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)
예제 #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)
예제 #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)
예제 #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()
예제 #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")
예제 #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)
예제 #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")
예제 #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)
예제 #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()
예제 #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()
예제 #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")
예제 #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()
예제 #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()
예제 #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")
예제 #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")
예제 #28
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()
예제 #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()
예제 #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)
예제 #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()
예제 #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)
예제 #33
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_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()
예제 #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()
예제 #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()
예제 #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)
예제 #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()
예제 #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)
예제 #40
0
	def validate(self):
		self.validate_amount()
		for e in self.get('employees'):
			set_employee_name(e)
		self.validate_date()
예제 #41
0
 def validate(self):
     self.validate_amount()
     self.validate_joining_date()
     for e in self.get("employees"):
         set_employee_name(e)
예제 #42
0
	def validate(self):
		self.check_overlap()
		self.validate_amount()
		self.validate_employee()
		self.validate_joining_date()
		set_employee_name(self)
예제 #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)
예제 #45
0
 def validate(self):
     self.validate_fiscal_year()
     self.validate_exp_details()
     self.validate_expense_approver()
     set_employee_name(self)
예제 #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())
예제 #47
0
 def validate(self):
     self.check_existing()
     self.validate_amount()
     self.validate_employee()
     set_employee_name(self)
예제 #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()
예제 #49
0
 def validate(self):
     self.validate_amount()
     self.validate_joining_date()
     for e in self.get('employees'):
         set_employee_name(e)