Merge branch 'develop' into opportunity-lost-reason
This commit is contained in:
commit
627b566445
@ -213,7 +213,7 @@ def prepare_data(accounts, balance_must_be, period_list, company_currency):
|
|||||||
total = 0
|
total = 0
|
||||||
row = frappe._dict({
|
row = frappe._dict({
|
||||||
"account": _(d.name),
|
"account": _(d.name),
|
||||||
"parent_account": _(d.parent_account),
|
"parent_account": _(d.parent_account) if d.parent_account else '',
|
||||||
"indent": flt(d.indent),
|
"indent": flt(d.indent),
|
||||||
"year_start_date": year_start_date,
|
"year_start_date": year_start_date,
|
||||||
"year_end_date": year_end_date,
|
"year_end_date": year_end_date,
|
||||||
|
@ -156,7 +156,6 @@ def get_sales_invoice_data(filters):
|
|||||||
|
|
||||||
|
|
||||||
def get_mode_of_payments(filters):
|
def get_mode_of_payments(filters):
|
||||||
frappe.log_error(filters, 'filters')
|
|
||||||
mode_of_payments = {}
|
mode_of_payments = {}
|
||||||
invoice_list = get_invoices(filters)
|
invoice_list = get_invoices(filters)
|
||||||
invoice_list_names = ",".join(['"' + invoice['name'] + '"' for invoice in invoice_list])
|
invoice_list_names = ",".join(['"' + invoice['name'] + '"' for invoice in invoice_list])
|
||||||
@ -164,12 +163,14 @@ def get_mode_of_payments(filters):
|
|||||||
inv_mop = frappe.db.sql("""select a.owner,a.posting_date, ifnull(b.mode_of_payment, '') as mode_of_payment
|
inv_mop = frappe.db.sql("""select a.owner,a.posting_date, ifnull(b.mode_of_payment, '') as mode_of_payment
|
||||||
from `tabSales Invoice` a, `tabSales Invoice Payment` b
|
from `tabSales Invoice` a, `tabSales Invoice Payment` b
|
||||||
where a.name = b.parent
|
where a.name = b.parent
|
||||||
|
and a.docstatus = 1
|
||||||
and a.name in ({invoice_list_names})
|
and a.name in ({invoice_list_names})
|
||||||
union
|
union
|
||||||
select a.owner,a.posting_date, ifnull(b.mode_of_payment, '') as mode_of_payment
|
select a.owner,a.posting_date, ifnull(b.mode_of_payment, '') as mode_of_payment
|
||||||
from `tabSales Invoice` a, `tabPayment Entry` b,`tabPayment Entry Reference` c
|
from `tabSales Invoice` a, `tabPayment Entry` b,`tabPayment Entry Reference` c
|
||||||
where a.name = c.reference_name
|
where a.name = c.reference_name
|
||||||
and b.name = c.parent
|
and b.name = c.parent
|
||||||
|
and b.docstatus = 1
|
||||||
and a.name in ({invoice_list_names})
|
and a.name in ({invoice_list_names})
|
||||||
union
|
union
|
||||||
select a.owner, a.posting_date,
|
select a.owner, a.posting_date,
|
||||||
@ -196,13 +197,13 @@ def get_invoices(filters):
|
|||||||
def get_mode_of_payment_details(filters):
|
def get_mode_of_payment_details(filters):
|
||||||
mode_of_payment_details = {}
|
mode_of_payment_details = {}
|
||||||
invoice_list = get_invoices(filters)
|
invoice_list = get_invoices(filters)
|
||||||
frappe.log_error(invoice_list, 'invoice_list')
|
|
||||||
invoice_list_names = ",".join(['"' + invoice['name'] + '"' for invoice in invoice_list])
|
invoice_list_names = ",".join(['"' + invoice['name'] + '"' for invoice in invoice_list])
|
||||||
if invoice_list:
|
if invoice_list:
|
||||||
inv_mop_detail = frappe.db.sql("""select a.owner, a.posting_date,
|
inv_mop_detail = frappe.db.sql("""select a.owner, a.posting_date,
|
||||||
ifnull(b.mode_of_payment, '') as mode_of_payment, sum(b.base_amount) as paid_amount
|
ifnull(b.mode_of_payment, '') as mode_of_payment, sum(b.base_amount) as paid_amount
|
||||||
from `tabSales Invoice` a, `tabSales Invoice Payment` b
|
from `tabSales Invoice` a, `tabSales Invoice Payment` b
|
||||||
where a.name = b.parent
|
where a.name = b.parent
|
||||||
|
and a.docstatus = 1
|
||||||
and a.name in ({invoice_list_names})
|
and a.name in ({invoice_list_names})
|
||||||
group by a.owner, a.posting_date, mode_of_payment
|
group by a.owner, a.posting_date, mode_of_payment
|
||||||
union
|
union
|
||||||
@ -211,6 +212,7 @@ def get_mode_of_payment_details(filters):
|
|||||||
from `tabSales Invoice` a, `tabPayment Entry` b,`tabPayment Entry Reference` c
|
from `tabSales Invoice` a, `tabPayment Entry` b,`tabPayment Entry Reference` c
|
||||||
where a.name = c.reference_name
|
where a.name = c.reference_name
|
||||||
and b.name = c.parent
|
and b.name = c.parent
|
||||||
|
and b.docstatus = 1
|
||||||
and a.name in ({invoice_list_names})
|
and a.name in ({invoice_list_names})
|
||||||
group by a.owner, a.posting_date, mode_of_payment
|
group by a.owner, a.posting_date, mode_of_payment
|
||||||
union
|
union
|
||||||
|
@ -0,0 +1,165 @@
|
|||||||
|
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import unittest
|
||||||
|
import frappe
|
||||||
|
from erpnext.accounts.report.sales_payment_summary.sales_payment_summary import get_mode_of_payments, get_mode_of_payment_details
|
||||||
|
from frappe.utils import today
|
||||||
|
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
|
||||||
|
|
||||||
|
test_dependencies = ["Sales Invoice"]
|
||||||
|
|
||||||
|
class TestSalesPaymentSummary(unittest.TestCase):
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(self):
|
||||||
|
create_records()
|
||||||
|
pes = frappe.get_all("Payment Entry")
|
||||||
|
jes = frappe.get_all("Journal Entry")
|
||||||
|
sis = frappe.get_all("Sales Invoice")
|
||||||
|
for pe in pes:
|
||||||
|
frappe.db.set_value("Payment Entry", pe.name, "docstatus", 2)
|
||||||
|
for je in jes:
|
||||||
|
frappe.db.set_value("Journal Entry", je.name, "docstatus", 2)
|
||||||
|
for si in sis:
|
||||||
|
frappe.db.set_value("Sales Invoice", si.name, "docstatus", 2)
|
||||||
|
|
||||||
|
def test_get_mode_of_payments(self):
|
||||||
|
filters = get_filters()
|
||||||
|
|
||||||
|
for dummy in range(2):
|
||||||
|
si = create_sales_invoice_record()
|
||||||
|
si.insert()
|
||||||
|
si.submit()
|
||||||
|
|
||||||
|
if int(si.name[-3:])%2 == 0:
|
||||||
|
bank_account = "_Test Cash - _TC"
|
||||||
|
mode_of_payment = "Cash"
|
||||||
|
else:
|
||||||
|
bank_account = "_Test Bank - _TC"
|
||||||
|
mode_of_payment = "Credit Card"
|
||||||
|
|
||||||
|
pe = get_payment_entry("Sales Invoice", si.name, bank_account=bank_account)
|
||||||
|
pe.reference_no = "_Test"
|
||||||
|
pe.reference_date = today()
|
||||||
|
pe.mode_of_payment = mode_of_payment
|
||||||
|
pe.insert()
|
||||||
|
pe.submit()
|
||||||
|
|
||||||
|
mop = get_mode_of_payments(filters)
|
||||||
|
self.assertTrue('Credit Card' in mop.values()[0])
|
||||||
|
self.assertTrue('Cash' in mop.values()[0])
|
||||||
|
|
||||||
|
# Cancel all Cash payment entry and check if this mode of payment is still fetched.
|
||||||
|
payment_entries = frappe.get_all("Payment Entry", filters={"mode_of_payment": "Cash", "docstatus": 1}, fields=["name", "docstatus"])
|
||||||
|
for payment_entry in payment_entries:
|
||||||
|
pe = frappe.get_doc("Payment Entry", payment_entry.name)
|
||||||
|
pe.cancel()
|
||||||
|
|
||||||
|
mop = get_mode_of_payments(filters)
|
||||||
|
self.assertTrue('Credit Card' in mop.values()[0])
|
||||||
|
self.assertTrue('Cash' not in mop.values()[0])
|
||||||
|
|
||||||
|
def test_get_mode_of_payments_details(self):
|
||||||
|
filters = get_filters()
|
||||||
|
|
||||||
|
for dummy in range(2):
|
||||||
|
si = create_sales_invoice_record()
|
||||||
|
si.insert()
|
||||||
|
si.submit()
|
||||||
|
|
||||||
|
if int(si.name[-3:])%2 == 0:
|
||||||
|
bank_account = "_Test Cash - _TC"
|
||||||
|
mode_of_payment = "Cash"
|
||||||
|
else:
|
||||||
|
bank_account = "_Test Bank - _TC"
|
||||||
|
mode_of_payment = "Credit Card"
|
||||||
|
|
||||||
|
pe = get_payment_entry("Sales Invoice", si.name, bank_account=bank_account)
|
||||||
|
pe.reference_no = "_Test"
|
||||||
|
pe.reference_date = today()
|
||||||
|
pe.mode_of_payment = mode_of_payment
|
||||||
|
pe.insert()
|
||||||
|
pe.submit()
|
||||||
|
|
||||||
|
mopd = get_mode_of_payment_details(filters)
|
||||||
|
|
||||||
|
mopd_values = mopd.values()[0]
|
||||||
|
for mopd_value in mopd_values:
|
||||||
|
if mopd_value[0] == "Credit Card":
|
||||||
|
cc_init_amount = mopd_value[1]
|
||||||
|
|
||||||
|
# Cancel one Credit Card Payment Entry and check that it is not fetched in mode of payment details.
|
||||||
|
payment_entries = frappe.get_all("Payment Entry", filters={"mode_of_payment": "Credit Card", "docstatus": 1}, fields=["name", "docstatus"])
|
||||||
|
for payment_entry in payment_entries[:1]:
|
||||||
|
pe = frappe.get_doc("Payment Entry", payment_entry.name)
|
||||||
|
pe.cancel()
|
||||||
|
|
||||||
|
mopd = get_mode_of_payment_details(filters)
|
||||||
|
mopd_values = mopd.values()[0]
|
||||||
|
for mopd_value in mopd_values:
|
||||||
|
if mopd_value[0] == "Credit Card":
|
||||||
|
cc_final_amount = mopd_value[1]
|
||||||
|
|
||||||
|
self.assertTrue(cc_init_amount > cc_final_amount)
|
||||||
|
|
||||||
|
def get_filters():
|
||||||
|
return {
|
||||||
|
"from_date": "1900-01-01",
|
||||||
|
"to_date": today(),
|
||||||
|
"company": "_Test Company"
|
||||||
|
}
|
||||||
|
|
||||||
|
def create_sales_invoice_record(qty=1):
|
||||||
|
# return sales invoice doc object
|
||||||
|
return frappe.get_doc({
|
||||||
|
"doctype": "Sales Invoice",
|
||||||
|
"customer": frappe.get_doc('Customer', {"customer_name": "Prestiga-Biz"}).name,
|
||||||
|
"company": '_Test Company',
|
||||||
|
"due_date": today(),
|
||||||
|
"posting_date": today(),
|
||||||
|
"currency": "INR",
|
||||||
|
"taxes_and_charges": "",
|
||||||
|
"debit_to": "Debtors - _TC",
|
||||||
|
"taxes": [],
|
||||||
|
"items": [{
|
||||||
|
'doctype': 'Sales Invoice Item',
|
||||||
|
'item_code': frappe.get_doc('Item', {'item_name': 'Consulting'}).name,
|
||||||
|
'qty': qty,
|
||||||
|
"rate": 10000,
|
||||||
|
'income_account': 'Sales - _TC',
|
||||||
|
'cost_center': 'Main - _TC',
|
||||||
|
'expense_account': 'Cost of Goods Sold - _TC'
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
|
||||||
|
def create_records():
|
||||||
|
if frappe.db.exists("Customer", "Prestiga-Biz"):
|
||||||
|
return
|
||||||
|
|
||||||
|
#customer
|
||||||
|
frappe.get_doc({
|
||||||
|
"customer_group": "_Test Customer Group",
|
||||||
|
"customer_name": "Prestiga-Biz",
|
||||||
|
"customer_type": "Company",
|
||||||
|
"doctype": "Customer",
|
||||||
|
"territory": "_Test Territory"
|
||||||
|
}).insert()
|
||||||
|
|
||||||
|
# item
|
||||||
|
item = frappe.get_doc({
|
||||||
|
"doctype": "Item",
|
||||||
|
"item_code": "Consulting",
|
||||||
|
"item_name": "Consulting",
|
||||||
|
"item_group": "All Item Groups",
|
||||||
|
"company": "_Test Company",
|
||||||
|
"is_stock_item": 0
|
||||||
|
}).insert()
|
||||||
|
|
||||||
|
# item price
|
||||||
|
frappe.get_doc({
|
||||||
|
"doctype": "Item Price",
|
||||||
|
"price_list": "Standard Selling",
|
||||||
|
"item_code": item.item_code,
|
||||||
|
"price_list_rate": 10000
|
||||||
|
}).insert()
|
@ -12,7 +12,7 @@ app_license = "GNU General Public License (v3)"
|
|||||||
source_link = "https://github.com/frappe/erpnext"
|
source_link = "https://github.com/frappe/erpnext"
|
||||||
|
|
||||||
develop_version = '12.x.x-develop'
|
develop_version = '12.x.x-develop'
|
||||||
staging_version = '11.0.3-beta.32'
|
staging_version = '11.0.3-beta.33'
|
||||||
|
|
||||||
error_report_email = "support@erpnext.com"
|
error_report_email = "support@erpnext.com"
|
||||||
|
|
||||||
|
@ -1,9 +1,24 @@
|
|||||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
# License: GNU General Public License v3. See license.txt
|
# License: GNU General Public License v3. See license.txt
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
import unittest
|
||||||
|
|
||||||
test_ignore = ["Leave Block List"]
|
test_ignore = ["Leave Block List"]
|
||||||
|
class TestDepartment(unittest.TestCase):
|
||||||
|
def test_remove_department_data(self):
|
||||||
|
doc = create_department("Test Department")
|
||||||
|
frappe.delete_doc('Department', doc.name)
|
||||||
|
|
||||||
|
def create_department(department_name, parent_department=None):
|
||||||
|
doc = frappe.get_doc({
|
||||||
|
'doctype': 'Department',
|
||||||
|
'is_group': 0,
|
||||||
|
'parent_department': parent_department,
|
||||||
|
'department_name': department_name,
|
||||||
|
'company': frappe.defaults.get_defaults().company
|
||||||
|
}).insert()
|
||||||
|
|
||||||
|
return doc
|
||||||
|
|
||||||
import frappe
|
|
||||||
test_records = frappe.get_test_records('Department')
|
test_records = frappe.get_test_records('Department')
|
@ -13,8 +13,8 @@ from frappe.model.document import Document
|
|||||||
from erpnext.utilities.transaction_base import delete_events
|
from erpnext.utilities.transaction_base import delete_events
|
||||||
from frappe.utils.nestedset import NestedSet
|
from frappe.utils.nestedset import NestedSet
|
||||||
|
|
||||||
class EmployeeUserDisabledError(frappe.ValidationError):
|
class EmployeeUserDisabledError(frappe.ValidationError): pass
|
||||||
pass
|
class EmployeeLeftValidationError(frappe.ValidationError): pass
|
||||||
|
|
||||||
class Employee(NestedSet):
|
class Employee(NestedSet):
|
||||||
nsm_parent_field = 'reports_to'
|
nsm_parent_field = 'reports_to'
|
||||||
@ -147,7 +147,15 @@ class Employee(NestedSet):
|
|||||||
validate_email_add(self.personal_email, True)
|
validate_email_add(self.personal_email, True)
|
||||||
|
|
||||||
def validate_status(self):
|
def validate_status(self):
|
||||||
if self.status == 'Left' and not self.relieving_date:
|
if self.status == 'Left':
|
||||||
|
reports_to = frappe.db.get_all('Employee',
|
||||||
|
filters={'reports_to': self.name}
|
||||||
|
)
|
||||||
|
if reports_to:
|
||||||
|
link_to_employees = [frappe.utils.get_link_to_form('Employee', employee.name) for employee in reports_to]
|
||||||
|
throw(_("Employee status cannot be set to 'Left' as following employees are currently reporting to this employee: ")
|
||||||
|
+ ', '.join(link_to_employees), EmployeeLeftValidationError)
|
||||||
|
if not self.relieving_date:
|
||||||
throw(_("Please enter relieving date."))
|
throw(_("Please enter relieving date."))
|
||||||
|
|
||||||
def validate_for_enabled_user_id(self, enabled):
|
def validate_for_enabled_user_id(self, enabled):
|
||||||
|
@ -7,6 +7,7 @@ import frappe
|
|||||||
import erpnext
|
import erpnext
|
||||||
import unittest
|
import unittest
|
||||||
import frappe.utils
|
import frappe.utils
|
||||||
|
from erpnext.hr.doctype.employee.employee import EmployeeLeftValidationError
|
||||||
|
|
||||||
test_records = frappe.get_test_records('Employee')
|
test_records = frappe.get_test_records('Employee')
|
||||||
|
|
||||||
@ -32,6 +33,18 @@ class TestEmployee(unittest.TestCase):
|
|||||||
email_queue = frappe.db.sql("""select * from `tabEmail Queue`""", as_dict=True)
|
email_queue = frappe.db.sql("""select * from `tabEmail Queue`""", as_dict=True)
|
||||||
self.assertTrue("Subject: Birthday Reminder" in email_queue[0].message)
|
self.assertTrue("Subject: Birthday Reminder" in email_queue[0].message)
|
||||||
|
|
||||||
|
def test_employee_status_left(self):
|
||||||
|
employee1 = make_employee("test_employee_1@company.com")
|
||||||
|
employee2 = make_employee("test_employee_2@company.com")
|
||||||
|
employee1_doc = frappe.get_doc("Employee", employee1)
|
||||||
|
employee2_doc = frappe.get_doc("Employee", employee2)
|
||||||
|
employee2_doc.reload()
|
||||||
|
employee2_doc.reports_to = employee1_doc.name
|
||||||
|
employee2_doc.save()
|
||||||
|
employee1_doc.reload()
|
||||||
|
employee1_doc.status = 'Left'
|
||||||
|
self.assertRaises(EmployeeLeftValidationError, employee1_doc.save)
|
||||||
|
|
||||||
def make_employee(user):
|
def make_employee(user):
|
||||||
if not frappe.db.get_value("User", user):
|
if not frappe.db.get_value("User", user):
|
||||||
frappe.get_doc({
|
frappe.get_doc({
|
||||||
|
@ -457,7 +457,7 @@ def get_leave_period():
|
|||||||
return frappe.get_doc(dict(
|
return frappe.get_doc(dict(
|
||||||
name = 'Test Leave Period',
|
name = 'Test Leave Period',
|
||||||
doctype = 'Leave Period',
|
doctype = 'Leave Period',
|
||||||
from_date = "{0}-01-01".format(now_datetime().year),
|
from_date = "{0}-12-01".format(now_datetime().year - 1),
|
||||||
to_date = "{0}-12-31".format(now_datetime().year),
|
to_date = "{0}-12-31".format(now_datetime().year),
|
||||||
company = "_Test Company",
|
company = "_Test Company",
|
||||||
is_active = 1
|
is_active = 1
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
|
# See license.txt
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import frappe
|
||||||
|
import unittest
|
||||||
|
from frappe.utils import getdate
|
||||||
|
from erpnext.hr.doctype.upload_attendance.upload_attendance import get_data
|
||||||
|
from erpnext.hr.doctype.employee.test_employee import make_employee
|
||||||
|
|
||||||
|
class TestUploadAttendance(unittest.TestCase):
|
||||||
|
def test_date_range(self):
|
||||||
|
employee = make_employee("test_employee@company.com")
|
||||||
|
employee_doc = frappe.get_doc("Employee", employee)
|
||||||
|
date_of_joining = "2018-01-02"
|
||||||
|
relieving_date = "2018-01-03"
|
||||||
|
from_date = "2018-01-01"
|
||||||
|
to_date = "2018-01-04"
|
||||||
|
employee_doc.date_of_joining = date_of_joining
|
||||||
|
employee_doc.relieving_date = relieving_date
|
||||||
|
employee_doc.save()
|
||||||
|
args = {
|
||||||
|
"from_date": from_date,
|
||||||
|
"to_date": to_date
|
||||||
|
}
|
||||||
|
data = get_data(args)
|
||||||
|
filtered_data = []
|
||||||
|
for row in data:
|
||||||
|
if row[1] == employee:
|
||||||
|
filtered_data.append(row)
|
||||||
|
for row in filtered_data:
|
||||||
|
self.assertTrue(getdate(row[3]) >= getdate(date_of_joining) and getdate(row[3]) <= getdate(relieving_date))
|
@ -41,16 +41,28 @@ def add_header(w):
|
|||||||
return w
|
return w
|
||||||
|
|
||||||
def add_data(w, args):
|
def add_data(w, args):
|
||||||
|
data = get_data(args)
|
||||||
|
writedata(w, data)
|
||||||
|
return w
|
||||||
|
|
||||||
|
def get_data(args):
|
||||||
dates = get_dates(args)
|
dates = get_dates(args)
|
||||||
employees = get_active_employees()
|
employees = get_active_employees()
|
||||||
existing_attendance_records = get_existing_attendance_records(args)
|
existing_attendance_records = get_existing_attendance_records(args)
|
||||||
|
data = []
|
||||||
for date in dates:
|
for date in dates:
|
||||||
for employee in employees:
|
for employee in employees:
|
||||||
|
if getdate(date) < getdate(employee.date_of_joining):
|
||||||
|
continue
|
||||||
|
if employee.relieving_date:
|
||||||
|
if getdate(date) > getdate(employee.relieving_date):
|
||||||
|
continue
|
||||||
existing_attendance = {}
|
existing_attendance = {}
|
||||||
if existing_attendance_records \
|
if existing_attendance_records \
|
||||||
and tuple([getdate(date), employee.name]) in existing_attendance_records:
|
and tuple([getdate(date), employee.name]) in existing_attendance_records \
|
||||||
|
and getdate(employee.date_of_joining) >= getdate(date) \
|
||||||
|
and getdate(employee.relieving_date) <= getdate(date):
|
||||||
existing_attendance = existing_attendance_records[tuple([getdate(date), employee.name])]
|
existing_attendance = existing_attendance_records[tuple([getdate(date), employee.name])]
|
||||||
|
|
||||||
row = [
|
row = [
|
||||||
existing_attendance and existing_attendance.name or "",
|
existing_attendance and existing_attendance.name or "",
|
||||||
employee.name, employee.employee_name, date,
|
employee.name, employee.employee_name, date,
|
||||||
@ -58,8 +70,12 @@ def add_data(w, args):
|
|||||||
existing_attendance and existing_attendance.leave_type or "", employee.company,
|
existing_attendance and existing_attendance.leave_type or "", employee.company,
|
||||||
existing_attendance and existing_attendance.naming_series or get_naming_series(),
|
existing_attendance and existing_attendance.naming_series or get_naming_series(),
|
||||||
]
|
]
|
||||||
|
data.append(row)
|
||||||
|
return data
|
||||||
|
|
||||||
|
def writedata(w, data):
|
||||||
|
for row in data:
|
||||||
w.writerow(row)
|
w.writerow(row)
|
||||||
return w
|
|
||||||
|
|
||||||
def get_dates(args):
|
def get_dates(args):
|
||||||
"""get list of dates in between from date and to date"""
|
"""get list of dates in between from date and to date"""
|
||||||
@ -68,8 +84,13 @@ def get_dates(args):
|
|||||||
return dates
|
return dates
|
||||||
|
|
||||||
def get_active_employees():
|
def get_active_employees():
|
||||||
employees = frappe.db.sql("""select name, employee_name, company
|
employees = frappe.db.get_all('Employee',
|
||||||
from tabEmployee where docstatus < 2 and status = 'Active'""", as_dict=1)
|
fields=['name', 'employee_name', 'date_of_joining', 'company', 'relieving_date'],
|
||||||
|
filters={
|
||||||
|
'docstatus': ['<', 2],
|
||||||
|
'status': 'Active'
|
||||||
|
}
|
||||||
|
)
|
||||||
return employees
|
return employees
|
||||||
|
|
||||||
def get_existing_attendance_records(args):
|
def get_existing_attendance_records(args):
|
||||||
|
@ -966,27 +966,6 @@
|
|||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"fetch_from": "item_code.include_item_in_manufacturing",
|
"fetch_from": "item_code.include_item_in_manufacturing",
|
||||||
"fieldtype": "Check",
|
|
||||||
"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,
|
|
||||||
"translatable": 0,
|
|
||||||
"fieldname": "include_item_in_manufacturing",
|
"fieldname": "include_item_in_manufacturing",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -1044,71 +1023,6 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"translatable": 0,
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
|
||||||
{
|
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "operation",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"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": "Item operation",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Operation",
|
|
||||||
"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,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "allow_alternative_item",
|
|
||||||
"fieldtype": "Check",
|
|
||||||
"hidden": 1,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Allow Alternative Item",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 1,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"has_web_view": 0,
|
"has_web_view": 0,
|
||||||
@ -1121,7 +1035,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2018-12-26 15:04:56.187136",
|
"modified": "2018-12-28 16:38:56.529079",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "BOM Item",
|
"name": "BOM Item",
|
||||||
|
@ -186,6 +186,8 @@ def make_salary_structure_for_timesheet(employee):
|
|||||||
|
|
||||||
if not frappe.db.get_value("Salary Structure Assignment",
|
if not frappe.db.get_value("Salary Structure Assignment",
|
||||||
{'employee':employee, 'docstatus': 1}):
|
{'employee':employee, 'docstatus': 1}):
|
||||||
|
frappe.db.set_value('Employee', employee, 'date_of_joining',
|
||||||
|
add_months(nowdate(), -5))
|
||||||
create_salary_structure_assignment(employee, salary_structure.name)
|
create_salary_structure_assignment(employee, salary_structure.name)
|
||||||
|
|
||||||
return salary_structure
|
return salary_structure
|
||||||
|
@ -146,8 +146,18 @@ class TransactionBase(StatusUpdater):
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
def delete_events(ref_type, ref_name):
|
def delete_events(ref_type, ref_name):
|
||||||
frappe.delete_doc("Event", frappe.db.sql_list("""select name from `tabEvent`
|
events = frappe.db.sql_list(""" SELECT
|
||||||
where ref_type=%s and ref_name=%s""", (ref_type, ref_name)), for_reload=True)
|
distinct `tabEvent`.name
|
||||||
|
from
|
||||||
|
`tabEvent`, `tabEvent Participants`
|
||||||
|
where
|
||||||
|
`tabEvent`.name = `tabEvent Participants`.parent
|
||||||
|
and `tabEvent Participants`.reference_doctype = %s
|
||||||
|
and `tabEvent Participants`.reference_docname = %s
|
||||||
|
""", (ref_type, ref_name)) or []
|
||||||
|
|
||||||
|
if events:
|
||||||
|
frappe.delete_doc("Event", events, for_reload=True)
|
||||||
|
|
||||||
def validate_uom_is_integer(doc, uom_field, qty_fields, child_dt=None):
|
def validate_uom_is_integer(doc, uom_field, qty_fields, child_dt=None):
|
||||||
if isinstance(qty_fields, string_types):
|
if isinstance(qty_fields, string_types):
|
||||||
|
Loading…
Reference in New Issue
Block a user