From 686022f777139021597b666647d519a284cafdda Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 12 Dec 2012 15:25:51 +0530 Subject: [PATCH 1/3] fixes to recent patch and removed company_control, home_control, webforms, wip_monitor --- home/doctype/company_control/__init__.py | 1 - .../company_control/company_control.py | 100 ----- .../company_control/company_control.txt | 30 -- home/doctype/home_control/__init__.py | 1 - home/doctype/home_control/home_control.py | 365 ------------------ home/doctype/home_control/home_control.txt | 56 --- home/page/latest_updates/latest_updates.js | 1 + .../december_2012/move_recent_to_memcache.py | 4 +- setup/page/webforms/__init__.py | 1 - setup/page/webforms/webforms.html | 13 - setup/page/webforms/webforms.js | 42 -- setup/page/webforms/webforms.txt | 51 --- setup/page/webforms/webforms_static.html | 1 - startup/event_handlers.py | 12 +- utilities/page/wip_monitor/__init__.py | 1 - utilities/page/wip_monitor/wip_monitor.html | 2 - utilities/page/wip_monitor/wip_monitor.js | 104 ----- utilities/page/wip_monitor/wip_monitor.txt | 28 -- 18 files changed, 8 insertions(+), 805 deletions(-) delete mode 100644 home/doctype/company_control/__init__.py delete mode 100644 home/doctype/company_control/company_control.py delete mode 100644 home/doctype/company_control/company_control.txt delete mode 100644 home/doctype/home_control/__init__.py delete mode 100644 home/doctype/home_control/home_control.py delete mode 100644 home/doctype/home_control/home_control.txt delete mode 100644 setup/page/webforms/__init__.py delete mode 100644 setup/page/webforms/webforms.html delete mode 100644 setup/page/webforms/webforms.js delete mode 100644 setup/page/webforms/webforms.txt delete mode 100644 setup/page/webforms/webforms_static.html delete mode 100644 utilities/page/wip_monitor/__init__.py delete mode 100644 utilities/page/wip_monitor/wip_monitor.html delete mode 100644 utilities/page/wip_monitor/wip_monitor.js delete mode 100644 utilities/page/wip_monitor/wip_monitor.txt diff --git a/home/doctype/company_control/__init__.py b/home/doctype/company_control/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/home/doctype/company_control/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/home/doctype/company_control/company_control.py b/home/doctype/company_control/company_control.py deleted file mode 100644 index c18610b7e4..0000000000 --- a/home/doctype/company_control/company_control.py +++ /dev/null @@ -1,100 +0,0 @@ -# ERPNext - web based ERP (http://erpnext.com) -# Copyright (C) 2012 Web Notes Technologies Pvt Ltd -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -from __future__ import unicode_literals -import webnotes - -from webnotes.utils import cint, cstr -from webnotes.model import db_exists -from webnotes.model.doc import Document -from webnotes.model.wrapper import copy_doclist -from webnotes import session - -sql = webnotes.conn.sql - - - -class DocType: - def __init__(self,d,dl): - self.doc, self.doclist = d,dl - - # All roles of Role Master - def get_all_roles(self): - r_list=sql("select name from `tabRole` where name not in ('All','Guest','Administrator','Customer','Supplier') and docstatus != 2") - if r_list[0][0]: - r_list = [x[0] for x in r_list] - return r_list - - # Get all permissions for given role - def get_permission(self,role): - perm = sql("select distinct t1.`parent`, t1.`read`, t1.`write`, t1.`create`, t1.`submit`,t1.`cancel`,t1.`amend` from `tabDocPerm` t1, `tabDocType` t2 where t1.`role` ='%s' and t1.docstatus !=2 and ifnull(t1.permlevel, 0) = 0 and t1.`read` = 1 and t2.module != 'Recycle Bin' and t1.parent=t2.name " % role) - return perm or '' - - # Get roles for given user - def get_user_roles(self,usr): - r_list=sql("select role from `tabUserRole` where parent=%s and role not in ('All','Guest')",usr) - if r_list: - return [r[0] for r in r_list] - else: - return '' - - # Update roles of given user - def update_roles(self,arg): - arg = eval(arg) - sql("delete from `tabUserRole` where parenttype='Profile' and parent ='%s'" % (cstr(arg['usr']))) - role_list = arg['role_list'].split(',') - for r in role_list: - pr=Document('UserRole') - pr.parent = arg['usr'] - pr.parenttype = 'Profile' - pr.role = r - pr.parentfield = 'userroles' - pr.save(1) - - # Update Membership Type at Gateway - from webnotes.utils import cint - - webnotes.clear_cache(cstr(arg['usr'])) - - # Save profile - def save_profile(self,arg): - arg = eval(arg) - p = Document('Profile', session['user']) - for k in arg: - p.fields[k] = arg[k] - p.save() - - def get_login_url(self): - return session['data']['login_from'] - - def get_user_info(self): - - usr = sql("select count(name) from tabProfile where docstatus != 2 and name not in ('Guest','Administrator')") - usr = usr and usr[0][0] or 0 - - ol = sql("select count(distinct t1.name) from tabProfile t1, tabSessions t2 where t1.name = t2.user and t1.name not in('Guest','Administrator') and TIMESTAMPDIFF(HOUR,t2.lastupdate,NOW()) <= 1 and t1.docstatus != 2 and t1.enabled=1") - ol = ol and ol[0][0] or 0 - - ac = sql("select count(name) from tabProfile where enabled=1 and docstatus != 2 and name not in ('Guest', 'Administrator')") - ac = ac and ac[0][0] or 0 - - inac = sql("select count(name) from tabProfile where (enabled=0 or enabled is null or enabled = '') and docstatus != 2 and name not in ('Guest','Administrator')") - inac = inac and inac[0][0] or 0 - - return usr, ol, ac, inac - - def get_sm_count(self) : - return sql("select count(t1.parent) from tabUserRole t1, tabProfile t2 where t1.role='System Manager' and t1.parent = t2.name and t2.enabled=1")[0][0] or 0 diff --git a/home/doctype/company_control/company_control.txt b/home/doctype/company_control/company_control.txt deleted file mode 100644 index 90952d1eeb..0000000000 --- a/home/doctype/company_control/company_control.txt +++ /dev/null @@ -1,30 +0,0 @@ -# DocType, Company Control -[ - - # These values are common in all dictionaries - { - 'creation': '2012-03-27 14:35:52', - 'docstatus': 0, - 'modified': '2012-03-27 14:35:52', - 'modified_by': u'Administrator', - 'owner': u'Administrator' - }, - - # These values are common for all DocType - { - 'colour': u'White:FFF', - 'doctype': 'DocType', - 'issingle': 1, - 'module': u'Home', - 'name': '__common__', - 'section_style': u'Simple', - 'server_code_error': u' ', - 'version': 13 - }, - - # DocType, Company Control - { - 'doctype': 'DocType', - 'name': u'Company Control' - } -] \ No newline at end of file diff --git a/home/doctype/home_control/__init__.py b/home/doctype/home_control/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/home/doctype/home_control/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/home/doctype/home_control/home_control.py b/home/doctype/home_control/home_control.py deleted file mode 100644 index 75ab2222ce..0000000000 --- a/home/doctype/home_control/home_control.py +++ /dev/null @@ -1,365 +0,0 @@ -# ERPNext - web based ERP (http://erpnext.com) -# Copyright (C) 2012 Web Notes Technologies Pvt Ltd -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -from __future__ import unicode_literals -import webnotes - -from webnotes.utils import add_days, cint, cstr, getdate, now, nowdate -from webnotes.model.doc import Document -from webnotes import session, msgprint - -sql = webnotes.conn.sql - -try: import json -except: import simplejson as json - - - -class DocType: - def __init__(self,d,dl): - self.doc, self.doclist = d,dl ---------------- -# ------------------------------------- Home page module details ----------------------------------------- - - def delete_cache(self): - com = sql("select abbr, name from tabCompany") - for d in com: - sql("update `tabCompany` set receivables_group = '%s' where (receivables_group = '%s' or receivables_group = '' or receivables_group is null) and name = '%s'" % ('Accounts Receivable - '+cstr(d[0]), 'Accounts Receivables - '+cstr(d[0]), d[1])) - sql("update `tabCompany` set payables_group = '%s' where (payables_group = '%s' or payables_group = '' or payables_group is null) and name = '%s'" % ('Accounts Payable - '+cstr(d[0]), 'Accounts Payables - '+cstr(d[0]), d[1])) - - def get_modules(self): - rl = webnotes.user.get_roles() - ml = sql("select distinct t1.name, t1.module_icon, t1.module_label, t1.module_desc, t1.module_page from `tabModule Def` t1, `tabModule Def Role` t2 where t2.role in ('%s') and t1.disabled !='Yes' and ifnull(t1.is_hidden, 'No') != 'Yes' and t1.name = t2.parent order by t1.module_seq asc" % "','".join(rl), as_dict=1) - webnotes.response['login_url'] = session['data'].get('login_from', '') - - return ml - - def get_module_details(self,m): - ret = {} - ret['il'] = sql('select doc_type, doc_name, display_name, icon, description, fields, click_function, idx from `tabModule Def Item` where parent=%s and ifnull(`hide`,0)=0 order by idx asc', m, as_dict=1) - ret['wl'] = sql('select widget_code from `tabModule Def` where name =%s', m)[0][0] or '' - ret['custom_reports'] = sql(''' - SELECT DISTINCT t1.criteria_name AS `display_name`, t1.description, t1.doc_type AS `doc_name`, 'Custom Reports' AS `doc_type` - FROM `tabSearch Criteria` t1, `tabDocPerm` t2 - WHERE t1.module = "%s" - AND IFNULL(t1.disabled,0) = 0 - AND (t1.doc_type=t2.parent OR t1.parent_doc_type = t2.parent) - AND t2.permlevel = 0 - AND t2.read=1 - AND t2.role IN ("%s") - AND ifnull(standard,"No")="No"''' % (m, '", "'.join(webnotes.user.get_roles())), as_dict=1) - - return ret - - # ---------------------------------------------------------------------------------------------------------------- - # ----------------------------------------------- Home page updates ---------------------------------------------- - - def get_events_list(self): - import webnotes, webnotes.utils - from webnotes.widgets.event import get_cal_events - - dl = get_cal_events(nowdate(), add_days(nowdate(), 7)) - el = [] - for d in dl: - #el.append([d.name, d.event_date, d.event_hour, d.event_name, d.description or '', d.ref_type or '', d.ref_name or '', d.owner]) - dict = { - 'name': d.name, - 'event_date': d.event_date, - 'event_hour': d.event_hour, - 'event_name': d.event_name, - 'description': d.description, - 'notes': d.notes, - 'event_type': d.event_type, - 'ref_type': d.ref_type, - 'ref_name': d.ref_name, - 'owner' : d.owner - } - - el.append(dict) - return el - - - def get_activity_list(self): - out = {} - import webnotes - rt = webnotes.user.can_read - - dt_list = [d[0] for d in sql("select distinct t2.name from tabDocField t1, tabDocType t2 where t1.fieldname='status' and t1.docstatus=0 and (t2.istable is null or t2.istable = 0) and t1.parent = t2.name")] - if not dt_list: - return out - - # get list of activity dt - for dt in dt_list: - if dt in rt: - out[dt] = {} - # get status list - sl = sql("select distinct status from `tab%s`" % dt) - - for s in sl: - if s[0]: - # get count - cnt = sql("select count(*) from `tab%s` where status = '%s' and modified > '%s'" % (dt, s[0], add_days(nowdate(), -7)))[0][0] - out[dt][s[0]] = cint(cnt) - return out - - def get_dt_help(self,dt): - return sql("select description from tabDocType where name=%s",dt)[0][0] or '' - - def get_wip_counts(self): - #dtl = ['Lead', 'Enquiries', 'Sales Order', 'Invoices', 'Purchase Request', 'Purchase Order', 'Bills', 'Tasks', 'Delivery Note', 'Maintenance'] - can_read_dt = ['Lead', 'Opportunity', 'Sales Order', 'Sales Invoice', 'Purchase Request', 'Purchase Order', 'Purchase Invoice', 'Delivery Note', 'Task', 'Serial No'] - dt = {} - for d in can_read_dt: - args = {} - - # if Lead - if d=='Lead': - args = {'To follow up':sql("select count(name) from tabLead where status!='Converted' and status!='Lead Lost' and status!='Not Interested'")} - - # if Opportunity - elif d=='Opportunity': - args['Quotations to be sent'] = sql("select count(distinct(t2.name)) from `tabQuotation`t1, `tabOpportunity`t2 where t1.enq_no!=t2.name and t2.docstatus=1") - args['To follow up'] = sql("select count(distinct(t2.name)) from `tabQuotation`t1, `tabOpportunity`t2 where t1.enq_no=t2.name and t2.docstatus=1 and t1.docstatus=1") - - # if Sales Order - elif d=='Sales Order': - args['To be delivered'] = sql("select count(name) from `tabSales Order` where ifnull(per_delivered,0)<100 and delivery_date>now() and docstatus=1") - args['To be billed'] = sql("select count(name) from `tabSales Order` where ifnull(per_billed,0)<100 and docstatus=1") - args['Overdue'] = sql("select count(name) from `tabSales Order` where ifnull(per_delivered,0)<100 and delivery_datenow() and outstanding_amount!=0") - args['Overdue'] = sql("select count(name) from `tabSales Invoice` where docstatus=1 and due_date= CURDATE() and ifnull(amc_expiry_date, '0000-00-00') !='0000-00-00' and ifnull(maintenance_status, '') !='Under AMC'") - if chk_for_under_amc: - lst3 = [x3[0] for x3 in chk_for_under_amc] - self.update_serial_status(lst3, 'Under AMC') - - # chk to set serial no status as 'under warranty' - def set_for_under_warranty(self): - chk_for_under_wrnty = sql("select name from `tabSerial No` where ifnull(warranty_expiry_date, '2200-12-12') >= CURDATE() and ifnull(warranty_expiry_date, '0000-00-00') != '0000-00-00' and ifnull(amc_expiry_date, '0000-00-00') ='0000-00-00' and ifnull(maintenance_status, '') != 'Under Warranty'") - if chk_for_under_wrnty: - lst4 = [x4[0] for x4 in chk_for_under_wrnty] - self.update_serial_status(lst4, 'Under Warranty') - - # check maintenance status for all serial nos only for 1st login each day - def set_serial_no_status(self): - - chk_serial_no_update_date = webnotes.conn.get_global('maintenance_status_update_date') - - # check status only for 1st login each day.... if maintenance date already updated means it is checked - if getdate(chk_serial_no_update_date) != nowdate(): - # chk to set serial no status as 'Out of warranty' - self.set_for_out_of_warranty() - - # chk to set serial no status as 'Out of amc' - self.set_for_out_of_amc() - - # chk to set serial no status as 'under amc' - self.set_for_under_amc() - - # chk to set serial no status as 'under warranty' - self.set_for_under_warranty() - - #set maintenance_status_update_date - webnotes.conn.set_global('maintenance_status_update_date', nowdate()) - - # get user fullname - def get_user_fullname(self,usr): - return sql("select concat_ws(' ',first_name, last_name) from tabProfile where name=%s", usr)[0][0] or '' diff --git a/home/doctype/home_control/home_control.txt b/home/doctype/home_control/home_control.txt deleted file mode 100644 index 1d9098ed7f..0000000000 --- a/home/doctype/home_control/home_control.txt +++ /dev/null @@ -1,56 +0,0 @@ -# DocType, Home Control -[ - - # These values are common in all dictionaries - { - 'creation': '2012-03-27 14:35:53', - 'docstatus': 0, - 'modified': '2012-03-27 14:35:53', - 'modified_by': u'Administrator', - 'owner': u'Administrator' - }, - - # These values are common for all DocType - { - 'colour': u'White:FFF', - 'doctype': 'DocType', - 'issingle': 1, - 'module': u'Home', - 'name': '__common__', - 'section_style': u'Simple', - 'server_code_error': u' ', - 'show_in_menu': 0, - 'version': 6 - }, - - # These values are common for all DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'name': '__common__', - 'parent': u'Home Control', - 'parentfield': u'permissions', - 'parenttype': u'DocType', - 'permlevel': 0, - 'read': 1, - 'write': 1 - }, - - # DocType, Home Control - { - 'doctype': 'DocType', - 'name': u'Home Control' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'role': u'System Manager' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'role': u'Guest' - } -] \ No newline at end of file diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js index 04d366adbc..f41c547962 100644 --- a/home/page/latest_updates/latest_updates.js +++ b/home/page/latest_updates/latest_updates.js @@ -1,6 +1,7 @@ erpnext.updates = [ ["12th December 2012", [ "Attachments: Attachments can be set as URLs or File Uploads. This will help if people want to share documents from Google Docs, Dropbox and other such services (esp for the Product listings on websites).", + "Global Defaults: Session Expiry can now be set in Global Defaults.", ]], ["6th December 2012", [ "Rename: Cost Center, Item Group, Customer Group, Supplier Type, Territory, Sales Person can now be renamed.", diff --git a/patches/december_2012/move_recent_to_memcache.py b/patches/december_2012/move_recent_to_memcache.py index ee94121977..c92c487fd0 100644 --- a/patches/december_2012/move_recent_to_memcache.py +++ b/patches/december_2012/move_recent_to_memcache.py @@ -1,7 +1,9 @@ +from __future__ import unicode_literals + import webnotes, json def execute(): for p in webnotes.conn.sql("""select name, recent_documents from tabProfile where ifnull(recent_documents,'')!=''"""): - if not '~~~' in p[1]: + if not '~~~' in p[1] and p[1][0]=='[': webnotes.cache().set_value("recent:" + p[0], json.loads(p[1])) \ No newline at end of file diff --git a/setup/page/webforms/__init__.py b/setup/page/webforms/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/setup/page/webforms/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/setup/page/webforms/webforms.html b/setup/page/webforms/webforms.html deleted file mode 100644 index e1717dce2a..0000000000 --- a/setup/page/webforms/webforms.html +++ /dev/null @@ -1,13 +0,0 @@ -
-
-

