mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-03 08:32:24 +00:00
This commit is contained in:
@@ -8,10 +8,9 @@ from frappe.utils import cstr, flt, getdate
|
||||
from frappe.model.bean import getlist
|
||||
from frappe import msgprint
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
from frappe.model.document import Document
|
||||
|
||||
class Appraisal(Document):
|
||||
|
||||
def validate(self):
|
||||
if not self.doc.status:
|
||||
@@ -45,7 +44,7 @@ class DocType:
|
||||
|
||||
def calculate_total(self):
|
||||
total, total_w = 0, 0
|
||||
for d in getlist(self.doclist, 'appraisal_details'):
|
||||
for d in self.get('appraisal_details'):
|
||||
if d.score:
|
||||
d.score_earned = flt(d.score) * flt(d.per_weightage) / 100
|
||||
total = total + d.score_earned
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class AppraisalGoal(Document):
|
||||
pass
|
||||
@@ -5,9 +5,9 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class AppraisalTemplate(Document):
|
||||
|
||||
def validate(self):
|
||||
self.doc.total_points = 0
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class AppraisalTemplateGoal(Document):
|
||||
pass
|
||||
@@ -8,10 +8,9 @@ from frappe.utils import getdate, nowdate
|
||||
from frappe import msgprint, _
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
from frappe.model.document import Document
|
||||
|
||||
class Attendance(Document):
|
||||
|
||||
def validate_duplicate_record(self):
|
||||
res = frappe.db.sql("""select name from `tabAttendance` where employee = %s and att_date = %s
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
from frappe.model.document import Document
|
||||
|
||||
class Branch(Document):
|
||||
pass
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class DeductionType(Document):
|
||||
pass
|
||||
@@ -4,7 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
from frappe.model.document import Document
|
||||
|
||||
class Department(Document):
|
||||
pass
|
||||
@@ -4,7 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
from frappe.model.document import Document
|
||||
|
||||
class Designation(Document):
|
||||
pass
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class EarningType(Document):
|
||||
pass
|
||||
@@ -11,7 +11,7 @@ import frappe.permissions
|
||||
from frappe.defaults import get_restrictions
|
||||
from frappe.model.controller import DocListController
|
||||
|
||||
class DocType(DocListController):
|
||||
class Employee(DocListController):
|
||||
def autoname(self):
|
||||
naming_method = frappe.db.get_value("HR Settings", None, "emp_created_by")
|
||||
if not naming_method:
|
||||
@@ -57,7 +57,7 @@ class DocType(DocListController):
|
||||
|
||||
def restrict_leave_approver(self):
|
||||
"""restrict to this employee for leave approver"""
|
||||
employee_leave_approvers = [d.leave_approver for d in self.doclist.get({"parentfield": "employee_leave_approvers"})]
|
||||
employee_leave_approvers = [d.leave_approver for d in self.get("employee_leave_approvers")]
|
||||
if self.doc.reports_to and self.doc.reports_to not in employee_leave_approvers:
|
||||
employee_leave_approvers.append(frappe.db.get_value("Employee", self.doc.reports_to, "user_id"))
|
||||
|
||||
@@ -167,7 +167,7 @@ class DocType(DocListController):
|
||||
from frappe.utils.user import User
|
||||
from erpnext.hr.doctype.leave_application.leave_application import InvalidLeaveApproverError
|
||||
|
||||
for l in self.doclist.get({"parentfield": "employee_leave_approvers"}):
|
||||
for l in self.get("employee_leave_approvers"):
|
||||
if "Leave Approver" not in User(l.leave_approver).get_roles():
|
||||
throw(_("Invalid Leave Approver") + ": \"" + l.leave_approver + "\"",
|
||||
exc=InvalidLeaveApproverError)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class EmployeeEducation(Document):
|
||||
pass
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class EmployeeExternalWorkHistory(Document):
|
||||
pass
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class EmployeeInternalWorkHistory(Document):
|
||||
pass
|
||||
@@ -6,6 +6,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class EmployeeLeaveApprover(Document):
|
||||
pass
|
||||
@@ -4,7 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
from frappe.model.document import Document
|
||||
|
||||
class EmploymentType(Document):
|
||||
pass
|
||||
@@ -7,10 +7,9 @@ import frappe
|
||||
from frappe.model.bean import getlist
|
||||
from frappe import msgprint
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
from frappe.model.document import Document
|
||||
|
||||
class ExpenseClaim(Document):
|
||||
|
||||
def validate(self):
|
||||
self.validate_fiscal_year()
|
||||
@@ -26,6 +25,6 @@ class DocType:
|
||||
validate_fiscal_year(self.doc.posting_date, self.doc.fiscal_year, "Posting Date")
|
||||
|
||||
def validate_exp_details(self):
|
||||
if not getlist(self.doclist, 'expense_voucher_details'):
|
||||
if not self.get('expense_voucher_details'):
|
||||
msgprint("Please add expense voucher details")
|
||||
raise Exception
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class ExpenseClaimDetail(Document):
|
||||
pass
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class ExpenseClaimType(Document):
|
||||
pass
|
||||
@@ -4,7 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
from frappe.model.document import Document
|
||||
|
||||
class Grade(Document):
|
||||
pass
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class Holiday(Document):
|
||||
pass
|
||||
@@ -5,17 +5,13 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
from frappe.utils import add_days, add_years, cint, getdate
|
||||
from frappe.model import db_exists
|
||||
from frappe.model.doc import addchild, make_autoname
|
||||
from frappe.model.bean import copy_doclist
|
||||
from frappe.model.doc import make_autoname
|
||||
from frappe import msgprint, throw, _
|
||||
import datetime
|
||||
|
||||
class DocType:
|
||||
def __init__(self,doc,doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
from frappe.model.document import Document
|
||||
|
||||
class HolidayList(Document):
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.fiscal_year + "/" + self.doc.holiday_list_name + "/.###")
|
||||
|
||||
@@ -29,7 +25,7 @@ class DocType:
|
||||
last_idx = max([cint(d.idx) for d in self.doclist.get(
|
||||
{"parentfield": "holiday_list_details"})] or [0,])
|
||||
for i, d in enumerate(date_list):
|
||||
ch = addchild(self.doc, 'holiday_list_details', 'Holiday', self.doclist)
|
||||
ch = self.doc.append('holiday_list_details', {})
|
||||
ch.description = self.doc.weekly_off
|
||||
ch.holiday_date = d
|
||||
ch.idx = last_idx + i + 1
|
||||
@@ -63,7 +59,7 @@ class DocType:
|
||||
return date_list
|
||||
|
||||
def clear_table(self):
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'holiday_list_details')
|
||||
self.set('holiday_list_details', [])
|
||||
|
||||
def update_default_holiday_list(self):
|
||||
frappe.db.sql("""update `tabHoliday List` set is_default = 0
|
||||
|
||||
@@ -8,9 +8,9 @@ import frappe
|
||||
|
||||
from frappe.utils import cint
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class HrSettings(Document):
|
||||
|
||||
def validate(self):
|
||||
self.update_birthday_reminders()
|
||||
|
||||
@@ -8,9 +8,7 @@ import frappe
|
||||
from erpnext.utilities.transaction_base import TransactionBase
|
||||
from frappe.utils import extract_email_id
|
||||
|
||||
class DocType(TransactionBase):
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
class JobApplicant(TransactionBase):
|
||||
|
||||
def get_sender(self, comm):
|
||||
return frappe.db.get_value('Jobs Email Settings',None,'email_id')
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class JobOpening(Document):
|
||||
pass
|
||||
@@ -6,7 +6,9 @@ import frappe
|
||||
from frappe.utils import cint, flt
|
||||
from frappe import msgprint
|
||||
|
||||
class DocType:
|
||||
from frappe.model.document import Document
|
||||
|
||||
class LeaveAllocation(Document):
|
||||
def __init__(self, doc, doclist):
|
||||
self.doc, self.doclist = doc, doclist
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class InvalidLeaveApproverError(frappe.ValidationError): pass
|
||||
class LeaveApproverIdentityError(frappe.ValidationError): pass
|
||||
|
||||
from frappe.model.controller import DocListController
|
||||
class DocType(DocListController):
|
||||
class LeaveApplication(DocListController):
|
||||
def setup(self):
|
||||
if frappe.db.exists(self.doc.doctype, self.doc.name):
|
||||
self.previous_doc = frappe.doc(self.doc.doctype, self.doc.name)
|
||||
@@ -149,7 +149,7 @@ class DocType(DocListController):
|
||||
def validate_leave_approver(self):
|
||||
employee = frappe.bean("Employee", self.doc.employee)
|
||||
leave_approvers = [l.leave_approver for l in
|
||||
employee.doclist.get({"parentfield": "employee_leave_approvers"})]
|
||||
employee.get("employee_leave_approvers")]
|
||||
|
||||
if len(leave_approvers) and self.doc.leave_approver not in leave_approvers:
|
||||
msgprint(("[" + _("For Employee") + ' "' + self.doc.employee + '"] '
|
||||
|
||||
@@ -8,9 +8,9 @@ import frappe
|
||||
from erpnext.accounts.utils import validate_fiscal_year
|
||||
from frappe import _
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class LeaveBlockList(Document):
|
||||
|
||||
def validate(self):
|
||||
dates = []
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class LeaveBlockListAllow(Document):
|
||||
pass
|
||||
@@ -6,6 +6,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class LeaveBlockListDate(Document):
|
||||
pass
|
||||
@@ -12,7 +12,9 @@ from frappe import msgprint, _
|
||||
|
||||
|
||||
|
||||
class DocType:
|
||||
from frappe.model.document import Document
|
||||
|
||||
class LeaveControlPanel(Document):
|
||||
def __init__(self, doc, doclist):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
from frappe.model.document import Document
|
||||
|
||||
class LeaveType(Document):
|
||||
pass
|
||||
@@ -7,10 +7,9 @@ from frappe.utils import cint, flt
|
||||
from frappe.model.code import get_obj
|
||||
from frappe import msgprint
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
from frappe.model.document import Document
|
||||
|
||||
class SalaryManager(Document):
|
||||
|
||||
def get_emp_list(self):
|
||||
"""
|
||||
|
||||
@@ -14,11 +14,7 @@ from erpnext.setup.utils import get_company_currency
|
||||
|
||||
from erpnext.utilities.transaction_base import TransactionBase
|
||||
|
||||
class DocType(TransactionBase):
|
||||
def __init__(self,doc,doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
class SalarySlip(TransactionBase):
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname('Sal Slip/' +self.doc.employee + '/.#####')
|
||||
|
||||
@@ -146,8 +142,8 @@ class DocType(TransactionBase):
|
||||
from frappe.utils import money_in_words
|
||||
self.check_existing()
|
||||
|
||||
if not (len(self.doclist.get({"parentfield": "earning_details"})) or
|
||||
len(self.doclist.get({"parentfield": "deduction_details"}))):
|
||||
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.doc.leave_without_pay)
|
||||
@@ -160,7 +156,7 @@ class DocType(TransactionBase):
|
||||
|
||||
def calculate_earning_total(self):
|
||||
self.doc.gross_pay = flt(self.doc.arrear_amount) + flt(self.doc.leave_encashment_amount)
|
||||
for d in self.doclist.get({"parentfield": "earning_details"}):
|
||||
for d in self.get("earning_details"):
|
||||
if cint(d.e_depends_on_lwp) == 1:
|
||||
d.e_modified_amount = _round(flt(d.e_amount) * flt(self.doc.payment_days)
|
||||
/ cint(self.doc.total_days_in_month), 2)
|
||||
@@ -172,7 +168,7 @@ class DocType(TransactionBase):
|
||||
|
||||
def calculate_ded_total(self):
|
||||
self.doc.total_deduction = 0
|
||||
for d in getlist(self.doclist, 'deduction_details'):
|
||||
for d in self.get('deduction_details'):
|
||||
if cint(d.d_depends_on_lwp) == 1:
|
||||
d.d_modified_amount = _round(flt(d.d_amount) * flt(self.doc.payment_days)
|
||||
/ cint(self.doc.total_days_in_month), 2)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class SalarySlipDeduction(Document):
|
||||
pass
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class SalarySlipEarning(Document):
|
||||
pass
|
||||
@@ -5,15 +5,13 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
from frappe.utils import cstr, flt
|
||||
from frappe.model.doc import addchild, make_autoname
|
||||
from frappe.model.doc import make_autoname
|
||||
from frappe import msgprint, _
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self,doc,doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
from frappe.model.document import Document
|
||||
|
||||
class SalaryStructure(Document):
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.employee + '/.SST' + '/.#####')
|
||||
|
||||
@@ -44,7 +42,7 @@ class DocType:
|
||||
def make_table(self, doct_name, tab_fname, tab_name):
|
||||
list1 = frappe.db.sql("select name from `tab%s` where docstatus != 2" % doct_name)
|
||||
for li in list1:
|
||||
child = addchild(self.doc, tab_fname, tab_name, self.doclist)
|
||||
child = self.doc.append(tab_fname, {})
|
||||
if(tab_fname == 'earning_details'):
|
||||
child.e_type = cstr(li[0])
|
||||
child.modified_value = 0
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class SalaryStructureDeduction(Document):
|
||||
pass
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
from frappe.model.document import Document
|
||||
|
||||
class SalaryStructureEarning(Document):
|
||||
pass
|
||||
@@ -8,14 +8,13 @@ import frappe
|
||||
from frappe.utils import cstr, add_days, date_diff
|
||||
from frappe import msgprint, _
|
||||
from frappe.utils.datautils import UnicodeWriter
|
||||
from frappe.model.document import Document
|
||||
|
||||
# doclist = None
|
||||
doclist = frappe.local('uploadattendance_doclist')
|
||||
|
||||
class DocType():
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
class UploadAttendance(Document):
|
||||
pass
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_template():
|
||||
|
||||
Reference in New Issue
Block a user