From b9d3ade2f42a2582353dffddaee4ba57e21bd834 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 27 Apr 2012 11:04:11 +0530 Subject: [PATCH 01/10] sales bom issue fixed --- erpnext/stock/doctype/sales_bom/sales_bom.py | 15 ++- erpnext/stock/doctype/sales_bom/sales_bom.txt | 115 ++++++++++++------ 2 files changed, 82 insertions(+), 48 deletions(-) diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.py b/erpnext/stock/doctype/sales_bom/sales_bom.py index ae3378e0ba..f2921646dd 100644 --- a/erpnext/stock/doctype/sales_bom/sales_bom.py +++ b/erpnext/stock/doctype/sales_bom/sales_bom.py @@ -67,7 +67,7 @@ class DocType: msgprint("Sales Bom Item " + d.item_code +" cannot be child item.") raise Exception # Check if is_main_item is modified once saved - if not self.doc.fields.get('__islocal') and d.is_main_item == "Yes" and cstr(d.item_code) != cstr(self.doc.name)[:-3] : + if not self.doc.fields.get('__islocal') and d.is_main_item == "Yes" and cstr(d.item_code) != cstr(self.doc.new_item_code)[:-3] : msgprint("Modifying the main item is not allowed.") raise Exception if len(is_main_item) > 1: @@ -165,19 +165,18 @@ class DocType: return # get all Sales BOM that have the first item - sbl = sql("select distinct parent from `tabSales BOM Item` where item_code=%s", il[0].item_code) + sbl = sql("select distinct parent from `tabSales BOM Item` where item_code=%s and parent != %s and docstatus != 2", (il[0].item_code, self.doc.name)) # check all siblings sub_items = [[d.item_code, flt(d.qty)] for d in il] for s in sbl: - if not cstr(s[0]) == cstr(self.doc.name) : - t = sql("select item_code, qty from `tabSales BOM Item` where parent=%s", s[0]) - t = [[d[0], flt(d[1])] for d in t] + t = sql("select item_code, qty from `tabSales BOM Item` where parent=%s and docstatus != 2", s[0]) + t = [[d[0], flt(d[1])] for d in t] - if self.has_same_items(sub_items, t): - msgprint("%s has the same Sales BOM details" % s[0]) - raise Exception + if self.has_same_items(sub_items, t): + msgprint("%s has the same Sales BOM details" % s[0]) + raise Exception if finder: msgprint("There is no Sales BOM present with the following Combination.") diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.txt b/erpnext/stock/doctype/sales_bom/sales_bom.txt index 476a3194b1..dfc2a6547d 100644 --- a/erpnext/stock/doctype/sales_bom/sales_bom.txt +++ b/erpnext/stock/doctype/sales_bom/sales_bom.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-04-23 16:00:21', + 'creation': '2012-04-26 13:04:56', 'docstatus': 0, - 'modified': '2012-04-24 15:07:42', + 'modified': '2012-04-27 11:00:18', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -15,7 +15,6 @@ '_last_update': u'1322549701', 'allow_trash': 1, 'colour': u'White:FFF', - 'default_print_format': u'Standard', 'doctype': 'DocType', 'document_type': u'Master', 'is_submittable': 1, @@ -124,6 +123,24 @@ 'write': 0 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'basic_section', + 'fieldtype': u'Section Break', + 'label': u'Basic Section', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'col1', + 'fieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' + }, + # DocField { 'doctype': u'DocField', @@ -173,6 +190,15 @@ 'width': u'300px' }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'col2', + 'fieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' + }, + # DocField { 'doctype': u'DocField', @@ -186,6 +212,18 @@ 'reqd': 1 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'stock_uom', + 'fieldtype': u'Link', + 'label': u'Stock UOM', + 'oldfieldname': u'stock_uom', + 'oldfieldtype': u'Link', + 'options': u'UOM', + 'permlevel': 0 + }, + # DocField { 'colour': u'White:FFF', @@ -214,42 +252,6 @@ 'trigger': u'Client' }, - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'find_sales_bom', - 'fieldtype': u'Button', - 'label': u'Find Sales BOM', - 'oldfieldtype': u'Button', - 'permlevel': 0, - 'trigger': u'Client' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'sales_bom_items', - 'fieldtype': u'Table', - 'label': u'Sales BOM Items', - 'oldfieldname': u'sales_bom_items', - 'oldfieldtype': u'Table', - 'options': u'Sales BOM Item', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'stock_uom', - 'fieldtype': u'Link', - 'label': u'Stock UOM', - 'oldfieldname': u'stock_uom', - 'oldfieldtype': u'Link', - 'options': u'UOM', - 'permlevel': 0 - }, - # DocField { 'depends_on': u'eval:doc.amended_from', @@ -270,11 +272,44 @@ 'fieldtype': u'Link', 'label': u'Amended From', 'no_copy': 1, - 'options': u'Sales Invoice', + 'options': u'Sales BOM', 'permlevel': 1, 'print_hide': 1 }, + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'find_sales_bom', + 'fieldtype': u'Button', + 'label': u'Find Sales BOM', + 'oldfieldtype': u'Button', + 'permlevel': 0, + 'trigger': u'Client' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'item_section', + 'fieldtype': u'Section Break', + 'label': u'Items', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'sales_bom_items', + 'fieldtype': u'Table', + 'label': u'Sales BOM Items', + 'oldfieldname': u'sales_bom_items', + 'oldfieldtype': u'Table', + 'options': u'Sales BOM Item', + 'permlevel': 0 + }, + # DocField { 'doctype': u'DocField', From 762056aaa8559dd78ff6bc2590307389abe96522 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 27 Apr 2012 11:06:12 +0530 Subject: [PATCH 02/10] sales bom amendment issue fixed --- erpnext/stock/doctype/sales_bom/sales_bom.py | 18 +- erpnext/stock/doctype/sales_bom/sales_bom.txt | 460 +++++++++++------- 2 files changed, 288 insertions(+), 190 deletions(-) diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.py b/erpnext/stock/doctype/sales_bom/sales_bom.py index 39fa2cda54..93d700810e 100644 --- a/erpnext/stock/doctype/sales_bom/sales_bom.py +++ b/erpnext/stock/doctype/sales_bom/sales_bom.py @@ -67,7 +67,7 @@ class DocType: msgprint("Sales Bom Item " + d.item_code +" cannot be child item.") raise Exception # Check if is_main_item is modified once saved - if not self.doc.fields.get('__islocal') and d.is_main_item == "Yes" and cstr(d.item_code) != cstr(self.doc.name)[:-3] : + if not self.doc.fields.get('__islocal') and d.is_main_item == "Yes" and cstr(d.item_code) != cstr(self.doc.new_item_code)[:-3]: msgprint("Modifying the main item is not allowed.") raise Exception if len(is_main_item) > 1: @@ -193,19 +193,17 @@ class DocType: return # get all Sales BOM that have the first item - sbl = sql("select distinct parent from `tabSales BOM Detail` where item_code=%s", il[0].item_code) + sbl = sql("select distinct parent from `tabSales BOM Detail` where item_code=%s and parent != %s and docstatus != 2", (il[0].item_code, self.doc.name)) # check all siblings sub_items = [[d.item_code, flt(d.qty)] for d in il] - for s in sbl: - if not cstr(s[0]) == cstr(self.doc.name) : - t = sql("select item_code, qty from `tabSales BOM Detail` where parent=%s", s[0]) - t = [[d[0], flt(d[1])] for d in t] + t = sql("select item_code, qty from `tabSales BOM Detail` where parent=%s and docstatus != 2", s[0]) + t = [[d[0], flt(d[1])] for d in t] - if self.has_same_items(sub_items, t): - msgprint("%s has the same Sales BOM details" % s[0]) - raise Exception + if self.has_same_items(sub_items, t): + msgprint("%s has the same Sales BOM details" % s[0]) + raise Exception if finder: msgprint("There is no Sales BOM present with the following Combination.") @@ -218,4 +216,4 @@ class DocType: for l in l1: if l not in l2: return 0 - return 1 \ No newline at end of file + return 1 diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.txt b/erpnext/stock/doctype/sales_bom/sales_bom.txt index b97458aec3..042ed44dbf 100644 --- a/erpnext/stock/doctype/sales_bom/sales_bom.txt +++ b/erpnext/stock/doctype/sales_bom/sales_bom.txt @@ -3,50 +3,78 @@ # These values are common in all dictionaries { - 'creation': '2010-08-08 17:09:21', + 'creation': '2009-05-12 16:47:47', 'docstatus': 0, - 'modified': '2010-12-23 11:43:34', - 'modified_by': 'umair@iwebnotes.com', - 'owner': 'Administrator' + 'modified': '2012-04-27 10:32:49', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all DocType { + '_last_update': u'1332222225', + 'allow_attach': 0, + 'allow_copy': 0, + 'allow_email': 0, + 'allow_print': 0, + 'allow_rename': 0, 'allow_trash': 1, - 'colour': 'White:FFF', + 'colour': u'White:FFF', 'doctype': 'DocType', - 'document_type': 'Master', - 'module': 'Stock', + 'document_type': u'Master', + 'hide_heading': 0, + 'hide_toolbar': 0, + 'in_create': 0, + 'in_dialog': 0, + 'is_transaction_doc': 0, + 'issingle': 0, + 'max_attachments': 0, + 'module': u'Stock', 'name': '__common__', - 'section_style': 'Simple', - 'server_code_error': ' ', + 'read_only': 0, + 'read_only_onload': 0, + 'section_style': u'Simple', + 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 37 + 'use_template': 0, + 'version': 1 }, # These values are common for all DocField { - 'doctype': 'DocField', + 'doctype': u'DocField', 'name': '__common__', - 'parent': 'Sales BOM', - 'parentfield': 'fields', - 'parenttype': 'DocType' + 'parent': u'Sales BOM', + 'parentfield': u'fields', + 'parenttype': u'DocType' }, # These values are common for all DocPerm { - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'name': '__common__', - 'parent': 'Sales BOM', - 'parentfield': 'permissions', - 'parenttype': 'DocType', + 'parent': u'Sales BOM', + 'parentfield': u'permissions', + 'parenttype': u'DocType', 'read': 1 }, # DocType, Sales BOM { 'doctype': 'DocType', - 'name': 'Sales BOM' + 'name': u'Sales BOM' + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales User', + 'submit': 0, + 'write': 1 }, # DocPerm @@ -54,10 +82,21 @@ 'amend': 0, 'cancel': 0, 'create': 0, - 'doctype': 'DocPerm', - 'idx': 1, + 'doctype': u'DocPerm', 'permlevel': 1, - 'role': 'Material Manager', + 'role': u'Sales User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material Manager', 'submit': 0, 'write': 0 }, @@ -67,10 +106,9 @@ 'amend': 1, 'cancel': 1, 'create': 1, - 'doctype': 'DocPerm', - 'idx': 2, + 'doctype': u'DocPerm', 'permlevel': 0, - 'role': 'Material Manager', + 'role': u'Material Manager', 'submit': 1, 'write': 1 }, @@ -80,10 +118,9 @@ 'amend': 0, 'cancel': 0, 'create': 0, - 'doctype': 'DocPerm', - 'idx': 3, + 'doctype': u'DocPerm', 'permlevel': 1, - 'role': 'Material User', + 'role': u'Material User', 'submit': 0, 'write': 0 }, @@ -93,182 +130,245 @@ 'amend': 0, 'cancel': 0, 'create': 0, - 'doctype': 'DocPerm', - 'idx': 4, + 'doctype': u'DocPerm', 'permlevel': 0, - 'role': 'Material User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 1, - 'create': 1, - 'doctype': 'DocPerm', - 'idx': 5, - 'permlevel': 0, - 'role': 'Sales User', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': 'DocPerm', - 'idx': 6, - 'permlevel': 1, - 'role': 'Sales User', + 'role': u'Material User', 'submit': 0, 'write': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'trash_reason', - 'fieldtype': 'Small Text', - 'idx': 1, - 'label': 'Trash Reason', - 'oldfieldname': 'trash_reason', - 'oldfieldtype': 'Small Text', - 'permlevel': 1 - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'new_item_code', - 'fieldtype': 'Data', - 'idx': 2, - 'label': 'New Item Code', + 'allow_on_submit': 0, + 'doctype': u'DocField', + 'fieldname': u'new_item_code', + 'fieldtype': u'Data', + 'hidden': 0, + 'in_filter': 0, + 'label': u'New Item Code', 'no_copy': 1, - 'oldfieldname': 'new_item_code', - 'oldfieldtype': 'Data', + 'oldfieldname': u'new_item_code', + 'oldfieldtype': u'Data', 'permlevel': 1, - 'reqd': 0 + 'print_hide': 0, + 'report_hide': 0, + 'reqd': 0, + 'search_index': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'new_item_name', - 'fieldtype': 'Data', - 'idx': 3, - 'label': 'New Item Name', - 'oldfieldname': 'new_item_name', - 'oldfieldtype': 'Data', + 'allow_on_submit': 0, + 'doctype': u'DocField', + 'fieldname': u'new_item_name', + 'fieldtype': u'Data', + 'hidden': 0, + 'in_filter': 0, + 'label': u'New Item Name', + 'no_copy': 0, + 'oldfieldname': u'new_item_name', + 'oldfieldtype': u'Data', + 'permlevel': 1, + 'print_hide': 0, + 'report_hide': 0, + 'reqd': 0, + 'search_index': 0 + }, + + # DocField + { + 'allow_on_submit': 0, + 'doctype': u'DocField', + 'fieldname': u'new_item_brand', + 'fieldtype': u'Data', + 'hidden': 0, + 'in_filter': 0, + 'label': u'New Item Brand', + 'no_copy': 0, + 'oldfieldname': u'new_item_brand', + 'oldfieldtype': u'Data', + 'permlevel': 1, + 'print_hide': 0, + 'report_hide': 0, + 'reqd': 0, + 'search_index': 0 + }, + + # DocField + { + 'allow_on_submit': 0, + 'doctype': u'DocField', + 'fieldname': u'description', + 'fieldtype': u'Text', + 'hidden': 0, + 'in_filter': 0, + 'label': u'New Description', + 'no_copy': 0, + 'oldfieldname': u'description', + 'oldfieldtype': u'Text', + 'permlevel': 1, + 'print_hide': 0, + 'report_hide': 0, + 'reqd': 0, + 'search_index': 0, + 'width': u'300px' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'amended_from', + 'fieldtype': u'Data', + 'label': u'Amended From', 'permlevel': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'new_item_brand', - 'fieldtype': 'Data', - 'idx': 4, - 'label': 'New Item Brand', - 'oldfieldname': 'new_item_brand', - 'oldfieldtype': 'Data', + 'doctype': u'DocField', + 'fieldname': u'amendment_date', + 'fieldtype': u'Date', + 'label': u'Amendment Date', 'permlevel': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'description', - 'fieldtype': 'Text', - 'idx': 5, - 'label': 'New Description', - 'oldfieldname': 'description', - 'oldfieldtype': 'Text', + 'allow_on_submit': 0, + 'doctype': u'DocField', + 'fieldname': u'item_group', + 'fieldtype': u'Link', + 'hidden': 0, + 'in_filter': 0, + 'label': u'Item Group', + 'no_copy': 0, + 'oldfieldname': u'item_group', + 'oldfieldtype': u'Link', + 'options': u'Item Group', + 'permlevel': 0, + 'print_hide': 0, + 'report_hide': 0, + 'reqd': 0, + 'search_index': 0 + }, + + # DocField + { + 'allow_on_submit': 0, + 'doctype': u'DocField', + 'fieldname': u'price_list', + 'fieldtype': u'Select', + 'hidden': 0, + 'in_filter': 0, + 'label': u'Price List', + 'no_copy': 0, + 'oldfieldname': u'price_list', + 'oldfieldtype': u'Select', + 'options': u'link:Price List', + 'permlevel': 0, + 'print_hide': 0, + 'report_hide': 0, + 'reqd': 0, + 'search_index': 0, + 'trigger': u'Client' + }, + + # DocField + { + 'allow_on_submit': 0, + 'doctype': u'DocField', + 'fieldname': u'currency', + 'fieldtype': u'Select', + 'hidden': 0, + 'in_filter': 0, + 'label': u'Currency', + 'no_copy': 0, + 'oldfieldname': u'currency', + 'oldfieldtype': u'Select', + 'options': u'link:Currency', + 'permlevel': 0, + 'print_hide': 0, + 'report_hide': 0, + 'reqd': 0, + 'search_index': 0, + 'trigger': u'Client' + }, + + # DocField + { + 'allow_on_submit': 0, + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldtype': u'Button', + 'hidden': 0, + 'in_filter': 0, + 'label': u'Find Sales BOM', + 'no_copy': 0, + 'oldfieldtype': u'Button', + 'permlevel': 0, + 'print_hide': 0, + 'report_hide': 0, + 'reqd': 0, + 'search_index': 0, + 'trigger': u'Client' + }, + + # DocField + { + 'allow_on_submit': 0, + 'doctype': u'DocField', + 'fieldname': u'sales_bom_items', + 'fieldtype': u'Table', + 'hidden': 0, + 'in_filter': 0, + 'label': u'Sales BOM Items', + 'no_copy': 0, + 'oldfieldname': u'sales_bom_items', + 'oldfieldtype': u'Table', + 'options': u'Sales BOM Detail', + 'permlevel': 0, + 'print_hide': 0, + 'report_hide': 0, + 'reqd': 0, + 'search_index': 0 + }, + + # DocField + { + 'allow_on_submit': 0, + 'doctype': u'DocField', + 'fieldname': u'stock_uom', + 'fieldtype': u'Link', + 'hidden': 0, + 'in_filter': 0, + 'label': u'Stock UOM', + 'no_copy': 0, + 'oldfieldname': u'stock_uom', + 'oldfieldtype': u'Link', + 'options': u'UOM', + 'permlevel': 0, + 'print_hide': 0, + 'report_hide': 0, + 'reqd': 0, + 'search_index': 0 + }, + + # DocField + { + 'allow_on_submit': 0, + 'doctype': u'DocField', + 'fieldname': u'trash_reason', + 'fieldtype': u'Small Text', + 'hidden': 0, + 'in_filter': 0, + 'label': u'Trash Reason', + 'no_copy': 0, + 'oldfieldname': u'trash_reason', + 'oldfieldtype': u'Small Text', 'permlevel': 1, - 'width': '300px' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'item_group', - 'fieldtype': 'Link', - 'idx': 7, - 'label': 'Item Group', - 'oldfieldname': 'item_group', - 'oldfieldtype': 'Link', - 'options': 'Item Group', - 'permlevel': 0 - }, - - # DocField - { - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'price_list', - 'fieldtype': 'Select', - 'idx': 8, - 'label': 'Price List', - 'oldfieldname': 'price_list', - 'oldfieldtype': 'Select', - 'options': 'link:Price List', - 'permlevel': 0, - 'trigger': 'Client' - }, - - # DocField - { - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'currency', - 'fieldtype': 'Select', - 'idx': 9, - 'label': 'Currency', - 'oldfieldname': 'currency', - 'oldfieldtype': 'Select', - 'options': 'link:Currency', - 'permlevel': 0, - 'trigger': 'Client' - }, - - # DocField - { - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldtype': 'Button', - 'idx': 10, - 'label': 'Find Sales BOM', - 'oldfieldtype': 'Button', - 'permlevel': 0, - 'trigger': 'Client' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'sales_bom_items', - 'fieldtype': 'Table', - 'idx': 11, - 'label': 'Sales BOM Items', - 'oldfieldname': 'sales_bom_items', - 'oldfieldtype': 'Table', - 'options': 'Sales BOM Detail', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'stock_uom', - 'fieldtype': 'Link', - 'idx': 12, - 'label': 'Stock UOM', - 'oldfieldname': 'stock_uom', - 'oldfieldtype': 'Link', - 'options': 'UOM', - 'permlevel': 0, + 'print_hide': 0, + 'report_hide': 0, + 'reqd': 0, 'search_index': 0 } ] \ No newline at end of file From de975ff3077170b927398dafd35328fc0d76bead Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 27 Apr 2012 13:53:20 +0530 Subject: [PATCH 03/10] fixed filtering issue in gs --- .../search_criteria/stock_report/stock_report.js | 13 ++++++------- .../search_criteria/stock_report/stock_report.py | 9 +++------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/erpnext/stock/search_criteria/stock_report/stock_report.js b/erpnext/stock/search_criteria/stock_report/stock_report.js index 5451eb10e9..d08d1e75e7 100644 --- a/erpnext/stock/search_criteria/stock_report/stock_report.js +++ b/erpnext/stock/search_criteria/stock_report/stock_report.js @@ -19,7 +19,7 @@ report.customize_filters = function() { this.mytabs.items['Select Columns'].hide() this.mytabs.items['More Filters'].hide() this.hide_all_filters(); - this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Warehouse'+NEWLINE+'Item Code',report_default:'Warehouse',ignore : 1,parent:'Stock Ledger Entry'}); + this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Warehouse'+NEWLINE+'Item Code',ignore : 1,parent:'Stock Ledger Entry'}); this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0; this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Item Code'].df.filter_hide = 0; this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Warehouse'].df.filter_hide = 0; @@ -57,8 +57,8 @@ report.get_query = function(){ ware_type_cond = repl(' AND `tabWarehouse`.warehouse_type IN (%(war)s)', {war: war.substr(0,war.length-1)}) } - if(based_on.length == 1){ - if(based_on == 'Item Code'){ + if(based_on.length == 1 && based_on[0]){ + if(based_on[0] == 'Item Code'){ cols = '`tabItem`.name AS "Item Code", `tabItem`.item_name AS "Item Name", `tabItem`.description AS "Description", `tabItem`.stock_uom AS "Stock UOM"'; cond = '(IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.is_stock_item = "Yes"'; if(item_code) cond += repl(' AND `tabItem`.name = %(item)s', {item:'"'+item_code+'"'}); @@ -66,7 +66,7 @@ report.get_query = function(){ tables = '`tabItem`'; group_by = '`tabStock Ledger Entry`.item_code'; } - else if(based_on == 'Warehouse'){ + else if(based_on[0] == 'Warehouse'){ cols = '`tabWarehouse`.name AS "Warehouse", `tabWarehouse`.warehouse_type AS "Warehouse Type"'; cond = '`tabWarehouse`.docstatus < 2' if(warehouse) cond += repl(' AND `tabWarehouse`.name = %(warehouse)s', {warehouse:'"'+warehouse+'"'}); @@ -74,8 +74,7 @@ report.get_query = function(){ tables = '`tabWarehouse`'; group_by = '`tabStock Ledger Entry`.warehouse'; } - } - else if(based_on.length == 2){ + } else { cols = '`tabItem`.name AS "Item Code", `tabItem`.item_name AS "Item Name", `tabItem`.description AS "Description", `tabItem`.stock_uom AS "Stock UOM", `tabWarehouse`.name AS "Warehouse", `tabWarehouse`.warehouse_type AS "Warehouse Type"'; cond = '(IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.is_stock_item = "Yes" AND `tabWarehouse`.docstatus < 2'; if(item_code) cond += repl(" AND `tabItem`.name = %(item)s", {item:"'"+item_code+"'"}); @@ -87,4 +86,4 @@ report.get_query = function(){ q = repl("SELECT %(cols)s FROM %(tables)s, `tabStock Ledger Entry` WHERE %(cond)s %(date_cond)s GROUP BY %(group_by)s", {cols:cols, tables:tables, cond:cond, date_cond:date_cond, group_by:group_by}); return q; -} \ No newline at end of file +} diff --git a/erpnext/stock/search_criteria/stock_report/stock_report.py b/erpnext/stock/search_criteria/stock_report/stock_report.py index 84866e93ee..b87f684d24 100644 --- a/erpnext/stock/search_criteria/stock_report/stock_report.py +++ b/erpnext/stock/search_criteria/stock_report/stock_report.py @@ -14,19 +14,16 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if not filter_values.get('based_on'): - msgprint("Please Select Based On") - raise Exception cols, columns = [], [] # Add columns # ------------ based_on = filter_values.get('based_on').split(NEWLINE) -if len(based_on) == 1: +if len(based_on) == 1 and based_on[0]: if based_on[0] == 'Item Code': cols = ["Item Code", "Item Name", "Description", "Stock UOM"] elif based_on[0] == 'Warehouse': cols = ["Warehouse", "Warehouse Type"] -elif len(based_on) == 2: +else: cols = ["Item Code", "Item Name", "Description", "Stock UOM", "Warehouse", "Warehouse Type"] for d in cols: @@ -65,7 +62,7 @@ out=[] cl_bal,tot_stock = 0,0 for r in res: - if len(based_on) == 1: + if len(based_on) == 1 and based_on[0]: if based_on[0] == 'Item Code': closing_balance, stock_value = get_values(msgprint, flt, posting_date, item_code = r[col_idx['Item Code']]) elif based_on[0] == 'Warehouse': closing_balance, stock_value = get_values(msgprint, flt, posting_date, warehouse = r[col_idx['Warehouse']]) r.append(closing_balance) From 0d1daa8875aef6ea8fc154f93effb99215ea38ce Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 27 Apr 2012 13:56:58 +0530 Subject: [PATCH 04/10] fld order change --- .../purchase_invoice/purchase_invoice.txt | 30 +++++++++---------- .../stock_report/stock_report.js | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt index 666cd1c02c..18bd7898c4 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt @@ -5,7 +5,7 @@ { 'creation': '2012-04-13 11:56:17', 'docstatus': 0, - 'modified': '2012-04-23 12:08:52', + 'modified': '2012-04-27 11:21:21', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -186,20 +186,6 @@ 'trigger': u'Client' }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'amended_from', - 'fieldtype': u'Link', - 'label': u'Amended From', - 'no_copy': 1, - 'oldfieldname': u'amended_from', - 'oldfieldtype': u'Link', - 'options': u'Purchase Invoice', - 'permlevel': 1, - 'print_hide': 1 - }, - # DocField { 'colour': u'White:FFF', @@ -359,6 +345,20 @@ 'search_index': 1 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'amended_from', + 'fieldtype': u'Link', + 'label': u'Amended From', + 'no_copy': 1, + 'oldfieldname': u'amended_from', + 'oldfieldtype': u'Link', + 'options': u'Purchase Invoice', + 'permlevel': 1, + 'print_hide': 1 + }, + # DocField { 'description': u'The date at which current entry is corrected in the system.', diff --git a/erpnext/stock/search_criteria/stock_report/stock_report.js b/erpnext/stock/search_criteria/stock_report/stock_report.js index 5451eb10e9..2e348bcefe 100644 --- a/erpnext/stock/search_criteria/stock_report/stock_report.js +++ b/erpnext/stock/search_criteria/stock_report/stock_report.js @@ -87,4 +87,4 @@ report.get_query = function(){ q = repl("SELECT %(cols)s FROM %(tables)s, `tabStock Ledger Entry` WHERE %(cond)s %(date_cond)s GROUP BY %(group_by)s", {cols:cols, tables:tables, cond:cond, date_cond:date_cond, group_by:group_by}); return q; -} \ No newline at end of file +} From 1ed4ef194659f6d0f671c63b5d476c08563045ee Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 27 Apr 2012 15:30:23 +0530 Subject: [PATCH 05/10] fixes in setup --- css/all-app.css | 9 + css/all-web.css | 9 + .../doctype/setup_control/setup_control.py | 66 +-- erpnext/startup/event_handlers.py | 66 ++- erpnext/startup/js/complete_setup.js | 527 +++++++++++++++--- erpnext/startup/startup.css | 9 + erpnext/startup/startup.js | 22 +- erpnext/utilities/page/users/users.css | 11 + erpnext/utilities/page/users/users.js | 26 + erpnext/utilities/page/users/users.py | 19 +- index.cgi | 4 +- js/all-app.js | 11 +- js/all-web.js | 11 +- 13 files changed, 623 insertions(+), 167 deletions(-) diff --git a/css/all-app.css b/css/all-app.css index 21cf8fb041..8ee043f90d 100644 --- a/css/all-app.css +++ b/css/all-app.css @@ -3622,3 +3622,12 @@ body { max-width: 260px !important; } +.expiry-info { + margin-top: 40px; + margin-bottom: -40px; + text-align: center; + background-color: rgb(255, 255, 204); + padding: 7px; + z-index: 1; +} + diff --git a/css/all-web.css b/css/all-web.css index 8ac14cb716..cf8fe990ed 100644 --- a/css/all-web.css +++ b/css/all-web.css @@ -1939,6 +1939,15 @@ body { max-width: 260px !important; } +.expiry-info { + margin-top: 40px; + margin-bottom: -40px; + text-align: center; + background-color: rgb(255, 255, 204); + padding: 7px; + z-index: 1; +} + /* * erpnext/website/css/website.css diff --git a/erpnext/setup/doctype/setup_control/setup_control.py b/erpnext/setup/doctype/setup_control/setup_control.py index ba39358866..af7bf9a016 100644 --- a/erpnext/setup/doctype/setup_control/setup_control.py +++ b/erpnext/setup/doctype/setup_control/setup_control.py @@ -27,42 +27,6 @@ class DocType: def __init__(self, d, dl): self.doc, self.doclist = d, dl - #Default Naming Series - #--------------------------------------------------- - def naming_series(self): - ns = [['TDS Payment', 'TDSP'], ['Purchase Invoice', 'BILL'], ['Journal Voucher', 'JV'], ['Sales Invoice', 'INV'], ['Lead', 'Lead'], ['Purchase Request', 'IDT'], ['Opportunity', 'Opportunity'], ['Purchase Order', 'PO'], ['Quotation', 'QTN'], ['Purchase Receipt', 'GRN'], ['Stock Entry', 'STE'], ['Sales Order', 'SO'], ['Delivery Note', 'DN'], ['Employee', 'EMP/']] - for r in ns: - rec = Document('Naming Series') - rec.select_doc_for_series = r[0] - rec.new_series = r[1] - rec_obj = get_obj(doc=rec) - rec_obj.add_series() - - # set account details - #----------------------- - def set_account_details(self, args): - """ - Called from gateway after allocation - """ - import json - 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')) - - # Domain related updates - try: - from server_tools.gateway_utils import add_domain_map - add_domain_map(args) - except ImportError, e: - pass - - # add record in domain_list of Website Settings - account_url = args['url_name'] + '.erpnext.com' - webnotes.conn.set_value('Website Settings', 'Website Settings', - 'subdomain', account_url) - - # Account Setup # --------------- def setup_account(self, args): @@ -117,6 +81,7 @@ class DocType: # Set self.set_defaults(def_args) + self.set_cp_defaults(**args) self.create_feed_and_todo() @@ -204,14 +169,12 @@ class DocType: # Set Control Panel Defaults # -------------------------- - def set_cp_defaults(self, cname, industry, timezone, country, acc_name): + def set_cp_defaults(self, industry, country, timezone, company_name): cp = Document('Control Panel','Control Panel') - cp.account_id = acc_name - cp.company_name = cname + cp.company_name = company_name cp.industry = industry cp.time_zone = timezone cp.country = country - cp.client_name = '
'+cname+'
' cp.save() # Create Profile @@ -238,25 +201,4 @@ class DocType: for r in roles_list: d = addchild(pr,'userroles', 'UserRole', 1) d.role = r - d.save(1) - - - def is_setup_okay(self, args): - """ - Validates if setup has been performed after database allocation - """ - - from server_tools.gateway_utils import get_total_users - - 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() - - if (cp_defaults==args['account_name']) and user_profile and \ - (total_users==cint(args['total_users'])): - return 'True' - + d.save(1) \ No newline at end of file diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py index 052704551c..fc0e118a4c 100644 --- a/erpnext/startup/event_handlers.py +++ b/erpnext/startup/event_handlers.py @@ -34,7 +34,10 @@ def on_login_post_session(login_manager): sid!=%s""", \ (webnotes.session['user'], webnotes.session['sid']), as_list=1) - if webnotes.session['user'] not in ('Guest', 'demo@webnotestech.com') and webnotes.conn.cur_db_name!='accounts': + # check if account is expired + check_if_expired() + + if webnotes.session['user'] not in ('Guest', 'demo@webnotestech.com'): # create feed from webnotes.utils import nowtime home.make_feed('Login', 'Profile', login_manager.user, login_manager.user, @@ -82,6 +85,11 @@ def boot_session(bootinfo): tabCompany limit 1""") and 'Yes' or 'No' bootinfo['user_background'] = webnotes.conn.get_value("Profile", webnotes.session['user'], 'background_image') or '' + + # load subscription info + import conf + if hasattr(conf, 'max_users'): bootinfo['max_users'] = conf.max_users + if hasattr(conf, 'expires_on'): bootinfo['expires_on'] = conf.expires_on def get_letter_heads(): @@ -90,27 +98,37 @@ def get_letter_heads(): ret = webnotes.conn.sql("""select name, content from `tabLetter Head` where ifnull(disabled,0)=0""") return dict(ret) + -def login_as(login_manager): - """ - Login as functionality -- allows signin from signin.erpnext.com - """ - # login as user - user = webnotes.form.getvalue('login_as') - if user: - if isinstance(webnotes.session, dict): - webnotes.session['user'] = user - else: - webnotes.session = {'user': user} - - login_manager.user = user - first_name, last_name = webnotes.conn.sql("select first_name, last_name from `tabProfile` where name=%s", user)[0] - - login_manager.user_fullname = (first_name and first_name or "") + (last_name and " " + last_name or "") - - # alisaing here... so check if the user is disabled - if not webnotes.conn.sql("select ifnull(enabled,0) from tabProfile where name=%s", user)[0][0]: - # throw execption - webnotes.msgprint("Authentication Failed", raise_exception=1) - - return login_manager +def check_if_expired(): + """check if account is expired. If expired, do not allow login""" + import conf + # check if expires_on is specified + if not hasattr(conf, 'expires_on'): return + + # check if expired + from datetime import datetime, date + expires_on = datetime.strptime(conf.expires_on, '%Y-%m-%d').date() + if date.today() <= expires_on: return + + # if expired, stop user from logging in + from webnotes.utils import formatdate + if 'System Manager' in webnotes.user.roles: + webnotes.response['server_messages'] = """Oops! \ + Your subscription expired on %s. + + Nothing catastrophic. + + Just drop in a mail at support@erpnext.com and \ + we will guide you to get your account re-activated.""" % formatdate(conf.expires_on) + else: + webnotes.response['server_messages'] = """Oops! \ + Your subscription expired on %s. + + Nothing catastrophic. + + Just ask your System Manager to drop in a mail at support@erpnext.com and \ + we will guide him to get your account re-activated.""" % formatdate(conf.expires_on) + + webnotes.response['message'] = 'Account Expired' + raise webnotes.AuthenticationError \ No newline at end of file diff --git a/erpnext/startup/js/complete_setup.js b/erpnext/startup/js/complete_setup.js index c643813a2d..88fb1f0f25 100644 --- a/erpnext/startup/js/complete_setup.js +++ b/erpnext/startup/js/complete_setup.js @@ -16,78 +16,463 @@ // complete my company registration // -------------------------------- +wn.provide('erpnext.complete_setup'); -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']; +$.extend(erpnext.complete_setup, { + + show: function() { + d = erpnext.complete_setup.prepare_dialog(); + d.show(); + }, - var d = new wn.widgets.Dialog({ - title: "Setup", - fields: [ - {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"'}, - {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'), fieldtype: 'Select'}, - {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.split(' '); - 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_info[user].fullname = user_fullname; - d.hide(); - $('header').toggle(true); - wn.container.wntoolbar.set_user_name(); + prepare_dialog: function() { + + var d = new wn.widgets.Dialog({ + title: "Setup", + fields: [ + {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"'}, + {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: erpnext.complete_setup.fy_start_list.join('\n')}, + {fieldname:'currency', label: 'Default Currency', reqd:1, + options: erpnext.complete_setup.currency_list.join('\n'), fieldtype: 'Select'}, + {fieldname:'industry', label: 'Industry', reqd:1, + options: erpnext.complete_setup.industry_list.join('\n'), fieldtype: 'Select'}, + {fieldname:'country', label: 'Country', reqd:1, + options: erpnext.complete_setup.country_list.join('\n'), fieldtype: 'Select'}, + {fieldname:'timezone', label: 'Time Zone', reqd:1, + options: "", fieldtype: 'Select'}, + {fieldname:'update', label:'Setup',fieldtype:'Button'}, + ], }); - } + + if(user != 'Administrator'){ + $(d.appframe.$titlebar).find('.close').toggle(false); // Hide close image + $('header').toggle(false); // hide toolbar + } + + // on clicking update + 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_info[user].fullname = user_fullname; + d.hide(); + $('header').toggle(true); + wn.container.wntoolbar.set_user_name(); + }); + }; + + d.fields_dict.country.input.onchange = function() { + var country = d.fields_dict.country.input.value; + var $timezone = $(d.fields_dict.timezone.input); + $timezone.empty(); + if(country){ + var timezone_list = erpnext.complete_setup.timezone_dict[country]; + if(timezone_list.length > 1) { + timezone_list = [""].concat(timezone_list); + } + $timezone.add_options(timezone_list); + } + }; + + // 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.split(' '); + if(u[0]) { + d.fields_dict.first_name.input.value = u[0]; + } + if(u[1]) { + d.fields_dict.last_name.input.value = u[1]; + } + } + + return d; + }, - d.show(); -} + fy_start_list: ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct'], + + 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'], + + industry_list: ['', 'Aerospace and Defence', 'Agriculture', 'Apparel', 'Automobile', + 'Banking', 'Biotechnology', 'Chemical', 'Communications', 'Consulting', 'Customer Service', + 'Education', 'Electronics', 'Energy', 'Engineering', 'Entertainment', 'Environmental', + 'Finance', 'Food and Beverage', 'Government', 'Healthcare', 'Hospitality', + 'Information Technology', 'Insurance', 'Machinery', 'Manufacturing', 'Media', + 'Not For Profit', 'Recreation', 'Retail', 'Shipping', 'Technology', + 'Telecommunications', 'Transportation', 'Trading', 'Utilities', 'Other'], + + country_list: ["", 'Afghanistan', 'Albania', 'Algeria', 'Andorra', 'Angola', 'Antigua and Barbuda', + 'Argentina', 'Armenia', 'Australia', 'Austria', 'Azerbaijan', 'Bahamas', 'Bahrain', + 'Bangladesh', 'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bhutan', 'Bolivia', + 'Bosnia and Herzegovina', 'Botswana', 'Brazil', 'Brunei Darussalam', 'Bulgaria', + 'Burkina Faso', 'Burundi', 'Cambodia', 'Cameroon', 'Canada', 'Cape Verde', + 'Central African Republic', 'Chad', 'Chile', 'Colombia', 'Comoros', 'Costa Rica', + 'Croatia', 'Cuba', 'Cyprus', 'Czech Republic', "C\xc3\xb4te d'Ivoire", + 'Democratic Republic of the Congo', 'Denmark', 'Djibouti', 'Dominica', + 'Dominican Republic', 'East Timor', 'Ecuador', 'Egypt', 'El Salvador', + 'Equatorial Guinea', 'Eritrea', 'Estonia', 'Ethiopia', 'Federated States of Micronesia', + 'Fiji', 'Finland', 'France', 'Gabon', 'Georgia', 'Germany', 'Ghana', 'Greece', + 'Grenada', 'Guatemala', 'Guinea', 'Guinea-Bissau', 'Guyana', 'Haiti', 'Honduras', + 'Hungary', 'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Israel', 'Italy', + 'Jamaica', 'Japan', 'Jordan', 'Kazakhstan', 'Kenya', 'Kingdom of the Netherlands', + 'Kiribati', 'Kuwait', 'Kyrgyzstan', 'Laos', 'Latvia', 'Lebanon', 'Lesotho', 'Liberia', + 'Libya', 'Liechtenstein', 'Lithuania', 'Luxembourg', 'Macedonia', 'Madagascar', 'Malawi', + 'Malaysia', 'Maldives', 'Mali', 'Malta', 'Marshall Islands', 'Mauritania', 'Mauritius', + 'Mexico', 'Moldova', 'Monaco', 'Mongolia', 'Montenegro', 'Morocco', 'Mozambique', + 'Myanmar', 'Namibia', 'Nauru', 'Nepal', 'New Zealand', 'Nicaragua', 'Niger', 'Nigeria', + 'North Korea', 'Norway', 'Oman', 'Pakistan', 'Palau', 'Panama', 'Papua New Guinea', + 'Paraguay', "People's Republic of China", 'Peru', 'Philippines', 'Poland', 'Portugal', + 'Qatar', 'Republic of Ireland', 'Republic of the Congo', 'Romania', 'Russia', 'Rwanda', + 'Saint Kitts and Nevis', 'Saint Lucia', 'Saint Vincent and the Grenadines', 'Samoa', + 'San Marino', 'Saudi Arabia', 'Senegal', 'Serbia', 'Seychelles', 'Sierra Leone', + 'Singapore', 'Slovakia', 'Slovenia', 'Solomon Islands', 'Somalia', 'South Africa', + 'South Korea', 'Spain', 'Sri Lanka', 'Sudan', 'Suriname', 'Swaziland', 'Sweden', + 'Switzerland', 'Syria', 'S\xc3\xa3o Tom\xc3\xa9 and Pr\xc3\xadncipe', 'Tajikistan', + 'Tanzania', 'Thailand', 'The Gambia', 'Togo', 'Tonga', 'Trinidad and Tobago', 'Tunisia', + 'Turkey', 'Turkmenistan', 'Tuvalu', 'Uganda', 'Ukraine', 'United Arab Emirates', + 'United Kingdom', 'United States', 'Uruguay', 'Uzbekistan', 'Vanuatu', 'Vatican City', + 'Venezuela', 'Vietnam', 'Yemen', 'Zambia', 'Zimbabwe'], + + timezone_dict: { + 'Afghanistan': ['Asia/Kabul'], + 'Albania': ['Europe/Tirane'], + 'Algeria': ['Africa/Algiers'], + 'Andorra': ['Europe/Andorra'], + 'Angola': ['Africa/Luanda'], + 'Antigua and Barbuda': ['America/Antigua'], + 'Argentina': ['America/Argentina/Buenos_Aires', + 'America/Argentina/Cordoba', + 'America/Argentina/Jujuy', + 'America/Argentina/Tucuman', + 'America/Argentina/Catamarca', + 'America/Argentina/La_Rioja', + 'America/Argentina/San_Juan', + 'America/Argentina/Mendoza', + 'America/Argentina/Rio_Gallegos', + 'America/Argentina/Ushuaia'], + 'Armenia': ['Asia/Yerevan'], + 'Australia': ['Australia/Lord_Howe', + 'Australia/Hobart', + 'Australia/Currie', + 'Australia/Melbourne', + 'Australia/Sydney', + 'Australia/Broken_Hill', + 'Australia/Brisbane', + 'Australia/Lindeman', + 'Australia/Adelaide', + 'Australia/Darwin', + 'Australia/Perth'], + 'Austria': ['Europe/Vienna'], + 'Azerbaijan': ['Asia/Baku'], + 'Bahamas': ['America/Nassau'], + 'Bahrain': ['Asia/Bahrain'], + 'Bangladesh': ['Asia/Dhaka'], + 'Barbados': ['America/Barbados'], + 'Belarus': ['Europe/Minsk'], + 'Belgium': ['Europe/Brussels'], + 'Belize': ['America/Belize'], + 'Benin': ['Africa/Porto-Novo'], + 'Bhutan': ['Asia/Thimphu'], + 'Bolivia': ['America/La_Paz'], + 'Bosnia and Herzegovina': ['Europe/Sarajevo'], + 'Botswana': ['Africa/Gaborone'], + 'Brazil': ['America/Noronha', + 'America/Belem', + 'America/Fortaleza', + 'America/Recife', + 'America/Araguaina', + 'America/Maceio', + 'America/Bahia', + 'America/Sao_Paulo', + 'America/Campo_Grande', + 'America/Cuiaba', + 'America/Porto_Velho', + 'America/Boa_Vista', + 'America/Manaus', + 'America/Eirunepe', + 'America/Rio_Branco'], + 'Brunei Darussalam': ['Asia/Brunei'], + 'Bulgaria': ['Europe/Sofia'], + 'Burkina Faso': ['Africa/Ouagadougou'], + 'Burundi': ['Africa/Bujumbura'], + 'Cambodia': ['Asia/Phnom_Penh'], + 'Cameroon': ['Africa/Douala'], + 'Canada': ['America/St_Johns', + 'America/Halifax', + 'America/Glace_Bay', + 'America/Moncton', + 'America/Goose_Bay', + 'America/Blanc-Sablon', + 'America/Montreal', + 'America/Toronto', + 'America/Nipigon', + 'America/Thunder_Bay', + 'America/Pangnirtung', + 'America/Iqaluit', + 'America/Atikokan', + 'America/Rankin_Inlet', + 'America/Winnipeg', + 'America/Rainy_River', + 'America/Cambridge_Bay', + 'America/Regina', + 'America/Swift_Current', + 'America/Edmonton', + 'America/Yellowknife', + 'America/Inuvik', + 'America/Dawson_Creek', + 'America/Vancouver', + 'America/Whitehorse', + 'America/Dawson'], + 'Cape Verde': ['Atlantic/Cape_Verde'], + 'Central African Republic': ['Africa/Bangui'], + 'Chad': ['Africa/Ndjamena'], + 'Chile': ['America/Santiago', 'Pacific/Easter'], + 'Colombia': ['America/Bogota'], + 'Comoros': ['Indian/Comoro'], + 'Costa Rica': ['America/Costa_Rica'], + 'Croatia': ['Europe/Zagreb'], + 'Cuba': ['America/Havana'], + 'Cyprus': ['Asia/Nicosia'], + 'Czech Republic': ['Europe/Prague'], + "C\xc3\xb4te d'Ivoire": ['Africa/Abidjan'], + 'Democratic Republic of the Congo': ['Africa/Kinshasa', 'Africa/Lubumbashi'], + 'Denmark': ['Europe/Copenhagen'], + 'Djibouti': ['Africa/Djibouti'], + 'Dominica': ['America/Dominica'], + 'Dominican Republic': ['America/Santo_Domingo'], + 'East Timor': ['Asia/Dili'], + 'Ecuador': ['America/Guayaquil', 'Pacific/Galapagos'], + 'Egypt': ['Africa/Cairo'], + 'El Salvador': ['America/El_Salvador'], + 'Equatorial Guinea': ['Africa/Malabo'], + 'Eritrea': ['Africa/Asmera'], + 'Estonia': ['Europe/Tallinn'], + 'Ethiopia': ['Africa/Addis_Ababa'], + 'Federated States of Micronesia': ['Pacific/Truk', + 'Pacific/Ponape', + 'Pacific/Kosrae'], + 'Fiji': ['Pacific/Fiji'], + 'Finland': ['Europe/Helsinki'], + 'France': ['Europe/Paris'], + 'Gabon': ['Africa/Libreville'], + 'Georgia': ['Asia/Tbilisi'], + 'Germany': ['Europe/Berlin'], + 'Ghana': ['Africa/Accra'], + 'Greece': ['Europe/Athens'], + 'Grenada': ['America/Grenada'], + 'Guatemala': ['America/Guatemala'], + 'Guinea': ['Africa/Conakry'], + 'Guinea-Bissau': ['Africa/Bissau'], + 'Guyana': ['America/Guyana'], + 'Haiti': ['America/Guatemala'], + 'Honduras': ['America/Tegucigalpa'], + 'Hungary': ['Europe/Budapest'], + 'Iceland': ['Atlantic/Reykjavik'], + 'India': ['Asia/Calcutta'], + 'Indonesia': ['Asia/Jakarta', + 'Asia/Pontianak', + 'Asia/Makassar', + 'Asia/Jayapura'], + 'Iran': ['Asia/Tehran'], + 'Iraq': ['Asia/Baghdad'], + 'Israel': ['Asia/Jerusalem'], + 'Italy': ['Europe/Rome'], + 'Jamaica': ['America/Jamaica'], + 'Japan': ['Asia/Tokyo'], + 'Jordan': ['Asia/Amman'], + 'Kazakhstan': ['Asia/Almaty', + 'Asia/Qyzylorda', + 'Asia/Aqtobe', + 'Asia/Aqtau', + 'Asia/Oral'], + 'Kenya': ['Africa/Nairobi'], + 'Kingdom of the Netherlands': ['Europe/Amsterdam'], + 'Kiribati': ['Pacific/Tarawa', 'Pacific/Enderbury', 'Pacific/Kiritimati'], + 'Kuwait': ['Asia/Kuwait'], + 'Kyrgyzstan': ['Asia/Bishkek'], + 'Laos': ['Asia/Vientiane'], + 'Latvia': ['Europe/Riga'], + 'Lebanon': ['Asia/Beirut'], + 'Lesotho': ['Africa/Maseru'], + 'Liberia': ['Africa/Monrovia'], + 'Libya': ['Africa/Tripoli'], + 'Liechtenstein': ['Europe/Vaduz'], + 'Lithuania': ['Europe/Vilnius'], + 'Luxembourg': ['Europe/Luxembourg'], + 'Macedonia': ['Europe/Skopje'], + 'Madagascar': ['Indian/Antananarivo'], + 'Malawi': ['Africa/Blantyre'], + 'Malaysia': ['Asia/Kuala_Lumpur', 'Asia/Kuching'], + 'Maldives': ['Indian/Maldives'], + 'Mali': ['Africa/Bamako'], + 'Malta': ['Europe/Malta'], + 'Marshall Islands': ['Pacific/Majuro', 'Pacific/Kwajalein'], + 'Mauritania': ['Africa/Nouakchott'], + 'Mauritius': ['Indian/Mauritius'], + 'Mexico': ['America/Mexico_City', + 'America/Cancun', + 'America/Merida', + 'America/Monterrey', + 'America/Mazatlan', + 'America/Chihuahua', + 'America/Hermosillo', + 'America/Tijuana'], + 'Moldova': ['Europe/Chisinau'], + 'Monaco': ['Europe/Monaco'], + 'Mongolia': ['Asia/Ulaanbaatar', 'Asia/Hovd', 'Asia/Choibalsan'], + 'Montenegro': ['Europe/Podgorica'], + 'Morocco': ['Africa/Casablanca'], + 'Mozambique': ['Africa/Maputo'], + 'Myanmar': ['Asia/Rangoon'], + 'Namibia': ['Africa/Windhoek'], + 'Nauru': ['Pacific/Nauru'], + 'Nepal': ['Asia/Katmandu'], + 'New Zealand': ['Pacific/Auckland', 'Pacific/Chatham'], + 'Nicaragua': ['America/Managua'], + 'Niger': ['Africa/Niamey'], + 'Nigeria': ['Africa/Lagos'], + 'North Korea': ['Asia/Pyongyang'], + 'Norway': ['Europe/Oslo'], + 'Oman': ['Asia/Muscat'], + 'Pakistan': ['Asia/Karachi'], + 'Palau': ['Pacific/Palau'], + 'Panama': ['America/Panama'], + 'Papua New Guinea': ['Pacific/Port_Moresby'], + 'Paraguay': ['America/Asuncion'], + "People's Republic of China": ['Asia/Shanghai', + 'Asia/Harbin', + 'Asia/Chongqing', + 'Asia/Urumqi', + 'Asia/Kashgar'], + 'Peru': ['America/Lima'], + 'Philippines': ['Asia/Manila'], + 'Poland': ['Europe/Warsaw'], + 'Portugal': ['Europe/Lisbon', 'Atlantic/Madeira', 'Atlantic/Azores'], + 'Qatar': ['Asia/Qatar'], + 'Republic of Ireland': ['Europe/Dublin'], + 'Republic of the Congo': ['Africa/Brazzaville'], + 'Romania': ['Europe/Bucharest'], + 'Russia': ['Europe/Kaliningrad', + 'Europe/Moscow', + 'Europe/Volgograd', + 'Europe/Samara', + 'Asia/Yekaterinburg', + 'Asia/Omsk', + 'Asia/Novosibirsk', + 'Asia/Krasnoyarsk', + 'Asia/Irkutsk', + 'Asia/Yakutsk', + 'Asia/Vladivostok', + 'Asia/Sakhalin', + 'Asia/Magadan', + 'Asia/Kamchatka', + 'Asia/Anadyr'], + 'Rwanda': ['Africa/Kigali'], + 'Saint Kitts and Nevis': ['America/St_Kitts'], + 'Saint Lucia': ['America/St_Lucia'], + 'Saint Vincent and the Grenadines': ['America/St_Vincent'], + 'Samoa': ['Pacific/Apia'], + 'San Marino': ['Europe/San_Marino'], + 'Saudi Arabia': ['Asia/Riyadh'], + 'Senegal': ['Africa/Dakar'], + 'Serbia': ['Europe/Belgrade'], + 'Seychelles': ['Indian/Mahe'], + 'Sierra Leone': ['Africa/Freetown'], + 'Singapore': ['Asia/Singapore'], + 'Slovakia': ['Europe/Bratislava'], + 'Slovenia': ['Europe/Ljubljana'], + 'Solomon Islands': ['Pacific/Guadalcanal'], + 'Somalia': ['Africa/Mogadishu'], + 'South Africa': ['Africa/Johannesburg'], + 'South Korea': ['Asia/Seoul'], + 'Spain': ['Europe/Madrid', 'Africa/Ceuta', 'Atlantic/Canary'], + 'Sri Lanka': ['Asia/Colombo'], + 'Sudan': ['Africa/Khartoum'], + 'Suriname': ['America/Paramaribo'], + 'Swaziland': ['Africa/Mbabane'], + 'Sweden': ['Europe/Stockholm'], + 'Switzerland': ['Europe/Zurich'], + 'Syria': ['Asia/Damascus'], + 'S\xc3\xa3o Tom\xc3\xa9 and Pr\xc3\xadncipe': ['Africa/Sao_Tome'], + 'Tajikistan': ['Asia/Dushanbe'], + 'Tanzania': ['Africa/Dar_es_Salaam'], + 'Thailand': ['Asia/Bangkok'], + 'The Gambia': ['Africa/Banjul'], + 'Togo': ['Africa/Lome'], + 'Tonga': ['Pacific/Tongatapu'], + 'Trinidad and Tobago': ['America/Port_of_Spain'], + 'Tunisia': ['Africa/Tunis'], + 'Turkey': ['Europe/Istanbul'], + 'Turkmenistan': ['Asia/Ashgabat'], + 'Tuvalu': ['Pacific/Funafuti'], + 'Uganda': ['Africa/Kampala'], + 'Ukraine': ['Europe/Kiev', + 'Europe/Uzhgorod', + 'Europe/Zaporozhye', + 'Europe/Simferopol'], + 'United Arab Emirates': ['Asia/Dubai'], + 'United Kingdom': ['Europe/London'], + 'United States': ['America/New_York', + 'America/Detroit', + 'America/Kentucky/Louisville', + 'America/Kentucky/Monticello', + 'America/Indiana/Indianapolis', + 'America/Indiana/Marengo', + 'America/Indiana/Knox', + 'America/Indiana/Vevay', + 'America/Chicago', + 'America/Indiana/Vincennes', + 'America/Indiana/Petersburg', + 'America/Menominee', + 'America/North_Dakota/Center', + 'America/North_Dakota/New_Salem', + 'America/Denver', + 'America/Boise', + 'America/Shiprock', + 'America/Phoenix', + 'America/Los_Angeles', + 'America/Anchorage', + 'America/Juneau', + 'America/Yakutat', + 'America/Nome', + 'America/Adak', + 'Pacific/Honolulu'], + 'Uruguay': ['America/Montevideo'], + 'Uzbekistan': ['Asia/Samarkand', 'Asia/Tashkent'], + 'Vanuatu': ['Pacific/Efate'], + 'Vatican City': ['Europe/Vatican'], + 'Venezuela': ['America/Caracas'], + 'Vietnam': ['Asia/Saigon'], + 'Yemen': ['Asia/Aden'], + 'Zambia': ['Africa/Lusaka'], + 'Zimbabwe': ['Africa/Harare'] + }, +}); \ No newline at end of file diff --git a/erpnext/startup/startup.css b/erpnext/startup/startup.css index bd21144ec6..47f188be65 100644 --- a/erpnext/startup/startup.css +++ b/erpnext/startup/startup.css @@ -53,3 +53,12 @@ body { min-width: 160px !important; max-width: 260px !important; } + +.expiry-info { + margin-top: 40px; + margin-bottom: -40px; + text-align: center; + background-color: rgb(255, 255, 204); + padding: 7px; + z-index: 1; +} diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js index 442e7be090..c96a6a8a1b 100644 --- a/erpnext/startup/startup.js +++ b/erpnext/startup/startup.js @@ -48,6 +48,7 @@ erpnext.startup.set_globals = function() { } erpnext.startup.start = function() { + console.log('Starting up...'); $('#startup_div').html('Starting up...').toggle(true); @@ -87,9 +88,26 @@ erpnext.startup.start = function() { // 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(); + erpnext.complete_setup.show(); + } + + if(wn.boot.expires_on) { + var today = dateutil.str_to_obj(dateutil.get_today()); + var expires_on = dateutil.str_to_obj(wn.boot.expires_on); + var diff = dateutil.get_diff(expires_on, today); + if (0 <= diff && diff <= 15) { + var expiry_string = diff==0 ? "today" : repl("in %(diff)s day(s)", { diff: diff }); + $('header').append(repl('
\ + Ahem! Your ERPNext subscription will expire %(expiry_string)s. \ + Please renew your subscription to continue using ERPNext \ + (and remove this annoying banner). \ +
', { expiry_string: expiry_string })); + } else if (diff < 0) { + $('header').append(repl('
\ + Ahem! This ERPNext subscription has expired and should be deleted. \ +
', { expiry_string: expiry_string })); + } } - } erpnext.set_about(); diff --git a/erpnext/utilities/page/users/users.css b/erpnext/utilities/page/users/users.css index 1a85d153c0..b739a57c5e 100644 --- a/erpnext/utilities/page/users/users.css +++ b/erpnext/utilities/page/users/users.css @@ -32,4 +32,15 @@ table.user-perm td, table.user-perm th { text-align: center; border-bottom: 1px solid #aaa; min-width: 30px; +} + +.subscription-info-box { + margin: 0px 11px; + background-color: #EEEEEE; + border: 1px solid #DDDBDB; + padding: 5px 3px; +} + +.subscription-info { + padding: 0px 10px; } \ No newline at end of file diff --git a/erpnext/utilities/page/users/users.js b/erpnext/utilities/page/users/users.js index ad238ae0b1..704682eafc 100644 --- a/erpnext/utilities/page/users/users.js +++ b/erpnext/utilities/page/users/users.js @@ -63,6 +63,21 @@ $.extend(wn.pages.users, { } } }); + if(!$('.subscription-info').length && (wn.boot.max_users || wn.boot.expires_on)) { + var $sub_info = $('
').insertAfter('.help'); + if(wn.boot.max_users) { + $sub_info.append(repl('\ + \ + Max Users: %(max_users)s \ + ', { max_users: wn.boot.max_users })); + } + if(wn.boot.expires_on) { + $sub_info.append(repl('\ + \ + Expires On: %(expires_on)s \ + ', { expires_on: dateutil.str_to_user(wn.boot.expires_on) })); + } + } }, render: function(data) { if(data.file_list) { @@ -207,6 +222,17 @@ $.extend(wn.pages.users, { }, add_user: function() { var me = wn.pages.users; + var active_users = $('.user-card:not(.disabled)'); + if(wn.boot.max_users && (active_users.length >= wn.boot.max_users)) { + msgprint(repl("Alas!
\ + You already have %(active_users)s active users, \ + which is the maximum number that you are currently allowed to add.

\ + So, to add more users, you can:
\ + 1. Upgrade to the unlimited users plan, or
\ + 2. Disable one or more of your existing users and try again", + {active_users: active_users.length})); + return; + } var d = new wn.widgets.Dialog({ title: 'Add User', width: 400, diff --git a/erpnext/utilities/page/users/users.py b/erpnext/utilities/page/users/users.py index 6735dc065b..819f7bb1da 100644 --- a/erpnext/utilities/page/users/users.py +++ b/erpnext/utilities/page/users/users.py @@ -103,9 +103,24 @@ def add_user(args): @webnotes.whitelist() def add_profile(args): from webnotes.utils import validate_email_add, now - email = args['user'] - + email = args['user'] sql = webnotes.conn.sql + + # validate max number of users exceeded or not + import conf + if hasattr(conf, 'max_users'): + active_users = sql("""select count(*) from tabProfile + where ifnull(enabled, 0)=1 and docstatus<2 + and name not in ('Administrator', 'Guest')""")[0][0] + if active_users >= conf.max_users: + # same message as in users.js + webnotes.msgprint("""Alas!
\ + You already have %(active_users)s active users, \ + which is the maximum number that you are currently allowed to add.

\ + So, to add more users, you can:
\ + 1. Upgrade to the unlimited users plan, or
\ + 2. Disable one or more of your existing users and try again""" \ + % {'active_users': active_users}, raise_exception=1) if not email: email = webnotes.form_dict.get('user') diff --git a/index.cgi b/index.cgi index 31da310c7a..bf84c5f6b3 100755 --- a/index.cgi +++ b/index.cgi @@ -50,8 +50,8 @@ def init(): return True except webnotes.AuthenticationError, e: return True - except webnotes.UnknownDomainError, e: - print "Location: " + (conf.redirect_404) + #except webnotes.UnknownDomainError, e: + # print "Location: " + (conf.redirect_404) except webnotes.SessionStopped, e: if 'cmd' in webnotes.form_dict: webnotes.handler.print_json() diff --git a/js/all-app.js b/js/all-app.js index bec4220647..647a888e49 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -2216,11 +2216,18 @@ wn.modules_path='erpnext';$(document).bind('toolbar_setup',function(){$('.brand' */ var current_module;var is_system_manager=0;wn.provide('erpnext.startup');erpnext.modules={'Selling':'selling-home','Accounts':'accounts-home','Stock':'stock-home','Buying':'buying-home','Support':'support-home','Projects':'projects-home','Production':'production-home','Website':'website-home','HR':'hr-home','Setup':'Setup','Activity':'activity','To Do':'todo','Calendar':'calendar','Messages':'messages','Knowledge Base':'questions','Dashboard':'dashboard'} wn.provide('wn.modules');$.extend(wn.modules,erpnext.modules);wn.modules['Core']='Setup';erpnext.startup.set_globals=function(){if(inList(user_roles,'System Manager'))is_system_manager=1;} -erpnext.startup.start=function(){$('#startup_div').html('Starting up...').toggle(true);erpnext.startup.set_globals();if(wn.boot.user_background){erpnext.set_user_background(wn.boot.user_background);} +erpnext.startup.start=function(){console.log('Starting up...');$('#startup_div').html('Starting up...').toggle(true);erpnext.startup.set_globals();if(wn.boot.user_background){erpnext.set_user_background(wn.boot.user_background);} if(user=='Guest'){if(wn.boot.custom_css){set_style(wn.boot.custom_css);} if(wn.boot.website_settings.title_prefix){wn.title_prefix=wn.boot.website_settings.title_prefix;}}else{wn.boot.profile.allow_modules=wn.boot.profile.allow_modules.concat(['To Do','Knowledge Base','Calendar','Activity','Messages']) if(user_roles.indexOf('Accounts Manager')!=-1){wn.boot.profile.allow_modules.push('Dashboard');} -erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("erpnext/startup/js/complete_setup.js");erpnext.complete_setup();}} +erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("erpnext/startup/js/complete_setup.js");erpnext.complete_setup.show();} +if(wn.boot.expires_on){var today=dateutil.str_to_obj(dateutil.get_today());var expires_on=dateutil.str_to_obj(wn.boot.expires_on);var diff=dateutil.get_diff(expires_on,today);if(0<=diff&&diff<=15){var expiry_string=diff==0?"today":repl("in %(diff)s day(s)",{diff:diff});$('header').append(repl('
\ + Ahem! Your ERPNext subscription will expire %(expiry_string)s. \ + Please renew your subscription to continue using ERPNext \ + (and remove this annoying banner). \ +
',{expiry_string:expiry_string}));}else if(diff<0){$('header').append(repl('
\ + Ahem! This ERPNext subscription has expired and should be deleted. \ +
',{expiry_string:expiry_string}));}}} erpnext.set_about();$('#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') diff --git a/js/all-web.js b/js/all-web.js index 6ec421e218..503f088e93 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -824,11 +824,18 @@ wn.modules_path='erpnext';$(document).bind('toolbar_setup',function(){$('.brand' */ var current_module;var is_system_manager=0;wn.provide('erpnext.startup');erpnext.modules={'Selling':'selling-home','Accounts':'accounts-home','Stock':'stock-home','Buying':'buying-home','Support':'support-home','Projects':'projects-home','Production':'production-home','Website':'website-home','HR':'hr-home','Setup':'Setup','Activity':'activity','To Do':'todo','Calendar':'calendar','Messages':'messages','Knowledge Base':'questions','Dashboard':'dashboard'} wn.provide('wn.modules');$.extend(wn.modules,erpnext.modules);wn.modules['Core']='Setup';erpnext.startup.set_globals=function(){if(inList(user_roles,'System Manager'))is_system_manager=1;} -erpnext.startup.start=function(){$('#startup_div').html('Starting up...').toggle(true);erpnext.startup.set_globals();if(wn.boot.user_background){erpnext.set_user_background(wn.boot.user_background);} +erpnext.startup.start=function(){console.log('Starting up...');$('#startup_div').html('Starting up...').toggle(true);erpnext.startup.set_globals();if(wn.boot.user_background){erpnext.set_user_background(wn.boot.user_background);} if(user=='Guest'){if(wn.boot.custom_css){set_style(wn.boot.custom_css);} if(wn.boot.website_settings.title_prefix){wn.title_prefix=wn.boot.website_settings.title_prefix;}}else{wn.boot.profile.allow_modules=wn.boot.profile.allow_modules.concat(['To Do','Knowledge Base','Calendar','Activity','Messages']) if(user_roles.indexOf('Accounts Manager')!=-1){wn.boot.profile.allow_modules.push('Dashboard');} -erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("erpnext/startup/js/complete_setup.js");erpnext.complete_setup();}} +erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("erpnext/startup/js/complete_setup.js");erpnext.complete_setup.show();} +if(wn.boot.expires_on){var today=dateutil.str_to_obj(dateutil.get_today());var expires_on=dateutil.str_to_obj(wn.boot.expires_on);var diff=dateutil.get_diff(expires_on,today);if(0<=diff&&diff<=15){var expiry_string=diff==0?"today":repl("in %(diff)s day(s)",{diff:diff});$('header').append(repl('
\ + Ahem! Your ERPNext subscription will expire %(expiry_string)s. \ + Please renew your subscription to continue using ERPNext \ + (and remove this annoying banner). \ +
',{expiry_string:expiry_string}));}else if(diff<0){$('header').append(repl('
\ + Ahem! This ERPNext subscription has expired and should be deleted. \ +
',{expiry_string:expiry_string}));}}} erpnext.set_about();$('#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') From 3fbf2ec0c5d8301bff7aea7954ff903decd475c2 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 27 Apr 2012 16:11:56 +0530 Subject: [PATCH 06/10] fix in setup control --- erpnext/setup/doctype/setup_control/setup_control.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/erpnext/setup/doctype/setup_control/setup_control.py b/erpnext/setup/doctype/setup_control/setup_control.py index af7bf9a016..12315438fd 100644 --- a/erpnext/setup/doctype/setup_control/setup_control.py +++ b/erpnext/setup/doctype/setup_control/setup_control.py @@ -21,8 +21,6 @@ from webnotes.model.doc import Document, addchild from webnotes.model.code import get_obj from webnotes import session, form, msgprint -sql = webnotes.conn.sql - class DocType: def __init__(self, d, dl): self.doc, self.doclist = d, dl From d4611482968c9a396922c41218f905217f78500d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 27 Apr 2012 17:05:50 +0530 Subject: [PATCH 07/10] fix in reload_c_form path --- erpnext/patches/april_2012/reload_c_form.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/patches/april_2012/reload_c_form.py b/erpnext/patches/april_2012/reload_c_form.py index 246ea0fdb1..bebca6f9bb 100644 --- a/erpnext/patches/april_2012/reload_c_form.py +++ b/erpnext/patches/april_2012/reload_c_form.py @@ -1,4 +1,4 @@ def execute(): import webnotes - from webnotes.modules.module_manager import reload_doc + from webnotes.modules import reload_doc reload_doc('accounts', 'doctype', 'c_form') From 864e220ec5a6a09c5ef50c2f8543514e65304083 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 27 Apr 2012 17:12:47 +0530 Subject: [PATCH 08/10] fixes in serial no patch --- erpnext/patches/april_2012/serial_no_fixes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/patches/april_2012/serial_no_fixes.py b/erpnext/patches/april_2012/serial_no_fixes.py index b4fcf759bd..f291e1000d 100644 --- a/erpnext/patches/april_2012/serial_no_fixes.py +++ b/erpnext/patches/april_2012/serial_no_fixes.py @@ -1,6 +1,6 @@ def execute(): import webnotes - from webnotes.modules.module_manager import reload_doc + from webnotes.modules import reload_doc reload_doc('stock', 'doctype', 'serial_no') webnotes.conn.sql("update `tabSerial No` set sle_exists = 1") From 914d67a1a36450d4e8b079348b8394a1e439489b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 27 Apr 2012 17:47:46 +0530 Subject: [PATCH 09/10] selective deletes from child table while overwriting --- erpnext/setup/page/import_data/import_data.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/page/import_data/import_data.html b/erpnext/setup/page/import_data/import_data.html index 29f0cc3dd8..b655442cef 100644 --- a/erpnext/setup/page/import_data/import_data.html +++ b/erpnext/setup/page/import_data/import_data.html @@ -10,7 +10,7 @@

Step 1. Download Template

-
Do you want to over-write records?
Warning: Over-writing the data of child tables, will delete all old data. For more info see below
+
Do you want to over-write records?
Warning: Over-writing the data of child tables, will delete all old entries from child tables. For more info see below

Step 2. Upload and Import

@@ -46,7 +46,7 @@
  1. To over-write data, click on "Do you want to over-write records?" and then download template
  2. To over-write parent table data, mention existing ID in "Name" column
  3. -
  4. 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
  5. +
  6. Over-writing of child table data will delete all previous data from child table of those parents which you are importing. So before over-writing child tables, take a backup of the child table data by exporting from report builder. Re-import all rows of the child table for a particular parent.
    For example: If you want to overwrite tax rate for tax account "VAT" ifor item: ITEM001 and suppose there are 3 rows in "Item Tax" table for item : ITEM001. While overwriting the system will delete all 3 rows. So, you have to re-import all 3 rows for that item.
  7. Over-write checkbox will be checked while importing

From f5216b46e3bbdf5b24a513c3f11602d21a729996 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 27 Apr 2012 18:03:47 +0530 Subject: [PATCH 10/10] fixes --- erpnext/setup/doctype/setup_control/setup_control.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/setup/doctype/setup_control/setup_control.py b/erpnext/setup/doctype/setup_control/setup_control.py index 12315438fd..84387e1323 100644 --- a/erpnext/setup/doctype/setup_control/setup_control.py +++ b/erpnext/setup/doctype/setup_control/setup_control.py @@ -30,6 +30,7 @@ class DocType: def setup_account(self, args): import webnotes, json args = json.loads(args) + webnotes.conn.begin() curr_fiscal_year, fy_start_date, fy_abbr = self.get_fy_details(args.get('fy_start')) @@ -89,6 +90,7 @@ class DocType: import webnotes.utils user_fullname = (args.get('first_name') or '') + (args.get('last_name') and (" " + args.get('last_name')) or '') + webnotes.conn.commit() return {'sys_defaults': webnotes.utils.get_defaults(), 'user_fullname': user_fullname} def create_feed_and_todo(self):