Note : Copy and paste code provided below in your website wherever you want to show the form to capture details

-

 

-

Lead

-
-

Customer Issue

-
-

Job Application

-
-

Ticket

-
-
\ No newline at end of file diff --git a/setup/page/webforms/webforms.js b/setup/page/webforms/webforms.js deleted file mode 100644 index 85caadf46f..0000000000 --- a/setup/page/webforms/webforms.js +++ /dev/null @@ -1,42 +0,0 @@ -// ERPNext - web based ERP (http://erpnext.com) -// Copyright (C) 2012 Web Notes Technologies Pvt Ltd -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -pscript.onload_Webforms = function(){ - - $c_obj('Home Control','get_acc_id','', function(r,rt) { - if(r.message) { - var acc_id = r.message; - var parent = $i('webform_div'); - new PageHeader(parent,'Web Forms',''); - - var lead_dv = $a('lead_div','div', '', {border:'1px solid #AAA', padding:'8px', width:'90%'}); - var cust_issue_dv = $a('cust_issue_div','div', '', {border:'1px solid #AAA', padding:'8px', width:'95%'}); - var job_dv = $a('job_div','div', '', {border:'1px solid #AAA', padding:'8px', width:'95%'}); - var ticket_dv = $a('ticket_div','div', '', {border:'1px solid #AAA', padding:'8px', width:'95%'}); - - // url - if(window.location.href.indexOf('?')!=-1) - var url = window.location.href.split('?')[0]; - else - var url = window.location.href.split('#')[0]; - - lead_dv.innerHTML = '<iframe src ="'+url+'?ac_name='+acc_id+'&embed=Lead" width ="400" height="800" frameborder="0"></iframe>'; - cust_issue_dv.innerHTML = '<iframe src ="'+url+'?ac_name='+acc_id+'&embed=Customer Issue" width ="400" height="500" frameborder="0"></iframe>'; - job_dv.innerHTML = '<iframe src ="'+url+'?ac_name='+acc_id+'&embed=Job Application" width ="400" height="800" frameborder="0""></iframe>'; - ticket_dv.innerHTML = '<iframe src ="'+url+'?ac_name='+acc_id+'&embed=Support Ticket" width ="400" height="800" frameborder="0""></iframe>'; - } - }); -} diff --git a/setup/page/webforms/webforms.txt b/setup/page/webforms/webforms.txt deleted file mode 100644 index 8e2970bf41..0000000000 --- a/setup/page/webforms/webforms.txt +++ /dev/null @@ -1,51 +0,0 @@ -# Page, Webforms -[ - - # These values are common in all dictionaries - { - 'creation': '2010-10-14 11:15:59', - 'docstatus': 0, - 'modified': '2011-01-04 13:19:54', - 'modified_by': 'Administrator', - 'owner': 'ashwini@webnotestech.com' - }, - - # These values are common for all Page - { - 'doctype': 'Page', - 'module': 'Setup', - 'name': '__common__', - 'page_name': 'Webforms', - 'show_in_menu': 1, - 'standard': 'Yes' - }, - - # These values are common for all Page Role - { - 'doctype': 'Page Role', - 'name': '__common__', - 'parent': 'Webforms', - 'parentfield': 'roles', - 'parenttype': 'Page' - }, - - # Page, Webforms - { - 'doctype': 'Page', - 'name': 'Webforms' - }, - - # Page Role - { - 'doctype': 'Page Role', - 'idx': 1, - 'role': 'Administrator' - }, - - # Page Role - { - 'doctype': 'Page Role', - 'idx': 2, - 'role': 'System Manager' - } -] \ No newline at end of file diff --git a/setup/page/webforms/webforms_static.html b/setup/page/webforms/webforms_static.html deleted file mode 100644 index 3488a17b82..0000000000 --- a/setup/page/webforms/webforms_static.html +++ /dev/null @@ -1 +0,0 @@ -webforms \ No newline at end of file diff --git a/startup/event_handlers.py b/startup/event_handlers.py index 9cd1af94d4..f526c73fc0 100644 --- a/startup/event_handlers.py +++ b/startup/event_handlers.py @@ -25,14 +25,10 @@ def on_login_post_session(login_manager): update login_from and delete parallel sessions """ # Clear previous sessions i.e. logout previous log-in attempts - exception_list = ['demo@erpnext.com', 'Administrator', 'Guest'] - if webnotes.session['user'] not in exception_list: - sid_list = webnotes.conn.sql(""" - DELETE FROM `tabSessions` - WHERE - user=%s AND - sid!=%s""", \ - (webnotes.session['user'], webnotes.session['sid']), as_list=1) + allow_multiple_sessions = ['demo@erpnext.com', 'Administrator', 'Guest'] + if webnotes.session['user'] not in allow_multiple_sessions: + from webnotes.sessions import clear_sessions + clear_sessions(webnotes.session.user, keep_current=True) # check if account is expired check_if_expired() diff --git a/utilities/page/wip_monitor/__init__.py b/utilities/page/wip_monitor/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/utilities/page/wip_monitor/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/utilities/page/wip_monitor/wip_monitor.html b/utilities/page/wip_monitor/wip_monitor.html deleted file mode 100644 index b7eb59e261..0000000000 --- a/utilities/page/wip_monitor/wip_monitor.html +++ /dev/null @@ -1,2 +0,0 @@ -
-
\ No newline at end of file diff --git a/utilities/page/wip_monitor/wip_monitor.js b/utilities/page/wip_monitor/wip_monitor.js deleted file mode 100644 index fcfc96face..0000000000 --- a/utilities/page/wip_monitor/wip_monitor.js +++ /dev/null @@ -1,104 +0,0 @@ -// ERPNext - web based ERP (http://erpnext.com) -// Copyright (C) 2012 Web Notes Technologies Pvt Ltd -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -pscript['onload_WIP Monitor'] = function(){ - wip = new WIP_Monitor(); - - var h = new PageHeader('wip_head','Work in Progress Monitor','A quick glance at your work in progress and pipeline'); - h.add_button('Refresh', function(){ wip = new WIP_Monitor();}, 1, 'ui-icon-refresh'); - -} - -// Work In Progress Monitor -// ========================================================================================================================================================= -WIP_Monitor = function(){ - var me = this; - this.row_index = 0; - $c_obj('Home Control','get_wip_counts','',function(r,rt){ - me.make_wip_dashboard(r.message); - }); -} - - -// Make wip dashboard -// ------------------ -WIP_Monitor.prototype.make_wip_dashboard = function(wip_dict) -{ - var me = this; - // list of doctypes which user can read - var can_read_dt = ['Lead', 'Opportunity', 'Sales Order', 'Sales Invoice', 'Purchase Request', 'Purchase Order', 'Purchase Invoice', 'Delivery Note', 'Task', 'Serial No']; - - $i('wip_body').innerHTML = ''; - this.tab = make_table('wip_body',1,0,'100%',[],{padding:'4px'}); - - for(var k=0; k Date: Wed, 12 Dec 2012 15:58:46 +0530 Subject: [PATCH 2/3] webnotes.user.roles deprecated to webnotes.user.get_roles() --- accounts/page/accounts_browser/accounts_browser.py | 5 +++-- startup/event_handlers.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/accounts/page/accounts_browser/accounts_browser.py b/accounts/page/accounts_browser/accounts_browser.py index 8b24394f36..7c8116c77c 100644 --- a/accounts/page/accounts_browser/accounts_browser.py +++ b/accounts/page/accounts_browser/accounts_browser.py @@ -10,9 +10,10 @@ def get_companies(): # check if match permission exists res = webnotes.conn.sql("""select role, `match` from `tabDocPerm` where parent='Account' and permlevel=0 and `read`=1""", as_dict=1) - + + roles = webnotes.user.get_roles() match = any((r["match"] for r in res - if r["role"] in webnotes.user.roles and r["match"]=="company")) + if r["role"] in roles and r["match"]=="company")) # if match == company is specified and companies are specified in user defaults if match and webnotes.user.get_defaults().get("company"): diff --git a/startup/event_handlers.py b/startup/event_handlers.py index f526c73fc0..4808298368 100644 --- a/startup/event_handlers.py +++ b/startup/event_handlers.py @@ -115,7 +115,7 @@ def check_if_expired(): from webnotes.utils import formatdate msg = """Oops! Your subscription expired on %s.
""" % formatdate(conf.expires_on) - if 'System Manager' in webnotes.user.roles: + if 'System Manager' in webnotes.user.get_roles(): msg += """Just drop in a mail at support@erpnext.com and we will guide you to get your account re-activated.""" else: From 9e12af4b7c13acfc8d1bb042f37ef9aa79cb6a2f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 12 Dec 2012 16:13:29 +0530 Subject: [PATCH 3/3] updated recipients email in communication --- selling/doctype/lead/lead.js | 2 +- selling/doctype/opportunity/opportunity.js | 2 +- selling/doctype/quotation/quotation.js | 2 +- startup/startup.py | 2 +- utilities/doctype/contact/contact.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/selling/doctype/lead/lead.js b/selling/doctype/lead/lead.js index 0c5bf87cdb..e4b3a7db58 100644 --- a/selling/doctype/lead/lead.js +++ b/selling/doctype/lead/lead.js @@ -71,7 +71,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { list: wn.model.get("Communication", {"lead": doc.name}), parent: cur_frm.fields_dict.communication_html.wrapper, doc: doc, - email: doc.email_id + recipients: doc.email_id }) } diff --git a/selling/doctype/opportunity/opportunity.js b/selling/doctype/opportunity/opportunity.js index 2bb41b21b5..2b530ff4a5 100644 --- a/selling/doctype/opportunity/opportunity.js +++ b/selling/doctype/opportunity/opportunity.js @@ -51,7 +51,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { list: wn.model.get("Communication", {"opportunity": doc.name}), parent: cur_frm.fields_dict.communication_html.wrapper, doc: doc, - email: doc.contact_email + recipients: doc.contact_email }); } diff --git a/selling/doctype/quotation/quotation.js b/selling/doctype/quotation/quotation.js index 1b03781b5b..7199132d61 100644 --- a/selling/doctype/quotation/quotation.js +++ b/selling/doctype/quotation/quotation.js @@ -107,7 +107,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { list: wn.model.get("Communication", {"quotation": doc.name}), parent: cur_frm.fields_dict.communication_html.wrapper, doc: doc, - email: doc.contact_email + recipients: doc.contact_email }); } } diff --git a/startup/startup.py b/startup/startup.py index 828239ee15..15ea491b13 100644 --- a/startup/startup.py +++ b/startup/startup.py @@ -48,7 +48,7 @@ def get_things_todo(): incomplete_todos = webnotes.conn.sql("""\ SELECT COUNT(*) FROM `tabToDo` WHERE IFNULL(checked, 0) = 0 - AND owner = %s""", webnotes.session.get('user')) + AND (owner = %s or assigned_by=%s)""", (webnotes.session.user, webnotes.session.user)) return incomplete_todos and cint(incomplete_todos[0][0]) or 0 def get_todays_events(): diff --git a/utilities/doctype/contact/contact.js b/utilities/doctype/contact/contact.js index 3876ca20ae..97fd8a6a10 100644 --- a/utilities/doctype/contact/contact.js +++ b/utilities/doctype/contact/contact.js @@ -27,7 +27,7 @@ cur_frm.cscript.refresh = function() { list: wn.model.get("Communication", {"contact": doc.name}), parent: cur_frm.fields_dict.communication_html.wrapper, doc: doc, - email: doc.email_id + recipients: doc.email_id }) }