From 72d412567c33e90c24cd9da3a28c77e3625a313e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 29 Feb 2012 10:43:21 +0530 Subject: [PATCH 01/11] Update erpnext/analysis/search_criteria/trend_analyzer/trend_analyzer.py --- .../analysis/search_criteria/trend_analyzer/trend_analyzer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/analysis/search_criteria/trend_analyzer/trend_analyzer.py b/erpnext/analysis/search_criteria/trend_analyzer/trend_analyzer.py index 42a7c5cc7e9..d92330a0e7c 100644 --- a/erpnext/analysis/search_criteria/trend_analyzer/trend_analyzer.py +++ b/erpnext/analysis/search_criteria/trend_analyzer/trend_analyzer.py @@ -91,7 +91,7 @@ if item or based_on == 'Item': # Item Group if item_group or based_on == 'Item Group': add_tab += ' ,`tabItem` t3, `tabItem Group` t4 ' - add_cond += ' AND t3.name = t2.item_code AND t3.item_group = t4.name and (t4.name = "%s" or t4.name IN (SELECT t5.name FROM `tabItem Group` t5,`tabItem Group` t6 WHERE t5.lft BETWEEN t6.lft and t6.rgt and t5.docstatus !=2 and ifnull(t5.is_group,"No") = "No" and t6.name = "%s"))' % (based_on != 'Item Group' and item_group or '%(value)s', based_on != 'Item Group' and item_group or '%(value)s') + add_cond += ' AND t3.name = t2.item_code AND t3.item_group = t4.name and (t4.name = "%s" or t4.name IN (SELECT t5.name FROM `tabItem Group` t5,`tabItem Group` t6 WHERE t5.lft BETWEEN t6.lft and t6.rgt and t5.docstatus !=2 and t6.name = "%s"))' % (based_on != 'Item Group' and item_group or '%(value)s', based_on != 'Item Group' and item_group or '%(value)s') # Customer if customer or based_on == 'Customer': From 1304d9741699c6f1714ed873f08feb40c560d31d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 29 Feb 2012 14:05:43 +0530 Subject: [PATCH 02/11] fix in import data page --- .../setup/page/import_data/import_data.html | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/erpnext/setup/page/import_data/import_data.html b/erpnext/setup/page/import_data/import_data.html index 5f9556b5af1..29f0cc3dd86 100644 --- a/erpnext/setup/page/import_data/import_data.html +++ b/erpnext/setup/page/import_data/import_data.html @@ -41,6 +41,7 @@
  • Select the saved CSV file, identify the date format if any
  • Click on "Import"
  • +

    Over-writing Guide

    1. To over-write data, click on "Do you want to over-write records?" and then download template
    2. @@ -48,6 +49,30 @@
    3. Over-writing of child table data will delete all previous data of child table and re-import. so before over-writing child tables, export all data from system, modify them and then re-import
    4. Over-write checkbox will be checked while importing
    +
    +

    Do you have Non-English data?

    + You may need to save the file with UTF-8 encoding for data to be imported correctly. +

    + Microsoft Excel Users:
    + There is no obvious way of saving a CSV file with UTF-8 encoding.
    + You will need to follow these steps: +
      +
    1. In Excel, save the file in CSV (Comma Delimited) format
    2. +
    3. Open this saved file in Notepad
    4. +
    5. Click on File -> Save As
    6. +
    7. File Name: <your filename>.csv
      + Save as type: Text Documents (*.txt)
      + Encoding: UTF-8 +
    8. +
    9. Click on Save
    10. +
    +
    + OpenOffice or LibreOffice Users:
    +
      +
    1. While saving as CSV, check "Edit Filter Settings".
    2. +
    3. You will be prompted for Encoding.
    4. +
    5. Make sure it is "UTF-8" and click on OK.
    6. +
    From 12852e73abe2c1bd2e459f9f862eac7e41c98a31 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 29 Feb 2012 15:11:06 +0530 Subject: [PATCH 03/11] added activity page --- build.json | 8 +- erpnext/home/page/activity/__init__.py | 0 erpnext/home/page/activity/activity.css | 23 ++++ erpnext/home/page/activity/activity.html | 6 + erpnext/home/page/activity/activity.js | 57 ++++++++ erpnext/home/page/activity/activity.py | 16 +++ erpnext/home/page/activity/activity.txt | 28 ++++ erpnext/home/page/desktop/desktop.js | 14 +- .../event_updates/complete_registration.js | 124 ------------------ erpnext/patches/jan_mar_2012/navupdate.py | 3 + .../doctype/setup_control/setup_control.py | 76 +++++------ erpnext/startup/event_handlers.py | 4 + erpnext/startup/js/complete_setup.js | 93 +++++++++++++ erpnext/startup/{ => js}/feature_setup.js | 0 erpnext/startup/{ => js}/modules.js | 0 erpnext/startup/{ => js}/toolbar.js | 0 erpnext/startup/startup.js | 33 ++--- erpnext/utilities/__init__.py | 3 +- js/all-app.js | 55 +++++--- js/all-web.js | 49 +++++-- version.num | 2 +- 21 files changed, 367 insertions(+), 227 deletions(-) create mode 100644 erpnext/home/page/activity/__init__.py create mode 100644 erpnext/home/page/activity/activity.css create mode 100644 erpnext/home/page/activity/activity.html create mode 100644 erpnext/home/page/activity/activity.js create mode 100644 erpnext/home/page/activity/activity.py create mode 100644 erpnext/home/page/activity/activity.txt delete mode 100644 erpnext/home/page/event_updates/complete_registration.js create mode 100644 erpnext/startup/js/complete_setup.js rename erpnext/startup/{ => js}/feature_setup.js (100%) rename erpnext/startup/{ => js}/modules.js (100%) rename erpnext/startup/{ => js}/toolbar.js (100%) diff --git a/build.json b/build.json index 95a38d6c577..76f3da0304c 100644 --- a/build.json +++ b/build.json @@ -78,6 +78,7 @@ "lib/js/lib/jquery.min.js:concat", "lib/js/lib/history/history.min.js:concat", "lib/js/lib/bootstrap.min.js:concat", + "lib/js/lib/sprintf.js", "lib/js/core.min.js:concat", "lib/js/legacy/globals.js", "lib/js/legacy/utils/datatype.js", @@ -121,6 +122,7 @@ "lib/js/legacy/jquery/jquery-ui.min.js:concat", "lib/js/legacy/tiny_mce_33/jquery.tinymce.js:concat", "lib/js/lib/bootstrap.min.js:concat", + "lib/js/lib/sprintf.js", "lib/js/core.min.js:concat", "lib/js/legacy/globals.js", "lib/js/legacy/utils/datatype.js", @@ -175,9 +177,9 @@ "lib/js/legacy/app.js", "js/app.js", "erpnext/startup/startup.js", - "erpnext/startup/modules.js", - "erpnext/startup/toolbar.js", - "erpnext/startup/feature_setup.js" + "erpnext/startup/js/modules.js", + "erpnext/startup/js/toolbar.js", + "erpnext/startup/js/feature_setup.js" ] } diff --git a/erpnext/home/page/activity/__init__.py b/erpnext/home/page/activity/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/home/page/activity/activity.css b/erpnext/home/page/activity/activity.css new file mode 100644 index 00000000000..f3988b275d8 --- /dev/null +++ b/erpnext/home/page/activity/activity.css @@ -0,0 +1,23 @@ +#activity-list .label { + display: inline-block; + width: 100px; + margin-right: 7px; +} + +#activity-list .label-info { + cursor: pointer; +} + +#activity-list .user-info { + float: right; + color: #777; + font-size: 10px; +} + +#activity-list .date-sep { + margin-bottom: 11px; + padding: 5px 0px; + border-bottom: 1px solid #aaa; + color: #555; + font-size: 10px; +} \ No newline at end of file diff --git a/erpnext/home/page/activity/activity.html b/erpnext/home/page/activity/activity.html new file mode 100644 index 00000000000..b348d95cc69 --- /dev/null +++ b/erpnext/home/page/activity/activity.html @@ -0,0 +1,6 @@ +
    + × +

    Activity

    +
    +
    +
    \ No newline at end of file diff --git a/erpnext/home/page/activity/activity.js b/erpnext/home/page/activity/activity.js new file mode 100644 index 00000000000..77e4ab92eab --- /dev/null +++ b/erpnext/home/page/activity/activity.js @@ -0,0 +1,57 @@ +wn.pages['activity'].onload = function(wrapper) { + var list = new wn.widgets.Listing({ + method: 'home.page.activity.activity.get_feed', + parent: $('#activity-list'), + render_row: function(row, data) { + new erpnext.ActivityFeed(row, data); + } + }); + list.run(); +} + +erpnext.last_feed_date = false; +erpnext.ActivityFeed = Class.extend({ + init: function(row, data) { + this.scrub_data(data); + this.add_date_separator(row, data); + $(row).append(repl('%(feed_type)s\ + %(link)s %(subject)s ', data)); + }, + scrub_data: function(data) { + data.by = wn.boot.user_fullnames[data.owner]; + + // feedtype + if(!data.feed_type) { + data.feed_type = get_doctype_label(data.doc_type); + data.add_class = "label-info"; + data.onclick = repl('onclick="window.location.href=\'#!List/%(feed_type)s\';"', data) + } + + // color for comment + if(data.feed_type=='Comment') { + data.add_class = "label-important"; + } + + // link + if(data.doc_name && data.feed_type!='Login') { + data.link = repl('%(doc_name)s', data) + } + }, + add_date_separator: function(row, data) { + var date = dateutil.str_to_obj(data.modified); + var last = erpnext.last_feed_date; + + if((last && dateutil.get_diff(last, date)>1) || (!last)) { + var pdate = dateutil.comment_when(date); + var diff = dateutil.get_diff(new Date(), date); + if(diff < 1) { + pdate = 'Today'; + } else if(diff > 6) { + pdate = dateutil.global_date_format(date); + } + $(row).html(repl('
    %(date)s
    ', {date: pdate})); + } + erpnext.last_feed_date = date; + } +}) \ No newline at end of file diff --git a/erpnext/home/page/activity/activity.py b/erpnext/home/page/activity/activity.py new file mode 100644 index 00000000000..8b8faf3f5fa --- /dev/null +++ b/erpnext/home/page/activity/activity.py @@ -0,0 +1,16 @@ +import webnotes + +@webnotes.whitelist() +def get_feed(arg=None): + """get feed""" + return webnotes.conn.sql("""select + distinct t1.name, t1.feed_type, t1.doc_type, t1.doc_name, t1.subject, t1.owner, + t1.modified + from tabFeed t1, tabDocPerm t2 + where t1.doc_type = t2.parent + and t2.role in ('%s') + and ifnull(t2.`read`,0) = 1 + order by t1.modified desc + limit %s, %s""" % ("','".join(webnotes.get_roles()), + webnotes.form_dict['limit_start'], webnotes.form_dict['limit_page_length']), + as_dict=1) \ No newline at end of file diff --git a/erpnext/home/page/activity/activity.txt b/erpnext/home/page/activity/activity.txt new file mode 100644 index 00000000000..e7f396389f0 --- /dev/null +++ b/erpnext/home/page/activity/activity.txt @@ -0,0 +1,28 @@ +# Page, activity +[ + + # These values are common in all dictionaries + { + 'creation': '2012-02-29 11:59:13', + 'docstatus': 0, + 'modified': '2012-02-29 12:11:46', + 'modified_by': u'Administrator', + 'owner': u'Administrator' + }, + + # These values are common for all Page + { + 'doctype': 'Page', + 'module': u'Home', + 'name': '__common__', + 'page_name': u'activity', + 'standard': u'Yes', + 'title': u'Activity' + }, + + # Page, activity + { + 'doctype': 'Page', + 'name': u'activity' + } +] \ No newline at end of file diff --git a/erpnext/home/page/desktop/desktop.js b/erpnext/home/page/desktop/desktop.js index 63a075ceb28..3aa9049e558 100644 --- a/erpnext/home/page/desktop/desktop.js +++ b/erpnext/home/page/desktop/desktop.js @@ -3,12 +3,12 @@ wn.provide('erpnext.desktop'); erpnext.desktop.gradient = "" @@ -79,7 +79,7 @@ erpnext.desktop.render = function() { for(var i in wn.boot.modules_list) { var m = wn.boot.modules_list[i]; - if(m!='Setup'); + if(m!='Setup') add_icon(m); } diff --git a/erpnext/home/page/event_updates/complete_registration.js b/erpnext/home/page/event_updates/complete_registration.js deleted file mode 100644 index 8f7eed32d4f..00000000000 --- a/erpnext/home/page/event_updates/complete_registration.js +++ /dev/null @@ -1,124 +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 . - -// complete my company registration -// -------------------------------- -pscript.complete_registration = function(is_complete, profile) { - if(is_complete == 'No'){ - var d = new Dialog(400, 200, "Setup your Account"); - if(user != 'Administrator'){ - d.no_cancel(); // Hide close image - $('header').toggle(false); - } - - d.make_body([ - ['HTML', 'Your Profile Details', '

    Your Profile Details

    '], - ['Data', 'First Name'], - ['Data', 'Last Name'], - ['HTML', 'Company Details', '

    Create your first company

    '], - ['Data','Company Name','Example: Your Company LLC'], - ['Data','Company Abbreviation', 'Example: YC (all your acconts will have this as a suffix)'], - ['Select','Fiscal Year Start Date'], - ['Select','Default Currency'], - ['Button','Save'], - ]); - - // if company name is set, set the input value - // and disable it - if(wn.control_panel.company_name) { - d.widgets['Company Name'].value = wn.control_panel.company_name; - d.widgets['Company Name'].disabled = 1; - } - - if(profile && profile.length>0) { - if(profile[0].first_name && profile[0].first_name!='None') { - d.widgets['First Name'].value = profile[0].first_name; - } - - if(profile[0].last_name && profile[0].last_name!='None') { - d.widgets['Last Name'].value = profile[0].last_name; - } - } - - - //d.widgets['Save'].disabled = true; // disable Save button - pscript.make_dialog_field(d); - - // submit details - d.widgets['Save'].onclick = function() - { - d.widgets['Save'].set_working(); - - flag = pscript.validate_fields(d); - if(flag) - { - var args = [ - d.widgets['Company Name'].value, - d.widgets['Company Abbreviation'].value, - d.widgets['Fiscal Year Start Date'].value, - d.widgets['Default Currency'].value, - d.widgets['First Name'].value, - d.widgets['Last Name'].value - ]; - - $c_obj('Setup Control','setup_account',JSON.stringify(args),function(r, rt){ - sys_defaults = r.message; - user_fullname = r.message.user_fullname; - d.hide(); - $('header').toggle(true); - page_body.wntoolbar.set_user_name(); - }); - } else { - d.widgets['Save'].done_working(); - } - } - d.show(); - } -} - -// make dialog fields -// ------------------ -pscript.make_dialog_field = function(d) -{ - // fiscal year format - fisc_format = d.widgets['Fiscal Year Start Date']; - add_sel_options(fisc_format, ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct']); - - // default currency - currency_list = ['', 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AZN', 'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL', 'BSD', 'BTN', 'BYR', 'BZD', 'CAD', 'CDF', 'CFA', 'CFP', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CUC', 'CZK', 'DJF', 'DKK', 'DOP', 'DZD', 'EEK', 'EGP', 'ERN', 'ETB', 'EUR', 'EURO', 'FJD', 'FKP', 'FMG', 'GBP', 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GQE', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF', 'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LTL', 'LVL', 'LYD', 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR', 'MZM', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NRs', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RMB', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SCR', 'SDG', 'SDR', 'SEK', 'SGD', 'SHP', 'SOS', 'SRD', 'STD', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', 'TND', 'TRY', 'TTD', 'TWD', 'TZS', 'UAE', 'UAH', 'UGX', 'USD', 'USh', 'UYU', 'UZS', 'VEB', 'VND', 'VUV', 'WST', 'XAF', 'XCD', 'XDR', 'XOF', 'XPF', 'YEN', 'YER', 'YTL', 'ZAR', 'ZMK', 'ZWR']; - currency = d.widgets['Default Currency']; - add_sel_options(currency, currency_list); -} - - -// validate fields -// --------------- -pscript.validate_fields = function(d) -{ - var lst = ['First Name', 'Company Name', 'Company Abbreviation', 'Fiscal Year Start Date', 'Default Currency']; - var msg = 'Please enter the following fields'; - var flag = 1; - for(var i=0; i. -# Please edit this list and import only required elements import webnotes -from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add -from webnotes.model import db_exists -from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType -from webnotes.model.doclist import getlist, copy_doclist -from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax -from webnotes import session, form, is_testing, msgprint, errprint +from webnotes.utils import cint, cstr, flt, getdate, now, nowdate +from webnotes.model.doc import Document, addchild +from webnotes.model.code import get_obj +from webnotes import session, form, msgprint -set = webnotes.conn.set sql = webnotes.conn.sql -get_value = webnotes.conn.get_value -in_transaction = webnotes.conn.in_transaction -convert_to_lists = webnotes.conn.convert_to_lists - -# ----------------------------------------------------------------------------------------- - class DocType: def __init__(self, d, dl): @@ -74,9 +64,10 @@ class DocType: # Account Setup # --------------- def setup_account(self, args): - import webnotes - company_name, comp_abbr, fy_start, currency, first_name, last_name = eval(args) - curr_fiscal_year,fy_start_date = self.get_fy_details(fy_start) + import webnotes, json + locals().update(args) + + curr_fiscal_year, fy_start_date = self.get_fy_details(fy_start) self.currency = currency # Update Profile @@ -92,7 +83,7 @@ class DocType: # Company master_dict = {'Company':{'company_name':company_name, - 'abbr':comp_abbr, + 'abbr':company_abbr, 'default_currency':currency }} self.create_records(master_dict) @@ -117,15 +108,39 @@ class DocType: # Set self.set_defaults(def_args) - # Set Registration Complete - set_default('registration_complete','1') + self.create_feed_and_todo() - msgprint("Great! Your company has now been created") + webnotes.clear_cache() + msgprint("Company setup is complete") import webnotes.utils user_fullname = (first_name or '') + (last_name and (" " + last_name) or '') return {'sys_defaults': webnotes.utils.get_defaults(), 'user_fullname': user_fullname} + def create_feed_and_todo(self): + """update activty feed and create todo for creation of item, customer, vendor""" + import home + home.make_feed('Comment', '', '', webnotes.session['user'], + '"' + doc.comment + '"', '#6B24B3') + + d = Document('ToDo Item') + d.description = 'Create your first Customer' + d.priority = 'High' + d.date = nowdate() + d.save(1) + + d = Document('ToDo Item') + d.description = 'Create your first Item' + d.priority = 'High' + d.date = nowdate() + d.save(1) + + d = Document('ToDo Item') + d.description = 'Create your first Supplier' + d.priority = 'High' + d.date = nowdate() + d.save(1) + # Get Fiscal year Details # ------------------------ @@ -207,14 +222,6 @@ class DocType: d = addchild(pr,'userroles', 'UserRole', 1) d.role = r d.save(1) - - - # Sync DB - # ------- - def sync_db(arg=''): - import webnotes.model.db_schema - sql("delete from `tabDocType Update Register`") - webnotes.model.db_schema.sync_all() def is_setup_okay(self, args): @@ -224,21 +231,14 @@ class DocType: from server_tools.gateway_utils import get_total_users - args = eval(args) - #webnotes.logger.error("args in set_account_details of setup_control: " + str(args)) - + args = eval(args) cp_defaults = webnotes.conn.get_value('Control Panel', None, 'account_id') - user_profile = webnotes.conn.get_value('Profile', args['user'], 'name') from webnotes.utils import cint total_users = get_total_users() - - #webnotes.logger.error("setup_control.is_setup_okay: " + cp_defaults + " " + user_profile + " " + str(total_users)) - - #webnotes.logger.error("setup_control.is_setup_okay: Passed Values:" + args['account_name'] + " " + args['user'] + " " + str(args['total_users'])) - + if (cp_defaults==args['account_name']) and user_profile and \ (total_users==cint(args['total_users'])): return 'True' diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py index a1d805ef1f1..79fd60312ac 100644 --- a/erpnext/startup/event_handlers.py +++ b/erpnext/startup/event_handlers.py @@ -89,6 +89,10 @@ def boot_session(bootinfo): bootinfo['docs'] += webnotes.model.doctype.get('Event') bootinfo['modules_list'] = webnotes.conn.get_global('modules_list') + + # if no company, show a dialog box to create a new company + bootinfo['setup_complete'] = webnotes.conn.sql("""select name from + tabCompany limit 1""") and 'Yes' or 'No' def get_letter_heads(): """load letter heads with startup""" diff --git a/erpnext/startup/js/complete_setup.js b/erpnext/startup/js/complete_setup.js new file mode 100644 index 00000000000..663c7b97f05 --- /dev/null +++ b/erpnext/startup/js/complete_setup.js @@ -0,0 +1,93 @@ +// 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 . + +// complete my company registration +// -------------------------------- + +erpnext.complete_setup = function() { + var currency_list = ['', 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AZN', + 'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL', 'BSD', 'BTN', 'BYR', + 'BZD', 'CAD', 'CDF', 'CFA', 'CFP', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CUC', 'CZK', 'DJF', + 'DKK', 'DOP', 'DZD', 'EEK', 'EGP', 'ERN', 'ETB', 'EUR', 'EURO', 'FJD', 'FKP', 'FMG', 'GBP', + 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GQE', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF', + 'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF', + 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LTL', 'LVL', 'LYD', + 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR', + 'MZM', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NRs', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP', + 'PKR', 'PLN', 'PYG', 'QAR', 'RMB', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SCR', 'SDG', 'SDR', + 'SEK', 'SGD', 'SHP', 'SOS', 'SRD', 'STD', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', 'TND', 'TRY', + 'TTD', 'TWD', 'TZS', 'UAE', 'UAH', 'UGX', 'USD', 'USh', 'UYU', 'UZS', 'VEB', 'VND', 'VUV', + 'WST', 'XAF', 'XCD', 'XDR', 'XOF', 'XPF', 'YEN', 'YER', 'YTL', 'ZAR', 'ZMK', 'ZWR']; + + var d = new wn.widgets.Dialog({ + title: "Setup", + fields: [ + {fieldname:'first_name', label:'Your First Name', fieldtype:'Data'}, + {fieldname:'last_name', label:'Your Last Name', fieldtype:'Data'}, + {fieldname:'company_name', label:'Company Name', fieldtype:'Data', reqd:1, + description: 'e.g. "My Company LLC"'}, + {fieldname:'company_abbr', label:'Company Abbreviation', fieldtype:'Data', + description:'e.g. "MC"',reqd:1}, + {fieldname:'fy_start', label:'Financial Year Start Date', fieldtype:'Select', + description:'Your financial year begins on"', reqd:1, + options=['', '1st Jan', '1st Apr', '1st Jul', '1st Oct'].join('\n')}, + {fieldname:'currency': label: 'Default Currency', reqd:1, + options=currency_list.join('\n')}, + {fieldname:'update', label:'Setup',fieldtype:'Button'} + ] + }) + + // prepare + if(user != 'Administrator'){ + d.no_cancel(); // Hide close image + $('header').toggle(false); // hide toolbar + } + + // company name already set + if(wn.control_panel.company_name) { + var inp = d.fields_dict.company_name.input; + inp.value = wn.control_panel.company_name; + inp.disabled = true; + } + + // set first name, last name + if(user_fullname) { + u = user_fullname.spilt(' '); + if(u[0]) { + d.fields_dict.first_name.input.value = u[0]; + } + if(u[1]) { + d.fields_dict.last_name.input.value = u[1]; + } + } + + // setup + d.fields_dict.update.input.onclick = function() { + var data = d.get_values(); + if(!data) return; + $(this).set_working(); + $c_obj('Setup Control','setup_account',data,function(r, rt){ + sys_defaults = r.message; + user_fullname = r.message.user_fullname; + wn.boot.user_fullnames[user] = user_fullname; + d.hide(); + $('header').toggle(true); + page_body.wntoolbar.set_user_name(); + }); + } + + d.show(); +} \ No newline at end of file diff --git a/erpnext/startup/feature_setup.js b/erpnext/startup/js/feature_setup.js similarity index 100% rename from erpnext/startup/feature_setup.js rename to erpnext/startup/js/feature_setup.js diff --git a/erpnext/startup/modules.js b/erpnext/startup/js/modules.js similarity index 100% rename from erpnext/startup/modules.js rename to erpnext/startup/js/modules.js diff --git a/erpnext/startup/toolbar.js b/erpnext/startup/js/toolbar.js similarity index 100% rename from erpnext/startup/toolbar.js rename to erpnext/startup/js/toolbar.js diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js index 30ab28d53bc..aef298cbd2b 100644 --- a/erpnext/startup/startup.js +++ b/erpnext/startup/startup.js @@ -30,7 +30,7 @@ erpnext.modules = { 'Website': 'website-home', 'HR': 'hr-home', 'Setup': 'Setup', - 'Activity': 'Event Updates', + 'Activity': 'activity', 'To Do': 'todo', 'Calendar': 'calendar', 'Messages': 'messages', @@ -58,7 +58,7 @@ erpnext.startup.start = function() { } else { // setup toolbar erpnext.toolbar.setup(); - + // set interval for updates erpnext.startup.set_periodic_updates(); @@ -66,6 +66,13 @@ erpnext.startup.start = function() { // ------------------ $('footer').html(''); + + // complete registration + if(in_list(user_roles,'System Manager') && (wn.boot.setup_complete=='No')) { + wn.require("erpnext/startup/js/complete_setup.js"); + erpnext.complete_setup(); + } + } $('#startup_div').toggle(false); @@ -87,28 +94,6 @@ show_chart_browser = function(nm, chart_type){ } -// Module Page -// ==================================================================== - -ModulePage = function(parent, module_name, module_label, help_page, callback) { - this.parent = parent; - - // add to current page - page_body.cur_page.module_page = this; - - this.wrapper = $a(parent,'div'); - this.module_name = module_name; - this.transactions = []; - this.page_head = new PageHeader(this.wrapper, module_label); - - if(help_page) { - var btn = this.page_head.add_button('Help', function() { loadpage(this.help_page) }, 1, 'ui-icon-help') - btn.help_page = help_page; - } - - if(callback) this.callback = function(){ callback(); } -} - // ========== Update Messages ============ var update_messages = function() { // Updates Team Messages diff --git a/erpnext/utilities/__init__.py b/erpnext/utilities/__init__.py index 28eaccecdcf..d57f0def058 100644 --- a/erpnext/utilities/__init__.py +++ b/erpnext/utilities/__init__.py @@ -23,6 +23,7 @@ def get_report_list(arg=None): distinct criteria_name, doc_type, parent_doc_type from `tabSearch Criteria` where module='%(module)s' - and docstatus in (0, NULL) + and docstatus in (0, NULL) + and ifnull(disabled, 0) = 0 order by criteria_name limit %(limit_start)s, %(limit_page_length)s""" % webnotes.form_dict, as_dict=True) \ No newline at end of file diff --git a/js/all-app.js b/js/all-app.js index 62d63ce67fc..09e92a504f8 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -111,6 +111,33 @@ $(document).bind('ready', function() { /* * lib/js/lib/bootstrap.min.js */!function(a){a(function(){"use strict",a.support.transition=function(){var b=document.body||document.documentElement,c=b.style,d=c.transition!==undefined||c.WebkitTransition!==undefined||c.MozTransition!==undefined||c.MsTransition!==undefined||c.OTransition!==undefined;return d&&{end:function(){var b="TransitionEnd";return a.browser.webkit?b="webkitTransitionEnd":a.browser.mozilla?b="transitionend":a.browser.opera&&(b="oTransitionEnd"),b}()}}()})}(window.jQuery),!function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype={constructor:c,close:function(b){function f(){e.remove(),e.trigger("closed")}var c=a(this),d=c.attr("data-target"),e;d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),e=a(d),e.trigger("close"),b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.removeClass("in"),a.support.transition&&e.hasClass("fade")?e.on(a.support.transition.end,f):f()}},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype={constructor:b,setState:function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},toggle:function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")}},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){a(b.target).button("toggle")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.carousel.defaults,c),this.options.slide&&this.slide(this.options.slide)};b.prototype={cycle:function(){return this.interval=setInterval(a.proxy(this.next,this),this.options.interval),this},to:function(b){var c=this.$element.find(".active"),d=c.parent().children(),e=d.index(c),f=this;if(b>d.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){f.to(b)}):e==b?this.pause().cycle():this.slide(b>e?"next":"prev",a(d[b]))},pause:function(){return clearInterval(this.interval),this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(b,c){var d=this.$element.find(".active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this;return this.sliding=!0,f&&this.pause(),e=e.length?e:this.$element.find(".item")[h](),!a.support.transition&&this.$element.hasClass("slide")?(this.$element.trigger("slide"),d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")):(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),this.$element.trigger("slide"),this.$element.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)})),f&&this.cycle(),this}},a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("carousel"),f=typeof c=="object"&&c;e||d.data("carousel",e=new b(this,f)),typeof c=="number"?e.to(c):typeof c=="string"||(c=f.slide)?e[c]():e.cycle()})},a.fn.carousel.defaults={interval:5e3},a.fn.carousel.Constructor=b,a(function(){a("body").on("click.carousel.data-api","[data-slide]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=!e.data("modal")&&a.extend({},e.data(),c.data());e.carousel(f),b.preventDefault()})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find(".in"),e;d&&d.length&&(e=d.data("collapse"),d.collapse("hide"),e||d.data("collapse",null)),this.$element[b](0),this.transition("addClass","show","shown"),this.$element[b](this.$element[0][c])},hide:function(){var a=this.dimension();this.reset(this.$element[a]()),this.transition("removeClass","hide","hidden"),this.$element[a](0)},reset:function(a){var b=this.dimension();this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element.addClass("collapse")},transition:function(b,c,d){var e=this,f=function(){c=="show"&&e.reset(),e.$element.trigger(d)};this.$element.trigger(c)[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){function d(){a(b).parent().removeClass("open")}"use strict";var b='[data-toggle="dropdown"]',c=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};c.prototype={constructor:c,toggle:function(b){var c=a(this),e=c.attr("data-target"),f,g;return e||(e=c.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,"")),f=a(e),f.length||(f=c.parent()),g=f.hasClass("open"),d(),!g&&f.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var d=a(this),e=d.data("dropdown");e||d.data("dropdown",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.dropdown.Constructor=c,a(function(){a("html").on("click.dropdown.data-api",d),a("body").on("click.dropdown.data-api",b,c.prototype.toggle)})}(window.jQuery),!function(a){function c(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),d.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),d.call(b)})}function d(a){this.$element.hide().trigger("hidden"),e.call(this)}function e(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('');if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("erpnext/startup/js/complete_setup.js");erpnext.complete_setup();}} $('#startup_div').toggle(false);} show_chart_browser=function(nm,chart_type){var call_back=function(){if(nm=='Sales Browser'){var sb_obj=new SalesBrowser();sb_obj.set_val(chart_type);} else if(nm=='Accounts Browser') pscript.make_chart(chart_type);} loadpage(nm,call_back);} -ModulePage=function(parent,module_name,module_label,help_page,callback){this.parent=parent;page_body.cur_page.module_page=this;this.wrapper=$a(parent,'div');this.module_name=module_name;this.transactions=[];this.page_head=new PageHeader(this.wrapper,module_label);if(help_page){var btn=this.page_head.add_button('Help',function(){loadpage(this.help_page)},1,'ui-icon-help') -btn.help_page=help_page;} -if(callback)this.callback=function(){callback();}} var update_messages=function(){if(inList(['Guest'],user)){return;} $c_page('home','event_updates','get_unread_messages',null,function(r,rt){if(!r.exc){page_body.wntoolbar.set_new_comments(r.message);var circle=$('#msg_count') if(circle){if(r.message.length){circle.find('span:first').text(r.message.length);circle.toggle(true);}else{circle.toggle(false);}}}else{clearInterval(wn.updates.id);}});} @@ -2213,7 +2236,7 @@ erpnext.startup.set_periodic_updates=function(){wn.updates={};if(wn.updates.id){ wn.updates.id=setInterval(update_messages,60000);} $(document).bind('startup',function(){erpnext.startup.start();}); /* - * erpnext/startup/modules.js + * erpnext/startup/js/modules.js */ wn.provide('erpnext.module_page');erpnext.module_page.setup_page=function(module,wrapper){erpnext.module_page.hide_links(wrapper);erpnext.module_page.make_list(module,wrapper);$(wrapper).find("a[title]").tooltip({delay:{show:500,hide:100}});} erpnext.module_page.hide_links=function(wrapper){$(wrapper).find('[href*="List/"]').each(function(){var href=$(this).attr('href');var dt=href.split('/')[1];if(wn.boot.profile.can_read.indexOf(get_label_doctype(dt))==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});$(wrapper).find('[data-doctype]').each(function(){var dt=$(this).attr('data-doctype');if(wn.boot.profile.can_read.indexOf(dt)==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});$(wrapper).find('[href*="Form/"]').each(function(){var href=$(this).attr('href');var dt=href.split('/')[1];if(wn.boot.profile.can_read.indexOf(get_label_doctype(dt))==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});} @@ -2221,7 +2244,7 @@ erpnext.module_page.make_list=function(module,wrapper){wrapper.list=new wn.widge data-doctype="%(parent_doc_type)s">\ %(criteria_name)s',data))},args:{module:module},no_refresh:true});wrapper.list.run();} /* - * erpnext/startup/toolbar.js + * erpnext/startup/js/toolbar.js */ wn.provide('erpnext.toolbar');erpnext.toolbar.setup=function(){erpnext.toolbar.add_modules();$('#toolbar-user').append('
  • Profile Settings
  • ');$('.navbar .pull-right').append('\
  • ');$('.navbar .pull-right').prepend('
  • \
  • Setup
  • ');}} /* - * erpnext/startup/feature_setup.js + * erpnext/startup/js/feature_setup.js */ pscript.feature_dict={'fs_projects':{'Bill Of Materials':{'fields':['project_name']},'Delivery Note':{'fields':['project_name']},'Payable Voucher':{'fields':['project_name']},'Production Order':{'fields':['project_name']},'Purchase Order':{'fields':['project_name']},'Purchase Receipt':{'fields':['project_name']},'Receivable Voucher':{'fields':['project_name']},'Sales Order':{'fields':['project_name']},'Stock Entry':{'fields':['project_name']},'Timesheet':{'timesheet_details':['project_name']}},'fs_packing_details':{},'fs_discounts':{'Delivery Note':{'delivery_note_details':['adj_rate']},'Quotation':{'quotation_details':['adj_rate']},'Receivable Voucher':{'entries':['adj_rate']},'Sales Order':{'sales_order_details':['adj_rate','ref_rate']}},'fs_purchase_discounts':{'Purchase Order':{'po_details':['purchase_ref_rate','discount_rate','import_ref_rate']},'Purchase Receipt':{'purchase_receipt_details':['purchase_ref_rate','discount_rate','import_ref_rate']},'Payable Voucher':{'entries':['purchase_ref_rate','discount_rate','import_ref_rate']}},'fs_brands':{'Delivery Note':{'delivery_note_details':['brand']},'Indent':{'indent_details':['brand']},'Item':{'fields':['brand']},'Purchase Order':{'po_details':['brand']},'Payable Voucher':{'entries':['brand']},'Quotation':{'quotation_details':['brand']},'Receivable Voucher':{'entries':['brand']},'Sales BOM':{'fields':['new_item_brand']},'Sales Order':{'sales_order_details':['brand']},'Serial No':{'fields':['brand']}},'fs_after_sales_installations':{'Delivery Note':{'fields':['installation_status','per_installed'],'delivery_note_details':['installed_qty']}},'fs_item_batch_nos':{'Delivery Note':{'delivery_note_details':['batch_no']},'Item':{'fields':['has_batch_no']},'Purchase Receipt':{'purchase_receipt_details':['batch_no']},'QA Inspection Report':{'fields':['batch_no']},'Sales and Pruchase Return Wizard':{'return_details':['batch_no']},'Receivable Voucher':{'entries':['batch_no']},'Stock Entry':{'mtn_details':['batch_no']},'Stock Ledger Entry':{'fields':['batch_no']}},'fs_item_serial_nos':{'Customer Issue':{'fields':['serial_no']},'Delivery Note':{'delivery_note_details':['serial_no'],'packing_details':['serial_no']},'Installation Note':{'installed_item_details':['serial_no']},'Item':{'fields':['has_serial_no']},'Maintenance Schedule':{'item_maintenance_details':['serial_no'],'maintenance_schedule_details':['serial_no']},'Maintenance Visit':{'maintenance_visit_details':['serial_no']},'Purchase Receipt':{'purchase_receipt_details':['serial_no']},'QA Inspection Report':{'fields':['item_serial_no']},'Sales and Pruchase Return Wizard':{'return_details':['serial_no']},'Receivable Voucher':{'entries':['serial_no']},'Stock Entry':{'mtn_details':['serial_no']},'Stock Ledger Entry':{'fields':['serial_no']}},'fs_item_group_in_details':{'Delivery Note':{'delivery_note_details':['item_group']},'Enquiry':{'enquiry_details':['item_group']},'Indent':{'indent_details':['item_group']},'Item':{'fields':['item_group']},'Manage Account':{'fields':['default_item_group']},'Purchase Order':{'po_details':['item_group']},'Purchase Receipt':{'purchase_receipt_details':['item_group']},'Purchase Voucher':{'entries':['item_group']},'Quotation':{'quotation_details':['item_group']},'Receivable Voucher':{'entries':['item_group']},'Sales BOM':{'fields':['serial_no']},'Sales Order':{'sales_order_details':['item_group']},'Serial No':{'fields':['item_group']},'Sales Partner':{'partner_target_details':['item_group']},'Sales Person':{'target_details':['item_group']},'Territory':{'target_details':['item_group']}},'fs_page_break':{'Delivery Note':{'delivery_note_details':['page_break'],'packing_details':['page_break']},'Indent':{'indent_details':['page_break']},'Purchase Order':{'po_details':['page_break']},'Purchase Receipt':{'purchase_receipt_details':['page_break']},'Purchase Voucher':{'entries':['page_break']},'Quotation':{'quotation_details':['page_break']},'Receivable Voucher':{'entries':['page_break']},'Sales Order':{'sales_order_details':['page_break']}},'fs_exports':{'Delivery Note':{'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','export_amount','export_rate']},'POS Setting':{'fields':['conversion_rate','currency']},'Quotation':{'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','export_amount','export_rate']},'Receivable Voucher':{'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','export_amount','export_rate']},'Item':{'ref_rate_details':['ref_currency']},'Sales BOM':{'fields':['currency']},'Sales Order':{'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','export_amount','export_rate']}},'fs_imports':{'Payable Voucher':{'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['import_amount','import_rate']},'Purchase Order':{'fields':['Note HTML','conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'po_details':['import_amount','import_rate']},'Purchase Receipt':{'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'purchase_receipt_details':['import_amount','import_rate']},'Supplier Quotation':{'fields':['conversion_rate','currency']}},'fs_item_advanced':{'Item':{'fields':['item_customer_details']}},'fs_sales_extras':{'Address':{'fields':['sales_partner']},'Contact':{'fields':['sales_partner']},'Customer':{'fields':['sales_team']},'Delivery Note':{'fields':['sales_team','Packing List']},'Item':{'fields':['item_customer_details']},'Receivable Voucher':{'fields':['sales_team']},'Sales Order':{'fields':['sales_team','Packing List']}},'fs_more_info':{'Customer':{'fields':['More Info']},'Delivery Note':{'fields':['More Info']},'Enquiry':{'fields':['More Info']},'Indent':{'fields':['More Info']},'Lead':{'fields':['More Info']},'Payable Voucher':{'fields':['More Info']},'Purchase Order':{'fields':['More Info']},'Purchase Receipt':{'fields':['More Info']},'Quotation':{'fields':['More Info']},'Receivable Voucher':{'fields':['More Info']},'Sales Order':{'fields':['More Info']},'Serial No':{'fields':['More Info']},'Supplier':{'fields':['More Info']}},'fs_quality':{'Item':{'fields':['Item Inspection Criteria','inspection_required']},'Purchase Receipt':{'purchase_receipt_details':['qa_no']}},'fs_manufacturing':{'Item':{'fields':['Manufacturing']}},'fs_pos':{'Receivable Voucher':{'fields':['is_pos']}},'fs_recurring_invoice':{'Receivable Voucher':{'fields':['Recurring Invoice']}}} $(document).bind('form_refresh',function(){for(sys_feat in sys_defaults) diff --git a/js/all-web.js b/js/all-web.js index 07fae99a0d6..98e1a7ab9b8 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -37,6 +37,33 @@ $(document).bind('ready', function() { /* * lib/js/lib/bootstrap.min.js */!function(a){a(function(){"use strict",a.support.transition=function(){var b=document.body||document.documentElement,c=b.style,d=c.transition!==undefined||c.WebkitTransition!==undefined||c.MozTransition!==undefined||c.MsTransition!==undefined||c.OTransition!==undefined;return d&&{end:function(){var b="TransitionEnd";return a.browser.webkit?b="webkitTransitionEnd":a.browser.mozilla?b="transitionend":a.browser.opera&&(b="oTransitionEnd"),b}()}}()})}(window.jQuery),!function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype={constructor:c,close:function(b){function f(){e.remove(),e.trigger("closed")}var c=a(this),d=c.attr("data-target"),e;d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),e=a(d),e.trigger("close"),b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.removeClass("in"),a.support.transition&&e.hasClass("fade")?e.on(a.support.transition.end,f):f()}},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype={constructor:b,setState:function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},toggle:function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")}},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){a(b.target).button("toggle")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.carousel.defaults,c),this.options.slide&&this.slide(this.options.slide)};b.prototype={cycle:function(){return this.interval=setInterval(a.proxy(this.next,this),this.options.interval),this},to:function(b){var c=this.$element.find(".active"),d=c.parent().children(),e=d.index(c),f=this;if(b>d.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){f.to(b)}):e==b?this.pause().cycle():this.slide(b>e?"next":"prev",a(d[b]))},pause:function(){return clearInterval(this.interval),this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(b,c){var d=this.$element.find(".active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this;return this.sliding=!0,f&&this.pause(),e=e.length?e:this.$element.find(".item")[h](),!a.support.transition&&this.$element.hasClass("slide")?(this.$element.trigger("slide"),d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")):(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),this.$element.trigger("slide"),this.$element.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)})),f&&this.cycle(),this}},a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("carousel"),f=typeof c=="object"&&c;e||d.data("carousel",e=new b(this,f)),typeof c=="number"?e.to(c):typeof c=="string"||(c=f.slide)?e[c]():e.cycle()})},a.fn.carousel.defaults={interval:5e3},a.fn.carousel.Constructor=b,a(function(){a("body").on("click.carousel.data-api","[data-slide]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=!e.data("modal")&&a.extend({},e.data(),c.data());e.carousel(f),b.preventDefault()})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find(".in"),e;d&&d.length&&(e=d.data("collapse"),d.collapse("hide"),e||d.data("collapse",null)),this.$element[b](0),this.transition("addClass","show","shown"),this.$element[b](this.$element[0][c])},hide:function(){var a=this.dimension();this.reset(this.$element[a]()),this.transition("removeClass","hide","hidden"),this.$element[a](0)},reset:function(a){var b=this.dimension();this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element.addClass("collapse")},transition:function(b,c,d){var e=this,f=function(){c=="show"&&e.reset(),e.$element.trigger(d)};this.$element.trigger(c)[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){function d(){a(b).parent().removeClass("open")}"use strict";var b='[data-toggle="dropdown"]',c=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};c.prototype={constructor:c,toggle:function(b){var c=a(this),e=c.attr("data-target"),f,g;return e||(e=c.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,"")),f=a(e),f.length||(f=c.parent()),g=f.hasClass("open"),d(),!g&&f.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var d=a(this),e=d.data("dropdown");e||d.data("dropdown",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.dropdown.Constructor=c,a(function(){a("html").on("click.dropdown.data-api",d),a("body").on("click.dropdown.data-api",b,c.prototype.toggle)})}(window.jQuery),!function(a){function c(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),d.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),d.call(b)})}function d(a){this.$element.hide().trigger("hidden"),e.call(this)}function e(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('');if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("erpnext/startup/js/complete_setup.js");erpnext.complete_setup();}} $('#startup_div').toggle(false);} show_chart_browser=function(nm,chart_type){var call_back=function(){if(nm=='Sales Browser'){var sb_obj=new SalesBrowser();sb_obj.set_val(chart_type);} else if(nm=='Accounts Browser') pscript.make_chart(chart_type);} loadpage(nm,call_back);} -ModulePage=function(parent,module_name,module_label,help_page,callback){this.parent=parent;page_body.cur_page.module_page=this;this.wrapper=$a(parent,'div');this.module_name=module_name;this.transactions=[];this.page_head=new PageHeader(this.wrapper,module_label);if(help_page){var btn=this.page_head.add_button('Help',function(){loadpage(this.help_page)},1,'ui-icon-help') -btn.help_page=help_page;} -if(callback)this.callback=function(){callback();}} var update_messages=function(){if(inList(['Guest'],user)){return;} $c_page('home','event_updates','get_unread_messages',null,function(r,rt){if(!r.exc){page_body.wntoolbar.set_new_comments(r.message);var circle=$('#msg_count') if(circle){if(r.message.length){circle.find('span:first').text(r.message.length);circle.toggle(true);}else{circle.toggle(false);}}}else{clearInterval(wn.updates.id);}});} diff --git a/version.num b/version.num index 3879e48b523..d6ee760bad3 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -753 \ No newline at end of file +762 \ No newline at end of file From 1572adf7f7149ccdfc475ab6abaaae9ea47a5998 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 29 Feb 2012 15:19:20 +0530 Subject: [PATCH 04/11] minor fix --- erpnext/home/page/activity/activity.js | 4 ++++ erpnext/patches/jan_mar_2012/navupdate.py | 4 ++-- erpnext/utilities/page/users/users.js | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/erpnext/home/page/activity/activity.js b/erpnext/home/page/activity/activity.js index 77e4ab92eab..174d381771c 100644 --- a/erpnext/home/page/activity/activity.js +++ b/erpnext/home/page/activity/activity.js @@ -33,6 +33,10 @@ erpnext.ActivityFeed = Class.extend({ data.add_class = "label-important"; } + if(date.feed_type=='Assignment') { + data.add_class = "label-warning"; + } + // link if(data.doc_name && data.feed_type!='Login') { data.link = repl('%(doc_name)s', data) diff --git a/erpnext/patches/jan_mar_2012/navupdate.py b/erpnext/patches/jan_mar_2012/navupdate.py index aa9c0867bb9..18338dd1ed5 100644 --- a/erpnext/patches/jan_mar_2012/navupdate.py +++ b/erpnext/patches/jan_mar_2012/navupdate.py @@ -32,9 +32,9 @@ def execute(): reload_doc('utilities', 'page', 'todo') reload_doc('utilities', 'page', 'calendar') reload_doc('utilities', 'page', 'messages') - reload_doc('utilities', 'page', 'modules_setup') + reload_doc('setup', 'page', 'modules_setup') reload_doc('utilities', 'page', 'users') - reload_doc('utilities', 'page', 'activity') + reload_doc('home', 'page', 'activity') webnotes.conn.set_value('Control Panel', 'Control Panel', 'home_page', 'desktop') diff --git a/erpnext/utilities/page/users/users.js b/erpnext/utilities/page/users/users.js index 21519b85a14..0dc4505fc0c 100644 --- a/erpnext/utilities/page/users/users.js +++ b/erpnext/utilities/page/users/users.js @@ -66,7 +66,7 @@ $.extend(wn.pages.users, { }, render: function(data) { if(data.file_list) { - data.imgsrc = 'files/' + data.files_list.split('\n')[0].split(',')[1]; + data.imgsrc = 'files/' + data.file_list.split('\n')[0].split(',')[1]; } else { data.imgsrc = 'lib/images/ui/no_img_' + (data.gender=='Female' ? 'f' : 'm'); } From 79ae16506b9711d0c6811df415e7d4c9390dc541 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 29 Feb 2012 15:23:25 +0530 Subject: [PATCH 05/11] minor fix --- erpnext/home/page/activity/activity.js | 2 +- erpnext/utilities/page/users/users.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/home/page/activity/activity.js b/erpnext/home/page/activity/activity.js index 174d381771c..b14f1f87bad 100644 --- a/erpnext/home/page/activity/activity.js +++ b/erpnext/home/page/activity/activity.js @@ -33,7 +33,7 @@ erpnext.ActivityFeed = Class.extend({ data.add_class = "label-important"; } - if(date.feed_type=='Assignment') { + if(data.feed_type=='Assignment') { data.add_class = "label-warning"; } diff --git a/erpnext/utilities/page/users/users.js b/erpnext/utilities/page/users/users.js index 0dc4505fc0c..76f5672eebe 100644 --- a/erpnext/utilities/page/users/users.js +++ b/erpnext/utilities/page/users/users.js @@ -68,7 +68,7 @@ $.extend(wn.pages.users, { if(data.file_list) { data.imgsrc = 'files/' + data.file_list.split('\n')[0].split(',')[1]; } else { - data.imgsrc = 'lib/images/ui/no_img_' + (data.gender=='Female' ? 'f' : 'm'); + data.imgsrc = 'lib/images/ui/no_img_' + (data.gender=='Female' ? 'f' : 'm') + '.gif'; } data.fullname = wn.boot.user_fullnames[data.name]; data.delete_html = ''; From 0b8ac7fc684111bdc9bb651752de2b8cfabe2bd8 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 29 Feb 2012 18:33:39 +0530 Subject: [PATCH 06/11] fix in company setup --- erpnext/patches/patch_list.py | 36 +++++++++++++++ .../doctype/setup_control/setup_control.py | 45 +++++++++++-------- erpnext/startup/js/complete_setup.js | 12 ++--- .../Purchase Order-Purchase Receipt.txt | 29 +++++++++++- erpnext/utilities/page/todo/todo.js | 16 +++++-- js/all-app.js | 6 +-- js/all-web.js | 6 +-- version.num | 2 +- 8 files changed, 114 insertions(+), 38 deletions(-) diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index dc9f1dd7e4a..6c66f75c52d 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -121,4 +121,40 @@ patch_list = [ 'patch_file': 'fix_packing_slip', 'description': 'Update Mapper Delivery Note-Packing Slip' }, + { + 'patch_module': 'patches.jan_mar_2012.apps', + 'patch_file': 'todo_item', + 'description': 'Reloads todo item' + }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'convert_tables_to_utf8', + 'description': 'Convert tables to UTF-8' + }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'pending_patches', + }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'pos_setting_patch', + }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'reload_doctype', + }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'reload_po_pr_mapper', + }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'delete_pur_of_service', + 'description': 'Deletes purpose of service' + }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'navupdate', + 'description': 'New Navigation Pages' + }, ] diff --git a/erpnext/setup/doctype/setup_control/setup_control.py b/erpnext/setup/doctype/setup_control/setup_control.py index 75cc038bb15..708b32ac5a5 100644 --- a/erpnext/setup/doctype/setup_control/setup_control.py +++ b/erpnext/setup/doctype/setup_control/setup_control.py @@ -65,16 +65,18 @@ class DocType: # --------------- def setup_account(self, args): import webnotes, json - locals().update(args) + args = json.loads(args) - curr_fiscal_year, fy_start_date = self.get_fy_details(fy_start) - self.currency = currency + curr_fiscal_year, fy_start_date = self.get_fy_details(args.get('fy_start')) + + args['name'] = webnotes.session.get('user') # Update Profile - if last_name=='None': last_name = None + if not args.get('last_name') or args.get('last_name')=='None': args['last_name'] = None webnotes.conn.sql("""\ - UPDATE `tabProfile` SET first_name=%s, last_name=%s - WHERE name=%s AND docstatus<2""", (first_name, last_name, webnotes.user.name)) + UPDATE `tabProfile` SET first_name=%(first_name)s, + last_name=%(last_name)s + WHERE name=%(name)s AND docstatus<2""", args) # Fiscal Year @@ -82,15 +84,15 @@ class DocType: self.create_records(master_dict) # Company - master_dict = {'Company':{'company_name':company_name, - 'abbr':company_abbr, - 'default_currency':currency - }} + master_dict = {'Company':{'company_name':args.get('company_name'), + 'abbr':args.get('company_abbr'), + 'default_currency':args.get('currency') + }} self.create_records(master_dict) def_args = {'current_fiscal_year':curr_fiscal_year, - 'default_currency': currency, - 'default_company':company_name, + 'default_currency': args.get('currency'), + 'default_company':args.get('company_name'), 'default_valuation_method':'FIFO', 'default_stock_uom':'Nos', 'date_format':'dd-mm-yyyy', @@ -102,7 +104,8 @@ class DocType: 'emp_created_by':'Naming Series', 'cust_master_name':'Customer Name', 'supp_master_name':'Supplier Name', - 'default_currency_format': (currency=='INR') and 'Lacs' or 'Millions' + 'default_currency_format': \ + (args.get('currency')=='INR') and 'Lacs' or 'Millions' } # Set @@ -114,31 +117,35 @@ class DocType: msgprint("Company setup is complete") import webnotes.utils - user_fullname = (first_name or '') + (last_name and (" " + last_name) or '') + user_fullname = (args.get('first_name') or '') + (args.get('last_name') + and (" " + args.get('last_name')) or '') return {'sys_defaults': webnotes.utils.get_defaults(), 'user_fullname': user_fullname} def create_feed_and_todo(self): """update activty feed and create todo for creation of item, customer, vendor""" import home - home.make_feed('Comment', '', '', webnotes.session['user'], - '"' + doc.comment + '"', '#6B24B3') + home.make_feed('Comment', 'ToDo Item', '', webnotes.session['user'], + '"' + 'Setup Complete. Please check your To Do List' + '"', '#6B24B3') d = Document('ToDo Item') - d.description = 'Create your first Customer' + d.description = 'Create your first Customer' d.priority = 'High' d.date = nowdate() + d.reference_type = 'Customer' d.save(1) d = Document('ToDo Item') - d.description = 'Create your first Item' + d.description = 'Create your first Item' d.priority = 'High' d.date = nowdate() + d.reference_type = 'Item' d.save(1) d = Document('ToDo Item') - d.description = 'Create your first Supplier' + d.description = 'Create your first Supplier' d.priority = 'High' d.date = nowdate() + d.reference_type = 'Supplier' d.save(1) diff --git a/erpnext/startup/js/complete_setup.js b/erpnext/startup/js/complete_setup.js index 663c7b97f05..26b2d3b689f 100644 --- a/erpnext/startup/js/complete_setup.js +++ b/erpnext/startup/js/complete_setup.js @@ -35,7 +35,7 @@ erpnext.complete_setup = function() { var d = new wn.widgets.Dialog({ title: "Setup", fields: [ - {fieldname:'first_name', label:'Your First Name', fieldtype:'Data'}, + {fieldname:'first_name', label:'Your First Name', fieldtype:'Data', reqd: 1}, {fieldname:'last_name', label:'Your Last Name', fieldtype:'Data'}, {fieldname:'company_name', label:'Company Name', fieldtype:'Data', reqd:1, description: 'e.g. "My Company LLC"'}, @@ -43,9 +43,9 @@ erpnext.complete_setup = function() { description:'e.g. "MC"',reqd:1}, {fieldname:'fy_start', label:'Financial Year Start Date', fieldtype:'Select', description:'Your financial year begins on"', reqd:1, - options=['', '1st Jan', '1st Apr', '1st Jul', '1st Oct'].join('\n')}, - {fieldname:'currency': label: 'Default Currency', reqd:1, - options=currency_list.join('\n')}, + options: ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct'].join('\n')}, + {fieldname:'currency', label: 'Default Currency', reqd:1, + options: currency_list.join('\n'), fieldtype: 'Select'}, {fieldname:'update', label:'Setup',fieldtype:'Button'} ] }) @@ -65,7 +65,7 @@ erpnext.complete_setup = function() { // set first name, last name if(user_fullname) { - u = user_fullname.spilt(' '); + u = user_fullname.split(' '); if(u[0]) { d.fields_dict.first_name.input.value = u[0]; } @@ -90,4 +90,4 @@ erpnext.complete_setup = function() { } d.show(); -} \ No newline at end of file +} diff --git a/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt b/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt index 3c50836af53..73dfd4b6a90 100644 --- a/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt +++ b/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt @@ -5,7 +5,7 @@ { 'creation': '2010-08-08 17:09:35', 'docstatus': 0, - 'modified': '2012-02-07 13:28:20', + 'modified': '2012-02-29 17:55:13', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -22,7 +22,6 @@ # These values are common for all Field Mapper Detail { 'doctype': u'Field Mapper Detail', - 'map': u'Yes', 'name': '__common__', 'parent': u'Purchase Order-Purchase Receipt', 'parentfield': u'field_mapper_details', @@ -50,6 +49,7 @@ 'checking_operator': u'=', 'doctype': u'Field Mapper Detail', 'from_field': u'supplier', + 'map': u'Yes', 'match_id': 0, 'to_field': u'supplier' }, @@ -59,6 +59,7 @@ 'checking_operator': u'=', 'doctype': u'Field Mapper Detail', 'from_field': u'company', + 'map': u'Yes', 'match_id': 0, 'to_field': u'company' }, @@ -68,6 +69,7 @@ 'checking_operator': u'=', 'doctype': u'Field Mapper Detail', 'from_field': u'currency', + 'map': u'Yes', 'match_id': 0, 'to_field': u'currency' }, @@ -76,6 +78,7 @@ { 'doctype': u'Field Mapper Detail', 'from_field': u'name', + 'map': u'Yes', 'match_id': 1, 'to_field': u'prevdoc_detail_docname' }, @@ -84,6 +87,7 @@ { 'doctype': u'Field Mapper Detail', 'from_field': u'parent', + 'map': u'Yes', 'match_id': 1, 'to_field': u'prevdoc_docname' }, @@ -92,6 +96,7 @@ { 'doctype': u'Field Mapper Detail', 'from_field': u'parenttype', + 'map': u'Yes', 'match_id': 1, 'to_field': u'prevdoc_doctype' }, @@ -101,6 +106,7 @@ 'checking_operator': u'=', 'doctype': u'Field Mapper Detail', 'from_field': u'item_code', + 'map': u'Yes', 'match_id': 1, 'to_field': u'item_code' }, @@ -109,6 +115,7 @@ { 'doctype': u'Field Mapper Detail', 'from_field': u'eval:(flt(obj.qty) - flt(obj.received_qty)) ', + 'map': u'Yes', 'match_id': 1, 'to_field': u'received_qty' }, @@ -117,6 +124,7 @@ { 'doctype': u'Field Mapper Detail', 'from_field': u'eval:(flt(obj.qty) - flt(obj.received_qty)) ', + 'map': u'Yes', 'match_id': 1, 'to_field': u'qty' }, @@ -125,6 +133,7 @@ { 'doctype': u'Field Mapper Detail', 'from_field': u'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.conversion_factor)', + 'map': u'Yes', 'match_id': 1, 'to_field': u'stock_qty' }, @@ -133,6 +142,7 @@ { 'doctype': u'Field Mapper Detail', 'from_field': u'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.import_rate)', + 'map': u'Yes', 'match_id': 1, 'to_field': u'import_amount' }, @@ -141,6 +151,7 @@ { 'doctype': u'Field Mapper Detail', 'from_field': u'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.purchase_rate)', + 'map': u'Yes', 'match_id': 1, 'to_field': u'amount' }, @@ -149,6 +160,7 @@ { 'doctype': u'Field Mapper Detail', 'from_field': u'schedule_date', + 'map': u'Yes', 'match_id': 1, 'to_field': u'schedule_date' }, @@ -157,6 +169,7 @@ { 'doctype': u'Field Mapper Detail', 'from_field': u'net_total', + 'map': u'Yes', 'match_id': 0, 'to_field': u'net_total' }, @@ -165,6 +178,7 @@ { 'doctype': u'Field Mapper Detail', 'from_field': u'grand_total', + 'map': u'Yes', 'match_id': 0, 'to_field': u'grand_total' }, @@ -173,14 +187,25 @@ { 'doctype': u'Field Mapper Detail', 'from_field': u'total_tax', + 'map': u'Yes', 'match_id': 0, 'to_field': u'total_tax' }, + # Field Mapper Detail + { + 'doctype': u'Field Mapper Detail', + 'from_field': u'transaction_date', + 'map': u'No', + 'match_id': 0, + 'to_field': u'transaction_date' + }, + # Field Mapper Detail { 'doctype': u'Field Mapper Detail', 'from_field': u'conversion_rate', + 'map': u'Yes', 'match_id': 0, 'to_field': u'conversion_rate' }, diff --git a/erpnext/utilities/page/todo/todo.js b/erpnext/utilities/page/todo/todo.js index 435002301b9..dfaa7cdecf8 100644 --- a/erpnext/utilities/page/todo/todo.js +++ b/erpnext/utilities/page/todo/todo.js @@ -46,14 +46,22 @@ erpnext.todo.ToDoItem = Class.extend({ } todo.labelclass = label_map[todo.priority]; todo.userdate = dateutil.str_to_user(todo.date); + if(todo.reference_name && todo.reference_type) { + todo.link = repl('\ + %(reference_name)s', todo); + } else if(todo.reference_type) { + todo.link = repl('\ + %(reference_type)s', todo); + } else { + todo.link = ''; + } $('#todo-list').append(repl('
    \ \ %(priority)s\ %(userdate)s\ %(description)s\ →\ - \ - [%(reference_name)s]\ + %(link)s\ ×\
    ', todo)); $todo = $('div.todoitem:last'); @@ -62,7 +70,7 @@ erpnext.todo.ToDoItem = Class.extend({ $todo.find('.description').css('text-decoration', 'line-through'); } - if(!todo.reference_name) + if(!todo.reference_type) $todo.find('.ref_link').toggle(false); $todo.find('.description') @@ -145,4 +153,4 @@ erpnext.todo.save = function(btn) { wn.pages.todo.onload = function() { // load todos erpnext.todo.refresh(); -} \ No newline at end of file +} diff --git a/js/all-app.js b/js/all-app.js index 09e92a504f8..aaa12db5445 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -129,13 +129,13 @@ return output.join('');};str_format.cache={};str_format.parse=function(fmt){var else if((match=/^\x25{2}/.exec(_fmt))!==null){parse_tree.push('%');} else if((match=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt))!==null){if(match[2]){arg_names|=1;var field_list=[],replacement_field=match[2],field_match=[];if((field_match=/^([a-z_][a-z_\d]*)/i.exec(replacement_field))!==null){field_list.push(field_match[1]);while((replacement_field=replacement_field.substring(field_match[0].length))!==''){if((field_match=/^\.([a-z_][a-z_\d]*)/i.exec(replacement_field))!==null){field_list.push(field_match[1]);} else if((field_match=/^\[(\d+)\]/.exec(replacement_field))!==null){field_list.push(field_match[1]);} -else{}}} -else{} +else{throw('[sprintf] huh?');}}} +else{throw('[sprintf] huh?');} match[2]=field_list;} else{arg_names|=2;} if(arg_names===3){throw('[sprintf] mixing positional and named placeholders is not (yet) supported');} parse_tree.push(match);} -else{} +else{throw('[sprintf] huh?');} _fmt=_fmt.substring(match[0].length);} return parse_tree;};return str_format;})();var vsprintf=function(fmt,argv){argv.unshift(fmt);return sprintf.apply(null,argv);}; /* diff --git a/js/all-web.js b/js/all-web.js index 98e1a7ab9b8..0395fc2cf64 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -55,13 +55,13 @@ return output.join('');};str_format.cache={};str_format.parse=function(fmt){var else if((match=/^\x25{2}/.exec(_fmt))!==null){parse_tree.push('%');} else if((match=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt))!==null){if(match[2]){arg_names|=1;var field_list=[],replacement_field=match[2],field_match=[];if((field_match=/^([a-z_][a-z_\d]*)/i.exec(replacement_field))!==null){field_list.push(field_match[1]);while((replacement_field=replacement_field.substring(field_match[0].length))!==''){if((field_match=/^\.([a-z_][a-z_\d]*)/i.exec(replacement_field))!==null){field_list.push(field_match[1]);} else if((field_match=/^\[(\d+)\]/.exec(replacement_field))!==null){field_list.push(field_match[1]);} -else{}}} -else{} +else{throw('[sprintf] huh?');}}} +else{throw('[sprintf] huh?');} match[2]=field_list;} else{arg_names|=2;} if(arg_names===3){throw('[sprintf] mixing positional and named placeholders is not (yet) supported');} parse_tree.push(match);} -else{} +else{throw('[sprintf] huh?');} _fmt=_fmt.substring(match[0].length);} return parse_tree;};return str_format;})();var vsprintf=function(fmt,argv){argv.unshift(fmt);return sprintf.apply(null,argv);}; /* diff --git a/version.num b/version.num index d6ee760bad3..c1891366fdb 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -762 \ No newline at end of file +769 \ No newline at end of file From 412a65c23cef7e3afc763d89fa833738521e3308 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 29 Feb 2012 18:38:18 +0530 Subject: [PATCH 07/11] user background --- erpnext/home/page/activity/activity.js | 2 +- .../page/profile_settings/profile_settings.js | 54 +++++++++++-------- .../page/profile_settings/profile_settings.py | 31 +++++++++-- erpnext/patches/jan_mar_2012/navupdate.py | 1 + erpnext/startup/event_handlers.py | 2 + erpnext/startup/startup.js | 7 +++ .../style_settings/custom_template.css | 2 +- js/all-app.js | 14 +++-- js/all-web.js | 12 +++-- version.num | 2 +- 10 files changed, 91 insertions(+), 36 deletions(-) diff --git a/erpnext/home/page/activity/activity.js b/erpnext/home/page/activity/activity.js index b14f1f87bad..d72c7aeab49 100644 --- a/erpnext/home/page/activity/activity.js +++ b/erpnext/home/page/activity/activity.js @@ -14,7 +14,7 @@ erpnext.ActivityFeed = Class.extend({ init: function(row, data) { this.scrub_data(data); this.add_date_separator(row, data); - $(row).append(repl('%(feed_type)s\ %(link)s %(subject)s ', data)); }, diff --git a/erpnext/home/page/profile_settings/profile_settings.js b/erpnext/home/page/profile_settings/profile_settings.js index 9dac7f6f1d5..8ce94f84390 100644 --- a/erpnext/home/page/profile_settings/profile_settings.js +++ b/erpnext/home/page/profile_settings/profile_settings.js @@ -26,13 +26,15 @@ MyProfile = function(wrapper) { this.make = function() { this.head = new PageHeader(this.wrapper, 'My Profile Settings'); - this.head.add_button('Change Password', this.change_password) + this.head.add_button('Change Password', this.change_password); + this.head.add_button('Change Background', this.change_background); + this.tab = make_table($a(this.wrapper, 'div', '', {marginTop:'19px'}), 1, 2, '90%', ['50%', '50%'], {padding:'11px'}) this.img = $a($td(this.tab, 0, 0), 'img'); set_user_img(this.img, user); - $btn($a($td(this.tab, 0, 0), 'div', '', {marginTop:'11px'}), 'Change Image', this.change_image) + $btn($a($td(this.tab, 0, 0), 'div', '', {marginTop:'11px'}), 'Change Image', this.change_image); this.make_form(); this.load_details(); @@ -105,32 +107,42 @@ MyProfile = function(wrapper) { // this.change_image = function() { - if(!me.change_dialog) { - - var d = new Dialog(400,200,'Set Your Profile Image'); - d.make_body([ - ['HTML','wrapper'] - ]); - - var w = d.widgets['wrapper']; - me.uploader = new Uploader(w, - { - modulename:'home.page.profile_settings.profile_settings', - method: 'set_user_image' - }, - pscript.user_image_upload, 1) - me.change_dialog = d; - } - me.change_dialog.show(); + var d = new wn.widgets.Dialog({ + title: 'Set your Profile' + }) + me.uploader = new Uploader(d.body, { + modulename:'home.page.profile_settings.profile_settings', + method: 'set_user_image' + }, + pscript.user_image_upload, 1) + d.show(); + pscript.open_dialog = d; + } + + this.change_background = function() { + var d = new wn.widgets.Dialog({ + title: 'Set Background Image' + }) + me.uploader = new Uploader(d.body, { + modulename:'home.page.profile_settings.profile_settings', + method: 'set_user_background' + }, + pscript.background_change, 1) + d.show(); + pscript.open_dialog = d; } this.make(); } +pscript.background_change = function(fid) { + //erpnext.set_background_image(fid); + pscript.open_dialog.hide(); +} + pscript.user_image_upload = function(fid) { msgprint('File Uploaded'); - if(fid) { - pscript.myprofile.change_dialog.hide(); + pscript.open_dialog.hide(); set_user_img(pscript.myprofile.img, user, null, fid); } } diff --git a/erpnext/home/page/profile_settings/profile_settings.py b/erpnext/home/page/profile_settings/profile_settings.py index f614c75ff41..fb633fdb192 100644 --- a/erpnext/home/page/profile_settings/profile_settings.py +++ b/erpnext/home/page/profile_settings/profile_settings.py @@ -63,6 +63,31 @@ def set_user_image(fid, fname): """ Set uploaded image as user image """ - from webnotes.utils.file_manager import add_file_list, remove_all - remove_all('Profile', webnotes.session['user']) - add_file_list('Profile', webnotes.session['user'], fname, fid) + from webnotes.utils.file_manager import add_file_list, remove_file + user = webnotes.session['user'] + + # remove old file + old_image = webnotes.conn.get_value('Profile', user, 'user_image') + if old_image: + remove_file('Profile', user, old_image) + + # add new file + add_file_list('Profile', user, fname, fid) + webnotes.conn.set_value('Profile', user, 'user_image', fid) + +@webnotes.whitelist() +def set_user_background(fid, fname): + """ + Set uploaded image as user image + """ + from webnotes.utils.file_manager import add_file_list, remove_file + user = webnotes.session['user'] + + # remove old file + old_image = webnotes.conn.get_value('Profile', user, 'background_image') + if old_image: + remove_file('Profile', user, old_image) + + # add new file + add_file_list('Profile', user, fname, fid) + webnotes.conn.set_value('Profile', user, 'background_image', fid) diff --git a/erpnext/patches/jan_mar_2012/navupdate.py b/erpnext/patches/jan_mar_2012/navupdate.py index 18338dd1ed5..29939e5aa71 100644 --- a/erpnext/patches/jan_mar_2012/navupdate.py +++ b/erpnext/patches/jan_mar_2012/navupdate.py @@ -35,6 +35,7 @@ def execute(): reload_doc('setup', 'page', 'modules_setup') reload_doc('utilities', 'page', 'users') reload_doc('home', 'page', 'activity') + reload_doc('core', 'doctype', 'profile') webnotes.conn.set_value('Control Panel', 'Control Panel', 'home_page', 'desktop') diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py index 79fd60312ac..dca9e0c6f60 100644 --- a/erpnext/startup/event_handlers.py +++ b/erpnext/startup/event_handlers.py @@ -93,6 +93,8 @@ def boot_session(bootinfo): # if no company, show a dialog box to create a new company bootinfo['setup_complete'] = webnotes.conn.sql("""select name from tabCompany limit 1""") and 'Yes' or 'No' + + bootinfo['user_background'] = webnotes.conn.get_value("Profile", webnotes.session['user'], 'background_image') or '' def get_letter_heads(): """load letter heads with startup""" diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js index aef298cbd2b..ad8289e9d5d 100644 --- a/erpnext/startup/startup.js +++ b/erpnext/startup/startup.js @@ -50,6 +50,9 @@ erpnext.startup.start = function() { if(wn.boot.custom_css) { set_style(wn.boot.custom_css); } + if(wn.boot.user_background) { + erpnext.set_user_background(wn.boot.user_background); + } if(user == 'Guest'){ if(wn.boot.website_settings.title_prefix) { @@ -132,6 +135,10 @@ erpnext.startup.set_periodic_updates = function() { wn.updates.id = setInterval(update_messages, 60000); } +erpnext.set_user_background = function(src) { + set_style(repl('body { background: url("files/%(src)s") repeat !important;}', {src:src})) +} + // ======================================= // start diff --git a/erpnext/website/doctype/style_settings/custom_template.css b/erpnext/website/doctype/style_settings/custom_template.css index e6eeeb34fac..8eb3d6396f5 100644 --- a/erpnext/website/doctype/style_settings/custom_template.css +++ b/erpnext/website/doctype/style_settings/custom_template.css @@ -1,6 +1,6 @@ body { {% if doc.background_image %} - background: url("files/{{ doc.background_image }}") repeat !important; + background: url("files/{{ doc.background_image }}") repeat; {% elif doc.background_color %} background-color: #{{ doc.background_color }}; {% endif %} diff --git a/js/all-app.js b/js/all-app.js index 09e92a504f8..e5e796783e3 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -129,13 +129,13 @@ return output.join('');};str_format.cache={};str_format.parse=function(fmt){var else if((match=/^\x25{2}/.exec(_fmt))!==null){parse_tree.push('%');} else if((match=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt))!==null){if(match[2]){arg_names|=1;var field_list=[],replacement_field=match[2],field_match=[];if((field_match=/^([a-z_][a-z_\d]*)/i.exec(replacement_field))!==null){field_list.push(field_match[1]);while((replacement_field=replacement_field.substring(field_match[0].length))!==''){if((field_match=/^\.([a-z_][a-z_\d]*)/i.exec(replacement_field))!==null){field_list.push(field_match[1]);} else if((field_match=/^\[(\d+)\]/.exec(replacement_field))!==null){field_list.push(field_match[1]);} -else{}}} -else{} +else{throw('[sprintf] huh?');}}} +else{throw('[sprintf] huh?');} match[2]=field_list;} else{arg_names|=2;} if(arg_names===3){throw('[sprintf] mixing positional and named placeholders is not (yet) supported');} parse_tree.push(match);} -else{} +else{throw('[sprintf] huh?');} _fmt=_fmt.substring(match[0].length);} return parse_tree;};return str_format;})();var vsprintf=function(fmt,argv){argv.unshift(fmt);return sprintf.apply(null,argv);}; /* @@ -280,7 +280,9 @@ var lstrip=function(s,chars){if(!chars)chars=['\n','\t',' '];var first_char=s.su return s;} var rstrip=function(s,chars){if(!chars)chars=['\n','\t',' '];var last_char=s.substr(s.length-1);while(in_list(chars,last_char)){var s=s.substr(0,this.length-1);last_char=s.substr(this.length-1);} return s;} -function repl(s,dict){return sprintf(s,dict);} +function repl_all(s,s1,s2){var idx=s.indexOf(s1);while(idx!=-1){s=s.replace(s1,s2);idx=s.indexOf(s1);} +return s;} +function repl(s,dict){if(s==null)return'';for(key in dict)s=repl_all(s,'%('+key+')s',dict[key]);return s;} function keys(obj){var mykeys=[];for(key in obj)mykeys[mykeys.length]=key;return mykeys;} function values(obj){var myvalues=[];for(key in obj)myvalues[myvalues.length]=obj[key];return myvalues;} function in_list(list,item){for(var i=0;i\ Powered by ERPNext');if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("erpnext/startup/js/complete_setup.js");erpnext.complete_setup();}} $('#startup_div').toggle(false);} @@ -2234,6 +2237,7 @@ $c_page('home','event_updates','get_unread_messages',null,function(r,rt){if(!r.e if(circle){if(r.message.length){circle.find('span:first').text(r.message.length);circle.toggle(true);}else{circle.toggle(false);}}}else{clearInterval(wn.updates.id);}});} erpnext.startup.set_periodic_updates=function(){wn.updates={};if(wn.updates.id){clearInterval(wn.updates.id);} wn.updates.id=setInterval(update_messages,60000);} +erpnext.set_user_background=function(src){set_style(repl('body { background: url("files/%(src)s") repeat !important;}',{src:src}))} $(document).bind('startup',function(){erpnext.startup.start();}); /* * erpnext/startup/js/modules.js diff --git a/js/all-web.js b/js/all-web.js index 98e1a7ab9b8..1df96396cad 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -55,13 +55,13 @@ return output.join('');};str_format.cache={};str_format.parse=function(fmt){var else if((match=/^\x25{2}/.exec(_fmt))!==null){parse_tree.push('%');} else if((match=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt))!==null){if(match[2]){arg_names|=1;var field_list=[],replacement_field=match[2],field_match=[];if((field_match=/^([a-z_][a-z_\d]*)/i.exec(replacement_field))!==null){field_list.push(field_match[1]);while((replacement_field=replacement_field.substring(field_match[0].length))!==''){if((field_match=/^\.([a-z_][a-z_\d]*)/i.exec(replacement_field))!==null){field_list.push(field_match[1]);} else if((field_match=/^\[(\d+)\]/.exec(replacement_field))!==null){field_list.push(field_match[1]);} -else{}}} -else{} +else{throw('[sprintf] huh?');}}} +else{throw('[sprintf] huh?');} match[2]=field_list;} else{arg_names|=2;} if(arg_names===3){throw('[sprintf] mixing positional and named placeholders is not (yet) supported');} parse_tree.push(match);} -else{} +else{throw('[sprintf] huh?');} _fmt=_fmt.substring(match[0].length);} return parse_tree;};return str_format;})();var vsprintf=function(fmt,argv){argv.unshift(fmt);return sprintf.apply(null,argv);}; /* @@ -206,7 +206,9 @@ var lstrip=function(s,chars){if(!chars)chars=['\n','\t',' '];var first_char=s.su return s;} var rstrip=function(s,chars){if(!chars)chars=['\n','\t',' '];var last_char=s.substr(s.length-1);while(in_list(chars,last_char)){var s=s.substr(0,this.length-1);last_char=s.substr(this.length-1);} return s;} -function repl(s,dict){return sprintf(s,dict);} +function repl_all(s,s1,s2){var idx=s.indexOf(s1);while(idx!=-1){s=s.replace(s1,s2);idx=s.indexOf(s1);} +return s;} +function repl(s,dict){if(s==null)return'';for(key in dict)s=repl_all(s,'%('+key+')s',dict[key]);return s;} function keys(obj){var mykeys=[];for(key in obj)mykeys[mykeys.length]=key;return mykeys;} function values(obj){var myvalues=[];for(key in obj)myvalues[myvalues.length]=obj[key];return myvalues;} function in_list(list,item){for(var i=0;i\ Powered by ERPNext');if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("erpnext/startup/js/complete_setup.js");erpnext.complete_setup();}} $('#startup_div').toggle(false);} @@ -1082,6 +1085,7 @@ $c_page('home','event_updates','get_unread_messages',null,function(r,rt){if(!r.e if(circle){if(r.message.length){circle.find('span:first').text(r.message.length);circle.toggle(true);}else{circle.toggle(false);}}}else{clearInterval(wn.updates.id);}});} erpnext.startup.set_periodic_updates=function(){wn.updates={};if(wn.updates.id){clearInterval(wn.updates.id);} wn.updates.id=setInterval(update_messages,60000);} +erpnext.set_user_background=function(src){set_style(repl('body { background: url("files/%(src)s") repeat !important;}',{src:src}))} $(document).bind('startup',function(){erpnext.startup.start();}); /* * erpnext/website/js/topbar.js diff --git a/version.num b/version.num index d6ee760bad3..988e00fe6b2 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -762 \ No newline at end of file +768 \ No newline at end of file From fd5a2138905ac841f4c8593889db8366446e448a Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 29 Feb 2012 18:58:02 +0530 Subject: [PATCH 08/11] fix in account setup and user addition --- erpnext/setup/doctype/setup_control/setup_control.py | 11 +++++++---- erpnext/utilities/page/users/users.py | 5 +++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/erpnext/setup/doctype/setup_control/setup_control.py b/erpnext/setup/doctype/setup_control/setup_control.py index 708b32ac5a5..6b8b37c2361 100644 --- a/erpnext/setup/doctype/setup_control/setup_control.py +++ b/erpnext/setup/doctype/setup_control/setup_control.py @@ -48,8 +48,8 @@ class DocType: args = json.loads(args) self.set_cp_defaults(args['company'], args['industry'], args['time_zone'], args['country'], args['account_name']) - self.create_profile(args['user'], args['first_name'], args['last_name'], args.get('pwd')) - + self.create_profile(args['user'], args['first_name'], args['last_name'], args.get('pwd')) + # Domain related updates try: from server_tools.gateway_utils import add_domain_map @@ -58,7 +58,9 @@ class DocType: pass # add record in domain_list of Website Settings - webnotes.conn.set_value('Website Settings', 'Website Settings', 'subdomain', args['url_name'] + ".erpnext.com") + account_url = args['url_name'] + '.erpnext.com' + webnotes.conn.set_value('Website Settings', 'Website Settings', + 'subdomain', account_url) # Account Setup @@ -125,7 +127,8 @@ class DocType: """update activty feed and create todo for creation of item, customer, vendor""" import home home.make_feed('Comment', 'ToDo Item', '', webnotes.session['user'], - '"' + 'Setup Complete. Please check your To Do List' + '"', '#6B24B3') + '"' + 'Setup Complete. Please check your \ + To Do List' + '"', '#6B24B3') d = Document('ToDo Item') d.description = 'Create your first Customer' diff --git a/erpnext/utilities/page/users/users.py b/erpnext/utilities/page/users/users.py index 44e2fb2aac9..bf8cf458a66 100644 --- a/erpnext/utilities/page/users/users.py +++ b/erpnext/utilities/page/users/users.py @@ -154,7 +154,8 @@ def send_welcome_mail(email, args): args.update({ 'company': webnotes.conn.get_default('company'), 'password': args.get('password'), - 'account_url': webnotes.conn.get_default('account_url') + 'account_url': webnotes.conn.get_value('Website Settings', 'Website + Settings', 'subdomain') or "" }) if not args.get('last_name'): args['last_name'] = '' sendmail_md(pr.email, subject="Welcome to ERPNext", msg=welcome_txt % args, from_defs=1) @@ -189,4 +190,4 @@ password: %(password)s To login to your new ERPNext account, please go to: %(account_url)s -""" \ No newline at end of file +""" From 9a6399669946fedbfdf202001f67719b5a797a6a Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 29 Feb 2012 18:59:45 +0530 Subject: [PATCH 09/11] fix in account setup and user addition --- erpnext/utilities/page/users/users.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/utilities/page/users/users.py b/erpnext/utilities/page/users/users.py index bf8cf458a66..ca482137ef1 100644 --- a/erpnext/utilities/page/users/users.py +++ b/erpnext/utilities/page/users/users.py @@ -154,8 +154,8 @@ def send_welcome_mail(email, args): args.update({ 'company': webnotes.conn.get_default('company'), 'password': args.get('password'), - 'account_url': webnotes.conn.get_value('Website Settings', 'Website - Settings', 'subdomain') or "" + 'account_url': webnotes.conn.get_value('Website Settings', + 'Website Settings', 'subdomain') or "" }) if not args.get('last_name'): args['last_name'] = '' sendmail_md(pr.email, subject="Welcome to ERPNext", msg=welcome_txt % args, from_defs=1) From 204e77d125b98b33cdeaa59434354dd25678d01f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 29 Feb 2012 19:09:20 +0530 Subject: [PATCH 10/11] background, user_info --- build.json | 1 + erpnext/home/page/activity/activity.js | 2 +- erpnext/startup/js/complete_setup.js | 2 +- erpnext/utilities/page/messages/messages.js | 6 +++--- erpnext/utilities/page/users/users.js | 3 ++- js/all-app.js | 11 ++++++++++- js/all-web.js | 11 ++++++++++- version.num | 2 +- 8 files changed, 29 insertions(+), 9 deletions(-) diff --git a/build.json b/build.json index 76f3da0304c..17d38b31410 100644 --- a/build.json +++ b/build.json @@ -9,6 +9,7 @@ "lib/js/wn/require.js", "lib/js/wn/dom.js", "lib/js/wn/page.js", + "lib/js/wn/misc/user.js", "lib/js/lib/json2.js", "lib/js/core.js" ] diff --git a/erpnext/home/page/activity/activity.js b/erpnext/home/page/activity/activity.js index d72c7aeab49..7dbf476acff 100644 --- a/erpnext/home/page/activity/activity.js +++ b/erpnext/home/page/activity/activity.js @@ -19,7 +19,7 @@ erpnext.ActivityFeed = Class.extend({ %(link)s %(subject)s ', data)); }, scrub_data: function(data) { - data.by = wn.boot.user_fullnames[data.owner]; + data.by = wn.user_info(data.owner).fullname; // feedtype if(!data.feed_type) { diff --git a/erpnext/startup/js/complete_setup.js b/erpnext/startup/js/complete_setup.js index 26b2d3b689f..ac89affa5c6 100644 --- a/erpnext/startup/js/complete_setup.js +++ b/erpnext/startup/js/complete_setup.js @@ -82,7 +82,7 @@ erpnext.complete_setup = function() { $c_obj('Setup Control','setup_account',data,function(r, rt){ sys_defaults = r.message; user_fullname = r.message.user_fullname; - wn.boot.user_fullnames[user] = user_fullname; + wn.boot.user_info[user].fullname = user_fullname; d.hide(); $('header').toggle(true); page_body.wntoolbar.set_user_name(); diff --git a/erpnext/utilities/page/messages/messages.js b/erpnext/utilities/page/messages/messages.js index 43adce404d8..f33c47b99dd 100644 --- a/erpnext/utilities/page/messages/messages.js +++ b/erpnext/utilities/page/messages/messages.js @@ -65,7 +65,7 @@ erpnext.messages = { $(wn.pages.messages).find('.well').toggle(contact==user ? false : true); $(wn.pages.messages).find('h1:first').html('Messages: ' - + (user==contact ? 'From everyone' : wn.boot.user_fullnames[contact])) + + (user==contact ? 'From everyone' : wn.user_info(contact).fullname)); erpnext.messages.contact = contact; erpnext.messages.list.opts.args.contact = contact; @@ -98,7 +98,7 @@ erpnext.messages = { }, render_row: function(wrapper, data) { data.creation = dateutil.comment_when(data.creation); - data.comment_by_fullname = wn.boot.user_fullnames[data.owner]; + data.comment_by_fullname = wn.user_info(data.owner).fullname; data.reply_html = ''; if(data.owner==user) { @@ -143,7 +143,7 @@ erpnext.messages = { var $body = $(wn.pages.messages).find('.section-body'); for(var i in r.message) { var p = r.message[i]; - p.fullname = wn.boot.user_fullnames[p.name]; + p.fullname = wn.user_info(p.name).fullname; p.name = p.name.replace('@', '__at__'); $body.append(repl('', p)) diff --git a/erpnext/utilities/page/users/users.js b/erpnext/utilities/page/users/users.js index 76f5672eebe..d1c916c6fd9 100644 --- a/erpnext/utilities/page/users/users.js +++ b/erpnext/utilities/page/users/users.js @@ -70,7 +70,7 @@ $.extend(wn.pages.users, { } else { data.imgsrc = 'lib/images/ui/no_img_' + (data.gender=='Female' ? 'f' : 'm') + '.gif'; } - data.fullname = wn.boot.user_fullnames[data.name]; + data.fullname = wn.user_info(data.name).fullname; data.delete_html = ''; if(!data.enabled) data.delete_html = '×'; @@ -232,6 +232,7 @@ $.extend(wn.pages.users, { $c_page('utilities', 'users', 'add_user', v, function(r,rt) { if(r.exc) { msgprint(r.exc); return; } else { + wn.boot.user_info[v.user] = {fullname:v.first_name + ' ' + v.last_name}; d.hide(); me.refresh(); } diff --git a/js/all-app.js b/js/all-app.js index e5e796783e3..fafaec294b9 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -201,6 +201,15 @@ wn.page={set:function(src){var new_selection=$('.inner div.content[_src="'+src+' $('.inner .current_page').removeClass('current_page');new_selection.addClass('current_page');var title=$('nav ul li a[href*="'+src+'"]').attr('title')||'No Title' state=window.location.hash;if(state!=src){window.location.hash=state;} else{document.title=title;}}} +/* + * lib/js/wn/misc/user.js + */ +wn.user_info=function(uid){var def={'fullname':uid,'image':'lib/images/ui/no_img_m.gif'} +if(!wn.boot.user_info)return def +if(!wn.boot.user_info[uid])return def +if(!wn.boot.user_info[uid].fullname) +wn.boot.user_info[uid].fullname=uid;if(!wn.boot.user_info[uid].image) +wn.boot.user_info[uid].image=def.image;return wn.boot.user_info[uid];} /* * lib/js/lib/json2.js */ @@ -2180,7 +2189,7 @@ me.dialog.clear();me.dialog.show();}}); /* * lib/js/legacy/app.js */ -var popup_cont;var session={};var start_sid=null;if(!wn)var wn={};function startup(){start_sid=get_cookie('sid');popup_cont=$a(document.getElementsByTagName('body')[0],'div');var setup_globals=function(r){wn.boot=r;profile=r.profile;user=r.profile.name;user_fullname=wn.boot.user_fullnames?wn.boot.user_fullnames[user]:'Guest';user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;home_page=r.home_page;_p.letter_heads=r.letter_heads;sys_defaults=r.sysdefaults;session.rt=profile.can_read;if(r.ipinfo)session.ipinfo=r.ipinfo;session.dt_labels=r.dt_labels;session.rev_dt_labels={} +var popup_cont;var session={};var start_sid=null;if(!wn)var wn={};function startup(){start_sid=get_cookie('sid');popup_cont=$a(document.getElementsByTagName('body')[0],'div');var setup_globals=function(r){wn.boot=r;profile=r.profile;user=r.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;home_page=r.home_page;_p.letter_heads=r.letter_heads;sys_defaults=r.sysdefaults;session.rt=profile.can_read;if(r.ipinfo)session.ipinfo=r.ipinfo;session.dt_labels=r.dt_labels;session.rev_dt_labels={} if(r.dt_labels){for(key in r.dt_labels)session.rev_dt_labels[r.dt_labels[key]]=key;} wn.control_panel=r.control_panel;} var setup_history=function(r){rename_observers.push(nav_obj);} diff --git a/js/all-web.js b/js/all-web.js index 1df96396cad..5137d58b60f 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -127,6 +127,15 @@ wn.page={set:function(src){var new_selection=$('.inner div.content[_src="'+src+' $('.inner .current_page').removeClass('current_page');new_selection.addClass('current_page');var title=$('nav ul li a[href*="'+src+'"]').attr('title')||'No Title' state=window.location.hash;if(state!=src){window.location.hash=state;} else{document.title=title;}}} +/* + * lib/js/wn/misc/user.js + */ +wn.user_info=function(uid){var def={'fullname':uid,'image':'lib/images/ui/no_img_m.gif'} +if(!wn.boot.user_info)return def +if(!wn.boot.user_info[uid])return def +if(!wn.boot.user_info[uid].fullname) +wn.boot.user_info[uid].fullname=uid;if(!wn.boot.user_info[uid].image) +wn.boot.user_info[uid].image=def.image;return wn.boot.user_info[uid];} /* * lib/js/lib/json2.js */ @@ -1028,7 +1037,7 @@ this.setup();} /* * lib/js/legacy/app.js */ -var popup_cont;var session={};var start_sid=null;if(!wn)var wn={};function startup(){start_sid=get_cookie('sid');popup_cont=$a(document.getElementsByTagName('body')[0],'div');var setup_globals=function(r){wn.boot=r;profile=r.profile;user=r.profile.name;user_fullname=wn.boot.user_fullnames?wn.boot.user_fullnames[user]:'Guest';user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;home_page=r.home_page;_p.letter_heads=r.letter_heads;sys_defaults=r.sysdefaults;session.rt=profile.can_read;if(r.ipinfo)session.ipinfo=r.ipinfo;session.dt_labels=r.dt_labels;session.rev_dt_labels={} +var popup_cont;var session={};var start_sid=null;if(!wn)var wn={};function startup(){start_sid=get_cookie('sid');popup_cont=$a(document.getElementsByTagName('body')[0],'div');var setup_globals=function(r){wn.boot=r;profile=r.profile;user=r.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;home_page=r.home_page;_p.letter_heads=r.letter_heads;sys_defaults=r.sysdefaults;session.rt=profile.can_read;if(r.ipinfo)session.ipinfo=r.ipinfo;session.dt_labels=r.dt_labels;session.rev_dt_labels={} if(r.dt_labels){for(key in r.dt_labels)session.rev_dt_labels[r.dt_labels[key]]=key;} wn.control_panel=r.control_panel;} var setup_history=function(r){rename_observers.push(nav_obj);} diff --git a/version.num b/version.num index c1891366fdb..eb6fa5affc4 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -769 \ No newline at end of file +773 \ No newline at end of file From a4f454faa04927f7d1e9b5ec4af6337aa2cbfc9a Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 29 Feb 2012 19:19:01 +0530 Subject: [PATCH 11/11] module page link fix --- erpnext/startup/js/modules.js | 5 ++++- erpnext/stock/page/stock_home/stock_home.html | 2 +- erpnext/website/page/website_home/website_home.html | 2 +- js/all-app.js | 4 ++-- js/all-web.js | 2 +- version.num | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/erpnext/startup/js/modules.js b/erpnext/startup/js/modules.js index dbd11b0b390..add068c75f9 100644 --- a/erpnext/startup/js/modules.js +++ b/erpnext/startup/js/modules.js @@ -73,7 +73,10 @@ erpnext.module_page.make_list = function(module, wrapper) { args: { module: module }, - no_refresh: true + no_refresh: true, + callback: function(r) { + erpnext.module_page.hide_links(wrapper) + } }); wrapper.list.run(); } \ No newline at end of file diff --git a/erpnext/stock/page/stock_home/stock_home.html b/erpnext/stock/page/stock_home/stock_home.html index 9ba21a43dd1..bab93dcfbd5 100644 --- a/erpnext/stock/page/stock_home/stock_home.html +++ b/erpnext/stock/page/stock_home/stock_home.html @@ -4,7 +4,7 @@

    Stock


    -

    Stock Entry

    +

    Stock Entry

    Transfer stock from one warehouse to another

    Delivery Note

    Delivery (shipment) to customers

    diff --git a/erpnext/website/page/website_home/website_home.html b/erpnext/website/page/website_home/website_home.html index 747ca5aa031..4c3c9c6c7b7 100644 --- a/erpnext/website/page/website_home/website_home.html +++ b/erpnext/website/page/website_home/website_home.html @@ -4,7 +4,7 @@

    Support


    -

    Web Page

    +

    Web Page

    Static (content) web page

    Product

    Product listed in catolog

    diff --git a/js/all-app.js b/js/all-app.js index fafaec294b9..be01071a0b0 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -901,7 +901,7 @@ this.clear=function(){this.results_area.innerHTML='';this.table=null;$ds(this.re this.make_results=function(r,rt){if(this.start==0)this.clear();$dh(this.more_button_area);if(this.loading_img)$dh(this.loading_img) if(r.message)r.values=r.message;if(r.values&&r.values.length){this.values=r.values;var m=Math.min(r.values.length,this.page_length);for(var i=0;i=this.page_length)$ds(this.more_button_area);}else{if(this.start==0){$dh(this.results_area);$ds(this.no_results_area);}} -if(this.onrun)this.onrun();if(this.opts.onrun)this.opts.onrun();} +if(this.onrun)this.onrun();if(this.opts.onrun)this.opts.onrun();if(this.opts.callback)this.opts.callback(r);} this.add_row=function(){return $a(this.results_area,'div','',(opts.cell_style?opts.cell_style:{padding:'3px 0px'}));} this.run=function(callback,append){if(callback) this.onrun=callback;if(!append) @@ -2255,7 +2255,7 @@ wn.provide('erpnext.module_page');erpnext.module_page.setup_page=function(module erpnext.module_page.hide_links=function(wrapper){$(wrapper).find('[href*="List/"]').each(function(){var href=$(this).attr('href');var dt=href.split('/')[1];if(wn.boot.profile.can_read.indexOf(get_label_doctype(dt))==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});$(wrapper).find('[data-doctype]').each(function(){var dt=$(this).attr('data-doctype');if(wn.boot.profile.can_read.indexOf(dt)==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});$(wrapper).find('[href*="Form/"]').each(function(){var href=$(this).attr('href');var dt=href.split('/')[1];if(wn.boot.profile.can_read.indexOf(get_label_doctype(dt))==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});} erpnext.module_page.make_list=function(module,wrapper){wrapper.list=new wn.widgets.Listing({parent:$(wrapper).find('.reports-list').get(0),method:'utilities.get_report_list',render_row:function(row,data){if(!data.parent_doc_type)data.parent_doc_type=data.doc_type;$(row).html(repl('\ - %(criteria_name)s',data))},args:{module:module},no_refresh:true});wrapper.list.run();} + %(criteria_name)s',data))},args:{module:module},no_refresh:true,callback:function(r){erpnext.module_page.hide_links(wrapper)}});wrapper.list.run();} /* * erpnext/startup/js/toolbar.js */ diff --git a/js/all-web.js b/js/all-web.js index 5137d58b60f..cad3c77fd32 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -716,7 +716,7 @@ this.clear=function(){this.results_area.innerHTML='';this.table=null;$ds(this.re this.make_results=function(r,rt){if(this.start==0)this.clear();$dh(this.more_button_area);if(this.loading_img)$dh(this.loading_img) if(r.message)r.values=r.message;if(r.values&&r.values.length){this.values=r.values;var m=Math.min(r.values.length,this.page_length);for(var i=0;i=this.page_length)$ds(this.more_button_area);}else{if(this.start==0){$dh(this.results_area);$ds(this.no_results_area);}} -if(this.onrun)this.onrun();if(this.opts.onrun)this.opts.onrun();} +if(this.onrun)this.onrun();if(this.opts.onrun)this.opts.onrun();if(this.opts.callback)this.opts.callback(r);} this.add_row=function(){return $a(this.results_area,'div','',(opts.cell_style?opts.cell_style:{padding:'3px 0px'}));} this.run=function(callback,append){if(callback) this.onrun=callback;if(!append) diff --git a/version.num b/version.num index eb6fa5affc4..fc0b67d079d 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -773 \ No newline at end of file +774 \ No newline at end of file