Merge branch 'develop' into attendance_template_fix

This commit is contained in:
Mangesh-Khairnar 2019-09-19 13:34:39 +05:30 committed by GitHub
commit 68a4c70b72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 12 deletions

View File

@ -57,7 +57,7 @@ def calculate_next_due_date(periodicity, start_date = None, end_date = None, las
if not start_date and not last_completion_date:
start_date = frappe.utils.now()
if last_completion_date and (last_completion_date > start_date or not start_date):
if last_completion_date and ((start_date and last_completion_date > start_date) or not start_date):
start_date = last_completion_date
if periodicity == 'Daily':
next_due_date = add_days(start_date, 1)
@ -71,10 +71,11 @@ def calculate_next_due_date(periodicity, start_date = None, end_date = None, las
next_due_date = add_years(start_date, 2)
if periodicity == 'Quarterly':
next_due_date = add_months(start_date, 3)
if end_date and (start_date >= end_date or last_completion_date >= end_date or next_due_date):
if end_date and ((start_date and start_date >= end_date) or (last_completion_date and last_completion_date >= end_date) or next_due_date):
next_due_date = ""
return next_due_date
def update_maintenance_log(asset_maintenance, item_code, item_name, task):
asset_maintenance_log = frappe.get_value("Asset Maintenance Log", {"asset_maintenance": asset_maintenance,
"task": task.maintenance_task, "maintenance_status": ('in',['Planned','Overdue'])})

View File

@ -105,7 +105,6 @@ class JobCard(Document):
for_quantity, time_in_mins = 0, 0
from_time_list, to_time_list = [], []
for d in frappe.get_all('Job Card',
filters = {'docstatus': 1, 'operation_id': self.operation_id}):
doc = frappe.get_doc('Job Card', d.name)
@ -125,8 +124,8 @@ class JobCard(Document):
if data.name == self.operation_id:
data.completed_qty = for_quantity
data.actual_operation_time = time_in_mins
data.actual_start_time = min(from_time_list)
data.actual_end_time = max(to_time_list)
data.actual_start_time = min(from_time_list) if from_time_list else None
data.actual_end_time = max(to_time_list) if to_time_list else None
wo.flags.ignore_validate_update_after_submit = True
wo.update_operation_status()

View File

@ -60,7 +60,7 @@ def get_details(filters):
conditions = ""
if filters.get("customer"):
conditions += " AND c.name = " + filters.get("customer")
conditions += " AND c.name = '" + filters.get("customer") + "'"
return frappe.db.sql("""SELECT
c.name, c.customer_name,
@ -69,6 +69,6 @@ def get_details(filters):
FROM `tabCustomer` c, `tabCustomer Credit Limit` ccl
WHERE
c.name = ccl.parent
AND ccl.company = %s
{0}
""".format(conditions), (filters.get("company")), as_dict=1) #nosec
AND ccl.company = '{0}'
{1}
""".format( filters.get("company"),conditions), as_dict=1) #nosec

View File

@ -15,8 +15,8 @@ def execute(filters=None):
def get_columns():
columns = [
_("Company") + ":Link/Item:250",
_("Warehouse") + ":Link/Item:150",
_("Company") + ":Link/Company:250",
_("Warehouse") + ":Link/Warehouse:150",
_("Item") + ":Link/Item:150",
_("Description") + "::300",
_("Current Qty") + ":Float:100",
@ -30,7 +30,7 @@ def get_total_stock(filters):
if filters.get("group_by") == "Warehouse":
if filters.get("company"):
conditions += " AND warehouse.company = %s" % frappe.db.escape(filters.get("company"), percent=False)
conditions += " AND warehouse.company = '%s'" % frappe.db.escape(filters.get("company"), percent=False)
conditions += " GROUP BY ledger.warehouse, item.item_code"
columns += "'' as company, ledger.warehouse"