-webnotes +frappe 💥

This commit is contained in:
Rushabh Mehta
2014-02-14 15:47:51 +05:30
parent 8ae051cb39
commit 793ba6bd37
729 changed files with 5194 additions and 9971 deletions

View File

@@ -2,7 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
import frappe
class DocType:
def __init__(self, d, dl):

View File

@@ -4,13 +4,13 @@
// show tasks
cur_frm.cscript.refresh = function(doc) {
if(!doc.__islocal) {
cur_frm.appframe.add_button(wn._("Gantt Chart"), function() {
wn.route_options = {"project": doc.name}
wn.set_route("Gantt", "Task");
cur_frm.appframe.add_button(frappe._("Gantt Chart"), function() {
frappe.route_options = {"project": doc.name}
frappe.set_route("Gantt", "Task");
}, "icon-tasks");
cur_frm.add_custom_button(wn._("Tasks"), function() {
wn.route_options = {"project": doc.name}
wn.set_route("List", "Task");
cur_frm.add_custom_button(frappe._("Tasks"), function() {
frappe.route_options = {"project": doc.name}
frappe.set_route("List", "Task");
}, "icon-list");
}
}

View File

@@ -2,10 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
import frappe
from webnotes.utils import flt, getdate
from webnotes import msgprint
from frappe.utils import flt, getdate
from frappe import msgprint
from erpnext.utilities.transaction_base import delete_events
class DocType:
@@ -32,12 +32,12 @@ class DocType:
self.add_calendar_event()
def update_percent_complete(self):
total = webnotes.conn.sql("""select count(*) from tabTask where project=%s""",
total = frappe.conn.sql("""select count(*) from tabTask where project=%s""",
self.doc.name)[0][0]
if total:
completed = webnotes.conn.sql("""select count(*) from tabTask where
completed = frappe.conn.sql("""select count(*) from tabTask where
project=%s and status in ('Closed', 'Cancelled')""", self.doc.name)[0][0]
webnotes.conn.set_value("Project", self.doc.name, "percent_complete",
frappe.conn.set_value("Project", self.doc.name, "percent_complete",
int(float(completed) / total * 100))
def add_calendar_event(self):
@@ -48,7 +48,7 @@ class DocType:
for milestone in self.doclist.get({"parentfield": "project_milestones"}):
if milestone.milestone_date:
description = (milestone.milestone or "Milestone") + " for " + self.doc.name
webnotes.bean({
frappe.bean({
"doctype": "Event",
"owner": self.doc.owner,
"subject": description,

View File

@@ -2,7 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
import frappe
class DocType:
def __init__(self, d, dl):

View File

@@ -1,11 +1,11 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
wn.provide("erpnext.projects");
frappe.provide("erpnext.projects");
cur_frm.add_fetch("project", "company", "company");
erpnext.projects.Task = wn.ui.form.Controller.extend({
erpnext.projects.Task = frappe.ui.form.Controller.extend({
setup: function() {
this.frm.fields_dict.project.get_query = function() {
return {
@@ -22,7 +22,7 @@ erpnext.projects.Task = wn.ui.form.Controller.extend({
},
validate: function() {
this.frm.doc.project && wn.model.remove_from_locals("Project",
this.frm.doc.project && frappe.model.remove_from_locals("Project",
this.frm.doc.project);
},
});

View File

@@ -2,12 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes, json
import frappe, json
from webnotes.utils import getdate, today
from webnotes.model import db_exists
from webnotes.model.bean import copy_doclist
from webnotes import msgprint
from frappe.utils import getdate, today
from frappe.model import db_exists
from frappe.model.bean import copy_doclist
from frappe import msgprint
class DocType:
@@ -21,7 +21,7 @@ class DocType:
}
def get_customer_details(self):
cust = webnotes.conn.sql("select customer_name from `tabCustomer` where name=%s", self.doc.customer)
cust = frappe.conn.sql("select customer_name from `tabCustomer` where name=%s", self.doc.customer)
if cust:
ret = {'customer_name': cust and cust[0][0] or ''}
return ret
@@ -38,7 +38,7 @@ class DocType:
self.update_status()
def update_status(self):
status = webnotes.conn.get_value("Task", self.doc.name, "status")
status = frappe.conn.get_value("Task", self.doc.name, "status")
if self.doc.status=="Working" and status !="Working" and not self.doc.act_start_date:
self.doc.act_start_date = today()
@@ -48,14 +48,14 @@ class DocType:
def on_update(self):
"""update percent complete in project"""
if self.doc.project:
project = webnotes.bean("Project", self.doc.project)
project = frappe.bean("Project", self.doc.project)
project.run_method("update_percent_complete")
@webnotes.whitelist()
@frappe.whitelist()
def get_events(start, end, filters=None):
from webnotes.widgets.reportview import build_match_conditions
if not webnotes.has_permission("Task"):
webnotes.msgprint(_("No Permission"), raise_exception=1)
from frappe.widgets.reportview import build_match_conditions
if not frappe.has_permission("Task"):
frappe.msgprint(_("No Permission"), raise_exception=1)
conditions = build_match_conditions("Task")
conditions and (" and " + conditions) or ""
@@ -66,7 +66,7 @@ def get_events(start, end, filters=None):
if filters[key]:
conditions += " and " + key + ' = "' + filters[key].replace('"', '\"') + '"'
data = webnotes.conn.sql("""select name, exp_start_date, exp_end_date,
data = frappe.conn.sql("""select name, exp_start_date, exp_end_date,
subject, status, project from `tabTask`
where ((exp_start_date between '%(start)s' and '%(end)s') \
or (exp_end_date between '%(start)s' and '%(end)s'))
@@ -80,7 +80,7 @@ def get_events(start, end, filters=None):
def get_project(doctype, txt, searchfield, start, page_len, filters):
from erpnext.controllers.queries import get_match_cond
return webnotes.conn.sql(""" select name from `tabProject`
return frappe.conn.sql(""" select name from `tabProject`
where %(key)s like "%(txt)s"
%(mcond)s
order by name

View File

@@ -1,12 +1,12 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
wn.views.calendar["Task"] = {
frappe.views.calendar["Task"] = {
field_map: {
"start": "exp_start_date",
"end": "exp_end_date",
"id": "name",
"title": wn._("subject"),
"title": frappe._("subject"),
"allDay": "allDay"
},
gantt: true,
@@ -15,7 +15,7 @@ wn.views.calendar["Task"] = {
"fieldtype": "Link",
"fieldname": "project",
"options": "Project",
"label": wn._("Project")
"label": frappe._("Project")
}
],
get_events_method: "erpnext.projects.doctype.task.task.get_events"

View File

@@ -1,14 +1,14 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
import frappe
import unittest
from erpnext.projects.doctype.time_log.time_log import OverlapError
class TestTimeLog(unittest.TestCase):
def test_duplication(self):
ts = webnotes.bean(webnotes.copy_doclist(test_records[0]))
ts = frappe.bean(frappe.copy_doclist(test_records[0]))
self.assertRaises(OverlapError, ts.insert)
test_records = [[{

View File

@@ -1,9 +1,9 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
wn.provide("erpnext.projects");
frappe.provide("erpnext.projects");
erpnext.projects.TimeLog = wn.ui.form.Controller.extend({
erpnext.projects.TimeLog = frappe.ui.form.Controller.extend({
onload: function() {
this.frm.set_query("task", erpnext.queries.task);
}

View File

@@ -4,12 +4,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
from webnotes import _
from webnotes.utils import cstr
import frappe
from frappe import _
from frappe.utils import cstr
class OverlapError(webnotes.ValidationError): pass
class OverlapError(frappe.ValidationError): pass
class DocType:
def __init__(self, d, dl):
@@ -21,7 +21,7 @@ class DocType:
self.calculate_total_hours()
def calculate_total_hours(self):
from webnotes.utils import time_diff_in_hours
from frappe.utils import time_diff_in_hours
self.doc.hours = time_diff_in_hours(self.doc.to_time, self.doc.from_time)
def set_status(self):
@@ -38,7 +38,7 @@ class DocType:
self.doc.status="Billed"
def validate_overlap(self):
existing = webnotes.conn.sql_list("""select name from `tabTime Log` where owner=%s and
existing = frappe.conn.sql_list("""select name from `tabTime Log` where owner=%s and
(
(from_time between %s and %s) or
(to_time between %s and %s) or
@@ -51,7 +51,7 @@ class DocType:
cstr(self.doc.task)))
if existing:
webnotes.msgprint(_("This Time Log conflicts with") + ":" + ', '.join(existing),
frappe.msgprint(_("This Time Log conflicts with") + ":" + ', '.join(existing),
raise_exception=OverlapError)
def before_cancel(self):
@@ -60,14 +60,14 @@ class DocType:
def before_update_after_submit(self):
self.set_status()
@webnotes.whitelist()
@frappe.whitelist()
def get_events(start, end):
from webnotes.widgets.reportview import build_match_conditions
if not webnotes.has_permission("Time Log"):
webnotes.msgprint(_("No Permission"), raise_exception=1)
from frappe.widgets.reportview import build_match_conditions
if not frappe.has_permission("Time Log"):
frappe.msgprint(_("No Permission"), raise_exception=1)
match = build_match_conditions("Time Log")
data = webnotes.conn.sql("""select name, from_time, to_time,
data = frappe.conn.sql("""select name, from_time, to_time,
activity_type, task, project from `tabTime Log`
where from_time between '%(start)s' and '%(end)s' or to_time between '%(start)s' and '%(end)s'
%(match)s""" % {

View File

@@ -1,7 +1,7 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
wn.views.calendar["Time Log"] = {
frappe.views.calendar["Time Log"] = {
field_map: {
"start": "from_time",
"end": "to_time",

View File

@@ -2,34 +2,34 @@
// License: GNU General Public License v3. See license.txt
// render
wn.listview_settings['Time Log'] = {
frappe.listview_settings['Time Log'] = {
add_fields: ["`tabTime Log`.`status`", "`tabTime Log`.`billable`", "`tabTime Log`.`activity_type`"],
selectable: true,
onload: function(me) {
me.appframe.add_button(wn._("Make Time Log Batch"), function() {
me.appframe.add_button(frappe._("Make Time Log Batch"), function() {
var selected = me.get_checked_items() || [];
if(!selected.length) {
msgprint(wn._("Please select Time Logs."))
msgprint(frappe._("Please select Time Logs."))
}
// select only billable time logs
for(var i in selected) {
var d = selected[i];
if(!d.billable) {
msgprint(wn._("Time Log is not billable") + ": " + d.name);
msgprint(frappe._("Time Log is not billable") + ": " + d.name);
return;
}
if(d.status!="Submitted") {
msgprint(wn._("Time Log Status must be Submitted."));
msgprint(frappe._("Time Log Status must be Submitted."));
}
}
// make batch
wn.model.with_doctype("Time Log Batch", function() {
var tlb = wn.model.get_new_doc("Time Log Batch");
frappe.model.with_doctype("Time Log Batch", function() {
var tlb = frappe.model.get_new_doc("Time Log Batch");
$.each(selected, function(i, d) {
var detail = wn.model.get_new_doc("Time Log Batch Detail");
var detail = frappe.model.get_new_doc("Time Log Batch Detail");
$.extend(detail, {
"parenttype": "Time Log Batch",
"parentfield": "time_log_batch_details",
@@ -40,7 +40,7 @@ wn.listview_settings['Time Log'] = {
"idx": i+1
});
})
wn.set_route("Form", "Time Log Batch", tlb.name);
frappe.set_route("Form", "Time Log Batch", tlb.name);
})
}, "icon-file-alt");

View File

@@ -1,12 +1,12 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes, unittest
import frappe, unittest
class TimeLogBatchTest(unittest.TestCase):
def test_time_log_status(self):
from erpnext.projects.doctype.time_log.test_time_log import test_records as time_log_records
time_log = webnotes.bean(copy=time_log_records[0])
time_log = frappe.bean(copy=time_log_records[0])
time_log.doc.fields.update({
"from_time": "2013-01-02 10:00:00",
"to_time": "2013-01-02 11:00:00",
@@ -15,15 +15,15 @@ class TimeLogBatchTest(unittest.TestCase):
time_log.insert()
time_log.submit()
self.assertEquals(webnotes.conn.get_value("Time Log", time_log.doc.name, "status"), "Submitted")
tlb = webnotes.bean(copy=test_records[0])
self.assertEquals(frappe.conn.get_value("Time Log", time_log.doc.name, "status"), "Submitted")
tlb = frappe.bean(copy=test_records[0])
tlb.doclist[1].time_log = time_log.doc.name
tlb.insert()
tlb.submit()
self.assertEquals(webnotes.conn.get_value("Time Log", time_log.doc.name, "status"), "Batched for Billing")
self.assertEquals(frappe.conn.get_value("Time Log", time_log.doc.name, "status"), "Batched for Billing")
tlb.cancel()
self.assertEquals(webnotes.conn.get_value("Time Log", time_log.doc.name, "status"), "Submitted")
self.assertEquals(frappe.conn.get_value("Time Log", time_log.doc.name, "status"), "Submitted")
test_records = [[
{

View File

@@ -18,21 +18,21 @@ cur_frm.set_query("time_log", "time_log_batch_details", function(doc) {
$.extend(cur_frm.cscript, {
refresh: function(doc) {
cur_frm.set_intro({
"Draft": wn._("Select Time Logs and Submit to create a new Sales Invoice."),
"Submitted": wn._("Click on 'Make Sales Invoice' button to create a new Sales Invoice."),
"Billed": wn._("This Time Log Batch has been billed."),
"Cancelled": wn._("This Time Log Batch has been cancelled.")
"Draft": frappe._("Select Time Logs and Submit to create a new Sales Invoice."),
"Submitted": frappe._("Click on 'Make Sales Invoice' button to create a new Sales Invoice."),
"Billed": frappe._("This Time Log Batch has been billed."),
"Cancelled": frappe._("This Time Log Batch has been cancelled.")
}[doc.status]);
if(doc.status=="Submitted") {
cur_frm.add_custom_button(wn._("Make Sales Invoice"), function() { cur_frm.cscript.make_invoice() },
cur_frm.add_custom_button(frappe._("Make Sales Invoice"), function() { cur_frm.cscript.make_invoice() },
"icon-file-alt");
}
},
make_invoice: function() {
var doc = cur_frm.doc;
wn.model.map({
source: wn.model.get_doclist(doc.doctype, doc.name),
frappe.model.map({
source: frappe.model.get_doclist(doc.doctype, doc.name),
target: "Sales Invoice"
});
}

View File

@@ -4,8 +4,8 @@
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
from webnotes import _
import frappe
from frappe import _
class DocType:
def __init__(self, d, dl):
@@ -15,7 +15,7 @@ class DocType:
self.set_status()
self.doc.total_hours = 0.0
for d in self.doclist.get({"doctype":"Time Log Batch Detail"}):
tl = webnotes.doc("Time Log", d.time_log)
tl = frappe.doc("Time Log", d.time_log)
self.update_time_log_values(d, tl)
self.validate_time_log_is_submitted(tl)
self.doc.total_hours += float(tl.hours or 0.0)
@@ -29,7 +29,7 @@ class DocType:
def validate_time_log_is_submitted(self, tl):
if tl.status != "Submitted" and self.doc.docstatus == 0:
webnotes.msgprint(_("Time Log must have status 'Submitted'") + \
frappe.msgprint(_("Time Log must have status 'Submitted'") + \
" :" + tl.name + " (" + _(tl.status) + ")", raise_exception=True)
def set_status(self):
@@ -54,7 +54,7 @@ class DocType:
def update_status(self, time_log_batch):
self.set_status()
for d in self.doclist.get({"doctype":"Time Log Batch Detail"}):
tl = webnotes.bean("Time Log", d.time_log)
tl = frappe.bean("Time Log", d.time_log)
tl.doc.time_log_batch = time_log_batch
tl.doc.sales_invoice = self.doc.sales_invoice
tl.update_after_submit()

View File

@@ -4,7 +4,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
import frappe
class DocType:
def __init__(self, d, dl):

View File

@@ -1,74 +1,74 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt"
wn.module_page["Projects"] = [
frappe.module_page["Projects"] = [
{
title: wn._("Top"),
title: frappe._("Top"),
icon: "icon-copy",
top: true,
items: [
{
label: wn._("Task"),
description: wn._("Project activity / task."),
label: frappe._("Task"),
description: frappe._("Project activity / task."),
doctype:"Task"
},
{
label: wn._("Project"),
description: wn._("Project master."),
label: frappe._("Project"),
description: frappe._("Project master."),
doctype:"Project"
},
{
label: wn._("Time Log"),
description: wn._("Time Log for tasks."),
label: frappe._("Time Log"),
description: frappe._("Time Log for tasks."),
doctype:"Time Log"
},
]
},
{
title: wn._("Documents"),
title: frappe._("Documents"),
icon: "icon-copy",
items: [
{
label: wn._("Time Log Batch"),
description: wn._("Batch Time Logs for billing."),
label: frappe._("Time Log Batch"),
description: frappe._("Batch Time Logs for billing."),
doctype:"Time Log Batch"
},
]
},
{
title: wn._("Tools"),
title: frappe._("Tools"),
icon: "icon-wrench",
items: [
{
route: "Gantt/Task",
label: wn._("Gantt Chart"),
"description":wn._("Gantt chart of all tasks.")
label: frappe._("Gantt Chart"),
"description":frappe._("Gantt chart of all tasks.")
},
]
},
{
title: wn._("Masters"),
title: frappe._("Masters"),
icon: "icon-book",
items: [
{
label: wn._("Activity Type"),
description: wn._("Types of activities for Time Sheets"),
label: frappe._("Activity Type"),
description: frappe._("Types of activities for Time Sheets"),
doctype:"Activity Type"
},
]
},
{
title: wn._("Reports"),
title: frappe._("Reports"),
right: true,
icon: "icon-list",
items: [
{
"label":wn._("Daily Time Log Summary"),
"label":frappe._("Daily Time Log Summary"),
route: "query-report/Daily Time Log Summary",
doctype: "Time Log"
},
{
"label":wn._("Project wise Stock Tracking"),
"label":frappe._("Project wise Stock Tracking"),
route: "query-report/Project wise Stock Tracking",
doctype: "Project"
},
@@ -76,5 +76,5 @@ wn.module_page["Projects"] = [
}]
pscript['onload_projects-home'] = function(wrapper) {
wn.views.moduleview.make(wrapper, "Projects");
frappe.views.moduleview.make(wrapper, "Projects");
}

View File

@@ -1,19 +1,19 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
wn.query_reports["Daily Time Log Summary"] = {
frappe.query_reports["Daily Time Log Summary"] = {
"filters": [
{
"fieldname":"from_date",
"label": wn._("From Date"),
"label": frappe._("From Date"),
"fieldtype": "Date",
"default": wn.datetime.get_today()
"default": frappe.datetime.get_today()
},
{
"fieldname":"to_date",
"label": wn._("To Date"),
"label": frappe._("To Date"),
"fieldtype": "Date",
"default": wn.datetime.get_today()
"default": frappe.datetime.get_today()
},
]
}

View File

@@ -2,8 +2,8 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import flt
import frappe
from frappe.utils import flt
def execute(filters=None):
if not filters:
@@ -19,7 +19,7 @@ def execute(filters=None):
task_map = get_task_map()
conditions = build_conditions(filters)
time_logs = webnotes.conn.sql("""select * from `tabTime Log`
time_logs = frappe.conn.sql("""select * from `tabTime Log`
where docstatus < 2 %s order by owner asc""" % (conditions, ), filters, as_dict=1)
if time_logs:
@@ -49,7 +49,7 @@ def execute(filters=None):
return columns, data
def get_profile_map():
profiles = webnotes.conn.sql("""select name,
profiles = frappe.conn.sql("""select name,
concat(first_name, if(last_name, (' ' + last_name), '')) as fullname
from tabProfile""", as_dict=1)
profile_map = {}
@@ -59,7 +59,7 @@ def get_profile_map():
return profile_map
def get_task_map():
tasks = webnotes.conn.sql("""select name, subject from tabTask""", as_dict=1)
tasks = frappe.conn.sql("""select name, subject from tabTask""", as_dict=1)
task_map = {}
for t in tasks:
task_map.setdefault(t.name, []).append(t.subject)
@@ -73,7 +73,7 @@ def build_conditions(filters):
if filters.get("to_date"):
conditions += " and to_time <= %(to_date)s"
from webnotes.widgets.reportview import build_match_conditions
from frappe.widgets.reportview import build_match_conditions
match_conditions = build_match_conditions("Time Log")
if match_conditions:
conditions += " and %s" % match_conditions

View File

@@ -1,7 +1,7 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
import frappe
def execute(filters=None):
columns = get_columns()
@@ -28,11 +28,11 @@ def get_columns():
"Project Start Date:Date:120", "Completion Date:Date:120"]
def get_project_details():
return webnotes.conn.sql(""" select name, project_name, status, company, customer, project_value,
return frappe.conn.sql(""" select name, project_name, status, company, customer, project_value,
project_start_date, completion_date from tabProject where docstatus < 2""", as_dict=1)
def get_purchased_items_cost():
pr_items = webnotes.conn.sql("""select project_name, sum(base_amount) as amount
pr_items = frappe.conn.sql("""select project_name, sum(base_amount) as amount
from `tabPurchase Receipt Item` where ifnull(project_name, '') != ''
and docstatus = 1 group by project_name""", as_dict=1)
@@ -43,7 +43,7 @@ def get_purchased_items_cost():
return pr_item_map
def get_issued_items_cost():
se_items = webnotes.conn.sql("""select se.project_name, sum(se_item.amount) as amount
se_items = frappe.conn.sql("""select se.project_name, sum(se_item.amount) as amount
from `tabStock Entry` se, `tabStock Entry Detail` se_item
where se.name = se_item.parent and se.docstatus = 1 and ifnull(se_item.t_warehouse, '') = ''
and ifnull(se.project_name, '') != '' group by se.project_name""", as_dict=1)
@@ -55,12 +55,12 @@ def get_issued_items_cost():
return se_item_map
def get_delivered_items_cost():
dn_items = webnotes.conn.sql("""select dn.project_name, sum(dn_item.base_amount) as amount
dn_items = frappe.conn.sql("""select dn.project_name, sum(dn_item.base_amount) as amount
from `tabDelivery Note` dn, `tabDelivery Note Item` dn_item
where dn.name = dn_item.parent and dn.docstatus = 1 and ifnull(dn.project_name, '') != ''
group by dn.project_name""", as_dict=1)
si_items = webnotes.conn.sql("""select si.project_name, sum(si_item.base_amount) as amount
si_items = frappe.conn.sql("""select si.project_name, sum(si_item.base_amount) as amount
from `tabSales Invoice` si, `tabSales Invoice Item` si_item
where si.name = si_item.parent and si.docstatus = 1 and ifnull(si.update_stock, 0) = 1
and ifnull(si.is_pos, 0) = 1 and ifnull(si.project_name, '') != ''

View File

@@ -4,22 +4,22 @@
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
import frappe
@webnotes.whitelist()
@frappe.whitelist()
def get_time_log_list(doctype, txt, searchfield, start, page_len, filters):
return webnotes.conn.get_values("Time Log", filters, ["name", "activity_type", "owner"])
return frappe.conn.get_values("Time Log", filters, ["name", "activity_type", "owner"])
@webnotes.whitelist()
@frappe.whitelist()
def query_task(doctype, txt, searchfield, start, page_len, filters):
from webnotes.widgets.reportview import build_match_conditions
from frappe.widgets.reportview import build_match_conditions
search_string = "%%%s%%" % txt
order_by_string = "%s%%" % txt
match_conditions = build_match_conditions("Task")
match_conditions = ("and" + match_conditions) if match_conditions else ""
return webnotes.conn.sql("""select name, subject from `tabTask`
return frappe.conn.sql("""select name, subject from `tabTask`
where (`%s` like %s or `subject` like %s) %s
order by
case when `subject` like %s then 0 else 1 end,