diff --git a/build.json b/build.json index 6efbbc30956..420e5f4c255 100644 --- a/build.json +++ b/build.json @@ -17,10 +17,4 @@ "erpnext/startup/js/feature_setup.js", "conf.js" ], - "public/js/kb_common.js": [ - "erpnext/utilities/page/kb_common/kb_common.js", - ], - "public/js/complete_setup.js": [ - "erpnext/startup/js/complete_setup.js", - ], } \ No newline at end of file diff --git a/erpnext/accounts/__init__.py b/erpnext/accounts/__init__.py index c750d25462e..aa2af626fc3 100644 --- a/erpnext/accounts/__init__.py +++ b/erpnext/accounts/__init__.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.utils import flt from webnotes.model.code import get_obj diff --git a/erpnext/accounts/doctype/__init__.py b/erpnext/accounts/doctype/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/__init__.py +++ b/erpnext/accounts/doctype/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/account/__init__.py b/erpnext/accounts/doctype/account/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/account/__init__.py +++ b/erpnext/accounts/doctype/account/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/account/account.js b/erpnext/accounts/doctype/account/account.js index d5300c75b5c..d34601b0ec5 100644 --- a/erpnext/accounts/doctype/account/account.js +++ b/erpnext/accounts/doctype/account/account.js @@ -14,6 +14,47 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + +// Onload +// ----------------------------------------- +cur_frm.cscript.onload = function(doc, cdt, cdn) { +} + +cur_frm.cscript.set_breadcrumbs = function(barea) { + cur_frm.frm_head.appframe.add_breadcrumb(cur_frm.docname); + cur_frm.frm_head.appframe.add_breadcrumb(' in \ + Chart of Accounts'); + cur_frm.frm_head.appframe.add_breadcrumb(' in Accounts'); +} + +// Refresh +// ----------------------------------------- +cur_frm.cscript.refresh = function(doc, cdt, cdn) { + cur_frm.toggle_display('account_name', doc.__islocal); + + // hide fields if group + cur_frm.toggle_display(['account_type', 'master_type', 'master_name', 'freeze_account', + 'credit_days', 'credit_limit', 'tax_rate'], doc.group_or_ledger=='Ledger') + + // read-only for root accounts + root_acc = ['Application of Funds (Assets)','Expenses','Income','Source of Funds (Liabilities)']; + if(in_list(root_acc, doc.account_name)) { + cur_frm.perm = [[1,0,0], [1,0,0]]; + cur_frm.set_intro("This is a root account and cannot be edited."); + } else { + // credit days and type if customer or supplier + cur_frm.set_intro(null); + cur_frm.toggle_display(['credit_days', 'credit_limit'], + in_list(['Customer', 'Supplier'], doc.master_type)) + + // hide tax_rate + cur_frm.cscript.account_type(doc, cdt, cdn); + + // show / hide convert buttons + cur_frm.cscript.hide_unhide_group_ledger(doc); + } +} + // Fetch parent details // ----------------------------------------- cur_frm.add_fetch('parent_account', 'debit_or_credit', 'debit_or_credit'); @@ -22,47 +63,31 @@ cur_frm.add_fetch('parent_account', 'is_pl_account', 'is_pl_account'); // Hide tax rate based on account type // ----------------------------------------- cur_frm.cscript.account_type = function(doc, cdt, cdn) { - if(doc.account_type == 'Tax') unhide_field(['tax_rate']); - else hide_field(['tax_rate']); -} - -// Onload -// ----------------------------------------- -cur_frm.cscript.onload = function(doc, cdt, cdn) { - cur_frm.cscript.account_type(doc, cdt, cdn); - // hide India specific fields - var cp = wn.control_panel; - if(cp.country == 'India') - unhide_field(['pan_number', 'tds_applicable', 'tds_details', 'tds']); - else - hide_field(['pan_number', 'tds_applicable', 'tds_details', 'tds']); -} - -// Refresh -// ----------------------------------------- -cur_frm.cscript.refresh = function(doc, cdt, cdn) { - root_acc = [' Application of Funds (Assets)','Expenses','Income','Source of Funds (Liabilities)']; - if(inList(root_acc, doc.account_name)) - cur_frm.perm = [[1,0,0], [1,0,0]]; - cur_frm.cscript.hide_unhide_group_ledger(doc); + if(doc.group_or_ledger=='Ledger') { + cur_frm.toggle_display(['tax_rate'], + doc.account_type == 'Tax'); + cur_frm.toggle_display(['master_type', 'master_name'], + cstr(doc.account_type)==''); + } } // Hide/unhide group or ledger // ----------------------------------------- cur_frm.cscript.hide_unhide_group_ledger = function(doc) { - hide_field(['convert_to_group', 'convert_to_ledger']); - if (cstr(doc.group_or_ledger) == 'Group') unhide_field('convert_to_ledger'); - else if (cstr(doc.group_or_ledger) == 'Ledger') unhide_field('convert_to_group'); + if (cstr(doc.group_or_ledger) == 'Group') { + cur_frm.add_custom_button('Convert to Ledger', + function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet') + } else if (cstr(doc.group_or_ledger) == 'Ledger') { + cur_frm.add_custom_button('Convert to Group', + function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet') + } } - // Convert group to ledger // ----------------------------------------- cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) { - $c_obj(make_doclist(cdt,cdn),'convert_group_to_ledger','',function(r,rt) { - if(r.message == 1) { - doc.group_or_ledger = 'Ledger'; - refresh_field('group_or_ledger'); - cur_frm.cscript.hide_unhide_group_ledger(doc); + $c_obj(cur_frm.get_doclist(),'convert_group_to_ledger','',function(r,rt) { + if(r.message == 1) { + cur_frm.refresh(); } }); } @@ -70,11 +95,9 @@ cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) { // Convert ledger to group // ----------------------------------------- cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) { - $c_obj(make_doclist(cdt,cdn),'convert_ledger_to_group','',function(r,rt) { + $c_obj(cur_frm.get_doclist(),'convert_ledger_to_group','',function(r,rt) { if(r.message == 1) { - doc.group_or_ledger = 'Group'; - refresh_field('group_or_ledger'); - cur_frm.cscript.hide_unhide_group_ledger(doc); + cur_frm.refresh(); } }); } @@ -85,11 +108,13 @@ cur_frm.fields_dict['master_name'].get_query=function(doc){ if (doc.master_type){ return 'SELECT `tab'+doc.master_type+'`.name FROM `tab'+doc.master_type+'` WHERE `tab'+doc.master_type+'`.name LIKE "%s" and `tab'+doc.master_type+'`.docstatus != 2 ORDER BY `tab'+doc.master_type+'`.name LIMIT 50'; } - else alert("Please select master type"); } // parent account get query // ----------------------------------------- cur_frm.fields_dict['parent_account'].get_query = function(doc){ - return 'SELECT DISTINCT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.group_or_ledger="Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.company="'+ doc.company+'" AND `tabAccount`.company is not NULL AND `tabAccount`.name LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; + return 'SELECT DISTINCT `tabAccount`.name FROM `tabAccount` WHERE \ + `tabAccount`.group_or_ledger="Group" AND `tabAccount`.docstatus != 2 AND \ + `tabAccount`.company="'+ doc.company+'" AND `tabAccount`.company is not NULL AND \ + `tabAccount`.name LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; } diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py index dfc138bcc1a..466b2f9b21e 100644 --- a/erpnext/accounts/doctype/account/account.py +++ b/erpnext/accounts/doctype/account/account.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 @@ -43,7 +44,6 @@ class DocType: self.doc.name = self.doc.account_name.strip() + ' - ' + company_abbr # Get customer/supplier address - # ================================================================== def get_address(self): add=sql("Select address from `tab%s` where name='%s'"%(self.doc.master_type,self.doc.master_name)) ret={'address':add[0][0]} @@ -51,20 +51,17 @@ class DocType: # check whether master name entered for supplier/customer - # ================================================================== def validate_master_name(self): if (self.doc.master_type == 'Customer' or self.doc.master_type == 'Supplier') and not self.doc.master_name: msgprint("Message: Please enter Master Name once the account is created.") # Rate is mandatory for tax account - # ================================================================== def validate_rate_for_tax(self): if self.doc.account_type == 'Tax' and not self.doc.tax_rate: msgprint("Please Enter Rate", raise_exception=1) # Fetch Parent Details and validation for account not to be created under ledger - # ================================================================== def validate_parent(self): if self.doc.parent_account: par = sql("select name, group_or_ledger, is_pl_account, debit_or_credit from tabAccount where name =%s",self.doc.parent_account) @@ -85,13 +82,11 @@ class DocType: # Account name must be unique - # ================================================================== def validate_duplicate_account(self): if (self.doc.__islocal or (not self.doc.name)) and sql("select name from tabAccount where account_name=%s and company=%s", (self.doc.account_name, self.doc.company)): msgprint("Account Name already exists, please rename", raise_exception=1) # validate root details - # ================================================================== def validate_root_details(self): #does not exists parent if self.doc.account_name in ['Income','Source of Funds', 'Expenses','Application of Funds'] and self.doc.parent_account: @@ -110,7 +105,6 @@ class DocType: self.doc.is_pl_account = 'No' # Convert group to ledger - # ================================================================== def convert_group_to_ledger(self): if self.check_if_child_exists(): msgprint("Account: %s has existing child. You can not convert this account to ledger" % (self.doc.name), raise_exception=1) @@ -122,28 +116,28 @@ class DocType: return 1 # Convert ledger to group - # ================================================================== def convert_ledger_to_group(self): if self.check_gle_exists(): - msgprint("Account with existing transaction can not be converted to group.", raise_exception=1) + msgprint("Account with existing transaction can not be converted to group.", + raise_exception=1) + elif self.doc.master_type or self.doc.account_type: + msgprint("Cannot covert to Group because Master Type or Account Type is selected.", + raise_exception=1) else: self.doc.group_or_ledger = 'Group' self.doc.save() return 1 # Check if any previous balance exists - # ================================================================== def check_gle_exists(self): exists = sql("select name from `tabGL Entry` where account = '%s' and ifnull(is_cancelled, 'No') = 'No'" % (self.doc.name)) return exists and exists[0][0] or '' # check if child exists - # ================================================================== def check_if_child_exists(self): return sql("select name from `tabAccount` where parent_account = %s and docstatus != 2", self.doc.name) # Update balance - # ================================================================== def update_balance(self, fy, period_det, flag = 1): # update in all parents for p in period_det: @@ -151,7 +145,6 @@ class DocType: # change parent balance - # ================================================================== def change_parent_bal(self): period_det = [] fy = sql("select name from `tabFiscal Year` where if(ifnull(is_fiscal_year_closed, 'No'),ifnull(is_fiscal_year_closed, 'No'), 'No') = 'No'") @@ -181,7 +174,6 @@ class DocType: # VALIDATE - # ================================================================== def validate(self): self.validate_master_name() self.validate_rate_for_tax() @@ -199,7 +191,6 @@ class DocType: self.change_parent_bal() # Add current fiscal year balance - # ================================================================== def set_year_balance(self): p = sql("select name, start_date, end_date, fiscal_year from `tabPeriod` where docstatus != 2 and period_type in ('Month', 'Year')") for d in p: @@ -217,29 +208,26 @@ class DocType: ac.save(1) # Update Node Set Model - # ================================================================== def update_nsm_model(self): import webnotes import webnotes.utils.nestedset webnotes.utils.nestedset.update_nsm(self) # ON UPDATE - # ================================================================== def on_update(self): + # update nsm self.update_nsm_model() # Add curret year balance self.set_year_balance() # Check user role for approval process - # ================================================================== def get_authorized_user(self): # Check logged-in user is authorized if get_value('Global Defaults', None, 'credit_controller') in webnotes.user.get_roles(): return 1 # Check Credit limit for customer - # ================================================================== def check_credit_limit(self, account, company, tot_outstanding): # Get credit limit credit_limit_from = 'Customer' @@ -256,7 +244,6 @@ class DocType: % (fmt_money(tot_outstanding), account, fmt_money(credit_limit), credit_limit_from), raise_exception=1) # Account with balance cannot be inactive - # ================================================================== def check_balance_before_trash(self): if self.check_gle_exists(): msgprint("Account with existing transaction (Sales Invoice / Purchase Invoice / Journal Voucher) can not be trashed", raise_exception=1) @@ -265,20 +252,18 @@ class DocType: # get current year balance - # ================================================================== def get_curr_bal(self): bal = sql("select balance from `tabAccount Balance` where period = '%s' and parent = '%s'" % (get_defaults()['fiscal_year'], self.doc.name),debug=0) return bal and flt(bal[0][0]) or 0 # On Trash - # ================================================================== def on_trash(self): # Check balance before trash self.check_balance_before_trash() # rebuild tree - set(self.doc,'old_parent', '') - self.update_nsm_model() + from webnotes.utils.nestedset import update_remove_node + update_remove_node('Account', self.doc.name) # delete all cancelled gl entry of this account sql("delete from `tabGL Entry` where account = %s and ifnull(is_cancelled, 'No') = 'Yes'", self.doc.name) @@ -287,7 +272,6 @@ class DocType: sql("delete from `tabAccount Balance` where account = %s", self.doc.name) # On restore - # ================================================================== def on_restore(self): # rebuild tree self.update_nsm_model() @@ -295,7 +279,6 @@ class DocType: self.set_year_balance() # on rename - # --------- def on_rename(self,newdn,olddn): company_abbr = sql("select tc.abbr from `tabAccount` ta, `tabCompany` tc where ta.company = tc.name and ta.name=%s", olddn)[0][0] diff --git a/erpnext/accounts/doctype/account/account.txt b/erpnext/accounts/doctype/account/account.txt index ec0ade9db2f..b649c9ab18b 100644 --- a/erpnext/accounts/doctype/account/account.txt +++ b/erpnext/accounts/doctype/account/account.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:35:39', + 'creation': '2012-07-03 13:30:50', 'docstatus': 0, - 'modified': '2012-03-27 14:35:39', + 'modified': '2012-07-11 13:58:44', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -17,6 +17,7 @@ 'allow_trash': 1, 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'An **Account** is heading under which financial and business transactions are carried on. For example, \u201cTravel Expense\u201d is an account, \u201cCustomer Zoe\u201d, \u201cSupplier Mae\u201d are accounts. \n\n**Note:** ERPNext creates accounts for Customers and Suppliers automatically.\n\n### Groups and Ledgers\n\nThere are two main kinds of Accounts in ERPNext - Group and Ledger. Groups can have sub-groups and ledgers within them, whereas ledgers are the leaf nodes of your chart and cannot be further classified.\n\nAccounting Transactions can only be made against Ledger Accounts (not Groups)\n', 'doctype': 'DocType', 'document_type': u'Master', 'in_create': 1, @@ -26,7 +27,7 @@ 'section_style': u'Tray', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 138 + 'version': 1 }, # These values are common for all DocField @@ -58,14 +59,34 @@ # DocPerm { - 'cancel': 1, - 'create': 1, + 'cancel': 0, + 'create': 0, 'doctype': u'DocPerm', 'permlevel': 0, - 'role': u'Accounts User', + 'role': u'Auditor', 'write': 1 }, + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Auditor', + 'write': 0 + }, + + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 2, + 'role': u'Auditor', + 'write': 0 + }, + # DocPerm { 'cancel': 0, @@ -86,6 +107,26 @@ 'write': 0 }, + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Accounts User', + 'write': 1 + }, + + # DocPerm + { + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Accounts Manager', + 'write': 1 + }, + # DocPerm { 'cancel': 0, @@ -106,16 +147,6 @@ 'write': 0 }, - # DocPerm - { - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Accounts Manager', - 'write': 1 - }, - # DocPerm { 'cancel': 0, @@ -141,7 +172,7 @@ 'doctype': u'DocField', 'fieldname': u'properties', 'fieldtype': u'Section Break', - 'label': u'Properties', + 'label': u'Account Details', 'oldfieldtype': u'Section Break', 'permlevel': 0 }, @@ -170,20 +201,6 @@ 'search_index': 1 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'parent_account', - 'fieldtype': u'Link', - 'label': u'Parent Account', - 'oldfieldname': u'parent_account', - 'oldfieldtype': u'Link', - 'options': u'Account', - 'permlevel': 0, - 'search_index': 1, - 'trigger': u'Client' - }, - # DocField { 'doctype': u'DocField', @@ -213,26 +230,6 @@ 'search_index': 1 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'convert_to_group', - 'fieldtype': u'Button', - 'label': u'Convert to Group', - 'permlevel': 0, - 'trigger': u'Client' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'convert_to_ledger', - 'fieldtype': u'Button', - 'label': u'Convert to Ledger', - 'permlevel': 0, - 'trigger': u'Client' - }, - # DocField { 'doctype': u'DocField', @@ -262,6 +259,46 @@ # DocField { + 'doctype': u'DocField', + 'fieldname': u'company', + 'fieldtype': u'Link', + 'in_filter': 1, + 'label': u'Company', + 'oldfieldname': u'company', + 'oldfieldtype': u'Link', + 'options': u'Company', + 'permlevel': 1, + 'reqd': 1, + 'search_index': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'column_break1', + 'fieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'parent_account', + 'fieldtype': u'Link', + 'label': u'Parent Account', + 'oldfieldname': u'parent_account', + 'oldfieldtype': u'Link', + 'options': u'Account', + 'permlevel': 0, + 'search_index': 1, + 'trigger': u'Client' + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'Setting Account Type helps in selecting this Account in transactions.', 'doctype': u'DocField', 'fieldname': u'account_type', 'fieldtype': u'Select', @@ -278,7 +315,7 @@ # DocField { 'colour': u'White:FFF', - 'description': u'If Account Type is "Tax" then the default rate is required.', + 'description': u'Rate at which this tax is applied', 'doctype': u'DocField', 'fieldname': u'tax_rate', 'fieldtype': u'Currency', @@ -292,19 +329,12 @@ # DocField { - 'doctype': u'DocField', - 'fieldname': u'column_break1', - 'fieldtype': u'Column Break', - 'permlevel': 0, - 'width': u'50%' - }, - - # DocField - { + 'colour': u'White:FFF', + 'description': u'If the account is frozen, entries are allowed for the "Account Manager" only.', 'doctype': u'DocField', 'fieldname': u'freeze_account', 'fieldtype': u'Select', - 'label': u'Freeze Account', + 'label': u'Frozen', 'oldfieldname': u'freeze_account', 'oldfieldtype': u'Select', 'options': u'No\nYes', @@ -313,21 +343,7 @@ # DocField { - 'doctype': u'DocField', - 'fieldname': u'company', - 'fieldtype': u'Link', - 'in_filter': 1, - 'label': u'Company', - 'oldfieldname': u'company', - 'oldfieldtype': u'Link', - 'options': u'Company', - 'permlevel': 1, - 'reqd': 1, - 'search_index': 1 - }, - - # DocField - { + 'colour': u'White:FFF', 'doctype': u'DocField', 'fieldname': u'credit_days', 'fieldtype': u'Int', @@ -354,13 +370,15 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'If this Account represents a Customer, Supplier or Employee, set it here.', 'doctype': u'DocField', 'fieldname': u'master_type', 'fieldtype': u'Select', 'label': u'Master Type', 'oldfieldname': u'master_type', 'oldfieldtype': u'Select', - 'options': u'\nNA\nSupplier\nCustomer\nEmployee', + 'options': u'\nSupplier\nCustomer\nEmployee', 'permlevel': 0 }, @@ -374,116 +392,5 @@ 'oldfieldtype': u'Link', 'permlevel': 0, 'trigger': u'Client' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'tds', - 'fieldtype': u'Section Break', - 'label': u'TDS', - 'oldfieldtype': u'Section Break', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'pan_number', - 'fieldtype': u'Data', - 'label': u'PAN Number', - 'oldfieldname': u'pan_number', - 'oldfieldtype': u'Data', - 'permlevel': 0 - }, - - # DocField - { - 'default': u'No', - 'doctype': u'DocField', - 'fieldname': u'tds_applicable', - 'fieldtype': u'Select', - 'label': u'TDS Applicable', - 'oldfieldname': u'tds_applicable', - 'oldfieldtype': u'Select', - 'options': u'\nYes\nNo', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'tds_details', - 'fieldtype': u'Table', - 'label': u'TDS Details', - 'oldfieldname': u'tds_details', - 'oldfieldtype': u'Table', - 'options': u'TDS Detail', - 'permlevel': 0 - }, - - # DocField - { - 'description': u"Don't delete this field at any cost", - 'doctype': u'DocField', - 'fieldname': u'old_parent', - 'fieldtype': u'Link', - 'hidden': 1, - 'label': u'Old Parent', - 'no_copy': 1, - 'oldfieldname': u'old_parent', - 'oldfieldtype': u'Data', - 'options': u'Account', - 'permlevel': 0, - 'report_hide': 1 - }, - - # DocField - { - 'colour': u'White:FFF', - 'description': u"Don't delete this field at any cost", - 'doctype': u'DocField', - 'fieldname': u'lft', - 'fieldtype': u'Int', - 'hidden': 1, - 'in_filter': 1, - 'label': u'Lft', - 'no_copy': 1, - 'oldfieldname': u'lft', - 'oldfieldtype': u'Int', - 'permlevel': 3, - 'print_hide': 1, - 'report_hide': 1, - 'search_index': 1 - }, - - # DocField - { - 'colour': u'White:FFF', - 'description': u"Don't delete this field at any cost", - 'doctype': u'DocField', - 'fieldname': u'rgt', - 'fieldtype': u'Int', - 'hidden': 1, - 'in_filter': 1, - 'label': u'Rgt', - 'no_copy': 1, - 'oldfieldname': u'rgt', - 'oldfieldtype': u'Int', - 'permlevel': 3, - 'print_hide': 1, - 'report_hide': 1, - 'search_index': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'trash_reason', - 'fieldtype': u'Small Text', - 'label': u'Trash Reason', - 'oldfieldname': u'trash_reason', - 'oldfieldtype': u'Small Text', - 'permlevel': 1 } ] \ No newline at end of file diff --git a/erpnext/accounts/doctype/account_balance/__init__.py b/erpnext/accounts/doctype/account_balance/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/account_balance/__init__.py +++ b/erpnext/accounts/doctype/account_balance/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/bank_reconciliation/__init__.py b/erpnext/accounts/doctype/bank_reconciliation/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/bank_reconciliation/__init__.py +++ b/erpnext/accounts/doctype/bank_reconciliation/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py index 2c228a771bd..7ac603ba1fb 100644 --- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py +++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/accounts/doctype/bank_reconciliation_detail/__init__.py b/erpnext/accounts/doctype/bank_reconciliation_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_detail/__init__.py +++ b/erpnext/accounts/doctype/bank_reconciliation_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/budget_control/__init__.py b/erpnext/accounts/doctype/budget_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/budget_control/__init__.py +++ b/erpnext/accounts/doctype/budget_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/budget_control/budget_control.py b/erpnext/accounts/doctype/budget_control/budget_control.py index 361e6aba6ba..c088ade344e 100644 --- a/erpnext/accounts/doctype/budget_control/budget_control.py +++ b/erpnext/accounts/doctype/budget_control/budget_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/accounts/doctype/budget_detail/__init__.py b/erpnext/accounts/doctype/budget_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/budget_detail/__init__.py +++ b/erpnext/accounts/doctype/budget_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/budget_distribution/__init__.py b/erpnext/accounts/doctype/budget_distribution/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/budget_distribution/__init__.py +++ b/erpnext/accounts/doctype/budget_distribution/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/budget_distribution/budget_distribution.js b/erpnext/accounts/doctype/budget_distribution/budget_distribution.js index d7deb9a712f..c8bfe11525d 100644 --- a/erpnext/accounts/doctype/budget_distribution/budget_distribution.js +++ b/erpnext/accounts/doctype/budget_distribution/budget_distribution.js @@ -20,6 +20,11 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){ refresh_field('budget_distribution_details'); } - $c('runserverobj',args={'method' : 'get_months', 'docs' : compress_doclist(make_doclist(doc.doctype, doc.name))},callback1); + $c('runserverobj',args={'method' : 'get_months', 'docs' : + compress_doclist(make_doclist(doc.doctype, doc.name))},callback1); } +} + +cur_frm.cscript.refresh = function(doc,cdt,cdn){ + cur_frm.toggle_display('distribution_id', doc.__islocal); } \ No newline at end of file diff --git a/erpnext/accounts/doctype/budget_distribution/budget_distribution.py b/erpnext/accounts/doctype/budget_distribution/budget_distribution.py index 9468b60224a..84886cd0bd5 100644 --- a/erpnext/accounts/doctype/budget_distribution/budget_distribution.py +++ b/erpnext/accounts/doctype/budget_distribution/budget_distribution.py @@ -14,31 +14,21 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Please edit this list and import only required elements +from __future__ import unicode_literals 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, getchildren, make_autoname -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 - -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 - -# ----------------------------------------------------------------------------------------- - +from webnotes.utils import flt +from webnotes.model.doc import addchild +from webnotes.model.doclist import getlist +from webnotes import msgprint class DocType: def __init__(self,doc,doclist=[]): self.doc,self.doclist = doc,doclist def get_months(self): - month_list = ['January','February','March','April','May','June','July','August','September','October','November','December'] + month_list = ['January','February','March','April','May','June','July','August','September', + 'October','November','December'] idx =1 for m in month_list: mnth = addchild(self.doc,'budget_distribution_details','Budget Distribution Detail',1,self.doclist) @@ -50,9 +40,5 @@ class DocType: total = 0 for d in getlist(self.doclist,'budget_distribution_details'): total = flt(total) + flt(d.percentage_allocation) - if total > 100: - msgprint("Percentage Allocation should not exceed 100%.") - raise Exception - elif total < 100: - msgprint("Percentage Allocation should not recede 100%.") - raise Exception \ No newline at end of file + if total != 100: + msgprint("Percentage Allocation should be equal to 100%%. Currently it is %s%%" % total, raise_exception=1) diff --git a/erpnext/accounts/doctype/budget_distribution/budget_distribution.txt b/erpnext/accounts/doctype/budget_distribution/budget_distribution.txt index ca9b869fe55..ab8a6c8cdc8 100644 --- a/erpnext/accounts/doctype/budget_distribution/budget_distribution.txt +++ b/erpnext/accounts/doctype/budget_distribution/budget_distribution.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:35:41', + 'creation': '2012-07-03 13:30:50', 'docstatus': 0, - 'modified': '2012-03-27 14:35:41', + 'modified': '2012-07-11 14:37:30', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -15,6 +15,7 @@ 'allow_trash': 1, 'autoname': u'field:distribution_id', 'colour': u'White:FFF', + 'description': u'**Budget Distribution** helps you distribute your budget across months if you have seasonality in your business.\n\nTo distribute a budget using this distribution, set this **Budget Distribution** in the **Cost Center**', 'doctype': 'DocType', 'module': u'Accounts', 'name': '__common__', @@ -22,7 +23,7 @@ 'section_style': u'Simple', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 24 + 'version': 1 }, # These values are common for all DocField @@ -108,13 +109,16 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'Name of the Budget Distribution', 'doctype': u'DocField', 'fieldname': u'distribution_id', 'fieldtype': u'Data', - 'label': u'Distribution ID', + 'label': u'Distribution Name', 'oldfieldname': u'distribution_id', 'oldfieldtype': u'Data', - 'permlevel': 0 + 'permlevel': 0, + 'reqd': 1 }, # DocField diff --git a/erpnext/accounts/doctype/budget_distribution_detail/__init__.py b/erpnext/accounts/doctype/budget_distribution_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/budget_distribution_detail/__init__.py +++ b/erpnext/accounts/doctype/budget_distribution_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt b/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt index d0912bef0c0..0acfdbc5bbe 100644 --- a/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt +++ b/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:35:41', + 'creation': '2012-07-03 13:30:47', 'docstatus': 0, - 'modified': '2012-03-27 14:35:41', + 'modified': '2012-07-11 14:32:16', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -21,7 +21,7 @@ 'section_style': u'Tray', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 6 + 'version': 1 }, # These values are common for all DocField @@ -60,16 +60,5 @@ 'oldfieldname': u'percentage_allocation', 'oldfieldtype': u'Currency', 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'aggregate_percentage', - 'fieldtype': u'Currency', - 'label': u'Aggregate Percentage', - 'oldfieldname': u'aggregate_percentage', - 'oldfieldtype': u'Currency', - 'permlevel': 2 } ] \ No newline at end of file diff --git a/erpnext/accounts/doctype/c_form/__init__.py b/erpnext/accounts/doctype/c_form/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/c_form/__init__.py +++ b/erpnext/accounts/doctype/c_form/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/c_form/c_form.py b/erpnext/accounts/doctype/c_form/c_form.py index e702c5371c6..a39ab4eb684 100644 --- a/erpnext/accounts/doctype/c_form/c_form.py +++ b/erpnext/accounts/doctype/c_form/c_form.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals import webnotes from webnotes.utils import add_days, cint, cstr, date_diff, default_fields, flt, getdate, now, nowdate from webnotes.model.doc import Document, addchild, getchildren, make_autoname diff --git a/erpnext/accounts/doctype/c_form_invoice_detail/__init__.py b/erpnext/accounts/doctype/c_form_invoice_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/c_form_invoice_detail/__init__.py +++ b/erpnext/accounts/doctype/c_form_invoice_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/cost_center/__init__.py b/erpnext/accounts/doctype/cost_center/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/cost_center/__init__.py +++ b/erpnext/accounts/doctype/cost_center/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/cost_center/cost_center.js b/erpnext/accounts/doctype/cost_center/cost_center.js index ade4ee882b4..058ebfb6316 100644 --- a/erpnext/accounts/doctype/cost_center/cost_center.js +++ b/erpnext/accounts/doctype/cost_center/cost_center.js @@ -14,7 +14,29 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . - + +cur_frm.cscript.set_breadcrumbs = function(barea) { + cur_frm.frm_head.appframe.add_breadcrumb(cur_frm.docname); + cur_frm.frm_head.appframe.add_breadcrumb(' in \ + Chart of Cost Centers'); + cur_frm.frm_head.appframe.add_breadcrumb(' in Accounts'); +} + +cur_frm.cscript.refresh = function(doc, cdt, cdn) { + var intro_txt = ''; + cur_frm.toggle_display('cost_center_name', doc.__islocal); + cur_frm.toggle_enable(['group_or_ledger', 'company_name'], doc.__islocal); + + if(!doc.__islocal && doc.group_or_ledger=='Group') { + intro_txt += '

Note: This is Cost Center is a Group, \ + Accounting Entries are not allowed against groups.

'; + } + + cur_frm.cscript.hide_unhide_group_ledger(doc); + + cur_frm.toggle_display('sb1', doc.group_or_ledger=='Ledger') + cur_frm.set_intro(intro_txt); +} //Account filtering for cost center cur_frm.fields_dict['budget_details'].grid.get_field('account').get_query = function(doc) { @@ -38,39 +60,25 @@ cur_frm.cscript.company_name = function(doc,cdt,cdn){ get_server_fields('get_abbr','','',doc,cdt,cdn,1); } -//onload if cost center is group -cur_frm.cscript.onload = function(doc, cdt, cdn) { - - if(!doc.__islocal && doc.docstatus == 0){ - get_field(doc.doctype,'group_or_ledger',doc.name).permlevel = 1; - refresh_field('group_or_ledger'); - get_field(doc.doctype,'company_name',doc.name).permlevel = 1; - refresh_field('company_name'); - } - -} - -cur_frm.cscript.refresh = function(doc, cdt, cdn) { - cur_frm.cscript.hide_unhide_group_ledger(doc); -} - // Hide/unhide group or ledger // ----------------------------------------- cur_frm.cscript.hide_unhide_group_ledger = function(doc) { - hide_field(['convert_to_group', 'convert_to_ledger']); - if (cstr(doc.group_or_ledger) == 'Group') unhide_field('convert_to_ledger'); - else if (cstr(doc.group_or_ledger) == 'Ledger') unhide_field('convert_to_group'); + if (cstr(doc.group_or_ledger) == 'Group') { + cur_frm.add_custom_button('Convert to Ledger', + function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet') + } else if (cstr(doc.group_or_ledger) == 'Ledger') { + cur_frm.add_custom_button('Convert to Group', + function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet') + } } // Convert group to ledger // ----------------------------------------- cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) { - $c_obj(make_doclist(cdt,cdn),'convert_group_to_ledger','',function(r,rt) { + $c_obj(cur_frm.get_doclist(),'convert_group_to_ledger','',function(r,rt) { if(r.message == 1) { - doc.group_or_ledger = 'Ledger'; - refresh_field('group_or_ledger'); - cur_frm.cscript.hide_unhide_group_ledger(doc); + cur_frm.refresh(); } }); } @@ -78,11 +86,9 @@ cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) { // Convert ledger to group // ----------------------------------------- cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) { - $c_obj(make_doclist(cdt,cdn),'convert_ledger_to_group','',function(r,rt) { + $c_obj(cur_frm.get_doclist(),'convert_ledger_to_group','',function(r,rt) { if(r.message == 1) { - doc.group_or_ledger = 'Group'; - refresh_field('group_or_ledger'); - cur_frm.cscript.hide_unhide_group_ledger(doc); + cur_frm.refresh(); } }); } diff --git a/erpnext/accounts/doctype/cost_center/cost_center.py b/erpnext/accounts/doctype/cost_center/cost_center.py index 83ad9d23cd9..57d9a295c13 100644 --- a/erpnext/accounts/doctype/cost_center/cost_center.py +++ b/erpnext/accounts/doctype/cost_center/cost_center.py @@ -14,26 +14,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Please edit this list and import only required elements +from __future__ import unicode_literals import webnotes +from webnotes.model.doclist import getlist +from webnotes import msgprint -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, getchildren, make_autoname -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.nestedset import DocTypeNestedSet -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: +class DocType(DocTypeNestedSet): def __init__(self,d,dl): self.doc, self.doclist = d,dl self.nsm_parent_field = 'parent_cost_center' @@ -41,9 +29,9 @@ class DocType: def autoname(self): self.doc.name = self.doc.cost_center_name + ' - ' + self.doc.company_abbr - #------------------------------------------------------------------------- def get_abbr(self): - abbr = sql("select abbr from tabCompany where company_name='%s'"%(self.doc.company_name))[0][0] or '' + abbr = webnotes.conn.sql("select abbr from tabCompany where company_name=%s", + self.doc.company_name)[0][0] or '' ret = { 'company_abbr' : abbr } @@ -56,7 +44,6 @@ class DocType: if self.doc.cost_center_name != 'Root' and not self.doc.parent_cost_center: msgprint("Please enter parent cost center", raise_exception=1) - #------------------------------------------------------------------------- def convert_group_to_ledger(self): if self.check_if_child_exists(): msgprint("Cost Center: %s has existing child. You can not convert this cost center to ledger" % (self.doc.name), raise_exception=1) @@ -67,7 +54,6 @@ class DocType: self.doc.save() return 1 - #------------------------------------------------------------------------- def convert_ledger_to_group(self): if self.check_gle_exists(): msgprint("Cost Center with existing transaction can not be converted to group.", raise_exception=1) @@ -76,54 +62,31 @@ class DocType: self.doc.save() return 1 - #------------------------------------------------------------------------- def check_gle_exists(self): - return sql("select name from `tabGL Entry` where cost_center = %s and ifnull(is_cancelled, 'No') = 'No'", (self.doc.name)) + return webnotes.conn.sql("select name from `tabGL Entry` where cost_center = %s and \ + ifnull(is_cancelled, 'No') = 'No'", (self.doc.name)) - - #------------------------------------------------------------------------- def check_if_child_exists(self): - return sql("select name from `tabCost Center` where parent_cost_center = %s and docstatus != 2", self.doc.name) - + return webnotes.conn.sql("select name from `tabCost Center` where \ + parent_cost_center = %s and docstatus != 2", self.doc.name) def validate_budget_details(self): check_acc_list = [] for d in getlist(self.doclist, 'budget_details'): + if self.doc.group_or_ledger=="Group": + msgprint("Budget cannot be set for Group Cost Centers", raise_exception=1) + if [d.account, d.fiscal_year] in check_acc_list: - msgprint("Account " + cstr(d.account) + "has been entered more than once for fiscal year " + cstr(d.fiscal_year), raise_exception=1) + msgprint("Account " + d.account + "has been entered more than once for fiscal year " + d.fiscal_year, raise_exception=1) else: check_acc_list.append([d.account, d.fiscal_year]) - - #------------------------------------------------------------------------- def validate(self): """ Cost Center name must be unique """ - if (self.doc.__islocal or not self.doc.name) and sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)): + if (self.doc.__islocal or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)): msgprint("Cost Center Name already exists, please rename", raise_exception=1) self.validate_mandatory() self.validate_budget_details() - - #------------------------------------------------------------------------- - def update_nsm_model(self): - """ - update Nested Set Model - """ - import webnotes.utils.nestedset - webnotes.utils.nestedset.update_nsm(self) - - #------------------------------------------------------------------------- - def on_update(self): - self.update_nsm_model() - - # On Trash - #------------------------------------------------------------------------- - def on_trash(self): - if self.check_if_child_exists(): - msgprint("Child exists for this cost center. You can not trash this account.", raise_exception=1) - - # rebuild tree - set(self.doc,'old_parent', '') - self.update_nsm_model() diff --git a/erpnext/accounts/doctype/cost_center/cost_center.txt b/erpnext/accounts/doctype/cost_center/cost_center.txt index b02d909370e..df655841235 100644 --- a/erpnext/accounts/doctype/cost_center/cost_center.txt +++ b/erpnext/accounts/doctype/cost_center/cost_center.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:35:41', + 'creation': '2012-07-03 13:30:47', 'docstatus': 0, - 'modified': '2012-03-27 14:35:41', + 'modified': '2012-07-11 14:41:39', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -18,6 +18,7 @@ 'autoname': u'field:cost_center_name', 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'**Chart of Accounts** is mainly for reporting information for governmental purposes and less for how business actually performs. \n\nMost businesses have multiple activities like different product lines, market segments, areas of business that share some common overheads but should ideally have their own structure to report whether they are profitable or not. For this purpose, there is an alternate structure, called the **Cost Centers**.\n\nA tree of **Cost Centers** to cab be designed to reflect the different units of an organization. Each Income / Expense entry is also tagged against a **Cost Center** and hence you can get Profit and Loss against a **Cost Center** too.\n\n### Budgeting\n\n**Cost Centers** can be used for budgeting purposes too. A budget can be set against each **Account** and the system will either stop, warn or ignore the budget based on the settings in the **Company** master.\n\nBudgets can also be distributed seasonally using **Budget Distribution**.', 'doctype': 'DocType', 'document_type': u'Master', 'in_create': 1, @@ -27,7 +28,7 @@ 'section_style': u'Simple', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 109 + 'version': 1 }, # These values are common for all DocField @@ -55,6 +56,42 @@ 'name': u'Cost Center' }, + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Accounts Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Accounts Manager', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Accounts User', + 'submit': 0, + 'write': 0 + }, + # DocPerm { 'amend': 0, @@ -84,40 +121,13 @@ 'role': u'All' }, - # DocPerm + # DocField { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Accounts Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Accounts Manager', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Accounts User', - 'submit': 0, - 'write': 0 + 'doctype': u'DocField', + 'fieldname': u'sb0', + 'fieldtype': u'Section Break', + 'label': u'Cost Center Details', + 'permlevel': 0 }, # DocField @@ -148,7 +158,7 @@ # DocField { - 'description': u'Select company name first.', + 'colour': u'White:FFF', 'doctype': u'DocField', 'fieldname': u'parent_cost_center', 'fieldtype': u'Link', @@ -178,15 +188,26 @@ # DocField { + 'colour': u'White:FFF', 'doctype': u'DocField', 'fieldname': u'company_abbr', 'fieldtype': u'Data', + 'hidden': 1, 'label': u'Company Abbr', 'oldfieldname': u'company_abbr', 'oldfieldtype': u'Data', 'permlevel': 1 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'cb0', + 'fieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' + }, + # DocField { 'colour': u'White:FFF', @@ -209,27 +230,18 @@ # DocField { 'colour': u'White:FFF', + 'description': u'Define Budget for this Cost Center. To set budget action, see Company Master', 'doctype': u'DocField', - 'fieldname': u'convert_to_group', - 'fieldtype': u'Button', - 'label': u'Convert to Group', - 'permlevel': 0, - 'trigger': u'Client' + 'fieldname': u'sb1', + 'fieldtype': u'Section Break', + 'label': u'Budget', + 'permlevel': 0 }, # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'convert_to_ledger', - 'fieldtype': u'Button', - 'label': u'Convert to Ledger', - 'permlevel': 0, - 'trigger': u'Client' - }, - - # DocField - { + 'description': u'Select Budget Distribution, if you want to track based on seasonality.', 'doctype': u'DocField', 'fieldname': u'distribution_id', 'fieldtype': u'Link', @@ -242,6 +254,8 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'Add rows to set annual budgets on Accounts.', 'doctype': u'DocField', 'fieldname': u'budget_details', 'fieldtype': u'Table', diff --git a/erpnext/accounts/doctype/fiscal_year/__init__.py b/erpnext/accounts/doctype/fiscal_year/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/fiscal_year/__init__.py +++ b/erpnext/accounts/doctype/fiscal_year/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.js b/erpnext/accounts/doctype/fiscal_year/fiscal_year.js index 6a03bf70144..936037cd6c2 100644 --- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.js +++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.js @@ -1,7 +1,3 @@ cur_frm.cscript.refresh = function(doc, dt, dn) { - if (doc.__islocal) { - hide_field(['repost_account_balances', 'repost_voucher_outstanding']); - set_multiple(dt, dn, {'is_fiscal_year_closed': 'No'}); - } - else unhide_field(['repost_account_balances', 'repost_voucher_outstanding']); + cur_frm.toggle_enable('year_start_date', doc.__islocal) } diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py index ce7140aa787..3ef27764953 100644 --- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py +++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 @@ -209,9 +210,6 @@ class DocType: if sql("select name from `tabFiscal Year` where year_start_date < %s", self.doc.year_start_date) and not self.doc.past_year: msgprint("Please enter Past Year", raise_exception=1) - if not self.doc.is_fiscal_year_closed: - self.doc.is_fiscal_year_closed = 'No' - # on update def on_update(self): diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.txt b/erpnext/accounts/doctype/fiscal_year/fiscal_year.txt index ae4c5a05e7c..68dbdb23328 100644 --- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.txt +++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:35:41', + 'creation': '2012-07-03 13:30:47', 'docstatus': 0, - 'modified': '2012-03-27 14:35:41', + 'modified': '2012-07-11 14:56:41', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -17,6 +17,7 @@ 'autoname': u'field:year', 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'**Fiscal Year** represents a Financial Year. All accounting entries and other major transactions are tracked against **Fiscal Year**.', 'doctype': 'DocType', 'document_type': u'Master', 'module': u'Accounts', @@ -24,7 +25,7 @@ 'section_style': u'Tabbed', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 57 + 'version': 1 }, # These values are common for all DocField @@ -59,14 +60,14 @@ # DocPerm { - 'doctype': u'DocPerm' + 'amend': 0, + 'doctype': u'DocPerm', + 'submit': 0 }, # DocPerm { - 'amend': 0, - 'doctype': u'DocPerm', - 'submit': 0 + 'doctype': u'DocPerm' }, # DocField @@ -74,7 +75,7 @@ 'doctype': u'DocField', 'fieldname': u'year_details', 'fieldtype': u'Section Break', - 'label': u'Year Details', + 'label': u'Fiscal Year Details', 'oldfieldtype': u'Section Break', 'permlevel': 0 }, @@ -92,6 +93,8 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'For e.g. 2012, 2012-13', 'doctype': u'DocField', 'fieldname': u'year', 'fieldtype': u'Data', @@ -102,18 +105,6 @@ 'reqd': 1 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'abbreviation', - 'fieldtype': u'Data', - 'label': u'Abbreviation', - 'oldfieldname': u'abbreviation', - 'oldfieldtype': u'Data', - 'permlevel': 0, - 'reqd': 1 - }, - # DocField { 'doctype': u'DocField', @@ -128,6 +119,9 @@ # DocField { + 'colour': u'White:FFF', + 'default': u'No', + 'description': u'Entries are not allowed against this Fiscal Year if the year is closed.', 'doctype': u'DocField', 'fieldname': u'is_fiscal_year_closed', 'fieldtype': u'Select', @@ -137,65 +131,5 @@ 'options': u'\nNo\nYes', 'permlevel': 0, 'reqd': 0 - }, - - # DocField - { - 'colour': u'White:FFF', - 'description': u"Click on the button below to reset balances from your previous year's closing and repost your balances. You can use this if your previous year balance sheet has been changed and you wish to update your current accounts.", - 'doctype': u'DocField', - 'fieldname': u'repost_accounts', - 'fieldtype': u'Section Break', - 'label': u'Repost Accounts', - 'oldfieldtype': u'Section Break', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'past_year', - 'fieldtype': u'Select', - 'label': u'Past Year', - 'oldfieldname': u'past_year', - 'oldfieldtype': u'Select', - 'options': u'link:Fiscal Year', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'company', - 'fieldtype': u'Link', - 'in_filter': 0, - 'label': u'Company', - 'oldfieldname': u'company', - 'oldfieldtype': u'Link', - 'options': u'Company', - 'permlevel': 0, - 'search_index': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'repost_account_balances', - 'fieldtype': u'Button', - 'label': u'Repost Account Balances', - 'oldfieldtype': u'Button', - 'options': u'repost', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'repost_voucher_outstanding', - 'fieldtype': u'Button', - 'label': u'Repost Voucher Outstanding', - 'oldfieldtype': u'Button', - 'options': u'update_voucher_outstanding', - 'permlevel': 0 } ] \ No newline at end of file diff --git a/erpnext/accounts/doctype/form_16a/__init__.py b/erpnext/accounts/doctype/form_16a/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/form_16a/__init__.py +++ b/erpnext/accounts/doctype/form_16a/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/form_16a/form_16a.py b/erpnext/accounts/doctype/form_16a/form_16a.py index fa2adb1c637..a254ef47d22 100644 --- a/erpnext/accounts/doctype/form_16a/form_16a.py +++ b/erpnext/accounts/doctype/form_16a/form_16a.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/accounts/doctype/form_16a_ack_detail/__init__.py b/erpnext/accounts/doctype/form_16a_ack_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/form_16a_ack_detail/__init__.py +++ b/erpnext/accounts/doctype/form_16a_ack_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/form_16a_tax_detail/__init__.py b/erpnext/accounts/doctype/form_16a_tax_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/form_16a_tax_detail/__init__.py +++ b/erpnext/accounts/doctype/form_16a_tax_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/gl_control/__init__.py b/erpnext/accounts/doctype/gl_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/gl_control/__init__.py +++ b/erpnext/accounts/doctype/gl_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/gl_control/gl_control.py b/erpnext/accounts/doctype/gl_control/gl_control.py index 28bc909cdff..bd10d6cfe50 100644 --- a/erpnext/accounts/doctype/gl_control/gl_control.py +++ b/erpnext/accounts/doctype/gl_control/gl_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 @@ -124,6 +125,7 @@ class DocType: ac.fields[d] = arg[d] ac.old_parent = '' ac_obj = get_obj(doc=ac) + ac_obj.doc.freeze_account='No' ac_obj.validate() ac_obj.doc.save(1) ac_obj.on_update() @@ -663,4 +665,4 @@ def send_notification(new_rv): msg = hd + tbl + totals recipients = new_rv.doc.notification_email_address.replace('\n', '').replace(' ', '').split(",") - sendmail(recipients, subject=subject, msg = msg) \ No newline at end of file + sendmail(recipients, subject=subject, msg = msg) diff --git a/erpnext/accounts/doctype/gl_entry/__init__.py b/erpnext/accounts/doctype/gl_entry/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/gl_entry/__init__.py +++ b/erpnext/accounts/doctype/gl_entry/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py index 775d2220b34..85670ab8860 100644 --- a/erpnext/accounts/doctype/gl_entry/gl_entry.py +++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/accounts/doctype/journal_voucher/__init__.py b/erpnext/accounts/doctype/journal_voucher/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/journal_voucher/__init__.py +++ b/erpnext/accounts/doctype/journal_voucher/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py index 7fed12929b8..1c01700cac2 100644 --- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py +++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals import webnotes from webnotes.utils import cint, cstr, flt, fmt_money, formatdate, getTraceback, get_defaults, getdate, has_common, month_name, now, nowdate, sendmail, set_default, str_esc_quote, user_format, validate_email_add diff --git a/erpnext/accounts/doctype/journal_voucher_detail/__init__.py b/erpnext/accounts/doctype/journal_voucher_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/journal_voucher_detail/__init__.py +++ b/erpnext/accounts/doctype/journal_voucher_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/lease_agreement/__init__.py b/erpnext/accounts/doctype/lease_agreement/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/lease_agreement/__init__.py +++ b/erpnext/accounts/doctype/lease_agreement/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/lease_agreement/lease_agreement.py b/erpnext/accounts/doctype/lease_agreement/lease_agreement.py index 1da2f05b298..f5f444c1086 100644 --- a/erpnext/accounts/doctype/lease_agreement/lease_agreement.py +++ b/erpnext/accounts/doctype/lease_agreement/lease_agreement.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.model.doc import make_autoname, Document, addchild from webnotes import msgprint diff --git a/erpnext/accounts/doctype/lease_installment/__init__.py b/erpnext/accounts/doctype/lease_installment/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/lease_installment/__init__.py +++ b/erpnext/accounts/doctype/lease_installment/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/mis_control/__init__.py b/erpnext/accounts/doctype/mis_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/mis_control/__init__.py +++ b/erpnext/accounts/doctype/mis_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/mis_control/mis_control.py b/erpnext/accounts/doctype/mis_control/mis_control.py index 06a9491ec8e..f32b3e6cccf 100644 --- a/erpnext/accounts/doctype/mis_control/mis_control.py +++ b/erpnext/accounts/doctype/mis_control/mis_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/accounts/doctype/mode_of_payment/__init__.py b/erpnext/accounts/doctype/mode_of_payment/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/mode_of_payment/__init__.py +++ b/erpnext/accounts/doctype/mode_of_payment/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/multi_ledger_report/__init__.py b/erpnext/accounts/doctype/multi_ledger_report/__init__.py index e69de29bb2d..baffc488252 100755 --- a/erpnext/accounts/doctype/multi_ledger_report/__init__.py +++ b/erpnext/accounts/doctype/multi_ledger_report/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/multi_ledger_report/multi_ledger_report.py b/erpnext/accounts/doctype/multi_ledger_report/multi_ledger_report.py index 864198f4c77..53d011f1d31 100755 --- a/erpnext/accounts/doctype/multi_ledger_report/multi_ledger_report.py +++ b/erpnext/accounts/doctype/multi_ledger_report/multi_ledger_report.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.utils import add_days, cint, cstr, flt, getdate from webnotes.model.doclist import getlist diff --git a/erpnext/accounts/doctype/multi_ledger_report_detail/__init__.py b/erpnext/accounts/doctype/multi_ledger_report_detail/__init__.py index e69de29bb2d..baffc488252 100755 --- a/erpnext/accounts/doctype/multi_ledger_report_detail/__init__.py +++ b/erpnext/accounts/doctype/multi_ledger_report_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/__init__.py b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/__init__.py +++ b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py index d615013d760..d28f89b58d8 100644 --- a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py +++ b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/test_ir.py b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/test_ir.py index d990b188522..92c9e789805 100644 --- a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/test_ir.py +++ b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/test_ir.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import unittest import webnotes diff --git a/erpnext/accounts/doctype/payment_to_invoice_matching_tool_detail/__init__.py b/erpnext/accounts/doctype/payment_to_invoice_matching_tool_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/payment_to_invoice_matching_tool_detail/__init__.py +++ b/erpnext/accounts/doctype/payment_to_invoice_matching_tool_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/period_closing_voucher/__init__.py b/erpnext/accounts/doctype/period_closing_voucher/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/__init__.py +++ b/erpnext/accounts/doctype/period_closing_voucher/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py index f4cf47d23ee..860fdd185bd 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py +++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 @@ -62,12 +63,12 @@ class DocType: def validate_posting_date(self): - yr = sql("select start_date, end_date from `tabPeriod` where period_name = '%s'" % (self.doc.fiscal_year)) + yr = sql("select start_date, end_date from `tabPeriod` where fiscal_year = '%s' and period_type = 'Year'" % (self.doc.fiscal_year)) self.year_start_date = yr and yr[0][0] or '' self.year_end_date = yr and yr[0][1] or '' # Posting Date should be within closing year - if getdate(self.doc.posting_date) < self.year_start_date or getdate(self.doc.posting_date) > self.year_end_date: + if getdate(self.doc.posting_date) < getdate(self.year_start_date) or getdate(self.doc.posting_date) > getdate(self.year_end_date): msgprint("Posting Date should be within Closing Fiscal Year") raise Exception diff --git a/erpnext/accounts/doctype/pos_setting/__init__.py b/erpnext/accounts/doctype/pos_setting/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/pos_setting/__init__.py +++ b/erpnext/accounts/doctype/pos_setting/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.py b/erpnext/accounts/doctype/pos_setting/pos_setting.py index c1dbf2bd53e..a485be9bbef 100755 --- a/erpnext/accounts/doctype/pos_setting/pos_setting.py +++ b/erpnext/accounts/doctype/pos_setting/pos_setting.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.txt b/erpnext/accounts/doctype/pos_setting/pos_setting.txt index b1b90e6ed5c..49ab1d3507d 100755 --- a/erpnext/accounts/doctype/pos_setting/pos_setting.txt +++ b/erpnext/accounts/doctype/pos_setting/pos_setting.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:35:46', + 'creation': '2012-06-11 12:09:53', 'docstatus': 0, - 'modified': '2012-03-27 14:35:46', + 'modified': '2012-07-16 16:27:51', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -22,7 +22,7 @@ 'section_style': u'Simple', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 33 + 'version': 1 }, # These values are common for all DocField @@ -52,37 +52,6 @@ 'name': u'POS Setting' }, - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'role': u'System Manager', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'role': u'System Manager', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'role': u'Accounts Manager', - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'role': u'Accounts User' - }, - # DocField { 'doctype': u'DocField', @@ -136,7 +105,7 @@ 'default': u'1', 'doctype': u'DocField', 'fieldname': u'conversion_rate', - 'fieldtype': u'Currency', + 'fieldtype': u'Float', 'label': u'Conversion Rate', 'oldfieldname': u'conversion_rate', 'oldfieldtype': u'Currency', @@ -279,5 +248,36 @@ 'oldfieldname': u'select_print_heading', 'oldfieldtype': u'Select', 'options': u'link:Print Heading' + }, + + # DocPerm + { + 'create': 1, + 'doctype': u'DocPerm', + 'role': u'System Manager', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + 'doctype': u'DocPerm', + 'role': u'System Manager', + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + 'doctype': u'DocPerm', + 'role': u'Accounts Manager', + 'write': 1 + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'role': u'Accounts User' } ] \ No newline at end of file diff --git a/erpnext/accounts/doctype/purchase_invoice/__init__.py b/erpnext/accounts/doctype/purchase_invoice/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/purchase_invoice/__init__.py +++ b/erpnext/accounts/doctype/purchase_invoice/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 9e2eb7351cd..d9c3fb149f5 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt index 3c2143ac72c..1f0e75097da 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-04-13 11:56:17', + 'creation': '2012-06-11 12:09:53', 'docstatus': 0, - 'modified': '2012-05-10 14:02:05', + 'modified': '2012-07-16 16:26:02', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -54,81 +54,6 @@ 'name': u'Purchase Invoice' }, - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Accounts Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Accounts Manager', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Accounts User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Purchase User' - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Purchase User', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Accounts User', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'match': u'supplier', - 'permlevel': 0, - 'role': u'Supplier' - }, - # DocField { 'allow_on_submit': 0, @@ -381,7 +306,7 @@ 'description': u"The rate at which Bill Currency is converted into company's base currency", 'doctype': u'DocField', 'fieldname': u'conversion_rate', - 'fieldtype': u'Currency', + 'fieldtype': u'Float', 'label': u'Bill Conversion Rate', 'oldfieldname': u'conversion_rate', 'oldfieldtype': u'Currency', @@ -1193,5 +1118,80 @@ 'no_copy': 1, 'permlevel': 0, 'print_hide': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Accounts Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Accounts Manager', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Accounts User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Purchase User' + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Purchase User', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Accounts User', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'match': u'supplier', + 'permlevel': 0, + 'role': u'Supplier' } ] \ No newline at end of file diff --git a/erpnext/accounts/doctype/purchase_invoice_advance/__init__.py b/erpnext/accounts/doctype/purchase_invoice_advance/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/purchase_invoice_advance/__init__.py +++ b/erpnext/accounts/doctype/purchase_invoice_advance/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/purchase_invoice_item/__init__.py b/erpnext/accounts/doctype/purchase_invoice_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/purchase_invoice_item/__init__.py +++ b/erpnext/accounts/doctype/purchase_invoice_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges/__init__.py b/erpnext/accounts/doctype/purchase_taxes_and_charges/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges/__init__.py +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt b/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt index 74fd69740c2..096050d2520 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:35:46', + 'creation': '2012-07-03 13:30:49', 'docstatus': 0, - 'modified': '2012-03-27 14:35:46', + 'modified': '2012-07-12 14:08:27', 'modified_by': u'Administrator', 'owner': u'wasim@webnotestech.com' }, @@ -24,7 +24,7 @@ 'section_style': u'Tray', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 13 + 'version': 1 }, # These values are common for all DocField @@ -42,34 +42,6 @@ 'name': u'Purchase Taxes and Charges' }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'category', - 'fieldtype': u'Select', - 'label': u'Category', - 'oldfieldname': u'category', - 'oldfieldtype': u'Select', - 'options': u'\nFor Total\nFor Valuation\nFor Both', - 'permlevel': 0, - 'reqd': 1 - }, - - # DocField - { - 'default': u'Add', - 'doctype': u'DocField', - 'fieldname': u'add_deduct_tax', - 'fieldtype': u'Select', - 'label': u'Add or Deduct', - 'oldfieldname': u'add_deduct_tax', - 'oldfieldtype': u'Select', - 'options': u'\nAdd\nDeduct', - 'permlevel': 0, - 'reqd': 1, - 'trigger': u'Client' - }, - # DocField { 'doctype': u'DocField', @@ -84,46 +56,6 @@ 'trigger': u'Client' }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'row_id', - 'fieldtype': u'Data', - 'hidden': 0, - 'label': u'Enter Row', - 'oldfieldname': u'row_id', - 'oldfieldtype': u'Data', - 'permlevel': 0, - 'trigger': u'Client' - }, - - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'item_wise_tax_detail', - 'fieldtype': u'Small Text', - 'hidden': 1, - 'label': u'Item Wise Tax Detail ', - 'oldfieldname': u'item_wise_tax_detail', - 'oldfieldtype': u'Small Text', - 'permlevel': 1, - 'print_hide': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'description', - 'fieldtype': u'Small Text', - 'label': u'Description', - 'oldfieldname': u'description', - 'oldfieldtype': u'Small Text', - 'permlevel': 0, - 'reqd': 1, - 'width': u'300px' - }, - # DocField { 'doctype': u'DocField', @@ -151,6 +83,19 @@ 'trigger': u'Client' }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'description', + 'fieldtype': u'Small Text', + 'label': u'Description', + 'oldfieldname': u'description', + 'oldfieldtype': u'Small Text', + 'permlevel': 0, + 'reqd': 1, + 'width': u'300px' + }, + # DocField { 'doctype': u'DocField', @@ -182,12 +127,70 @@ 'doctype': u'DocField', 'fieldname': u'total', 'fieldtype': u'Currency', - 'label': u'Aggregate Total', + 'label': u'Total', 'oldfieldname': u'total', 'oldfieldtype': u'Currency', 'permlevel': 1 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'row_id', + 'fieldtype': u'Data', + 'hidden': 0, + 'label': u'Enter Row', + 'oldfieldname': u'row_id', + 'oldfieldtype': u'Data', + 'permlevel': 0, + 'trigger': u'Client' + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'For Both', + 'doctype': u'DocField', + 'fieldname': u'category', + 'fieldtype': u'Select', + 'label': u'Consider Tax or Charge for', + 'oldfieldname': u'category', + 'oldfieldtype': u'Select', + 'options': u'Valuation and Total\nValuation\nTotal', + 'permlevel': 0, + 'reqd': 1 + }, + + # DocField + { + 'colour': u'White:FFF', + 'default': u'Add', + 'doctype': u'DocField', + 'fieldname': u'add_deduct_tax', + 'fieldtype': u'Select', + 'label': u'Add or Deduct', + 'oldfieldname': u'add_deduct_tax', + 'oldfieldtype': u'Select', + 'options': u'Add\nDeduct', + 'permlevel': 0, + 'reqd': 1, + 'trigger': u'Client' + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'item_wise_tax_detail', + 'fieldtype': u'Small Text', + 'hidden': 1, + 'label': u'Item Wise Tax Detail ', + 'oldfieldname': u'item_wise_tax_detail', + 'oldfieldtype': u'Small Text', + 'permlevel': 1, + 'print_hide': 1 + }, + # DocField { 'doctype': u'DocField', diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/__init__.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/__init__.py +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js index d3a32e92c00..fa2c8365305 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js @@ -22,7 +22,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { } cur_frm.cscript.refresh = function(doc, cdt, cdn) { - + cur_frm.set_footnote(wn.markdown(cur_frm.meta.description)); } cur_frm.pformat.purchase_tax_details= function(doc){ @@ -74,7 +74,7 @@ cur_frm.cscript.add_deduct_tax = function(doc, cdt, cdn) { alert("Please select Category first"); d.add_deduct_tax = ''; } - else if(d.category != 'For Total' && d.add_deduct_tax == 'Deduct'){ + else if(d.category != 'Total' && d.add_deduct_tax == 'Deduct'){ alert("You cannot Deduct when category is for valuation or for both(i.e total and valuation)"); d.add_deduct_tax = ''; } @@ -91,8 +91,8 @@ cur_frm.cscript.charge_type = function(doc, cdt, cdn) { alert("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row"); d.charge_type = ''; } - else if((d.category == 'For Valuation' || d.category == 'For Both') && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){ - alert("You cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for valuation. You can select only 'For Total' option for previous row amount or previous row total") + else if((d.category == 'Valuation' || d.category == 'Valuation and Total') && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){ + alert("You cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for valuation. You can select only 'Total' option for previous row amount or previous row total") d.charge_type = ''; } validated = false; diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py index a3cc0b38d2f..7c2ca7e5f17 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt index 15b4dfa9548..5c72c2c5841 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt @@ -17,6 +17,7 @@ 'autoname': u'field:title', 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'Standard tax template that can be applied to all Purchase Transactions. This template can contain list of tax heads and also other expense heads like "Shipping", "Insurance", "Handling" etc.\n\n#### Note\n\nThe tax rate you define here will be the standard tax rate for all **Items**. If there are **Items** that have different rates, they must be added in the **Item Tax** table in the **Item** master.\n\n#### Description of Columns\n\n1. Calculation Type: \n - This can be on **Net Total** (that is the sum of basic amount).\n - **On Previous Row Total / Amount** (for cumulative taxes or charges). If you select this option, the tax will be applied as a percentage of the previous row (in the tax table) amount or total.\n - **Actual** (as mentioned).\n2. Account Head: The Account ledger under which this tax will be booked\n3. Cost Center: If the tax / charge is an income (like shipping) or expense it needs to be booked against a Cost Center.\n4. Description: Description of the tax (that will be printed in invoices / quotes).\n5. Rate: Tax rate.\n6. Amount: Tax amount.\n7. Total: Cumulative total to this point.\n8. Enter Row: If based on "Previous Row Total" you can select the row number which will be taken as a base for this calculation (default is the previous row).\n9. Consider Tax or Charge for: In this section you can specify if the tax / charge is only for valuation (not a part of total) or only for total (does not add value to the item) or for both.\n10. Add or Deduct: Whether you want to add or deduct the tax.', 'doctype': 'DocType', 'document_type': u'Master', 'module': u'Accounts', @@ -134,5 +135,16 @@ 'oldfieldname': u'purchase_tax_details', 'oldfieldtype': u'Table', 'options': u'Purchase Taxes and Charges' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'company', + 'fieldtype': u'Link', + 'in_filter': 1, + 'label': u'Company', + 'options': u'Company', + 'reqd': 1 } ] \ No newline at end of file diff --git a/erpnext/accounts/doctype/sales_invoice/__init__.py b/erpnext/accounts/doctype/sales_invoice/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/sales_invoice/__init__.py +++ b/erpnext/accounts/doctype/sales_invoice/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index ec327c7e1bb..97848a36a88 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 @@ -40,18 +41,12 @@ class DocType(TransactionBase): self.fname = 'entries' - # Autoname - # --------- def autoname(self): self.doc.name = make_autoname(self.doc.naming_series+ '.#####') - -# ********************************* Trigger Functions ****************************** - - #Set retail related fields from pos settings - #------------------------------------------------------------------------- def set_pos_fields(self): + """Set retail related fields from pos settings""" pos = webnotes.conn.sql("select * from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1) if not pos: pos = webnotes.conn.sql("select * from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1) @@ -79,9 +74,8 @@ class DocType(TransactionBase): if self.doc.charge: self.get_other_charges() - # Set default values related to pos for previously created sales invoice. - # -------------------------------------------------------------------------- def set_pos_item_values(self): + """Set default values related to pos for previously created sales invoice.""" if cint(self.doc.is_pos) ==1: dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1) if not dtl: @@ -94,10 +88,8 @@ class DocType(TransactionBase): d.warehouse = item and item[0]['default_warehouse'] or dtl and dtl[0]['warehouse'] or d.warehouse - - # Get Account Head to which amount needs to be Debited based on Customer - # ---------------------------------------------------------------------- def get_customer_account(self): + """Get Account Head to which amount needs to be Debited based on Customer""" if not self.doc.company: msgprint("Please select company first and re-select the customer after doing so", raise_exception=1) @@ -115,10 +107,8 @@ class DocType(TransactionBase): return acc_head and {'debit_to' : acc_head} or {} - - # Set Due Date = Posting Date + Credit Days - # ----------------------------------------- def get_cust_and_due_date(self): + """Set Due Date = Posting Date + Credit Days""" credit_days = 0 if self.doc.debit_to: credit_days = webnotes.conn.sql("select credit_days from `tabAccount` where name='%s' and docstatus != 2" % self.doc.debit_to) @@ -134,9 +124,8 @@ class DocType(TransactionBase): self.doc.customer = webnotes.conn.get_value('Account',self.doc.debit_to,'master_name') - # Pull Details of Delivery Note or Sales Order Selected - # ------------------------------------------------------ def pull_details(self): + """Pull Details of Delivery Note or Sales Order Selected""" # Delivery Note if self.doc.delivery_note_main: self.validate_prev_docname('delivery note') @@ -153,14 +142,14 @@ class DocType(TransactionBase): ret = self.get_debit_to() self.doc.debit_to = ret.get('debit_to') - # onload pull income account - # -------------------------- + def load_default_accounts(self): """ Loads default accounts from items, customer when called from mapper """ self.get_income_account('entries') + def get_income_account(self,doctype): for d in getlist(self.doclist, doctype): if d.item_code: @@ -168,8 +157,7 @@ class DocType(TransactionBase): d.income_account = item and item[0]['default_income_account'] or '' d.cost_center = item and item[0]['default_sales_cost_center'] or '' - # Item Details - # ------------- + def get_item_details(self, args=None): import json args = args and json.loads(args) or {} @@ -215,61 +203,49 @@ class DocType(TransactionBase): return get_obj('Sales Common').get_barcode_details(barcode) - # Fetch ref rate from item master as per selected price list def get_adj_percent(self, arg=''): + """Fetch ref rate from item master as per selected price list""" get_obj('Sales Common').get_adj_percent(self) - # Get tax rate if account type is tax - # ------------------------------------ def get_rate(self,arg): + """Get tax rate if account type is tax""" get_obj('Sales Common').get_rate(arg) - # Get Commission rate of Sales Partner - # ------------------------------------- def get_comm_rate(self, sales_partner): + """Get Commission rate of Sales Partner""" return get_obj('Sales Common').get_comm_rate(sales_partner, self) - - # GET TERMS & CONDITIONS - # ------------------------------------- + def get_tc_details(self): return get_obj('Sales Common').get_tc_details(self) - # Load Default Charges - # ---------------------------------------------------------- + def load_default_taxes(self): self.doclist = get_obj('Sales Common').load_default_taxes(self) - # Get Sales Taxes and Charges Master Details - # -------------------------- + def get_other_charges(self): self.doclist = get_obj('Sales Common').get_other_charges(self) - # Get Advances - # ------------- + def get_advances(self): self.doclist = get_obj('GL Control').get_advances(self, self.doc.debit_to, 'Sales Invoice Advance', 'advance_adjustment_details', 'credit') - #pull project customer - #------------------------- + def pull_project_customer(self): res = webnotes.conn.sql("select customer from `tabProject` where name = '%s'"%self.doc.project_name) if res: get_obj('DocType Mapper', 'Project-Sales Invoice').dt_map('Project', 'Sales Invoice', self.doc.project_name, self.doc, self.doclist, "[['Project', 'Sales Invoice']]") -# ********************************** Server Utility Functions ****************************** - - # Get Company Abbr. - # ------------------ + def get_company_abbr(self): return webnotes.conn.sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0] - - # Check whether sales order / delivery note items already pulled - #---------------------------------------------------------------- + def validate_prev_docname(self,doctype): + """Check whether sales order / delivery note items already pulled""" for d in getlist(self.doclist, 'entries'): if doctype == 'delivery note' and self.doc.delivery_note_main == d.delivery_note: msgprint(cstr(self.doc.delivery_note_main) + " delivery note details have already been pulled.") @@ -279,7 +255,6 @@ class DocType(TransactionBase): raise Exception , "Validation Error. Sales order details have already been pulled." - #----------------------------------------------------------------- def update_against_document_in_jv(self): """ Links invoice and advance voucher: @@ -308,11 +283,8 @@ class DocType(TransactionBase): get_obj('GL Control').reconcile_against_document(lst) - # ------------------------------------------------------------------------ def validate_customer(self): - """ - Validate customer name with SO and DN - """ + """ Validate customer name with SO and DN""" for d in getlist(self.doclist,'entries'): dt = d.delivery_note and 'Delivery Note' or d.sales_order and 'Sales Order' or '' if dt: @@ -322,9 +294,8 @@ class DocType(TransactionBase): msgprint("Customer %s does not match with customer of %s: %s." %(self.doc.customer, dt, dt_no), raise_exception=1) - # Validates Debit To Account and Customer Matches - # ------------------------------------------------ - def validate_debit_to_acc(self): + def validate_customer_account(self): + """Validates Debit To Account and Customer Matches""" if self.doc.customer and self.doc.debit_to and not cint(self.doc.is_pos): acc_head = webnotes.conn.sql("select master_name from `tabAccount` where name = %s and docstatus != 2", self.doc.debit_to) @@ -334,11 +305,6 @@ class DocType(TransactionBase): and Master Name in account master." %(self.doc.debit_to, self.doc.customer,self.doc.company), raise_exception=1) - # Validate Debit To Account - # 1. Account Exists - # 2. Is a Debit Account - # 3. Is a PL Account - # --------------------------- def validate_debit_acc(self): acc = webnotes.conn.sql("select debit_or_credit, is_pl_account from tabAccount where name = '%s' and docstatus != 2" % self.doc.debit_to) if not acc: @@ -352,9 +318,8 @@ class DocType(TransactionBase): raise Exception - # Validate Fixed Asset Account and whether Income Account Entered Exists - # ----------------------------------------------------------------------- def validate_fixed_asset_account(self): + """Validate Fixed Asset Account and whether Income Account Entered Exists""" for d in getlist(self.doclist,'entries'): item = webnotes.conn.sql("select name,is_asset_item,is_sales_item from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())"% d.item_code) acc = webnotes.conn.sql("select account_type from `tabAccount` where name = '%s' and docstatus != 2" % d.income_account) @@ -366,22 +331,16 @@ class DocType(TransactionBase): raise Exception - - # Set totals in words - #-------------------- def set_in_words(self): dcc = TransactionBase().get_company_currency(self.doc.company) self.doc.in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.rounded_total) self.doc.in_words_export = get_obj('Sales Common').get_total_in_words(self.doc.currency, self.doc.rounded_total_export) - # Clear Advances - # -------------- + def clear_advances(self): get_obj('GL Control').clear_advances(self, 'Sales Invoice Advance','advance_adjustment_details') - # set aging date - #------------------- def set_aging_date(self): if self.doc.is_opening != 'Yes': self.doc.aging_date = self.doc.posting_date @@ -390,20 +349,21 @@ class DocType(TransactionBase): raise Exception - # Set against account for debit to account - #------------------------------------------ def set_against_income_account(self): + """Set against account for debit to account""" against_acc = [] for d in getlist(self.doclist, 'entries'): if d.income_account not in against_acc: against_acc.append(d.income_account) self.doc.against_income_account = ','.join(against_acc) + def add_remarks(self): if not self.doc.remarks: self.doc.remarks = 'No Remarks' - #check in manage account if sales order / delivery note required or not. + def so_dn_required(self): + """check in manage account if sales order / delivery note required or not.""" dic = {'Sales Order':'so_required','Delivery Note':'dn_required'} for i in dic: if webnotes.conn.get_value('Global Defaults', 'Global Defaults', dic[i]) == 'Yes': @@ -412,9 +372,9 @@ class DocType(TransactionBase): and not d.fields[i.lower().replace(' ','_')]: msgprint("%s is mandatory for stock item which is not mentioed against item: %s"%(i,d.item_code), raise_exception=1) - #check for does customer belong to same project as entered.. - #------------------------------------------------------------------------------------------------- + def validate_proj_cust(self): + """check for does customer belong to same project as entered..""" if self.doc.project_name and self.doc.customer: res = webnotes.conn.sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer)) if not res: @@ -430,20 +390,13 @@ class DocType(TransactionBase): raise Exception - # ********* UPDATE CURRENT STOCK ***************************** - def update_current_stock(self): - for d in getlist(self.doclist, 'entries'): - bin = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1) - d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0 - def validate_item_code(self): for d in getlist(self.doclist, 'entries'): if not d.item_code: msgprint("Please enter Item Code at line no : %s to update stock for POS or remove check from Update Stock in Basic Info Tab." % (d.idx)) raise Exception - # Validate Write Off Account - # ------------------------------- + def validate_write_off_account(self): if flt(self.doc.write_off_amount) and not self.doc.write_off_account: msgprint("Please enter Write Off Account", raise_exception=1) @@ -456,12 +409,22 @@ class DocType(TransactionBase): and parent = %s""", (self.doc.amended_from, self.doc.c_form_no)) webnotes.conn.set(self.doc, 'c_form_no', '') + + + def update_current_stock(self): + for d in getlist(self.doclist, 'entries'): + if d.item_code and d.warehouse: + bin = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1) + d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0 + + for d in getlist(self.doclist, 'packing_details'): + bin = sql("select actual_qty, projected_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1) + d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0 + d.projected_qty = bin and flt(bin[0]['projected_qty']) or 0 - # VALIDATE - # ==================================================================================== + def validate(self): self.so_dn_required() - #self.dn_required() self.validate_proj_cust() sales_com_obj = get_obj('Sales Common') sales_com_obj.check_stop_sales_order(self) @@ -471,7 +434,7 @@ class DocType(TransactionBase): sales_com_obj.get_allocated_sum(self) # this is to verify that the allocated % of sales persons is 100% sales_com_obj.validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date') self.validate_customer() - self.validate_debit_to_acc() + self.validate_customer_account() self.validate_debit_acc() self.validate_fixed_asset_account() self.add_remarks() @@ -479,7 +442,9 @@ class DocType(TransactionBase): self.validate_pos() self.validate_write_off_account() if cint(self.doc.update_stock): - get_obj('Stock Ledger').validate_serial_no(self, 'entries') + sl = get_obj('Stock Ledger') + sl.validate_serial_no(self, 'entries') + sl.validate_serial_no(self, 'packing_details') self.validate_item_code() self.update_current_stock() self.set_in_words() @@ -487,14 +452,62 @@ class DocType(TransactionBase): self.doc.is_opening = 'No' self.set_aging_date() self.clear_advances() - # Set against account self.set_against_income_account() self.validate_c_form() + + def get_warehouse(self): + w = webnotes.conn.sql("select warehouse from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company)) + w = w and w[0][0] or '' + if not w: + ps = webnotes.conn.sql("select name, warehouse from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % self.doc.company) + if not ps: + msgprint("To make POS entry, please create POS Setting from Accounts --> POS Setting page and refresh the system.") + raise Exception + elif not ps[0][1]: + msgprint("Please enter warehouse in POS Setting") + else: + w = ps[0][1] + return w + + + def make_packing_list(self): + get_obj('Sales Common').make_packing_list(self,'entries') + sl = get_obj('Stock Ledger') + sl.scrub_serial_nos(self) + sl.scrub_serial_nos(self, 'packing_details') + + + def on_update(self): + # Set default warehouse from pos setting + if cint(self.doc.is_pos) == 1: + if cint(self.doc.update_stock) == 1: + w = self.get_warehouse() + if w: + for d in getlist(self.doclist, 'entries'): + if not d.warehouse: + d.warehouse = cstr(w) + + self.make_packing_list() + else: + self.doclist = self.doc.clear_table(self.doclist, 'packing_details') + + if flt(self.doc.paid_amount) == 0: + if self.doc.cash_bank_account: + webnotes.conn.set(self.doc, 'paid_amount', + (flt(self.doc.grand_total) - flt(self.doc.write_off_amount))) + else: + # show message that the amount is not paid + webnotes.conn.set(self.doc,'paid_amount',0) + webnotes.msgprint("Note: Payment Entry will not be created since 'Cash/Bank Account' was not specified.") + + else: + self.doclist = self.doc.clear_table(self.doclist, 'packing_details') + webnotes.conn.set(self.doc,'paid_amount',0) + + webnotes.conn.set(self.doc,'outstanding_amount',flt(self.doc.grand_total) - flt(self.doc.total_advance) - flt(self.doc.paid_amount) - flt(self.doc.write_off_amount)) + -# *************************************************** ON SUBMIT ********************************************** - # Check Ref Document's docstatus - # ------------------------------- def check_prev_docstatus(self): for d in getlist(self.doclist,'entries'): if d.sales_order: @@ -510,56 +523,45 @@ class DocType(TransactionBase): raise Exception , "Validation Error." - #Set Actual Qty based on item code and warehouse - #------------------------------------------------------ - def set_actual_qty(self): - for d in getlist(self.doclist, 'entries'): - if d.item_code and d.warehouse: - actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, d.warehouse)) - d.actual_qty = actual_qty and flt(actual_qty[0][0]) or 0 - - - - # ********************** Make Stock Entry ************************************ def make_sl_entry(self, d, wh, qty, in_value, update_stock): - st_uom = webnotes.conn.sql("select stock_uom from `tabItem` where name = '%s'"%d.item_code) + st_uom = webnotes.conn.sql("select stock_uom from `tabItem` where name = '%s'"%d['item_code']) self.values.append({ - 'item_code' : d.item_code, + 'item_code' : d['item_code'], 'warehouse' : wh, 'transaction_date' : getdate(self.doc.modified).strftime('%Y-%m-%d'), 'posting_date' : self.doc.posting_date, 'posting_time' : self.doc.posting_time, 'voucher_type' : 'Sales Invoice', 'voucher_no' : cstr(self.doc.name), - 'voucher_detail_no' : cstr(d.name), + 'voucher_detail_no' : cstr(d['name']), 'actual_qty' : qty, 'stock_uom' : st_uom and st_uom[0][0] or '', 'incoming_rate' : in_value, 'company' : self.doc.company, 'fiscal_year' : self.doc.fiscal_year, 'is_cancelled' : (update_stock==1) and 'No' or 'Yes', - 'batch_no' : cstr(d.batch_no), - 'serial_no' : d.serial_no - }) + 'batch_no' : cstr(d['batch_no']), + 'serial_no' : d['serial_no'] + }) - # UPDATE STOCK LEDGER - # --------------------------------------------------------------------------- - def update_stock_ledger(self, update_stock, clear = 0): + def update_stock_ledger(self, update_stock): self.values = [] - for d in getlist(self.doclist, 'entries'): - stock_item = webnotes.conn.sql("SELECT is_stock_item, is_sample_item FROM tabItem where name = '%s'"%(d.item_code), as_dict = 1) # stock ledger will be updated only if it is a stock item + items = get_obj('Sales Common').get_item_list(self) + for d in items: + stock_item = webnotes.conn.sql("SELECT is_stock_item, is_sample_item \ + FROM tabItem where name = '%s'"%(d['item_code']), as_dict = 1) if stock_item[0]['is_stock_item'] == "Yes": + if not d['warehouse']: + msgprint("Message: Please enter Warehouse for item %s as it is stock item." \ + % d['item_code'], raise_exception=1) + # Reduce actual qty from warehouse - self.make_sl_entry( d, d.warehouse, - flt(d.qty) , 0, update_stock) - get_obj('Stock Ledger', 'Stock Ledger').update_stock(self.values, self.doc.amended_from and 'Yes' or 'No') - - - #-------------------POS Stock Updatation Part---------------------------------------------- - def pos_update_stock(self): - self.update_stock_ledger(update_stock = 1) + self.make_sl_entry( d, d['warehouse'], - flt(d['qty']) , 0, update_stock) + + get_obj('Stock Ledger', 'Stock Ledger').update_stock(self.values) - # ********** Get Actual Qty of item in warehouse selected ************* + def get_actual_qty(self,args): args = eval(args) actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], args['warehouse']), as_dict=1) @@ -568,23 +570,39 @@ class DocType(TransactionBase): } return ret - # Make GL Entries - # ------------------------- + def make_gl_entries(self, is_cancel=0): mapper = self.doc.is_pos and self.doc.write_off_account and 'POS with write off' or self.doc.is_pos and not self.doc.write_off_account and 'POS' or '' update_outstanding = self.doc.is_pos and self.doc.write_off_account and 'No' or 'Yes' get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist,cancel = is_cancel, use_mapper = mapper, update_outstanding = update_outstanding, merge_entries = cint(self.doc.is_pos) != 1 and 1 or 0) - # On Submit - # --------- + def update_c_form(self): + """Update amended id in C-form""" + if self.doc.c_form_no and self.doc.amended_from: + webnotes.conn.sql("""update `tabC-Form Invoice Detail` set invoice_no = %s, + invoice_date = %s, territory = %s, net_total = %s, + grand_total = %s where invoice_no = %s and parent = %s""", (self.doc.name, self.doc.amended_from, self.doc.c_form_no)) + + + def check_next_docstatus(self): + submit_jv = webnotes.conn.sql("select t1.name from `tabJournal Voucher` t1,`tabJournal Voucher Detail` t2 where t1.name = t2.parent and t2.against_invoice = '%s' and t1.docstatus = 1" % (self.doc.name)) + if submit_jv: + msgprint("Journal Voucher : " + cstr(submit_jv[0][0]) + " has been created against " + cstr(self.doc.doctype) + ". So " + cstr(self.doc.doctype) + " cannot be Cancelled.") + raise Exception, "Validation Error." + + def on_submit(self): if cint(self.doc.is_pos) == 1: if cint(self.doc.update_stock) == 1: sl_obj = get_obj("Stock Ledger") sl_obj.validate_serial_no_warehouse(self, 'entries') + sl_obj.validate_serial_no_warehouse(self, 'packing_details') + sl_obj.update_serial_record(self, 'entries', is_submit = 1, is_incoming = 0) - self.pos_update_stock() + sl_obj.update_serial_record(self, 'packing_details', is_submit = 1, is_incoming = 0) + + self.update_stock_ledger(update_stock=1) else: self.check_prev_docstatus() get_obj("Sales Common").update_prevdoc_detail(1,self) @@ -602,31 +620,13 @@ class DocType(TransactionBase): self.update_c_form() - def update_c_form(self): - """Update amended id in C-form""" - if self.doc.c_form_no and self.doc.amended_from: - webnotes.conn.sql("""update `tabC-Form Invoice Detail` set invoice_no = %s, - invoice_date = %s, territory = %s, net_total = %s, - grand_total = %s where invoice_no = %s and parent = %s""", (self.doc.name, self.doc.amended_from, self.doc.c_form_no)) - - - -# *************************************************** ON CANCEL ********************************************** - # Check Next Document's docstatus - # -------------------------------- - def check_next_docstatus(self): - submit_jv = webnotes.conn.sql("select t1.name from `tabJournal Voucher` t1,`tabJournal Voucher Detail` t2 where t1.name = t2.parent and t2.against_invoice = '%s' and t1.docstatus = 1" % (self.doc.name)) - if submit_jv: - msgprint("Journal Voucher : " + cstr(submit_jv[0][0]) + " has been created against " + cstr(self.doc.doctype) + ". So " + cstr(self.doc.doctype) + " cannot be Cancelled.") - raise Exception, "Validation Error." - - - # On Cancel - # ---------- def on_cancel(self): if cint(self.doc.is_pos) == 1: if cint(self.doc.update_stock) == 1: - get_obj('Stock Ledger').update_serial_record(self, 'entries', is_submit = 0, is_incoming = 0) + sl = get_obj('Stock Ledger') + sl.update_serial_record(self, 'entries', is_submit = 0, is_incoming = 0) + sl.update_serial_record(self, 'packing_details', is_submit = 0, is_incoming = 0) + self.update_stock_ledger(update_stock = -1) else: sales_com_obj = get_obj(dt = 'Sales Common') @@ -743,3 +743,4 @@ class DocType(TransactionBase): next_date = next_date.strftime("%Y-%m-%d") webnotes.conn.set(self.doc, 'next_date', next_date) + diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt index c517a588f40..ad92d22e06d 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt @@ -354,6 +354,16 @@ 'permlevel': 0 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'sales_bom_help', + 'fieldtype': u'HTML', + 'label': u'Sales BOM Help', + 'permlevel': 0, + 'print_hide': 1 + }, + # DocField { 'doctype': u'DocField', @@ -502,7 +512,7 @@ 'description': u"Rate at which Price list currency is converted to customer's base currency", 'doctype': u'DocField', 'fieldname': u'plc_conversion_rate', - 'fieldtype': u'Currency', + 'fieldtype': u'Float', 'label': u'Price List Currency Conversion Rate', 'permlevel': 0, 'print_hide': 1, @@ -539,7 +549,7 @@ 'description': u"Rate at which Customer Currency is converted to customer's base currency", 'doctype': u'DocField', 'fieldname': u'conversion_rate', - 'fieldtype': u'Currency', + 'fieldtype': u'Float', 'label': u'Conversion Rate', 'oldfieldname': u'conversion_rate', 'oldfieldtype': u'Currency', @@ -1347,6 +1357,27 @@ 'print_hide': 1 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'packing_list', + 'fieldtype': u'Section Break', + 'label': u'Packing List', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'packing_details', + 'fieldtype': u'Table', + 'label': u'Packing Details', + 'options': u'Delivery Note Packing Item', + 'permlevel': 0, + 'print_hide': 1 + }, + # DocField { 'doctype': u'DocField', @@ -1632,5 +1663,61 @@ 'no_copy': 1, 'permlevel': 0, 'print_hide': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Accounts Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Accounts Manager', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Accounts User', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Accounts User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'match': u'customer', + 'permlevel': 0, + 'role': u'Customer' } ] \ No newline at end of file diff --git a/erpnext/accounts/doctype/sales_invoice_advance/__init__.py b/erpnext/accounts/doctype/sales_invoice_advance/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/sales_invoice_advance/__init__.py +++ b/erpnext/accounts/doctype/sales_invoice_advance/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/sales_invoice_item/__init__.py b/erpnext/accounts/doctype/sales_invoice_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/sales_invoice_item/__init__.py +++ b/erpnext/accounts/doctype/sales_invoice_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/__init__.py b/erpnext/accounts/doctype/sales_taxes_and_charges/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges/__init__.py +++ b/erpnext/accounts/doctype/sales_taxes_and_charges/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt index 2a25a6a61ee..66d7aae835d 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt +++ b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-05-15 12:14:34', + 'creation': '2012-07-04 16:40:13', 'docstatus': 0, - 'modified': '2012-07-04 13:27:05', + 'modified': '2012-07-12 13:50:43', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -113,7 +113,7 @@ 'doctype': u'DocField', 'fieldname': u'tax_amount', 'fieldtype': u'Currency', - 'label': u'Amount*', + 'label': u'Amount', 'oldfieldname': u'tax_amount', 'oldfieldtype': u'Currency', 'permlevel': 0, @@ -126,7 +126,7 @@ 'doctype': u'DocField', 'fieldname': u'total', 'fieldtype': u'Currency', - 'label': u'Total*', + 'label': u'Total', 'oldfieldname': u'total', 'oldfieldtype': u'Currency', 'permlevel': 1 diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/__init__.py b/erpnext/accounts/doctype/sales_taxes_and_charges_master/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/__init__.py +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js index bae6b74d279..16bf1bb6d97 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js @@ -19,9 +19,9 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { // } -/*cur_frm.cscript.refresh = function(doc, cdt, cdn) { - -}*/ +cur_frm.cscript.refresh = function(doc, cdt, cdn) { + cur_frm.set_footnote(wn.markdown(cur_frm.meta.description)); +} // For customizing print cur_frm.pformat.net_total = function(doc) { diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.py b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.py index f5342edf5f4..953269c50e9 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.py +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.py @@ -8,43 +8,26 @@ # # 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 +# 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 . +# along with this program. If not, see . -# Please edit this list and import only required elements +from __future__ import unicode_literals 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, getchildren, make_autoname -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 - -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, doc, doclist=[]): - self.doc = doc - self.doclist = doclist + def __init__(self, doc, doclist=[]): + self.doc = doc + self.doclist = doclist - # Get Tax Rate if account type is Tax - # =================================================================== - def get_rate(self, arg): - get_obj('Sales Common').get_rate(arg, self) + def get_rate(self, arg): + from webnotes.model.code import get_obj + return get_obj('Sales Common').get_rate(arg, self) - def update_other_default_charges(self): - sql("update `tabSales Taxes and Charges Master` set is_default = 0 where ifnull(is_default,0) = 1 and name != '%s' and company = '%s'" % (self.doc.name, self.doc.company)) + def update_other_default_charges(self): + webnotes.conn.sql("update `tabSales Taxes and Charges Master` set is_default = 0 where ifnull(is_default,0) = 1 and name != '%s' and company = '%s'" % (self.doc.name, self.doc.company)) - def on_update(self): - self.update_other_default_charges() + def on_update(self): + self.update_other_default_charges() diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt index 655269c26ef..1707bf4cfb1 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:22', + 'creation': '2012-07-03 13:30:46', 'docstatus': 0, - 'modified': '2012-03-27 14:36:22', + 'modified': '2012-07-12 13:43:32', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -17,6 +17,7 @@ 'autoname': u'field:title', 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'Standard tax template that can be applied to all Sales Transactions. This template can contain list of tax heads and also other expense / income heads like "Shipping", "Insurance", "Handling" etc.\n\n#### Note\n\nThe tax rate you define here will be the standard tax rate for all **Items**. If there are **Items** that have different rates, they must be added in the **Item Tax** table in the **Item** master.\n\n#### Description of Columns\n\n1. Calculation Type: \n - This can be on **Net Total** (that is the sum of basic amount).\n - **On Previous Row Total / Amount** (for cumulative taxes or charges). If you select this option, the tax will be applied as a percentage of the previous row (in the tax table) amount or total.\n - **Actual** (as mentioned).\n2. Account Head: The Account ledger under which this tax will be booked\n3. Cost Center: If the tax / charge is an income (like shipping) or expense it needs to be booked against a Cost Center.\n4. Description: Description of the tax (that will be printed in invoices / quotes).\n5. Rate: Tax rate.\n6. Amount: Tax amount.\n7. Total: Cumulative total to this point.\n8. Enter Row: If based on "Previous Row Total" you can select the row number which will be taken as a base for this calculation (default is the previous row).\n9. Is this Tax included in Basic Rate?: If you check this, it means that this tax will not be shown below the item table, but will be included in the Basic Rate in your main item table. This is useful where you want give a flat price (inclusive of all taxes) price to customers.', 'doctype': 'DocType', 'document_type': u'Master', 'module': u'Accounts', @@ -24,7 +25,7 @@ 'section_style': u'Tabbed', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 57 + 'version': 1 }, # These values are common for all DocField @@ -33,7 +34,8 @@ 'name': '__common__', 'parent': u'Sales Taxes and Charges Master', 'parentfield': u'fields', - 'parenttype': u'DocType' + 'parenttype': u'DocType', + 'permlevel': 0 }, # These values are common for all DocPerm @@ -52,6 +54,42 @@ 'name': u'Sales Taxes and Charges Master' }, + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales Master Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales User', + 'submit': 0, + 'write': 0 + }, + # DocPerm { 'amend': 0, @@ -86,63 +124,6 @@ 'write': 1 }, - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Master Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales User', - 'submit': 0, - 'write': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'trash_reason', - 'fieldtype': u'Small Text', - 'label': u'Trash Reason', - 'oldfieldname': u'trash_reason', - 'oldfieldtype': u'Small Text', - 'permlevel': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'other_charges_details', - 'fieldtype': u'Section Break', - 'label': u'Other Charges Details', - 'oldfieldtype': u'Section Break', - 'permlevel': 0 - }, - # DocField { 'doctype': u'DocField', @@ -152,7 +133,6 @@ 'label': u'Title', 'oldfieldname': u'title', 'oldfieldtype': u'Data', - 'permlevel': 0, 'reqd': 1, 'search_index': 0 }, @@ -162,8 +142,20 @@ 'doctype': u'DocField', 'fieldname': u'is_default', 'fieldtype': u'Check', - 'label': u'Default', - 'permlevel': 0 + 'label': u'Default' + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'* Will be calculated in the transaction.', + 'doctype': u'DocField', + 'fieldname': u'other_charges', + 'fieldtype': u'Table', + 'label': u'Sales Taxes and Charges Master', + 'oldfieldname': u'other_charges', + 'oldfieldtype': u'Table', + 'options': u'Sales Taxes and Charges' }, # DocField @@ -176,20 +168,7 @@ 'oldfieldname': u'company', 'oldfieldtype': u'Link', 'options': u'Company', - 'permlevel': 0, 'reqd': 1, 'search_index': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'other_charges', - 'fieldtype': u'Table', - 'label': u'Sales Taxes and Charges Master', - 'oldfieldname': u'other_charges', - 'oldfieldtype': u'Table', - 'options': u'Sales Taxes and Charges', - 'permlevel': 0 } -] +] \ No newline at end of file diff --git a/erpnext/accounts/doctype/tds_category/__init__.py b/erpnext/accounts/doctype/tds_category/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/tds_category/__init__.py +++ b/erpnext/accounts/doctype/tds_category/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/tds_category/tds_category.py b/erpnext/accounts/doctype/tds_category/tds_category.py index 2053f084104..027c807b40a 100644 --- a/erpnext/accounts/doctype/tds_category/tds_category.py +++ b/erpnext/accounts/doctype/tds_category/tds_category.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/accounts/doctype/tds_category_account/__init__.py b/erpnext/accounts/doctype/tds_category_account/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/tds_category_account/__init__.py +++ b/erpnext/accounts/doctype/tds_category_account/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/tds_control/__init__.py b/erpnext/accounts/doctype/tds_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/tds_control/__init__.py +++ b/erpnext/accounts/doctype/tds_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/tds_control/tds_control.py b/erpnext/accounts/doctype/tds_control/tds_control.py index 5fda090b19a..585308155d2 100644 --- a/erpnext/accounts/doctype/tds_control/tds_control.py +++ b/erpnext/accounts/doctype/tds_control/tds_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/accounts/doctype/tds_detail/__init__.py b/erpnext/accounts/doctype/tds_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/tds_detail/__init__.py +++ b/erpnext/accounts/doctype/tds_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/tds_detail/tds_detail.txt b/erpnext/accounts/doctype/tds_detail/tds_detail.txt index c248e73ba27..b15e346c12b 100644 --- a/erpnext/accounts/doctype/tds_detail/tds_detail.txt +++ b/erpnext/accounts/doctype/tds_detail/tds_detail.txt @@ -3,30 +3,30 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:35:48', - 'docstatus': 0, - 'modified': '2012-03-27 14:35:48', - 'modified_by': u'Administrator', - 'owner': u'wasim@webnotestech.com' + u'creation': '2012-07-03 13:29:51', + u'docstatus': 0, + u'modified': '2012-09-17 11:08:28', + u'modified_by': u'Administrator', + u'owner': u'wasim@webnotestech.com' }, # These values are common for all DocType { 'colour': u'White:FFF', - 'doctype': 'DocType', + u'doctype': u'DocType', 'istable': 1, 'module': u'Accounts', - 'name': '__common__', + u'name': u'__common__', 'section_style': u'Simple', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 2 + 'version': 1 }, # These values are common for all DocField { - 'doctype': u'DocField', - 'name': '__common__', + u'doctype': u'DocField', + u'name': u'__common__', 'parent': u'TDS Detail', 'parentfield': u'fields', 'parenttype': u'DocType', @@ -36,54 +36,24 @@ # These values are common for all DocPerm { - 'doctype': u'DocPerm', - 'name': '__common__', + u'doctype': u'DocPerm', + u'name': u'__common__', 'parent': u'TDS Detail', 'parentfield': u'permissions', 'parenttype': u'DocType', - 'read': 1 + 'read': 1, + 'role': u'System Manager' }, # DocType, TDS Detail { - 'doctype': 'DocType', - 'name': u'TDS Detail' - }, - - # DocPerm - { - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'All', - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'All' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'System Manager', - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'System Manager' + u'doctype': u'DocType', + u'name': u'TDS Detail' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'tds_category', 'fieldtype': u'Select', 'label': u'TDS Category', @@ -94,7 +64,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'special_tds_rate_applicable', 'fieldtype': u'Select', 'label': u'Special TDS Rate Applicable', @@ -105,7 +75,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'special_tds_rate', 'fieldtype': u'Currency', 'label': u'Special TDS Rate(Section-197)\t', @@ -115,11 +85,24 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'special_tds_limit', 'fieldtype': u'Currency', 'label': u'Special TDS Limit', 'oldfieldname': u'special_tds_limit', 'oldfieldtype': u'Currency' + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 0, + 'write': 1 + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1 } ] \ No newline at end of file diff --git a/erpnext/accounts/doctype/tds_payment/__init__.py b/erpnext/accounts/doctype/tds_payment/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/tds_payment/__init__.py +++ b/erpnext/accounts/doctype/tds_payment/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/tds_payment/tds_payment.py b/erpnext/accounts/doctype/tds_payment/tds_payment.py index c1874d9f461..fa14f86f126 100644 --- a/erpnext/accounts/doctype/tds_payment/tds_payment.py +++ b/erpnext/accounts/doctype/tds_payment/tds_payment.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/accounts/doctype/tds_payment_detail/__init__.py b/erpnext/accounts/doctype/tds_payment_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/tds_payment_detail/__init__.py +++ b/erpnext/accounts/doctype/tds_payment_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/tds_rate_chart/__init__.py b/erpnext/accounts/doctype/tds_rate_chart/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/tds_rate_chart/__init__.py +++ b/erpnext/accounts/doctype/tds_rate_chart/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/tds_rate_detail/__init__.py b/erpnext/accounts/doctype/tds_rate_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/tds_rate_detail/__init__.py +++ b/erpnext/accounts/doctype/tds_rate_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/tds_return_acknowledgement/__init__.py b/erpnext/accounts/doctype/tds_return_acknowledgement/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/doctype/tds_return_acknowledgement/__init__.py +++ b/erpnext/accounts/doctype/tds_return_acknowledgement/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/trend_analyzer_control/__init__.py b/erpnext/accounts/doctype/trend_analyzer_control/__init__.py index e69de29bb2d..baffc488252 100755 --- a/erpnext/accounts/doctype/trend_analyzer_control/__init__.py +++ b/erpnext/accounts/doctype/trend_analyzer_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/doctype/trend_analyzer_control/trend_analyzer_control.py b/erpnext/accounts/doctype/trend_analyzer_control/trend_analyzer_control.py index cafe20a159b..a97cd6cdf1c 100755 --- a/erpnext/accounts/doctype/trend_analyzer_control/trend_analyzer_control.py +++ b/erpnext/accounts/doctype/trend_analyzer_control/trend_analyzer_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/accounts/page/__init__.py b/erpnext/accounts/page/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/page/__init__.py +++ b/erpnext/accounts/page/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/page/accounts_browser/__init__.py b/erpnext/accounts/page/accounts_browser/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/page/accounts_browser/__init__.py +++ b/erpnext/accounts/page/accounts_browser/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js index c58f73c5642..55d6be9c1cd 100644 --- a/erpnext/accounts/page/accounts_browser/accounts_browser.js +++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js @@ -56,7 +56,11 @@ pscript['onload_Accounts Browser'] = function(wrapper){ pscript['onshow_Accounts Browser'] = function(wrapper){ // set route var ctype = wn.get_route()[1] || 'Account'; - wrapper.appframe.title('Chart of '+ctype+'s'); + + wrapper.appframe.clear_breadcrumbs(); + wrapper.appframe.add_breadcrumb('Chart of '+ctype+'s'); + document.title = 'Chart of '+ctype+'s'; + wrapper.appframe.add_breadcrumb(' in Accounts'); if(erpnext.account_chart && erpnext.account_chart.ctype != ctype) { wrapper.$company_select.change(); @@ -153,13 +157,12 @@ erpnext.AccountsChart = Class.extend({ fields: [ {fieldtype:'Data', fieldname:'account_name', label:'New Account Name', reqd:true}, {fieldtype:'Select', fieldname:'group_or_ledger', label:'Group or Ledger', - options:'Group\nLedger'}, + options:'Group\nLedger', description:'Further accounts can be made under Groups,\ + but entries can be made against Ledger'}, {fieldtype:'Select', fieldname:'account_type', label:'Account Type', options: ['', 'Fixed Asset Account', 'Bank or Cash', 'Expense Account', 'Tax', 'Income Account', 'Chargeable'].join('\n') }, {fieldtype:'Float', fieldname:'tax_rate', label:'Tax Rate'}, - {fieldtype:'Select', fieldname:'master_type', label:'Master Type', - options: ['NA', 'Supplier', 'Customer', 'Employee'].join('\n') }, {fieldtype:'Button', fieldname:'create_new', label:'Create New' } ] }) @@ -170,11 +173,9 @@ erpnext.AccountsChart = Class.extend({ $(fd.group_or_ledger.input).change(function() { if($(this).val()=='Group') { $(fd.account_type.wrapper).toggle(false); - $(fd.master_type.wrapper).toggle(false); $(fd.tax_rate.wrapper).toggle(false); } else { $(fd.account_type.wrapper).toggle(true); - $(fd.master_type.wrapper).toggle(true); if(fd.account_type.get_value()=='Tax') { $(fd.tax_rate.wrapper).toggle(true); } @@ -199,6 +200,7 @@ erpnext.AccountsChart = Class.extend({ var node = me.selected_node(); v.parent_account = node.data('label'); + v.master_type = ''; v.company = me.company; $c_obj('GL Control', 'add_ac', v, @@ -224,10 +226,11 @@ erpnext.AccountsChart = Class.extend({ fields: [ {fieldtype:'Data', fieldname:'cost_center_name', label:'New Cost Center Name', reqd:true}, {fieldtype:'Select', fieldname:'group_or_ledger', label:'Group or Ledger', - options:'Group\nLedger'}, + options:'Group\nLedger', description:'Further accounts can be made under Groups,\ + but entries can be made against Ledger'}, {fieldtype:'Button', fieldname:'create_new', label:'Create New' } ] - }) + }); // create $(d.fields_dict.create_new.input).click(function() { diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.py b/erpnext/accounts/page/accounts_browser/accounts_browser.py index 690bf7aa221..aa955aeff1e 100644 --- a/erpnext/accounts/page/accounts_browser/accounts_browser.py +++ b/erpnext/accounts/page/accounts_browser/accounts_browser.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import webnotes from webnotes.utils import get_defaults, cstr diff --git a/erpnext/accounts/page/accounts_home/__init__.py b/erpnext/accounts/page/accounts_home/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/page/accounts_home/__init__.py +++ b/erpnext/accounts/page/accounts_home/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/page/chart_of_accounts/chart_of_accounts.html b/erpnext/accounts/page/chart_of_accounts/chart_of_accounts.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/erpnext/accounts/page/chart_of_accounts/chart_of_accounts.js b/erpnext/accounts/page/chart_of_accounts/chart_of_accounts.js deleted file mode 100644 index 0e8e298f4c7..00000000000 --- a/erpnext/accounts/page/chart_of_accounts/chart_of_accounts.js +++ /dev/null @@ -1,369 +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 . - -/* todo - - load / display chart of accounts - - settings for company, start date, end data - - load balances - - open ledger on link -*/ - -wn.pages['chart-of-accounts'].onload = function(wrapper) { - wn.ui.make_app_page({ - parent: wrapper, - title: 'Chart of Accounts', - single_column: true - }); - - erpnext.coa.make_page(wrapper); - erpnext.coa.load_companies(); -} -erpnext.coa = { - make_page: function(wrapper) { - erpnext.coa.company_select = wrapper.appframe - .add_select("Company", ["Loading..."]) - .change(function() { - erpnext.coa.chart = new erpnext.ChartOfAccounts(); - }); - - erpnext.coa.fiscal_year_select = wrapper.appframe - .add_select("Fiscal Year", ["Loading..."]).css("width", "100px") - .change(function() { - var selected_year = $(this).val(); - var fiscal_year = $.map(erpnext.coa.fiscal_years, function(v) { - return v[0] === selected_year ? v : null; - }); - erpnext.coa.opening_date.val(dateutil.str_to_user(fiscal_year[1])); - erpnext.coa.closing_date.val(dateutil.str_to_user(fiscal_year[2])); - erpnext.coa.refresh_btn.click(); - }) - - erpnext.coa.opening_date = wrapper.appframe.add_date("Opening Date") - .val(dateutil.str_to_user(sys_defaults.year_start_date)); - - var end_date = new Date(); - if(end_date > dateutil.str_to_obj(sys_defaults.year_end_date)) - end_date = sys_defaults.year_end_date; - - erpnext.coa.closing_date = wrapper.appframe.add_date("Closing Date") - .val(dateutil.obj_to_user(end_date)); - - erpnext.coa.refresh_btn = wrapper.appframe.add_button("Refresh", function() { - erpnext.coa.chart.refresh(); - }, "icon-refresh"); - - - - erpnext.coa.waiting = $('
\ -

Building Trial Balance Report. \ - Please wait for a few moments

\ -
\ -
') - .appendTo($(wrapper).find('.layout-main')); - - $('
\ -
').appendTo($(wrapper).find('.layout-main')); - - }, - load_companies: function() { - wn.call({ - module: "accounts", - page: "chart_of_accounts", - method: "get_companies", - callback: function(r) { - erpnext.coa.waiting.toggle(); - erpnext.coa.company_select.empty().add_options(r.message.companies) - .val(sys_defaults.company || r.message.companies[0]).change(); - erpnext.coa.fiscal_year_select.empty() - .add_options($.map(r.message.fiscal_years, function(v) { return v[0]; })) - .val(sys_defaults.fiscal_year); - erpnext.coa.fiscal_years = r.message.fiscal_years; - } - }); - } -}; - -erpnext.ChartOfAccounts = Class.extend({ - init: function() { - this.load_slickgrid(); - this.load_data($(erpnext.coa.company_select).val()); - }, - load_slickgrid: function() { - // load tree - wn.require('js/lib/slickgrid/slick.grid.css'); - wn.require('js/lib/slickgrid/slick-default-theme.css'); - wn.require('js/lib/slickgrid/jquery.event.drag.min.js'); - wn.require('js/lib/slickgrid/slick.core.js'); - wn.require('js/lib/slickgrid/slick.grid.js'); - wn.require('js/lib/slickgrid/slick.dataview.js'); - wn.dom.set_style('.slick-cell { font-size: 12px; }'); - }, - refresh: function() { - this.prepare_balances(); - this.render(); - }, - render: function() { - var me = this; - erpnext.coa.waiting.toggle(false); - this.setup_dataview(); - - var columns = [ - {id: "name", name: "Account", field: "name", width: 300, cssClass: "cell-title", - formatter: this.account_formatter}, - {id: "opening_debit", name: "Opening (Dr)", field: "opening_debit", width: 100}, - {id: "opening_credit", name: "Opening (Cr)", field: "opening_credit", width: 100}, - {id: "debit", name: "Debit", field: "debit", width: 100}, - {id: "credit", name: "Credit", field: "credit", width: 100}, - {id: "closing_debit", name: "Closing (Dr)", field: "closing_debit", width: 100}, - {id: "closing_credit", name: "Closing (Cr)", field: "closing_credit", width: 100} - ]; - - var options = { - editable: false, - enableColumnReorder: false - }; - - // initialize the grid - var grid = new Slick.Grid("#chart-of-accounts", this.dataView, columns, options); - this.add_events(grid); - this.grid = grid; - }, - load_data: function(company) { - var me = this; - wn.call({ - module: "accounts", - page: "chart_of_accounts", - method: "get_chart", - args: {company: company}, - callback: function(r) { - me.gl = r.message.gl; - me.prepare_chart(r.message.chart); - $.each(me.gl, function(i, v) { - v[1] = me.accounts[v[1]].name; - }); - me.refresh(); - } - }) - }, - prepare_chart: function(indata) { - var data = []; - var parent_map = {}; - var data_by_name = {}; - $.each(indata, function(i, v) { - if(v[0]) { - var d = { - "id": v[0], - "name": v[0], - "parent": v[1], - "debit_or_credit": v[2], - "opening_debit": 0, - "opening_credit": 0, - "debit": 0, - "credit": 0, - "closing_debit": 0, - "closing_credit": 0, - "is_pl": v[3] - }; - - data.push(d); - data_by_name[d.name] = d; - if(d.parent) { - parent_map[d.name] = d.parent; - } - } - }); - this.set_indent(data, parent_map); - this.accounts = data; - this.parent_map = parent_map; - this.accounts_by_name = data_by_name; - }, - prepare_balances: function() { - var gl = this.gl; - var me = this; - - this.opening_date = dateutil.user_to_obj(erpnext.coa.opening_date.val()); - this.closing_date = dateutil.user_to_obj(erpnext.coa.closing_date.val()); - this.set_fiscal_year(); - if (!this.fiscal_year) return; - - $.each(this.accounts, function(i, v) { - v.opening_debit = v.opening_credit = v.debit - = v.credit = v.closing_debit = v.closing_credit = 0; - }); - - $.each(gl, function(i, v) { - var posting_date = dateutil.str_to_obj(v[0]); - var account = me.accounts_by_name[v[1]]; - me.update_balances(account, posting_date, v) - }); - - this.update_groups(); - this.format_balances(); - }, - update_balances: function(account, posting_date, v) { - // opening - if (posting_date < this.opening_date || v[4] === "Y") { - if (account.is_pl === "Yes" && posting_date <= dateutil.str_to_obj(this.fiscal_year[1])) { - // balance of previous fiscal_year should - // not be part of opening of pl account balance - } else { - if(account.debit_or_credit=='D') { - account.opening_debit += (v[2] - v[3]); - } else { - account.opening_credit += (v[3] - v[2]); - } - } - } else if (this.opening_date <= posting_date && posting_date <= this.closing_date) { - // in between - account.debit += v[2]; - account.credit += v[3]; - } - // closing - if(account.debit_or_credit=='D') { - account.closing_debit = account.opening_debit + account.debit - account.credit; - } else { - account.closing_credit = account.opening_credit - account.debit + account.credit; - } - }, - update_groups: function() { - // update groups - var me= this; - $.each(this.accounts, function(i, account) { - // update groups - var parent = me.parent_map[account.name]; - while(parent) { - parent_account = me.accounts_by_name[parent]; - parent_account.opening_debit += account.opening_debit; - parent_account.opening_credit += account.opening_credit; - parent_account.debit += account.debit; - parent_account.credit += account.credit; - parent_account.closing_debit += account.closing_debit; - parent_account.closing_credit += account.closing_credit; - parent = me.parent_map[parent]; - } - }); - }, - format_balances: function() { - // format amount - $.each(this.accounts, function(i, v) { - v.opening_debit = fmt_money(v.opening_debit); - v.opening_credit = fmt_money(v.opening_credit); - v.debit = fmt_money(v.debit); - v.credit = fmt_money(v.credit); - v.closing_debit = fmt_money(v.closing_debit); - v.closing_credit = fmt_money(v.closing_credit); - }); - }, - set_fiscal_year: function() { - if (this.opening_date > this.closing_date) { - msgprint("Opening Date should be before Closing Date"); - return; - } - - this.fiscal_year = null; - var me = this; - $.each(erpnext.coa.fiscal_years, function(i, v) { - if (me.opening_date >= dateutil.str_to_obj(v[1]) && - me.closing_date <= dateutil.str_to_obj(v[2])) { - me.fiscal_year = v; - } - }); - - if (!this.fiscal_year) { - msgprint("Opening Date and Closing Date should be within same Fiscal Year"); - return; - } - }, - set_indent: function(data, parent_map) { - $.each(data, function(i, d) { - var indent = 0; - var parent = parent_map[d.name]; - if(parent) { - while(parent) { - indent++; - parent = parent_map[parent]; - } - } - d.indent = indent; - }); - }, - setup_dataview: function() { - var me = this; - // initialize the model - this.dataView = new Slick.Data.DataView({ inlineFilters: true }); - this.dataView.beginUpdate(); - this.dataView.setItems(this.accounts); - this.dataView.setFilter(this.dataview_filter); - this.dataView.endUpdate(); - }, - dataview_filter: function(item) { - if (item.parent) { - var parent = item.parent; - while (parent) { - if (erpnext.coa.chart.accounts_by_name[parent]._collapsed) { - return false; - } - parent = erpnext.coa.chart.parent_map[parent]; - } - } - return true; - }, - add_events: function(grid) { - var me = this; - grid.onClick.subscribe(function (e, args) { - if ($(e.target).hasClass("toggle")) { - var item = me.dataView.getItem(args.row); - if (item) { - if (!item._collapsed) { - item._collapsed = true; - } else { - item._collapsed = false; - } - - me.dataView.updateItem(item.id, item); - } - e.stopImmediatePropagation(); - } - }); - - this.dataView.onRowsChanged.subscribe(function (e, args) { - grid.invalidateRows(args.rows); - grid.render(); - }); - - this.dataView.onRowCountChanged.subscribe(function (e, args) { - grid.updateRowCount(); - grid.render(); - }); - - }, - account_formatter: function (row, cell, value, columnDef, dataContext) { - value = value.replace(/&/g,"&").replace(//g,">"); - var data = erpnext.coa.chart.accounts; - var spacer = ""; - var idx = erpnext.coa.chart.dataView.getIdxById(dataContext.id); - if (data[idx + 1] && data[idx + 1].indent > data[idx].indent) { - if (dataContext._collapsed) { - return spacer + "  " + value; - } else { - return spacer + "  " + value; - } - } else { - return spacer + "  " + value; - } - } -}); diff --git a/erpnext/accounts/page/chart_of_accounts/chart_of_accounts.py b/erpnext/accounts/page/chart_of_accounts/chart_of_accounts.py deleted file mode 100644 index 59cd460e710..00000000000 --- a/erpnext/accounts/page/chart_of_accounts/chart_of_accounts.py +++ /dev/null @@ -1,49 +0,0 @@ -import webnotes - -@webnotes.whitelist() -def get_chart(): - company = webnotes.form_dict.get('company') - res = {} - res["chart"] = webnotes.conn.sql("""select name, parent_account, - if(debit_or_credit="Debit", "D", ""), - if(is_pl_account="Yes", "Y", "") from - tabAccount where company=%s and docstatus < 2 order by lft""", (company, )) - - res["gl"] = webnotes.conn.sql("""select posting_date, account, ifnull(debit, 0), - ifnull(credit, 0), ifnull(is_opening, 'No') - from `tabGL Entry` where company=%s and ifnull(is_cancelled, "No") = "No" - order by posting_date""", (company, ), as_list=1) - - idx_map = {} - for i in xrange(len(res["chart"])): - idx_map[res["chart"][i][0]] = i - - for d in res["gl"]: - d[1] = idx_map[d[1]] - - return res - -@webnotes.whitelist() -def get_companies(): - """get a list of companies based on permission""" - - # check if match permission exists - res = webnotes.conn.sql("""select role, `match` from `tabDocPerm` - where parent='Account' and permlevel=0 and `read`=1""", as_dict=1) - - match = any((r["match"] for r in res - if r["role"] in webnotes.user.roles and r["match"]=="company")) - - # if match == company is specified and companies are specified in user defaults - res = {} - if match and webnotes.user.get_defaults().get("company"): - res["companies"] = webnotes.user.get_defaults().get("company") - else: - res["companies"] = [r[0] for r in webnotes.conn.sql("""select name from tabCompany - where docstatus!=2""")] - - res["fiscal_years"] = webnotes.conn.sql("""select name, year_start_date, - adddate(year_start_date, interval 1 year) - from `tabFiscal Year` where docstatus!=2 - order by year_start_date asc""") - return res diff --git a/erpnext/accounts/page/chart_of_accounts/chart_of_accounts.txt b/erpnext/accounts/page/chart_of_accounts/chart_of_accounts.txt deleted file mode 100644 index e9d5ab5065e..00000000000 --- a/erpnext/accounts/page/chart_of_accounts/chart_of_accounts.txt +++ /dev/null @@ -1,28 +0,0 @@ -# Page, chart-of-accounts -[ - - # These values are common in all dictionaries - { - 'creation': '2012-09-12 14:43:52', - 'docstatus': 0, - 'modified': '2012-09-12 14:43:53', - 'modified_by': u'Administrator', - 'owner': u'Administrator' - }, - - # These values are common for all Page - { - 'doctype': 'Page', - 'module': u'Accounts', - 'name': '__common__', - 'page_name': u'Chart of Accounts', - 'standard': u'Yes', - 'title': u'Chart of Accounts' - }, - - # Page, chart-of-accounts - { - 'doctype': 'Page', - 'name': u'chart-of-accounts' - } -] \ No newline at end of file diff --git a/erpnext/accounts/page/chart_of_accounts/__init__.py b/erpnext/accounts/page/financial_analytics/__init__.py similarity index 100% rename from erpnext/accounts/page/chart_of_accounts/__init__.py rename to erpnext/accounts/page/financial_analytics/__init__.py diff --git a/erpnext/accounts/page/financial_analytics/financial_analytics.js b/erpnext/accounts/page/financial_analytics/financial_analytics.js new file mode 100644 index 00000000000..e48ccb48156 --- /dev/null +++ b/erpnext/accounts/page/financial_analytics/financial_analytics.js @@ -0,0 +1,226 @@ +// 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 . + +wn.require("js/app/account_tree_grid.js"); +wn.require("js/app/account_tree_grid.css"); + +wn.pages['financial-analytics'].onload = function(wrapper) { + wn.ui.make_app_page({ + parent: wrapper, + title: 'Financial Analytics', + single_column: true + }); + erpnext.trial_balance = new erpnext.FinancialAnalytics(wrapper, 'Financial Analytics'); +} + +erpnext.FinancialAnalytics = erpnext.AccountTreeGrid.extend({ + filters: [ + {fieldtype:"Select", label: "PL or BS", options:["Profit and Loss", "Balance Sheet"], + filter: function(val, item, opts) { + if(val=='Profit and Loss') { + return item.is_pl_account=='Yes' || item._show; + } else { + return item.is_pl_account=='No' || item._show; + } + }}, + {fieldtype:"Select", label: "Company", link:"Company", default_value: "Select Company...", + filter: function(val, item, opts) { + return item.company == val || val == opts.default_value || item._show; + }}, + {fieldtype:"Select", label: "Fiscal Year", link:"Fiscal Year", + default_value: "Select Fiscal Year..."}, + {fieldtype:"Date", label: "From Date"}, + {fieldtype:"Label", label: "To"}, + {fieldtype:"Date", label: "To Date"}, + {fieldtype:"Select", label: "Range", + options:["Daily", "Weekly", "Monthly", "Quarterly", "Yearly"]}, + {fieldtype:"Button", label: "Refresh", icon:"icon-refresh icon-white", cssClass:"btn-info"}, + {fieldtype:"Button", label: "Reset Filters"} + ], + setup_columns: function() { + this.columns = [ + {id: "check", name: "Plot", field: "check", width: 30, + formatter: function(row, cell, value, columnDef, dataContext) { + return repl("", { + "name": dataContext.name, + "checked": dataContext.checked ? "checked" : "" + }) + }}, + {id: "name", name: "Account", field: "name", width: 300, + formatter: this.account_formatter}, + ]; + + var me = this; + var range = this.filter_inputs.range.val(); + this.from_date = dateutil.user_to_str(this.filter_inputs.from_date.val()); + this.to_date = dateutil.user_to_str(this.filter_inputs.to_date.val()); + var date_diff = dateutil.get_diff(this.to_date, this.from_date); + + me.column_map = {}; + var build_columns = function(condition) { + for(var i=0; i < date_diff; i++) { + var date = dateutil.add_days(me.from_date, i); + if(!condition) condition = function() { return true; } + + if(condition(date)) { + me.columns.push({ + from_date: date, + id: date, + name: dateutil.str_to_user(date), + field: date, + formatter: me.currency_formatter, + width: 100 + }); + } + me.last_date = date; + me.column_map[date] = me.columns[me.columns.length-1]; + } + } + + if(range=='Daily') { + build_columns(); + } else if(range=='Weekly') { + build_columns(function(date) { + if(!me.last_date) return true; + return !(dateutil.get_diff(date, me.from_date) % 7) + }); + } else if(range=='Monthly') { + build_columns(function(date) { + if(!me.last_date) return true; + return dateutil.str_to_obj(me.last_date).getMonth() != dateutil.str_to_obj(date).getMonth() + }); + } else if(range=='Quarterly') { + build_columns(function(date) { + if(!me.last_date) return true; + return dateutil.str_to_obj(date).getDate()==1 && in_list([0,3,6,9], dateutil.str_to_obj(date).getMonth()) + }); + } else if(range=='Yearly') { + build_columns(function(date) { + if(!me.last_date) return true; + return $.map(wn.report_dump.data['Fiscal Year'], function(v) { + return date==v.year_start_date ? true : null; + }).length; + }); + } + + }, + init_filter_values: function() { + this._super(); + this.filter_inputs.range.val('Weekly'); + }, + prepare_balances: function() { + var me = this; + + $.each(wn.report_dump.data['GL Entry'], function(i, gl) { + var posting_date = dateutil.str_to_obj(gl.posting_date); + var account = me.accounts_by_name[gl.account]; + var col = me.column_map[gl.posting_date]; + + if(col) { + if(gl.voucher_type=='Period Closing Voucher') { + // period closing voucher not to be added + // to profit and loss accounts (else will become zero!!) + if(account.is_pl_account!='Yes') + me.add_balance(col.field, account, gl); + } else { + me.add_balance(col.field, account, gl); + } + + } else if(account.is_pl_account!='Yes' + && (posting_date < dateutil.str_to_obj(me.from_date))) { + me.add_balance('opening', account, gl); + } + }); + + // make balances as cumulative + if(me.filter_inputs.pl_or_bs.val()=='Balance Sheet') { + $.each(me.accounts, function(i, ac) { + if((ac.rgt - ac.lft)==1 && ac.is_pl_account!='Yes') { + var opening = flt(ac.opening); + //if(opening) throw opening; + $.each(me.columns, function(i, col) { + if(col.formatter==me.currency_formatter) { + ac[col.field] = opening + flt(ac[col.field]); + opening = ac[col.field]; + } + }); + } + }) + } + this.update_groups(); + }, + add_balance: function(field, account, gl) { + account[field] = flt(account[field]) + + ((account.debit_or_credit == "Debit" ? 1 : -1) * (gl.debit - gl.credit)) + }, + init_account: function(d) { + var me = this; + $.each(this.columns, function(i, col) { + if (col.formatter==me.currency_formatter) { + d[col.from_date] = 0; + } + }); + }, + init_refresh: function() { + var me = this; + $.each(this.accounts || [], function(i, account) { + account.checked && me.preset_checks.push(account.name); + }); + }, + init_plot: function() { + var me = this; + if(this.preset_checks.length) { + $.each(me.preset_checks, function(i, name) { + me.accounts_by_name[name].checked = true; + }); + } else { + $.each(this.accounts, function(i, account) { + if(!account.parent_account) { + account.checked = true; + } + }); + } + }, + get_plot_data: function() { + var data = []; + var me = this; + var pl_or_bs = this.filter_inputs.pl_or_bs.val(); + $.each(this.accounts, function(i, account) { + var show = pl_or_bs == "Profit and Loss" ? account.is_pl_account=="Yes" : account.is_pl_account!="Yes"; + if (show && account.checked) { + data.push({ + label: account.name, + data: $.map(me.columns, function(col, idx) { + if(col.formatter==me.currency_formatter) + return [[idx, account[col.field]]] + }) + }); + } + }); + + return data; + }, + add_grid_events: function() { + this._super(); + var me = this; + this.wrapper.find('.plot-check').click(function() { + var checked = $(this).attr("checked"); + me.accounts_by_name[$(this).attr("account")].checked = checked ? true : false; + me.render_plot(); + }); + } +}) \ No newline at end of file diff --git a/erpnext/accounts/page/financial_analytics/financial_analytics.txt b/erpnext/accounts/page/financial_analytics/financial_analytics.txt new file mode 100644 index 00000000000..834503d1c9c --- /dev/null +++ b/erpnext/accounts/page/financial_analytics/financial_analytics.txt @@ -0,0 +1,28 @@ +# Page, financial-analytics +[ + + # These values are common in all dictionaries + { + u'creation': '2012-09-17 13:46:47', + u'docstatus': 0, + u'modified': '2012-09-17 13:46:47', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Page + { + u'doctype': u'Page', + 'module': u'Accounts', + u'name': u'__common__', + 'page_name': u'financial-analytics', + 'standard': u'Yes', + 'title': u'Financial Analytics' + }, + + # Page, financial-analytics + { + u'doctype': u'Page', + u'name': u'financial-analytics' + } +] \ No newline at end of file diff --git a/erpnext/accounts/page/financial_statements/__init__.py b/erpnext/accounts/page/financial_statements/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/page/financial_statements/__init__.py +++ b/erpnext/accounts/page/financial_statements/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/page/general_ledger/general_ledger.js b/erpnext/accounts/page/general_ledger/general_ledger.js index d3956128168..7fdf57c5176 100644 --- a/erpnext/accounts/page/general_ledger/general_ledger.js +++ b/erpnext/accounts/page/general_ledger/general_ledger.js @@ -6,60 +6,147 @@ wn.pages['general-ledger'].onload = function(wrapper) { }); erpnext.general_ledger = new wn.views.GridReport({ + title: "General Ledger", + page: wrapper, parent: $(wrapper).find('.layout-main'), appframe: wrapper.appframe, doctypes: ["Company", "Account", "GL Entry"], - filters: [ - {fieldtype:"Select", label: "Company", options:"Company", - filter: function(val, item) { - return item.company == val || val == "Select Company"; - }}, - {fieldtype:"Select", label: "Account", options:"Account", - filter: function(val, item) { - return item.account == val || val == "Select Account"; - }}, - {fieldtype:"Date", label: "From Date"}, - {fieldtype:"Label", label: "To"}, - {fieldtype:"Date", label: "To Date"}, - {fieldtype:"Button", label: "Refresh"}, - ], - setup: function() { - this.setup_filters(); - this.setup_columns(); - }, - setup_filters: function() { - var me = this; - // default filters - this.filter_inputs.company.val(sys_defaults.company); - this.filter_inputs.from_date.val(dateutil.str_to_user(sys_defaults.year_start_date)); - this.filter_inputs.to_date.val(dateutil.str_to_user(sys_defaults.year_end_date)); - this.filter_inputs.refresh.click(function() { me.refresh(); }) - }, + setup_columns: function() { this.columns = [ {id: "posting_date", name: "Posting Date", field: "posting_date", width: 100, formatter: this.date_formatter}, - {id: "account", name: "Account", field: "account", width: 240}, + {id: "account", name: "Account", field: "account", width: 240, + link_formatter: { + filter_input: "account", + open_btn: true, + doctype: '"Account"' + }}, {id: "debit", name: "Debit", field: "debit", width: 100, formatter: this.currency_formatter}, {id: "credit", name: "Credit", field: "credit", width: 100, formatter: this.currency_formatter}, + {id: "voucher_type", name: "Voucher Type", field: "voucher_type", width: 120}, + {id: "voucher_no", name: "Voucher No", field: "voucher_no", width: 160, + link_formatter: { + filter_input: "voucher_no", + open_btn: true, + doctype: "dataContext.voucher_type" + }}, + {id: "remarks", name: "Remarks", field: "remarks", width: 200, + formatter: this.text_formatter}, + ]; }, + filters: [ + {fieldtype:"Select", label: "Company", link:"Company", default_value: "Select Company...", + filter: function(val, item, opts) { + return item.company == val || val == opts.default_value || item._show; + }}, + {fieldtype:"Select", label: "Account", link:"Account", default_value: "Select Account...", + filter: function(val, item, opts, me) { + if(val == opts.default_value || item._show) { + return true; + } else { + // true if GL Entry belongs to selected + // account ledger or group + return me.is_child_account(val, item.account); + } + }}, + {fieldtype:"Data", label: "Voucher No", + filter: function(val, item, opts) { + if(!val) return true; + return (item.voucher_no && item.voucher_no.indexOf(val)!=-1) || item._show; + }}, + {fieldtype:"Date", label: "From Date", filter: function(val, item) { + return item._show || dateutil.user_to_obj(val) <= dateutil.str_to_obj(item.posting_date); + }}, + {fieldtype:"Label", label: "To"}, + {fieldtype:"Date", label: "To Date", filter: function(val, item) { + return item._show || dateutil.user_to_obj(val) >= dateutil.str_to_obj(item.posting_date); + }}, + {fieldtype:"Button", label: "Refresh", icon:"icon-refresh icon-white", cssClass:"btn-info"}, + {fieldtype:"Button", label: "Reset Filters"} + ], + init_filter_values: function() { + this.filter_inputs.company.val(sys_defaults.company); + this.filter_inputs.from_date.val(dateutil.str_to_user(sys_defaults.year_start_date)); + this.filter_inputs.to_date.val(dateutil.str_to_user(sys_defaults.year_end_date)); + this.filter_inputs.voucher_no.val(""); + this.filter_inputs.account.get(0).selectedIndex = 0; + }, + is_child_account: function(account, item_account) { + account = this.account_by_name[account]; + item_account = this.account_by_name[item_account]; + + return (item_account.lft >= account.lft && item_account.rgt <= account.rgt) + }, prepare_data: function() { - this.prepare_data_view(wn.report_dump.data["GL Entry"]); - }, - dataview_filter: function(item) { - var filters = wn.cur_grid_report.filter_inputs; - for (i in filters) { - var filter = filters[i].get(0); - if(filter.opts.filter && !filter.opts.filter($(filter).val(), item)) { - return false; - } + // add Opening, Closing, Totals rows + // if filtered by account and / or voucher + var data = wn.report_dump.data["GL Entry"]; + this.make_account_by_name(); + var me = this; + + var account = this.filter_inputs.account.val(); + var from_date = dateutil.user_to_obj(this.filter_inputs.from_date.val()); + var to_date = dateutil.user_to_obj(this.filter_inputs.to_date.val()); + var voucher_no = this.filter_inputs.voucher_no.val(); + var default_account = this.filter_inputs.account.get(0).opts.default_value; + + if(to_date < from_date) { + msgprint("From Date must be before To Date"); + return; } - return true; + + var opening = { + account: "Opening", debit: 0.0, credit: 0.0, + id:"_opening", _show: true, _style: "font-weight: bold" + } + var totals = { + account: "Totals", debit: 0.0, credit: 0.0, + id:"_totals", _show: true, _style: "font-weight: bold" + } + + $.each(data, function(i, item) { + if((account!=default_account ? me.is_child_account(account, item.account) : true) && + (voucher_no ? item.voucher_no==voucher_no : true)) { + + var date = dateutil.str_to_obj(item.posting_date); + + if(date < from_date) { + opening.debit += item.debit; + opening.credit += item.credit; + } else if(date <= to_date) { + totals.debit += item.debit; + totals.credit += item.credit; + } + } + }) + + var closing = { + account: "Closing (Opening + Totals)", debit: opening.debit + totals.debit, + credit: opening.credit + totals.credit, + id:"_closing", _show: true, _style: "font-weight: bold" + } + + + if(account != default_account) { + var out = [opening].concat(data).concat([totals, closing]); + } else { + var out = data.concat([totals]); + } + + this.prepare_data_view(out); }, + make_account_by_name: function() { + this.account_by_name = {}; + var me = this; + $.each(wn.report_dump.data['Account'], function(i, v) { + me.account_by_name[v.name] = v; + }) + } }); - + } diff --git a/erpnext/accounts/page/general_ledger/general_ledger.py b/erpnext/accounts/page/general_ledger/general_ledger.py deleted file mode 100644 index f351978a5eb..00000000000 --- a/erpnext/accounts/page/general_ledger/general_ledger.py +++ /dev/null @@ -1,10 +0,0 @@ -import webnotes - -@webnotes.whitelist() -def get_chart(): - company = webnotes.form_dict.get('company') - res = {} - res["chart"] = webnotes.conn.sql("""select name, parent_account, - if(debit_or_credit="Debit", "D", ""), - if(is_pl_account="Yes", "Y", "") from - tabAccount where company=%s and docstatus < 2 order by lft""", (company, )) \ No newline at end of file diff --git a/erpnext/projects/doctype/activity_type/__init__.py b/erpnext/accounts/page/trial_balance/__init__.py similarity index 100% rename from erpnext/projects/doctype/activity_type/__init__.py rename to erpnext/accounts/page/trial_balance/__init__.py diff --git a/erpnext/accounts/page/trial_balance/trial_balance.js b/erpnext/accounts/page/trial_balance/trial_balance.js new file mode 100644 index 00000000000..91ab82aa2af --- /dev/null +++ b/erpnext/accounts/page/trial_balance/trial_balance.js @@ -0,0 +1,27 @@ +// 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 . + +wn.require("js/app/account_tree_grid.js"); +wn.require("js/app/account_tree_grid.css"); + +wn.pages['trial-balance'].onload = function(wrapper) { + wn.ui.make_app_page({ + parent: wrapper, + title: 'Trial Balance', + single_column: true + }); + erpnext.trial_balance = new erpnext.AccountTreeGrid(wrapper, 'Trial Balance'); +} \ No newline at end of file diff --git a/erpnext/accounts/page/trial_balance/trial_balance.txt b/erpnext/accounts/page/trial_balance/trial_balance.txt new file mode 100644 index 00000000000..88b91d62a67 --- /dev/null +++ b/erpnext/accounts/page/trial_balance/trial_balance.txt @@ -0,0 +1,28 @@ +# Page, trial-balance +[ + + # These values are common in all dictionaries + { + u'creation': '2012-09-17 13:47:16', + u'docstatus': 0, + u'modified': '2012-09-17 13:47:16', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Page + { + u'doctype': u'Page', + 'module': u'Accounts', + u'name': u'__common__', + 'page_name': u'trial-balance', + 'standard': u'Yes', + 'title': u'Trial Balance' + }, + + # Page, trial-balance + { + u'doctype': u'Page', + u'name': u'trial-balance' + } +] \ No newline at end of file diff --git a/erpnext/accounts/search_criteria/__init__.py b/erpnext/accounts/search_criteria/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/__init__.py +++ b/erpnext/accounts/search_criteria/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/accounts_payable/__init__.py b/erpnext/accounts/search_criteria/accounts_payable/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/accounts_payable/__init__.py +++ b/erpnext/accounts/search_criteria/accounts_payable/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/accounts_payable/accounts_payable.py b/erpnext/accounts/search_criteria/accounts_payable/accounts_payable.py index 4ecba4aeaec..1aaee964de5 100644 --- a/erpnext/accounts/search_criteria/accounts_payable/accounts_payable.py +++ b/erpnext/accounts/search_criteria/accounts_payable/accounts_payable.py @@ -17,6 +17,7 @@ # Check mandatory filters # ------------------------------------------------------------------ +from __future__ import unicode_literals if not filter_values.get('posting_date') or not filter_values.get('posting_date1'): msgprint("Please select From Posting Date and To Posting Date ") raise Exception diff --git a/erpnext/accounts/search_criteria/accounts_receivable/__init__.py b/erpnext/accounts/search_criteria/accounts_receivable/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/accounts_receivable/__init__.py +++ b/erpnext/accounts/search_criteria/accounts_receivable/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/accounts_receivable/accounts_receivable.py b/erpnext/accounts/search_criteria/accounts_receivable/accounts_receivable.py index 48899dc8d3c..51259e69b84 100644 --- a/erpnext/accounts/search_criteria/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/search_criteria/accounts_receivable/accounts_receivable.py @@ -17,6 +17,7 @@ # Check mandatory filters #------------------------------ +from __future__ import unicode_literals if not filter_values.get('posting_date') or not filter_values.get('posting_date1'): msgprint("Please select From Posting Date and To Posting Date in 'Set Filters' section") raise Exception diff --git a/erpnext/accounts/search_criteria/bank_clearance_report/__init__.py b/erpnext/accounts/search_criteria/bank_clearance_report/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/bank_clearance_report/__init__.py +++ b/erpnext/accounts/search_criteria/bank_clearance_report/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/bank_reconciliation_statement/__init__.py b/erpnext/accounts/search_criteria/bank_reconciliation_statement/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/bank_reconciliation_statement/__init__.py +++ b/erpnext/accounts/search_criteria/bank_reconciliation_statement/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.py b/erpnext/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.py index b9a126ccccd..3250f025a44 100644 --- a/erpnext/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.py +++ b/erpnext/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.py @@ -15,6 +15,7 @@ # along with this program. If not, see . #get company +from __future__ import unicode_literals company = filter_values.get('company') or get_defaults()['company'] # To date diff --git a/erpnext/accounts/search_criteria/budget_variance_report/__init__.py b/erpnext/accounts/search_criteria/budget_variance_report/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/budget_variance_report/__init__.py +++ b/erpnext/accounts/search_criteria/budget_variance_report/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/budget_variance_report/budget_variance_report.py b/erpnext/accounts/search_criteria/budget_variance_report/budget_variance_report.py index 7000630d9fc..dbb6b2d9229 100644 --- a/erpnext/accounts/search_criteria/budget_variance_report/budget_variance_report.py +++ b/erpnext/accounts/search_criteria/budget_variance_report/budget_variance_report.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # validate Filters +from __future__ import unicode_literals flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period'} for f in flt_dict: if not filter_values.get(f): diff --git a/erpnext/accounts/search_criteria/business_associate_commission_report/__init__.py b/erpnext/accounts/search_criteria/business_associate_commission_report/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/business_associate_commission_report/__init__.py +++ b/erpnext/accounts/search_criteria/business_associate_commission_report/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.py b/erpnext/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.py index e30fa009ba7..6aa7529ca3d 100644 --- a/erpnext/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.py +++ b/erpnext/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals colwidths[col_idx['Business Associate']] = '200px' coltypes[col_idx['Average Commission Rate']] = 'Currency' diff --git a/erpnext/accounts/search_criteria/cash_flow_statement/__init__.py b/erpnext/accounts/search_criteria/cash_flow_statement/__init__.py new file mode 100644 index 00000000000..baffc488252 --- /dev/null +++ b/erpnext/accounts/search_criteria/cash_flow_statement/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.py b/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.py new file mode 100644 index 00000000000..cf7d075a316 --- /dev/null +++ b/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.py @@ -0,0 +1,127 @@ +# ERPNext - web based ERP (http://erpnext.com) +# Copyright (C) 2012 Web Notes Technologies Pvt Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from __future__ import unicode_literals +cl = [['Account','Data', '200px'],['Debit/Credit', 'Data', '100px'], ['Group/Ledger', 'Data', '100px'], ['Opening','Data', '100px'],['Closing', 'Data', '100px'],['Inc in Cash','Data','100px']] + +for c in cl: + colnames.append(c[0]) + coltypes.append(c[1]) + colwidths.append(c[2]) + coloptions.append('') + col_idx[c[0]] = len(colnames)-1 + + +company = filter_values['company'] + +# transaction date +if not filter_values.get('transaction_date') or not filter_values.get('transaction_date1'): + msgprint("Please enter From Date and To Date") + raise Exception +else: + from_date = add_days(filter_values['transaction_date'], -1) + to_date = filter_values['transaction_date1'] + +ysd, fiscal_year = sql("select year_start_date, name from `tabFiscal Year` where %s between year_start_date and date_add(year_start_date,interval 1 year)",from_date)[0] + + +if from_export == 0 and len(res) >250: + msgprint("This is very large report and cannot be shown in the browser as it is likely to make your browser very slow. Please click on 'Export' to open in excel") + raise Exception + +total_debit, total_credit, total = 0,0,0 +glc = get_obj('GL Control') + +for r in res: + acc = r[col_idx['Account']].strip() + acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % acc) + r.append(acc_det[0][0]) + r.append(acc_det[0][4]) + + opening = glc.get_as_on_balance(acc, fiscal_year, from_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2] + + amount = sql("select sum(t1.debit), sum(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' and ifnull(t1.is_opening,'No') = 'No' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s AND is_cancelled = 'No'" % (from_date,to_date, acc_det[0][2], acc_det[0][3])) + if acc_det[0][0] == 'Debit': + closing = opening + flt(amount[0][0]) - flt(amount[0][1]) + else: + closing = opening + flt(amount[0][1]) - flt(amount[0][0]) + + r.append(fmt_money(flt(opening))) + r.append(fmt_money(flt(closing))) + + diff = flt(closing) - flt(opening) + if acc_det[0][0]=='Debit': + r.append(fmt_money(-diff)) + total -= diff + else: + r.append(fmt_money(diff)) + total += diff + + +# net profit +# ------------------ + +acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where account_name = %s AND company=%s", ('Income',company)) +amount = sql("select sum(t1.debit), sum(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' and ifnull(t1.is_opening,'No') = 'No' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s AND is_cancelled = 'No'" % (from_date,to_date, acc_det[0][2], acc_det[0][3])) +net_income = flt(amount[0][1]) - flt(amount[0][0]) + +acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where account_name = %s AND company=%s", ('Expenses',company)) +amount = sql("select sum(t1.debit), sum(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' and ifnull(t1.is_opening,'No') = 'No' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s AND is_cancelled = 'No'" % (from_date,to_date, acc_det[0][2], acc_det[0][3])) +net_expenses = flt(amount[0][0]) - flt(amount[0][1]) + +t_row = ['' for i in range(len(colnames))] +t_row[col_idx['Account']] = 'Net Profit' +t_row[col_idx['Inc in Cash']] = fmt_money(net_income - net_expenses) + +total += net_income - net_expenses + +res.append(t_row) + +# total row +# ------------------ +t_row = ['' for i in range(len(colnames))] +t_row[col_idx['Account']] = 'Total Cash Generated' +t_row[col_idx['Inc in Cash']] = fmt_money(total) + +res.append(t_row) + +# Show Inc / Dec in Bank and Cash Accounts +# ---------------------------------------- + +t_row = ['' for i in range(len(colnames))] +res.append(t_row) + +acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger, name from tabAccount where account_type = 'Bank or Cash' AND company=%s AND level=%s", (company, cint(filter_values['level']))) +for acc in acc_det: + r = [acc[5],] + + opening = glc.get_as_on_balance(acc[5], fiscal_year, from_date, acc[0], acc[2], acc[3])[2] + + amount = sql("select sum(t1.debit), sum(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' and ifnull(t1.is_opening,'No') = 'No' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s AND is_cancelled = 'No'" % (from_date,to_date, acc[2], acc[3])) + closing = opening + flt(amount[0][0]) - flt(amount[0][1]) + diff = closing - opening + + + r.append(acc_det[0][0]) + r.append(acc_det[0][4]) + + r.append(fmt_money(flt(opening))) + r.append(fmt_money(flt(closing))) + + r.append(fmt_money(diff)) + + res.append(r) + diff --git a/erpnext/accounts/search_criteria/collection_report/__init__.py b/erpnext/accounts/search_criteria/collection_report/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/collection_report/__init__.py +++ b/erpnext/accounts/search_criteria/collection_report/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/collection_report/collection_report.py b/erpnext/accounts/search_criteria/collection_report/collection_report.py index f08fe5c6fd9..bc40a69e937 100644 --- a/erpnext/accounts/search_criteria/collection_report/collection_report.py +++ b/erpnext/accounts/search_criteria/collection_report/collection_report.py @@ -15,6 +15,7 @@ # along with this program. If not, see . #check mandatory +from __future__ import unicode_literals if not filter_values.get('posting_date') or not filter_values.get('posting_date1'): msgprint("Please select From Posting Date and To Posting Date ") raise Exception diff --git a/erpnext/accounts/search_criteria/cost_center_wise_expense/__init__.py b/erpnext/accounts/search_criteria/cost_center_wise_expense/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/cost_center_wise_expense/__init__.py +++ b/erpnext/accounts/search_criteria/cost_center_wise_expense/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.py b/erpnext/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.py index d08599f9d03..1c7350128ce 100644 --- a/erpnext/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.py +++ b/erpnext/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.py @@ -16,6 +16,7 @@ # Add columns # ----------- +from __future__ import unicode_literals row_list = [['Cost Center','Data','160px'], ['Account','Data','160px'], ['Debit','Currency','120px'], diff --git a/erpnext/accounts/search_criteria/creditors_ledger/__init__.py b/erpnext/accounts/search_criteria/creditors_ledger/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/creditors_ledger/__init__.py +++ b/erpnext/accounts/search_criteria/creditors_ledger/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/creditors_ledger/creditors_ledger.py b/erpnext/accounts/search_criteria/creditors_ledger/creditors_ledger.py index a2fa8edb7af..66359222956 100644 --- a/erpnext/accounts/search_criteria/creditors_ledger/creditors_ledger.py +++ b/erpnext/accounts/search_criteria/creditors_ledger/creditors_ledger.py @@ -15,6 +15,7 @@ # along with this program. If not, see . #get company +from __future__ import unicode_literals company = filter_values.get('company') or get_defaults()['company'] #get company letter head diff --git a/erpnext/accounts/search_criteria/debtors_ledger/__init__.py b/erpnext/accounts/search_criteria/debtors_ledger/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/debtors_ledger/__init__.py +++ b/erpnext/accounts/search_criteria/debtors_ledger/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/debtors_ledger/debtors_ledger.py b/erpnext/accounts/search_criteria/debtors_ledger/debtors_ledger.py index a2fa8edb7af..66359222956 100644 --- a/erpnext/accounts/search_criteria/debtors_ledger/debtors_ledger.py +++ b/erpnext/accounts/search_criteria/debtors_ledger/debtors_ledger.py @@ -15,6 +15,7 @@ # along with this program. If not, see . #get company +from __future__ import unicode_literals company = filter_values.get('company') or get_defaults()['company'] #get company letter head diff --git a/erpnext/accounts/search_criteria/general_ledger/__init__.py b/erpnext/accounts/search_criteria/general_ledger/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/general_ledger/__init__.py +++ b/erpnext/accounts/search_criteria/general_ledger/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/general_ledger/general_ledger.py b/erpnext/accounts/search_criteria/general_ledger/general_ledger.py index c78b5841281..1f02478ceb0 100644 --- a/erpnext/accounts/search_criteria/general_ledger/general_ledger.py +++ b/erpnext/accounts/search_criteria/general_ledger/general_ledger.py @@ -16,6 +16,7 @@ #get company letter head #--------------------------------------------------------------------- +from __future__ import unicode_literals l_head = sql("select content from `tabLetter Head` where ifnull(is_default, 0) = 1 and ifnull(disabled, 0) = 0") l_head = l_head and l_head[0][0] or '' diff --git a/erpnext/accounts/search_criteria/invoices_overdue/__init__.py b/erpnext/accounts/search_criteria/invoices_overdue/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/invoices_overdue/__init__.py +++ b/erpnext/accounts/search_criteria/invoices_overdue/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/itemwise_purchase_register/__init__.py b/erpnext/accounts/search_criteria/itemwise_purchase_register/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/itemwise_purchase_register/__init__.py +++ b/erpnext/accounts/search_criteria/itemwise_purchase_register/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/itemwise_sales_register/__init__.py b/erpnext/accounts/search_criteria/itemwise_sales_register/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/itemwise_sales_register/__init__.py +++ b/erpnext/accounts/search_criteria/itemwise_sales_register/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/monthly_transaction_summary/__init__.py b/erpnext/accounts/search_criteria/monthly_transaction_summary/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/monthly_transaction_summary/__init__.py +++ b/erpnext/accounts/search_criteria/monthly_transaction_summary/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.py b/erpnext/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.py index 8a7d8c40efd..7660fe9fd65 100644 --- a/erpnext/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.py +++ b/erpnext/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals if filter_values.get('period'): period_values = filter_values.get('period').split(NEWLINE) diff --git a/erpnext/accounts/search_criteria/payment_receipt_report/__init__.py b/erpnext/accounts/search_criteria/payment_receipt_report/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/payment_receipt_report/__init__.py +++ b/erpnext/accounts/search_criteria/payment_receipt_report/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/payment_receipt_report/payment_receipt_report.py b/erpnext/accounts/search_criteria/payment_receipt_report/payment_receipt_report.py index fd7ce589406..84cbbec245b 100644 --- a/erpnext/accounts/search_criteria/payment_receipt_report/payment_receipt_report.py +++ b/erpnext/accounts/search_criteria/payment_receipt_report/payment_receipt_report.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals if not filter_values.get('posting_date'): msgprint("Enter From Posting Date.") raise Exception diff --git a/erpnext/accounts/search_criteria/purchase_register/__init__.py b/erpnext/accounts/search_criteria/purchase_register/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/purchase_register/__init__.py +++ b/erpnext/accounts/search_criteria/purchase_register/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/purchase_register/purchase_register.py b/erpnext/accounts/search_criteria/purchase_register/purchase_register.py index bb58d77bbc0..5e77d5c43fd 100644 --- a/erpnext/accounts/search_criteria/purchase_register/purchase_register.py +++ b/erpnext/accounts/search_criteria/purchase_register/purchase_register.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # add expense head columns +from __future__ import unicode_literals from webnotes.utils import flt, cint, cstr expense_acc = [c[0] for c in sql("""select distinct expense_head diff --git a/erpnext/accounts/search_criteria/sales_register/__init__.py b/erpnext/accounts/search_criteria/sales_register/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/sales_register/__init__.py +++ b/erpnext/accounts/search_criteria/sales_register/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/sales_register/sales_register.py b/erpnext/accounts/search_criteria/sales_register/sales_register.py index c99948e3a71..ef9374a4a24 100644 --- a/erpnext/accounts/search_criteria/sales_register/sales_register.py +++ b/erpnext/accounts/search_criteria/sales_register/sales_register.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # add additional columns +from __future__ import unicode_literals from webnotes.utils import flt, cint, cstr cl = [c[0] for c in sql("""select distinct account_head diff --git a/erpnext/accounts/search_criteria/tds_return/__init__.py b/erpnext/accounts/search_criteria/tds_return/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/tds_return/__init__.py +++ b/erpnext/accounts/search_criteria/tds_return/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/tds_return/tds_return.py b/erpnext/accounts/search_criteria/tds_return/tds_return.py index 24e73084ec5..41693b6ce40 100644 --- a/erpnext/accounts/search_criteria/tds_return/tds_return.py +++ b/erpnext/accounts/search_criteria/tds_return/tds_return.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals if not filter_values.get('tds_category'): msgprint("Please enter TDS Category") raise Exception diff --git a/erpnext/accounts/search_criteria/trend_analyzer/__init__.py b/erpnext/accounts/search_criteria/trend_analyzer/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/trend_analyzer/__init__.py +++ b/erpnext/accounts/search_criteria/trend_analyzer/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/trend_analyzer/trend_analyzer.py b/erpnext/accounts/search_criteria/trend_analyzer/trend_analyzer.py index 4a7d0939c67..53a17ba010e 100644 --- a/erpnext/accounts/search_criteria/trend_analyzer/trend_analyzer.py +++ b/erpnext/accounts/search_criteria/trend_analyzer/trend_analyzer.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # ********************************************* INITIALIZATION ******************************************* +from __future__ import unicode_literals out = [] # Filter Values diff --git a/erpnext/accounts/search_criteria/trial_balance/__init__.py b/erpnext/accounts/search_criteria/trial_balance/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/trial_balance/__init__.py +++ b/erpnext/accounts/search_criteria/trial_balance/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/trial_balance/trial_balance.py b/erpnext/accounts/search_criteria/trial_balance/trial_balance.py index d9f00d19ece..8d798fa05e7 100644 --- a/erpnext/accounts/search_criteria/trial_balance/trial_balance.py +++ b/erpnext/accounts/search_criteria/trial_balance/trial_balance.py @@ -16,6 +16,7 @@ # Columns #---------- +from __future__ import unicode_literals cl = [['Account','Data', '200px'],['Debit/Credit', 'Data', '100px'], ['Group/Ledger', 'Data', '100px'], ['Is PL Account', 'Data', '100px'], ['Opening (Dr)','Data', '100px'], ['Opening (Cr)','Data', '100px'],['Debit', 'Data', '100px'],['Credit', 'Data', '100px'],['Closing (Dr)', 'Data', '100px'],['Closing (Cr)', 'Data', '100px']] for c in cl: colnames.append(c[0]) diff --git a/erpnext/accounts/search_criteria/voucher_wise_tax_details/__init__.py b/erpnext/accounts/search_criteria/voucher_wise_tax_details/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/voucher_wise_tax_details/__init__.py +++ b/erpnext/accounts/search_criteria/voucher_wise_tax_details/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.py b/erpnext/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.py index 43dd9543474..0f99d0b4189 100644 --- a/erpnext/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.py +++ b/erpnext/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals if filter_values.get('based_on') == 'Sales Invoice': based_on_dt = 'Sales Invoice' else: diff --git a/erpnext/accounts/search_criteria/yearly_transaction_summary/__init__.py b/erpnext/accounts/search_criteria/yearly_transaction_summary/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/accounts/search_criteria/yearly_transaction_summary/__init__.py +++ b/erpnext/accounts/search_criteria/yearly_transaction_summary/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.py b/erpnext/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.py index 99465a84b84..1e163b322eb 100644 --- a/erpnext/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.py +++ b/erpnext/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals if not filter_values.get('from_fiscal_year'): msgprint("Please Select From Fiscal Year") raise Exception diff --git a/erpnext/accounts/utils/__init__.py b/erpnext/accounts/utils/__init__.py index f98c79ecd17..05d2391f2a5 100644 --- a/erpnext/accounts/utils/__init__.py +++ b/erpnext/accounts/utils/__init__.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals from webnotes.model.doc import make_autoname, Document, addchild # Posts JV diff --git a/erpnext/buying/__init__.py b/erpnext/buying/__init__.py index 1bcab3d99cd..d9bbbcc4872 100644 --- a/erpnext/buying/__init__.py +++ b/erpnext/buying/__init__.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals install_docs = [ {"doctype":"Role", "role_name":"Purchase Manager", "name":"Purchase Manager"}, {"doctype":"Role", "role_name":"Purchase User", "name":"Purchase User"}, diff --git a/erpnext/buying/doctype/__init__.py b/erpnext/buying/doctype/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/doctype/__init__.py +++ b/erpnext/buying/doctype/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/doctype/purchase_common/__init__.py b/erpnext/buying/doctype/purchase_common/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/doctype/purchase_common/__init__.py +++ b/erpnext/buying/doctype/purchase_common/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index eedc59b0dec..33c05df546d 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -653,7 +653,7 @@ cur_frm.cscript.check_charge_type_and_get_tax_amount = function(doc, tax, t, cl, } cur_frm.cscript.toggle_contact_section = function(doc) { - doc.supplier ? unhide_field("contact_section") : hide_field("contact_section"); + cur_frm.toggle_display("contact_section", doc.supplier); } cur_frm.cscript.project_name = function(doc, cdt, cdn) { diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py index 8d1d3b5149b..b8424aba7f1 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.py +++ b/erpnext/buying/doctype/purchase_common/purchase_common.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/buying/doctype/purchase_order/__init__.py b/erpnext/buying/doctype/purchase_order/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/doctype/purchase_order/__init__.py +++ b/erpnext/buying/doctype/purchase_order/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 55f59b5c28c..65efd3767f7 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.txt b/erpnext/buying/doctype/purchase_order/purchase_order.txt index d5e8df51c54..b1a70bb5062 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.txt +++ b/erpnext/buying/doctype/purchase_order/purchase_order.txt @@ -56,114 +56,6 @@ 'name': u'Purchase Order' }, - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Production Manager', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Material User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Purchase Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Purchase Manager', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 0, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Purchase User', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'All', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Supplier', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 2, - 'role': u'All', - 'submit': 0, - 'write': 1 - }, - # DocField { 'colour': u'White:FFF', @@ -428,7 +320,7 @@ 'description': u"Rate at which supplier's currency is converted to company's base currency", 'doctype': u'DocField', 'fieldname': u'conversion_rate', - 'fieldtype': u'Currency', + 'fieldtype': u'Float', 'hidden': 0, 'label': u'Conversion Rate', 'no_copy': 1, @@ -1102,5 +994,88 @@ 'no_copy': 1, 'permlevel': 0, 'print_hide': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Purchase Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Purchase Manager', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Purchase User', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'All' + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'match': u'supplier', + 'permlevel': 0, + 'role': u'Supplier' + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 2, + 'role': u'All', + 'write': 1 } ] \ No newline at end of file diff --git a/erpnext/buying/doctype/purchase_order_item/__init__.py b/erpnext/buying/doctype/purchase_order_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/doctype/purchase_order_item/__init__.py +++ b/erpnext/buying/doctype/purchase_order_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/doctype/purchase_order_item_supplied/__init__.py b/erpnext/buying/doctype/purchase_order_item_supplied/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/doctype/purchase_order_item_supplied/__init__.py +++ b/erpnext/buying/doctype/purchase_order_item_supplied/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/doctype/purchase_receipt_item_supplied/__init__.py b/erpnext/buying/doctype/purchase_receipt_item_supplied/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/doctype/purchase_receipt_item_supplied/__init__.py +++ b/erpnext/buying/doctype/purchase_receipt_item_supplied/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/doctype/purchase_request/__init__.py b/erpnext/buying/doctype/purchase_request/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/doctype/purchase_request/__init__.py +++ b/erpnext/buying/doctype/purchase_request/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/doctype/purchase_request/purchase_request.py b/erpnext/buying/doctype/purchase_request/purchase_request.py index afa58d41838..324af2a52fc 100644 --- a/erpnext/buying/doctype/purchase_request/purchase_request.py +++ b/erpnext/buying/doctype/purchase_request/purchase_request.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/buying/doctype/purchase_request_item/__init__.py b/erpnext/buying/doctype/purchase_request_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/doctype/purchase_request_item/__init__.py +++ b/erpnext/buying/doctype/purchase_request_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/doctype/quality_inspection/__init__.py b/erpnext/buying/doctype/quality_inspection/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/doctype/quality_inspection/__init__.py +++ b/erpnext/buying/doctype/quality_inspection/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.py b/erpnext/buying/doctype/quality_inspection/quality_inspection.py index 698c1a278b6..1baac2137f5 100644 --- a/erpnext/buying/doctype/quality_inspection/quality_inspection.py +++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/buying/doctype/quality_inspection_reading/__init__.py b/erpnext/buying/doctype/quality_inspection_reading/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/doctype/quality_inspection_reading/__init__.py +++ b/erpnext/buying/doctype/quality_inspection_reading/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/doctype/supplier/__init__.py b/erpnext/buying/doctype/supplier/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/doctype/supplier/__init__.py +++ b/erpnext/buying/doctype/supplier/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py index 20de364c0f1..d77be881ea7 100644 --- a/erpnext/buying/doctype/supplier/supplier.py +++ b/erpnext/buying/doctype/supplier/supplier.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/buying/doctype/supplier_quotation/__init__.py b/erpnext/buying/doctype/supplier_quotation/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/doctype/supplier_quotation/__init__.py +++ b/erpnext/buying/doctype/supplier_quotation/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py index 88219760b7f..057f8da257d 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.model.code import get_obj from utilities.transaction_base import TransactionBase diff --git a/erpnext/buying/doctype/supplier_quotation_item/__init__.py b/erpnext/buying/doctype/supplier_quotation_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/doctype/supplier_quotation_item/__init__.py +++ b/erpnext/buying/doctype/supplier_quotation_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/page/__init__.py b/erpnext/buying/page/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/page/__init__.py +++ b/erpnext/buying/page/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/page/buying_home/__init__.py b/erpnext/buying/page/buying_home/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/page/buying_home/__init__.py +++ b/erpnext/buying/page/buying_home/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/Report/Supplier Quotations/Supplier Quotations.txt b/erpnext/buying/report/supplier_quotations/supplier_quotations.txt similarity index 100% rename from erpnext/buying/Report/Supplier Quotations/Supplier Quotations.txt rename to erpnext/buying/report/supplier_quotations/supplier_quotations.txt diff --git a/erpnext/buying/search_criteria/__init__.py b/erpnext/buying/search_criteria/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/search_criteria/__init__.py +++ b/erpnext/buying/search_criteria/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/search_criteria/itemwise_purchase_details/__init__.py b/erpnext/buying/search_criteria/itemwise_purchase_details/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/search_criteria/itemwise_purchase_details/__init__.py +++ b/erpnext/buying/search_criteria/itemwise_purchase_details/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/search_criteria/pending_po_items_to_bill/__init__.py b/erpnext/buying/search_criteria/pending_po_items_to_bill/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/search_criteria/pending_po_items_to_bill/__init__.py +++ b/erpnext/buying/search_criteria/pending_po_items_to_bill/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/search_criteria/pending_po_items_to_receive/__init__.py b/erpnext/buying/search_criteria/pending_po_items_to_receive/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/search_criteria/pending_po_items_to_receive/__init__.py +++ b/erpnext/buying/search_criteria/pending_po_items_to_receive/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.py b/erpnext/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.py index 066882bf55d..e7ada4ff977 100644 --- a/erpnext/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.py +++ b/erpnext/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.py @@ -14,5 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals colwidths[col_idx['Pending Quantity To Receive']] = '200px' colwidths[col_idx['Pending Amount To Receive']] = '200px' diff --git a/erpnext/buying/search_criteria/purchase_in_transit/__init__.py b/erpnext/buying/search_criteria/purchase_in_transit/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/buying/search_criteria/purchase_in_transit/__init__.py +++ b/erpnext/buying/search_criteria/purchase_in_transit/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/buying/search_criteria/purchase_in_transit/purchase_in_transit.py b/erpnext/buying/search_criteria/purchase_in_transit/purchase_in_transit.py index 8ecf88c7e3c..c8739bbf7eb 100644 --- a/erpnext/buying/search_criteria/purchase_in_transit/purchase_in_transit.py +++ b/erpnext/buying/search_criteria/purchase_in_transit/purchase_in_transit.py @@ -15,6 +15,7 @@ # along with this program. If not, see . #check mendatory +from __future__ import unicode_literals if not filter_values.get('posting_date') or not filter_values.get('posting_date1'): msgprint("Please select From Posting Date and To Posting Date in 'Set Filters' section") raise Exception diff --git a/erpnext/home/__init__.py b/erpnext/home/__init__.py index 97106bdb753..436e8eca200 100644 --- a/erpnext/home/__init__.py +++ b/erpnext/home/__init__.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes import msgprint diff --git a/erpnext/home/doctype/__init__.py b/erpnext/home/doctype/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/home/doctype/__init__.py +++ b/erpnext/home/doctype/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/home/doctype/company_control/__init__.py b/erpnext/home/doctype/company_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/home/doctype/company_control/__init__.py +++ b/erpnext/home/doctype/company_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/home/doctype/company_control/company_control.py b/erpnext/home/doctype/company_control/company_control.py index 793da2573a4..2e2d3028846 100644 --- a/erpnext/home/doctype/company_control/company_control.py +++ b/erpnext/home/doctype/company_control/company_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/home/doctype/feed/__init__.py b/erpnext/home/doctype/feed/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/home/doctype/feed/__init__.py +++ b/erpnext/home/doctype/feed/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/home/doctype/feed/feed.py b/erpnext/home/doctype/feed/feed.py index 6d0f6f319c9..23ab4a3ffa4 100644 --- a/erpnext/home/doctype/feed/feed.py +++ b/erpnext/home/doctype/feed/feed.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/home/doctype/home_control/__init__.py b/erpnext/home/doctype/home_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/home/doctype/home_control/__init__.py +++ b/erpnext/home/doctype/home_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/home/doctype/home_control/home_control.py b/erpnext/home/doctype/home_control/home_control.py index b1ddda40119..1a8be78e088 100644 --- a/erpnext/home/doctype/home_control/home_control.py +++ b/erpnext/home/doctype/home_control/home_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/home/page/__init__.py b/erpnext/home/page/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/home/page/__init__.py +++ b/erpnext/home/page/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/home/page/activity/__init__.py b/erpnext/home/page/activity/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/home/page/activity/__init__.py +++ b/erpnext/home/page/activity/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/home/page/activity/activity.py b/erpnext/home/page/activity/activity.py index 8b8faf3f5fa..cbd28ec6ee0 100644 --- a/erpnext/home/page/activity/activity.py +++ b/erpnext/home/page/activity/activity.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import webnotes @webnotes.whitelist() diff --git a/erpnext/home/page/attributions/__init__.py b/erpnext/home/page/attributions/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/home/page/attributions/__init__.py +++ b/erpnext/home/page/attributions/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/home/page/attributions/attributions.html b/erpnext/home/page/attributions/attributions.html index f76c248dd97..9952908eda9 100644 --- a/erpnext/home/page/attributions/attributions.html +++ b/erpnext/home/page/attributions/attributions.html @@ -40,10 +40,10 @@
  • Ace - code editor
  • Slick Grid - report grid
  • jQPlot - graphs
  • +
  • JQuery.Gantt - Gantt Chart
  • JSON2 - JSON builder, parser
  • JSColor - color picker
  • -
  • sprintf - string formatting
  • -
  • historyjs - AJAX history
  • +
  • Downloadify - Export CSV files from the browser
  • diff --git a/erpnext/home/page/attributions/attributions.py b/erpnext/home/page/attributions/attributions.py index f807eb0a4d4..fbba0997d8f 100644 --- a/erpnext/home/page/attributions/attributions.py +++ b/erpnext/home/page/attributions/attributions.py @@ -1 +1,2 @@ +from __future__ import unicode_literals import webnotes \ No newline at end of file diff --git a/erpnext/home/page/dashboard/__init__.py b/erpnext/home/page/dashboard/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/home/page/dashboard/__init__.py +++ b/erpnext/home/page/dashboard/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/home/page/dashboard/dashboard.py b/erpnext/home/page/dashboard/dashboard.py index 29f15022fc2..71ce8051379 100644 --- a/erpnext/home/page/dashboard/dashboard.py +++ b/erpnext/home/page/dashboard/dashboard.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals dashboards = [ { 'type': 'account', diff --git a/erpnext/home/page/desktop/__init__.py b/erpnext/home/page/desktop/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/home/page/desktop/__init__.py +++ b/erpnext/home/page/desktop/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/home/page/profile_settings/__init__.py b/erpnext/home/page/profile_settings/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/home/page/profile_settings/__init__.py +++ b/erpnext/home/page/profile_settings/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/home/page/profile_settings/profile_settings.py b/erpnext/home/page/profile_settings/profile_settings.py index 4e48eeeba64..0de424f4682 100644 --- a/erpnext/home/page/profile_settings/profile_settings.py +++ b/erpnext/home/page/profile_settings/profile_settings.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.utils import load_json, cint, nowdate @@ -33,11 +34,14 @@ def change_password(arg): check_demo() arg = load_json(arg) - if not webnotes.conn.sql('select name from tabProfile where name=%s and password=password(%s)', (webnotes.session['user'], arg['old_password'])): + if not webnotes.conn.sql("""select * from `__Auth` where `user`=%s + and password=password(%s)""", + (webnotes.session["user"], arg["old_password"])): webnotes.msgprint('Old password is not correct', raise_exception=1) - - from webnotes.utils import nowdate - webnotes.conn.sql("update tabProfile set password=password(%s), modified=%s where name=%s",(arg['new_password'], nowdate(), webnotes.session['user'])) + + webnotes.conn.sql("""update `__Auth` set password=password(%s) + where `user`=%s""", (arg["new_password"], webnotes.session["user"])) + webnotes.msgprint('Password Updated'); @webnotes.whitelist() diff --git a/erpnext/hr/__init__.py b/erpnext/hr/__init__.py index 930b9eeeec7..96bd47bdbef 100644 --- a/erpnext/hr/__init__.py +++ b/erpnext/hr/__init__.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals install_docs = [ {"doctype":"Role", "role_name":"Employee", "name":"Employee"}, {"doctype":"Role", "role_name":"HR Manager", "name":"HR Manager"}, diff --git a/erpnext/hr/doctype/__init__.py b/erpnext/hr/doctype/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/__init__.py +++ b/erpnext/hr/doctype/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/appraisal/__init__.py b/erpnext/hr/doctype/appraisal/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/appraisal/__init__.py +++ b/erpnext/hr/doctype/appraisal/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/appraisal/appraisal.py b/erpnext/hr/doctype/appraisal/appraisal.py index a889e5fa6a9..13d2f3ff69c 100644 --- a/erpnext/hr/doctype/appraisal/appraisal.py +++ b/erpnext/hr/doctype/appraisal/appraisal.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/hr/doctype/appraisal_goal/__init__.py b/erpnext/hr/doctype/appraisal_goal/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/appraisal_goal/__init__.py +++ b/erpnext/hr/doctype/appraisal_goal/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/appraisal_template/__init__.py b/erpnext/hr/doctype/appraisal_template/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/appraisal_template/__init__.py +++ b/erpnext/hr/doctype/appraisal_template/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/appraisal_template_goal/__init__.py b/erpnext/hr/doctype/appraisal_template_goal/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/appraisal_template_goal/__init__.py +++ b/erpnext/hr/doctype/appraisal_template_goal/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/attendance/__init__.py b/erpnext/hr/doctype/attendance/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/attendance/__init__.py +++ b/erpnext/hr/doctype/attendance/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/attendance/attendance.py b/erpnext/hr/doctype/attendance/attendance.py index ec0a6042192..9d52a8b73ef 100644 --- a/erpnext/hr/doctype/attendance/attendance.py +++ b/erpnext/hr/doctype/attendance/attendance.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/hr/doctype/attendance_control_panel/__init__.py b/erpnext/hr/doctype/attendance_control_panel/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/attendance_control_panel/__init__.py +++ b/erpnext/hr/doctype/attendance_control_panel/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/attendance_control_panel/attendance_control_panel.py b/erpnext/hr/doctype/attendance_control_panel/attendance_control_panel.py index 7726980d60d..d845d10275a 100644 --- a/erpnext/hr/doctype/attendance_control_panel/attendance_control_panel.py +++ b/erpnext/hr/doctype/attendance_control_panel/attendance_control_panel.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 @@ -48,7 +49,7 @@ class DocType: res = sql("select name, employee_name from `tabEmployee` where status = 'Active' and docstatus !=2") for d in dt: - for r in res: + for r in res: lst.append([r[0],r[1],d,'',fy,comp,sr]) return lst @@ -68,7 +69,7 @@ class DocType: else: r = 1 dateList = [getdate(self.doc.att_fr_date)+datetime.timedelta(days=i) for i in range(0,r)] - dt=([str(date) for date in dateList]) + dt=([formatdate(cstr(date)) for date in dateList]) return dt diff --git a/erpnext/hr/doctype/branch/__init__.py b/erpnext/hr/doctype/branch/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/branch/__init__.py +++ b/erpnext/hr/doctype/branch/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/deduction_type/__init__.py b/erpnext/hr/doctype/deduction_type/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/deduction_type/__init__.py +++ b/erpnext/hr/doctype/deduction_type/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/department/__init__.py b/erpnext/hr/doctype/department/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/department/__init__.py +++ b/erpnext/hr/doctype/department/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/designation/__init__.py b/erpnext/hr/doctype/designation/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/designation/__init__.py +++ b/erpnext/hr/doctype/designation/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/earning_type/__init__.py b/erpnext/hr/doctype/earning_type/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/earning_type/__init__.py +++ b/erpnext/hr/doctype/earning_type/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/employee/__init__.py b/erpnext/hr/doctype/employee/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/employee/__init__.py +++ b/erpnext/hr/doctype/employee/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py index 85fbbc1b7d4..bb9a4ef1d35 100644 --- a/erpnext/hr/doctype/employee/employee.py +++ b/erpnext/hr/doctype/employee/employee.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.utils import add_days, 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 diff --git a/erpnext/hr/doctype/employee_education/__init__.py b/erpnext/hr/doctype/employee_education/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/employee_education/__init__.py +++ b/erpnext/hr/doctype/employee_education/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/employee_external_work_history/__init__.py b/erpnext/hr/doctype/employee_external_work_history/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/employee_external_work_history/__init__.py +++ b/erpnext/hr/doctype/employee_external_work_history/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/employee_internal_work_history/__init__.py b/erpnext/hr/doctype/employee_internal_work_history/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/employee_internal_work_history/__init__.py +++ b/erpnext/hr/doctype/employee_internal_work_history/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/employee_training/__init__.py b/erpnext/hr/doctype/employee_training/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/employee_training/__init__.py +++ b/erpnext/hr/doctype/employee_training/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/employment_type/__init__.py b/erpnext/hr/doctype/employment_type/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/employment_type/__init__.py +++ b/erpnext/hr/doctype/employment_type/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/expense_claim/__init__.py b/erpnext/hr/doctype/expense_claim/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/expense_claim/__init__.py +++ b/erpnext/hr/doctype/expense_claim/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js index 206d208fd97..eabb47647c5 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.js +++ b/erpnext/hr/doctype/expense_claim/expense_claim.js @@ -51,7 +51,7 @@ cur_frm.cscript.employee = function(doc,cdt,cdn){ $c_obj(make_doclist(doc.doctype, doc.name),'set_approver','', function(r,rt){ if(r.message){ doc.employee_name = r.message['emp_nm']; - get_field(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst']; + wn.meta.get_docfield(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst']; refresh_many(['exp_approver','employee_name']); } }); diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.py b/erpnext/hr/doctype/expense_claim/expense_claim.py index 94761a141df..ee02dc339df 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.py +++ b/erpnext/hr/doctype/expense_claim/expense_claim.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/hr/doctype/expense_claim_detail/__init__.py b/erpnext/hr/doctype/expense_claim_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/expense_claim_detail/__init__.py +++ b/erpnext/hr/doctype/expense_claim_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/expense_claim_type/__init__.py b/erpnext/hr/doctype/expense_claim_type/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/expense_claim_type/__init__.py +++ b/erpnext/hr/doctype/expense_claim_type/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/grade/__init__.py b/erpnext/hr/doctype/grade/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/grade/__init__.py +++ b/erpnext/hr/doctype/grade/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/holiday/__init__.py b/erpnext/hr/doctype/holiday/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/holiday/__init__.py +++ b/erpnext/hr/doctype/holiday/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/holiday_list/__init__.py b/erpnext/hr/doctype/holiday_list/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/holiday_list/__init__.py +++ b/erpnext/hr/doctype/holiday_list/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/holiday_list/holiday_list.py b/erpnext/hr/doctype/holiday_list/holiday_list.py index 78c9e33cea4..dc75e9af2fd 100644 --- a/erpnext/hr/doctype/holiday_list/holiday_list.py +++ b/erpnext/hr/doctype/holiday_list/holiday_list.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/hr/doctype/leave_allocation/__init__.py b/erpnext/hr/doctype/leave_allocation/__init__.py index e69de29bb2d..baffc488252 100755 --- a/erpnext/hr/doctype/leave_allocation/__init__.py +++ b/erpnext/hr/doctype/leave_allocation/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.py b/erpnext/hr/doctype/leave_allocation/leave_allocation.py index c6776ad626a..bf104685ba8 100755 --- a/erpnext/hr/doctype/leave_allocation/leave_allocation.py +++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/hr/doctype/leave_application/__init__.py b/erpnext/hr/doctype/leave_application/__init__.py index e69de29bb2d..baffc488252 100755 --- a/erpnext/hr/doctype/leave_application/__init__.py +++ b/erpnext/hr/doctype/leave_application/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py index 9b1b6fcf033..b17b91fbf99 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.py +++ b/erpnext/hr/doctype/leave_application/leave_application.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/hr/doctype/leave_control_panel/__init__.py b/erpnext/hr/doctype/leave_control_panel/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/leave_control_panel/__init__.py +++ b/erpnext/hr/doctype/leave_control_panel/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.py b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.py index c41a95ec824..13c886e6ffe 100644 --- a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.py +++ b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/hr/doctype/leave_type/__init__.py b/erpnext/hr/doctype/leave_type/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/leave_type/__init__.py +++ b/erpnext/hr/doctype/leave_type/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/other_income_detail/__init__.py b/erpnext/hr/doctype/other_income_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/other_income_detail/__init__.py +++ b/erpnext/hr/doctype/other_income_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/salary_manager/__init__.py b/erpnext/hr/doctype/salary_manager/__init__.py index ca974f3254b..3405b481de1 100644 --- a/erpnext/hr/doctype/salary_manager/__init__.py +++ b/erpnext/hr/doctype/salary_manager/__init__.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals from webnotes import ValidationError class SalarySlipExistsError(ValidationError): pass diff --git a/erpnext/hr/doctype/salary_manager/salary_manager.py b/erpnext/hr/doctype/salary_manager/salary_manager.py index 111366b9186..317e72d1b65 100644 --- a/erpnext/hr/doctype/salary_manager/salary_manager.py +++ b/erpnext/hr/doctype/salary_manager/salary_manager.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 @@ -24,7 +25,6 @@ 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 -set = webnotes.conn.set sql = webnotes.conn.sql get_value = webnotes.conn.get_value in_transaction = webnotes.conn.in_transaction @@ -46,14 +46,14 @@ class DocType: """ cond = self.get_filter_condition() + cond += self.get_joining_releiving_condition() emp_list = sql(""" select t1.name from `tabEmployee` t1, `tabSalary Structure` t2 where t1.docstatus!=2 and t2.docstatus != 2 - and ifnull(t1.status, 'Left') = 'Active' and ifnull(t2.is_active, 'No') = 'Yes' and t1.name = t2.employee - %s """% cond) + %s """% cond, debug=1) return emp_list @@ -64,9 +64,19 @@ class DocType: cond = '' for f in ['company', 'branch', 'department', 'designation', 'grade']: if self.doc.fields.get(f): - cond += " and t1." + f + " = '" + self.doc.fields.get(f) + "'" - + cond += " and t1." + f + " = '" + self.doc.fields.get(f) + "'" + return cond + + + def get_joining_releiving_condition(self): + m = self.get_month_details(self.doc.fiscal_year, self.doc.month) + cond = """ + and ifnull(t1.date_of_joining, '0000-00-00') <= '%(month_end_date)s' + and ifnull(t1.relieving_date, '2199-12-31') >= '%(month_start_date)s' + """ % m + return cond + def check_mandatory(self): @@ -74,6 +84,26 @@ class DocType: if not self.doc.fields[f]: msgprint("Please select %s to proceed" % f, raise_exception=1) + + def get_month_details(self, year, month): + ysd = sql("select year_start_date from `tabFiscal Year` where name ='%s'"%year)[0][0] + if ysd: + from dateutil.relativedelta import relativedelta + import calendar, datetime + diff_mnt = cint(month)-cint(ysd.month) + if diff_mnt<0: + diff_mnt = 12-int(ysd.month)+cint(month) + msd = ysd + relativedelta(months=diff_mnt) # month start date + month_days = cint(calendar.monthrange(cint(msd.year) ,cint(month))[1]) # days in month + med = datetime.date(msd.year, cint(month), month_days) # month end date + return { + 'year': msd.year, + 'month_start_date': msd, + 'month_end_date': med, + 'month_days': month_days + } + + def create_sal_slip(self): """ @@ -82,12 +112,7 @@ class DocType: """ emp_list = self.get_emp_list() - log = "" - if emp_list: - log = "" - else: - log = "
    Following Salary Slip has been created:
    SAL SLIP IDEMPLOYEE NAME
    " - + ss_list = [] for emp in emp_list: if not sql("""select name from `tabSalary Slip` where docstatus!= 2 and employee = %s and month = %s and fiscal_year = %s and company = %s @@ -111,9 +136,18 @@ class DocType: for d in getlist(ss_obj.doclist, 'deduction_details'): d.save() - log += '' - log += '
    No employee found for the above selected criteria
    ' + ss.name + '' + ss_obj.doc.employee_name + '
    ' - return log + ss_list.append(ss.name) + + return self.create_log(ss_list) + + + def create_log(self, ss_list): + log = "No employee for the above selected criteria OR salary slip already created" + if ss_list: + log = "Created Salary Slip has been created: \ +

    %s" % '
    '.join(ss_list) + return log + def get_sal_slip_list(self): """ @@ -132,28 +166,49 @@ class DocType: """ Submit all salary slips based on selected criteria """ - ss_list = self.get_sal_slip_list() - log = "" - if ss_list: - log = """ - - - - - - - - """ - else: - log = "
    Following Salary Slip has been submitted:
    SAL SLIP IDEMPLOYEE NAME
    " - + ss_list = self.get_sal_slip_list() + not_submitted_ss = [] for ss in ss_list: ss_obj = get_obj("Salary Slip",ss[0],with_children=1) - set(ss_obj.doc, 'docstatus', 1) - ss_obj.on_submit() + try: + webnotes.conn.set(ss_obj.doc, 'email_check', cint(self.doc.send_mail)) + if cint(self.doc.send_email) == 1: + ss_obj.send_mail_funct() + + webnotes.conn.set(ss_obj.doc, 'docstatus', 1) + except Exception,e: + not_submitted_ss.append(ss[0]) + msgprint(e) + continue + + return self.create_submit_log(ss_list, not_submitted_ss) + + + def create_submit_log(self, all_ss, not_submitted_ss): + log = '' + if not all_ss: + log = "No salary slip found to submit for the above selected criteria" + else: + all_ss = [d[0] for d in all_ss] - log += '' - log += '
    No salary slip found to submit for the above selected criteria
    ' + ss[0] + '' + ss_obj.doc.employee_name + '
    ' + submitted_ss = list(set(all_ss) - set(not_submitted_ss)) + if submitted_ss: + mail_sent_msg = self.doc.send_email and " (Mail has been sent to the employee)" or "" + log = """ + Submitted Salary Slips%s:\ +

    %s

    + """ % (mail_sent_msg, '
    '.join(submitted_ss)) + + if not_submitted_ss: + log += """ + Not Submitted Salary Slips: \ +

    %s

    \ + Reason:
    \ + May be company email id specified in employee master is not valid.
    \ + Please mention correct email id in employee master or if you don't want to \ + send mail, uncheck 'Send Email' checkbox.
    \ + Then try to submit Salary Slip again. + """% ('
    '.join(not_submitted_ss)) return log @@ -168,7 +223,7 @@ class DocType: """ % (self.doc.month, self.doc.fiscal_year, cond)) return flt(tot[0][0]) - + def get_acc_details(self): """ diff --git a/erpnext/hr/doctype/salary_manager/test_salary_manager.py b/erpnext/hr/doctype/salary_manager/test_salary_manager.py index 8cea1053a6a..b689b51adbe 100644 --- a/erpnext/hr/doctype/salary_manager/test_salary_manager.py +++ b/erpnext/hr/doctype/salary_manager/test_salary_manager.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import unittest import webnotes diff --git a/erpnext/hr/doctype/salary_slip/__init__.py b/erpnext/hr/doctype/salary_slip/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/salary_slip/__init__.py +++ b/erpnext/hr/doctype/salary_slip/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.js b/erpnext/hr/doctype/salary_slip/salary_slip.js index 5fe93a68a58..3e61665a2bb 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.js +++ b/erpnext/hr/doctype/salary_slip/salary_slip.js @@ -45,9 +45,13 @@ cur_frm.cscript.month = cur_frm.cscript.employee = cur_frm.cscript.fiscal_year; // Calculate total if lwp exists // ------------------------------------------------------------------------ cur_frm.cscript.leave_without_pay = function(doc,dt,dn){ - doc.payment_days = flt(doc.total_days_in_month) - flt(doc.leave_without_pay); - refresh_field('payment_days'); - calculate_all(doc, dt, dn); + if (doc.employee && doc.fiscal_year && doc.month) { + $c_obj(make_doclist(doc.doctype,doc.name), 'get_leave_details',doc.leave_without_pay,function(r, rt) { + var doc = locals[dt][dn]; + cur_frm.refresh(); + calculate_all(doc, dt, dn); + }); + } } // Calculate all diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index 3439fc861fd..ff72652e21a 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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, set_default, str_esc_quote, user_format, validate_email_add @@ -39,27 +40,22 @@ class DocType(TransactionBase): self.doclist = doclist - # autoname - #======================================================= def autoname(self): self.doc.name = make_autoname('Sal Slip/' +self.doc.employee + '/.#####') - # Get employee details - #======================================================= - def get_emp_and_leave_details(self): - # Get payment days - if self.doc.fiscal_year and self.doc.month: - self.get_leave_details() - # check sal structure + def get_emp_and_leave_details(self): if self.doc.employee: + # Get payment days + if self.doc.fiscal_year and self.doc.month: + self.get_leave_details() + + # check sal structure struct = self.check_sal_struct() if struct: self.pull_sal_struct(struct) - # Check sal structure - #======================================================= def check_sal_struct(self): struct = sql("select name from `tabSalary Structure` where employee ='%s' and is_active = 'Yes' "%self.doc.employee) if not struct: @@ -67,8 +63,7 @@ class DocType(TransactionBase): self.doc.employee = '' return struct and struct[0][0] or '' - # Pull struct details - #======================================================= + def pull_sal_struct(self, struct): self.doclist = self.doc.clear_table(self.doclist, 'earning_details') self.doclist = self.doc.clear_table(self.doclist, 'deduction_details') @@ -81,41 +76,48 @@ class DocType(TransactionBase): self.doc.esic_no = basic_info[0][2] self.doc.pf_no = basic_info[0][3] - # Get leave details - #======================================================= - def get_leave_details(self): - m = self.get_month_details() - lwp = self.calculate_lwp(m) - self.doc.total_days_in_month = m[3] + + def get_leave_details(self, lwp=None): + m = get_obj('Salary Manager').get_month_details(self.doc.fiscal_year, self.doc.month) + + if not lwp: + lwp = self.calculate_lwp(m) + self.doc.total_days_in_month = m['month_days'] self.doc.leave_without_pay = lwp - self.doc.payment_days = flt(m[3]) - flt(lwp) + payment_days = flt(self.get_payment_days(m)) - flt(lwp) + self.doc.payment_days = payment_days > 0 and payment_days or 0 + + + def get_payment_days(self, m): + payment_days = m['month_days'] + emp = webnotes.conn.sql("select date_of_joining, relieving_date from `tabEmployee` \ + where name = %s", self.doc.employee, as_dict=1)[0] + + if emp['relieving_date']: + if getdate(emp['relieving_date']) > m['month_start_date'] and getdate(emp['relieving_date']) < m['month_end_date']: + payment_days = getdate(emp['relieving_date']).day + elif getdate(emp['relieving_date']) < m['month_start_date']: + payment_days = 0 + + if emp['date_of_joining']: + if getdate(emp['date_of_joining']) > m['month_start_date'] and getdate(emp['date_of_joining']) < m['month_end_date']: + payment_days = payment_days - getdate(emp['date_of_joining']).day + 1 + elif getdate(emp['date_of_joining']) > m['month_end_date']: + payment_days = 0 + + return payment_days + + - # Get month details - #======================================================= - def get_month_details(self): - ysd = sql("select year_start_date from `tabFiscal Year` where name ='%s'"%self.doc.fiscal_year)[0][0] - if ysd: - from dateutil.relativedelta import relativedelta - import calendar, datetime - mnt = int(self.doc.month) - diff_mnt = int(mnt)-int(ysd.month) - if diff_mnt<0: - diff_mnt = 12-int(ysd.month)+int(mnt) - msd = ysd + relativedelta(months=diff_mnt) # month start date - month_days = cint(calendar.monthrange(cint(msd.year) ,cint(self.doc.month))[1]) # days in month - med = datetime.date(msd.year, cint(self.doc.month), month_days) # month end date - return msd.year, msd, med, month_days - # Calculate LWP - #======================================================= def calculate_lwp(self, m): - holidays = sql("select t1.holiday_date from `tabHoliday` t1, tabEmployee t2 where t1.parent = t2.holiday_list and t2.name = '%s' and t1.holiday_date between '%s' and '%s'" % (self.doc.employee, m[1], m[2])) + holidays = sql("select t1.holiday_date from `tabHoliday` t1, tabEmployee t2 where t1.parent = t2.holiday_list and t2.name = '%s' and t1.holiday_date between '%s' and '%s'" % (self.doc.employee, m['month_start_date'], m['month_end_date'])) if not holidays: holidays = sql("select t1.holiday_date from `tabHoliday` t1, `tabHoliday List` t2 where t1.parent = t2.name and ifnull(t2.is_default, 0) = 1 and t2.fiscal_year = '%s'" % self.doc.fiscal_year) holidays = [cstr(i[0]) for i in holidays] lwp = 0 - for d in range(m[3]): - dt = add_days(cstr(m[1]), d) + for d in range(m['month_days']): + dt = add_days(cstr(m['month_start_date']), d) if dt not in holidays: leave = sql(""" select t1.name, t1.half_day @@ -130,8 +132,7 @@ class DocType(TransactionBase): lwp = cint(leave[0][1]) and lwp + 0.5 or lwp + 1 return lwp - # Check existing - #======================================================= + def check_existing(self): ret_exist = sql("select name from `tabSalary Slip` where month = '%s' and fiscal_year = '%s' and docstatus != 2 and employee = '%s' and name !='%s'" % (self.doc.month,self.doc.fiscal_year,self.doc.employee,self.doc.name)) if ret_exist: @@ -139,8 +140,7 @@ class DocType(TransactionBase): self.doc.employee = '' raise Exception - # Validate - #======================================================= + def validate(self): self.check_existing() dcc = TransactionBase().get_company_currency(self.doc.company) @@ -155,6 +155,8 @@ class DocType(TransactionBase): for d in getlist(self.doclist, 'earning_details'): if cint(d.e_depends_on_lwp) == 1: d.e_modified_amount = round(flt(d.e_amount)*flt(self.doc.payment_days)/cint(self.doc.total_days_in_month), 2) + elif not self.doc.payment_days: + d.e_modified_amount = 0 self.doc.gross_pay += d.e_modified_amount def calculate_ded_total(self): @@ -165,6 +167,9 @@ class DocType(TransactionBase): for d in getlist(self.doclist, 'deduction_details'): if cint(d.d_depends_on_lwp) == 1: d.d_modified_amount = round(flt(d.d_amount)*flt(self.doc.payment_days)/cint(self.doc.total_days_in_month), 2) + elif not self.doc.payment_days: + d.d_modified_amount = 0 + self.doc.total_deduction += d.d_modified_amount def calculate_net_pay(self): @@ -176,17 +181,12 @@ class DocType(TransactionBase): self.doc.net_pay = flt(self.doc.gross_pay) - flt(self.doc.total_deduction) self.doc.rounded_total = round(self.doc.net_pay) - # ON SUBMIT - #======================================================= + def on_submit(self): if(self.doc.email_check == 1): self.send_mail_funct() - - - # Send mail - #======================================================= def send_mail_funct(self): from webnotes.utils.email_lib import sendmail emailid_ret=sql("select company_email from `tabEmployee` where name = '%s'"%self.doc.employee) @@ -281,4 +281,4 @@ class DocType(TransactionBase):
    '''%(cstr(letter_head[0][0]),cstr(self.doc.employee), cstr(self.doc.employee_name), cstr(self.doc.month), cstr(self.doc.fiscal_year), cstr(self.doc.department), cstr(self.doc.branch), cstr(self.doc.designation), cstr(self.doc.grade), cstr(self.doc.bank_account_no), cstr(self.doc.bank_name), cstr(self.doc.arrear_amount), cstr(self.doc.payment_days), earn_table, ded_table, cstr(flt(self.doc.gross_pay)), cstr(flt(self.doc.total_deduction)), cstr(flt(self.doc.net_pay)), cstr(self.doc.total_in_words)) sendmail([receiver], subject=subj, msg = msg) else: - msgprint("Company Email ID not found.") + msgprint("Company Email ID not found, hence mail not sent") diff --git a/erpnext/hr/doctype/salary_slip_deduction/__init__.py b/erpnext/hr/doctype/salary_slip_deduction/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/salary_slip_deduction/__init__.py +++ b/erpnext/hr/doctype/salary_slip_deduction/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/salary_slip_earning/__init__.py b/erpnext/hr/doctype/salary_slip_earning/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/salary_slip_earning/__init__.py +++ b/erpnext/hr/doctype/salary_slip_earning/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/salary_structure/__init__.py b/erpnext/hr/doctype/salary_structure/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/salary_structure/__init__.py +++ b/erpnext/hr/doctype/salary_structure/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/salary_structure/listview.js b/erpnext/hr/doctype/salary_structure/listview.js new file mode 100644 index 00000000000..77259b5d138 --- /dev/null +++ b/erpnext/hr/doctype/salary_structure/listview.js @@ -0,0 +1,47 @@ +// render +wn.doclistviews['Salary Structure'] = wn.views.ListView.extend({ + init: function(d) { + this._super(d) + this.fields = this.fields.concat([ + "`tabSalary Structure`.employee_name", + "`tabSalary Structure`.designation", + "`tabSalary Structure`.branch", + "`tabSalary Structure`.net_pay", + "`tabSalary Structure`.from_date", + "`tabSalary Structure`.to_date", + "`tabSalary Structure`.company" + ]); + this.stats = this.stats.concat(['company']); + }, + + prepare_data: function(data) { + this._super(data); + var concat_list = []; + data.designation && concat_list.push(data.designation); + data.branch && concat_list.push(data.branch); + data.description = concat_list.join(", "); + data.period = data.from_date + (data.to_date && ' to ' + data.to_date); + }, + + columns: [ + {width: '2%', content: 'check'}, + {width: '2%', content: 'docstatus'}, + {width: '13%', content: 'name'}, + {width: '18%', content: 'employee_name'}, + {width: '24%', content: 'description+tags', css: {'color': '#aaa'}}, + {width: '26%', content:'period', css: {'text-align': 'right', 'color':'#aaa'}}, + { + width: '15%', + content: function(parent, data) { + $(parent).html( + ( + data.company + ? wn.boot.company[data.company].default_currency + : sys_defaults.currency + ) + + ' ' + fmt_money(data.net_pay)); + }, + css: {'text-align': 'right'}, + }, +] +}); \ No newline at end of file diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.js b/erpnext/hr/doctype/salary_structure/salary_structure.js index 2cfab812815..27ed19e83fa 100644 --- a/erpnext/hr/doctype/salary_structure/salary_structure.js +++ b/erpnext/hr/doctype/salary_structure/salary_structure.js @@ -29,11 +29,10 @@ cur_frm.cscript.onload = function(doc, dt, dn){ //======================================================================= cur_frm.cscript.refresh = function(doc, dt, dn){ if((!doc.__islocal) && (doc.is_active == 'Yes')){ - cur_frm.add_custom_button('Make Salary Slip', cur_frm.cscript['Make Salary Slip']); - - get_field(doc.doctype, 'employee', doc.name).permlevel = 1; - refresh_field('employee'); + cur_frm.add_custom_button('Make Salary Slip', cur_frm.cscript['Make Salary Slip']); } + + cur_frm.toggle_enable('employee', doc.__islocal); } diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.py b/erpnext/hr/doctype/salary_structure/salary_structure.py index b2d10b82153..c4fd54acec6 100644 --- a/erpnext/hr/doctype/salary_structure/salary_structure.py +++ b/erpnext/hr/doctype/salary_structure/salary_structure.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/hr/doctype/salary_structure_deduction/__init__.py b/erpnext/hr/doctype/salary_structure_deduction/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/salary_structure_deduction/__init__.py +++ b/erpnext/hr/doctype/salary_structure_deduction/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/doctype/salary_structure_earning/__init__.py b/erpnext/hr/doctype/salary_structure_earning/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/doctype/salary_structure_earning/__init__.py +++ b/erpnext/hr/doctype/salary_structure_earning/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/page/__init__.py b/erpnext/hr/page/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/page/__init__.py +++ b/erpnext/hr/page/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/page/hr_home/__init__.py b/erpnext/hr/page/hr_home/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/page/hr_home/__init__.py +++ b/erpnext/hr/page/hr_home/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/search_criteria/__init__.py b/erpnext/hr/search_criteria/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/search_criteria/__init__.py +++ b/erpnext/hr/search_criteria/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/search_criteria/employee_appraisals/__init__.py b/erpnext/hr/search_criteria/employee_appraisals/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/search_criteria/employee_appraisals/__init__.py +++ b/erpnext/hr/search_criteria/employee_appraisals/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/search_criteria/employee_information/__init__.py b/erpnext/hr/search_criteria/employee_information/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/search_criteria/employee_information/__init__.py +++ b/erpnext/hr/search_criteria/employee_information/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/search_criteria/employee_information/employee_information.py b/erpnext/hr/search_criteria/employee_information/employee_information.py index 74dd259a70f..6e0887270f1 100644 --- a/erpnext/hr/search_criteria/employee_information/employee_information.py +++ b/erpnext/hr/search_criteria/employee_information/employee_information.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals for c in range(0,len(colnames)): l = (len(colnames[c])*9) if l < 150 : col_width = '150px' diff --git a/erpnext/hr/search_criteria/employees_birthday/__init__.py b/erpnext/hr/search_criteria/employees_birthday/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/search_criteria/employees_birthday/__init__.py +++ b/erpnext/hr/search_criteria/employees_birthday/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/search_criteria/employeewise_balance_leave_report/__init__.py b/erpnext/hr/search_criteria/employeewise_balance_leave_report/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/search_criteria/employeewise_balance_leave_report/__init__.py +++ b/erpnext/hr/search_criteria/employeewise_balance_leave_report/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.py b/erpnext/hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.py index 2721a6b9391..cb822100d11 100644 --- a/erpnext/hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.py +++ b/erpnext/hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals leave_types = sql(""" SELECT name FROM `tabLeave Type` WHERE diff --git a/erpnext/hr/search_criteria/expense_claims/__init__.py b/erpnext/hr/search_criteria/expense_claims/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/search_criteria/expense_claims/__init__.py +++ b/erpnext/hr/search_criteria/expense_claims/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/search_criteria/monthly_attendance_details/__init__.py b/erpnext/hr/search_criteria/monthly_attendance_details/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/search_criteria/monthly_attendance_details/__init__.py +++ b/erpnext/hr/search_criteria/monthly_attendance_details/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.py b/erpnext/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.py index a45c09d7fd9..dff95df1695 100644 --- a/erpnext/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.py +++ b/erpnext/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.py @@ -16,6 +16,7 @@ #add column employee, employee name #-------------------------------------------------------------------------------------- +from __future__ import unicode_literals col =[['Employee','Link','155px','Employee'],['Employee Name','Data','150px','']] for c in col: diff --git a/erpnext/hr/search_criteria/monthly_salary_register/__init__.py b/erpnext/hr/search_criteria/monthly_salary_register/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/search_criteria/monthly_salary_register/__init__.py +++ b/erpnext/hr/search_criteria/monthly_salary_register/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/search_criteria/monthly_salary_register/monthly_salary_register.py b/erpnext/hr/search_criteria/monthly_salary_register/monthly_salary_register.py index bbf6fb0b5f4..b22c32aeccb 100644 --- a/erpnext/hr/search_criteria/monthly_salary_register/monthly_salary_register.py +++ b/erpnext/hr/search_criteria/monthly_salary_register/monthly_salary_register.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals colwidths[col_idx['Employee Name']]="120px" colwidths[col_idx['Leave Without Pay']] = '120px' diff --git a/erpnext/hr/search_criteria/new_or_left_employees_for_a_month/__init__.py b/erpnext/hr/search_criteria/new_or_left_employees_for_a_month/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/search_criteria/new_or_left_employees_for_a_month/__init__.py +++ b/erpnext/hr/search_criteria/new_or_left_employees_for_a_month/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.py b/erpnext/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.py index f116d901756..7d5feca9ce4 100644 --- a/erpnext/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.py +++ b/erpnext/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals status = filter_values.get('status') month = filter_values.get('month') diff --git a/erpnext/hr/search_criteria/salary_register/__init__.py b/erpnext/hr/search_criteria/salary_register/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/search_criteria/salary_register/__init__.py +++ b/erpnext/hr/search_criteria/salary_register/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/search_criteria/salary_register/salary_register.py b/erpnext/hr/search_criteria/salary_register/salary_register.py index 875c7db08b3..088b9bbbcd6 100644 --- a/erpnext/hr/search_criteria/salary_register/salary_register.py +++ b/erpnext/hr/search_criteria/salary_register/salary_register.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals sal_slips_ids = '' for r in res: if not sal_slips_ids == '': sal_slips_ids +="," diff --git a/erpnext/hr/search_criteria/salary_slips/__init__.py b/erpnext/hr/search_criteria/salary_slips/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/search_criteria/salary_slips/__init__.py +++ b/erpnext/hr/search_criteria/salary_slips/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/hr/search_criteria/salary_structure_details/__init__.py b/erpnext/hr/search_criteria/salary_structure_details/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/hr/search_criteria/salary_structure_details/__init__.py +++ b/erpnext/hr/search_criteria/salary_structure_details/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/patches/__init__.py b/erpnext/patches/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/patches/__init__.py +++ b/erpnext/patches/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/patches/april_2012/__init__.py b/erpnext/patches/april_2012/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/patches/april_2012/__init__.py +++ b/erpnext/patches/april_2012/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/patches/april_2012/after_sync_cleanup.py b/erpnext/patches/april_2012/after_sync_cleanup.py index 33840a00e82..1856ee9d572 100644 --- a/erpnext/patches/april_2012/after_sync_cleanup.py +++ b/erpnext/patches/april_2012/after_sync_cleanup.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model import delete_doc diff --git a/erpnext/patches/april_2012/change_cacheitem_schema.py b/erpnext/patches/april_2012/change_cacheitem_schema.py index dc3c2536895..4d46f2cef0c 100644 --- a/erpnext/patches/april_2012/change_cacheitem_schema.py +++ b/erpnext/patches/april_2012/change_cacheitem_schema.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.commit() diff --git a/erpnext/patches/april_2012/delete_about_contact.py b/erpnext/patches/april_2012/delete_about_contact.py index e7173d93e5f..4bd10d74005 100644 --- a/erpnext/patches/april_2012/delete_about_contact.py +++ b/erpnext/patches/april_2012/delete_about_contact.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model import delete_doc diff --git a/erpnext/patches/april_2012/naming_series_patch.py b/erpnext/patches/april_2012/naming_series_patch.py index 574d03682cc..434d1a44ad0 100644 --- a/erpnext/patches/april_2012/naming_series_patch.py +++ b/erpnext/patches/april_2012/naming_series_patch.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model.code import get_obj diff --git a/erpnext/patches/april_2012/reload_c_form.py b/erpnext/patches/april_2012/reload_c_form.py index bebca6f9bb6..0b109044e4f 100644 --- a/erpnext/patches/april_2012/reload_c_form.py +++ b/erpnext/patches/april_2012/reload_c_form.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/april_2012/remove_default_from_rv_detail.py b/erpnext/patches/april_2012/remove_default_from_rv_detail.py index cf81f6d2a78..9ce5e24e0aa 100644 --- a/erpnext/patches/april_2012/remove_default_from_rv_detail.py +++ b/erpnext/patches/april_2012/remove_default_from_rv_detail.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("update `tabDocField` set `default` = '' where fieldname = 'cost_center' and parent = 'RV Detail' and `default` = 'Purchase - TC'") diff --git a/erpnext/patches/april_2012/repost_stock_for_posting_time.py b/erpnext/patches/april_2012/repost_stock_for_posting_time.py index 095449ab5de..a1283a0327d 100644 --- a/erpnext/patches/april_2012/repost_stock_for_posting_time.py +++ b/erpnext/patches/april_2012/repost_stock_for_posting_time.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model.code import get_obj diff --git a/erpnext/patches/april_2012/serial_no_fixes.py b/erpnext/patches/april_2012/serial_no_fixes.py index f291e1000d8..be6fbeb1a84 100644 --- a/erpnext/patches/april_2012/serial_no_fixes.py +++ b/erpnext/patches/april_2012/serial_no_fixes.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/april_2012/update_appraisal_permission.py b/erpnext/patches/april_2012/update_appraisal_permission.py index bd4578f5e45..5afcdbba7a0 100644 --- a/erpnext/patches/april_2012/update_appraisal_permission.py +++ b/erpnext/patches/april_2012/update_appraisal_permission.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model.doc import addchild diff --git a/erpnext/patches/april_2012/update_permlevel_in_address.py b/erpnext/patches/april_2012/update_permlevel_in_address.py index f8deb2c4c3a..96d5adcb50b 100644 --- a/erpnext/patches/april_2012/update_permlevel_in_address.py +++ b/erpnext/patches/april_2012/update_permlevel_in_address.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("update `tabDocPerm` set permlevel = 0 where parent = 'Address'") diff --git a/erpnext/patches/april_2012/update_role_in_address.py b/erpnext/patches/april_2012/update_role_in_address.py index 6917da422be..3a65c30e1c7 100644 --- a/erpnext/patches/april_2012/update_role_in_address.py +++ b/erpnext/patches/april_2012/update_role_in_address.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model.doc import addchild diff --git a/erpnext/patches/august_2012/__init__.py b/erpnext/patches/august_2012/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/patches/august_2012/__init__.py +++ b/erpnext/patches/august_2012/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/patches/august_2012/change_profile_permission.py b/erpnext/patches/august_2012/change_profile_permission.py new file mode 100644 index 00000000000..27169d8792a --- /dev/null +++ b/erpnext/patches/august_2012/change_profile_permission.py @@ -0,0 +1,35 @@ +from __future__ import unicode_literals +def execute(): + import webnotes + import webnotes.model.doc + webnotes.conn.sql("delete from `tabDocPerm` where parent='Profile' and permlevel=1") + new_perms = [ + { + 'parent': 'Profile', + 'parentfield': 'permissions', + 'parenttype': 'DocType', + 'role': 'Administrator', + 'permlevel': 1, + 'read': 1, + 'write': 1 + }, + { + 'parent': 'Profile', + 'parentfield': 'permissions', + 'parenttype': 'DocType', + 'role': 'System Manager', + 'permlevel': 1, + 'read': 1, + 'write': 1 + }, + + ] + for perms in new_perms: + doc = webnotes.model.doc.Document('DocPerm') + doc.fields.update(perms) + doc.save() + webnotes.conn.commit() + webnotes.conn.begin() + + import webnotes.model.sync + webnotes.model.sync.sync('core', 'profile') \ No newline at end of file diff --git a/erpnext/patches/august_2012/changed_blog_date_format.py b/erpnext/patches/august_2012/changed_blog_date_format.py index d2dd87069c6..047a4d9b862 100644 --- a/erpnext/patches/august_2012/changed_blog_date_format.py +++ b/erpnext/patches/august_2012/changed_blog_date_format.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model.doclist import DocList diff --git a/erpnext/patches/august_2012/remove_cash_flow_statement.py b/erpnext/patches/august_2012/remove_cash_flow_statement.py index a1243b807d5..739a4f2709e 100644 --- a/erpnext/patches/august_2012/remove_cash_flow_statement.py +++ b/erpnext/patches/august_2012/remove_cash_flow_statement.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("delete from `tabSearch Criteria` where name = 'cash_flow_statement'") \ No newline at end of file diff --git a/erpnext/patches/august_2012/report_supplier_quotations.py b/erpnext/patches/august_2012/report_supplier_quotations.py index c0e6b3cf54e..8eaf707c4cc 100644 --- a/erpnext/patches/august_2012/report_supplier_quotations.py +++ b/erpnext/patches/august_2012/report_supplier_quotations.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): from webnotes.modules import reload_doc - reload_doc("Buying", "Report", "Supplier Quotations") \ No newline at end of file + reload_doc("buying", "report", "supplier_quotations") diff --git a/erpnext/patches/august_2012/repost_billed_amt.py b/erpnext/patches/august_2012/repost_billed_amt.py index e6b463c1571..4ff7afb2e93 100644 --- a/erpnext/patches/august_2012/repost_billed_amt.py +++ b/erpnext/patches/august_2012/repost_billed_amt.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model.code import get_obj diff --git a/erpnext/patches/august_2012/task_allocated_to_assigned.py b/erpnext/patches/august_2012/task_allocated_to_assigned.py new file mode 100644 index 00000000000..1bbc447c761 --- /dev/null +++ b/erpnext/patches/august_2012/task_allocated_to_assigned.py @@ -0,0 +1,15 @@ +from __future__ import unicode_literals +import webnotes + +def execute(): + from webnotes.widgets.form.assign_to import add + for t in webnotes.conn.sql("""select * from tabTask + where ifnull(allocated_to, '')!=''""", as_dict=1): + add({ + 'doctype': "Task", + 'name': t['name'], + 'assign_to': t['allocated_to'], + 'assigned_by': t['owner'], + 'description': t['subject'], + 'date': t['creation'] + }) \ No newline at end of file diff --git a/erpnext/patches/before_jan_2012/Discount_purchase_cycle.py b/erpnext/patches/before_jan_2012/Discount_purchase_cycle.py index 42145764476..8ddcbf5967d 100644 --- a/erpnext/patches/before_jan_2012/Discount_purchase_cycle.py +++ b/erpnext/patches/before_jan_2012/Discount_purchase_cycle.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/__init__.py b/erpnext/patches/before_jan_2012/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/patches/before_jan_2012/__init__.py +++ b/erpnext/patches/before_jan_2012/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/patches/before_jan_2012/accounts_default_form.py b/erpnext/patches/before_jan_2012/accounts_default_form.py index eb8f58699e0..51e41aa0cbe 100644 --- a/erpnext/patches/before_jan_2012/accounts_default_form.py +++ b/erpnext/patches/before_jan_2012/accounts_default_form.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/auto_indent.py b/erpnext/patches/before_jan_2012/auto_indent.py index a472d80562f..6018681a0b2 100644 --- a/erpnext/patches/before_jan_2012/auto_indent.py +++ b/erpnext/patches/before_jan_2012/auto_indent.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/c_form_patch.py b/erpnext/patches/before_jan_2012/c_form_patch.py index 76e3646b635..37b99835a5d 100644 --- a/erpnext/patches/before_jan_2012/c_form_patch.py +++ b/erpnext/patches/before_jan_2012/c_form_patch.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/delivery_billing_status_patch.py b/erpnext/patches/before_jan_2012/delivery_billing_status_patch.py index 424ef4abdc7..ca022f3a47f 100644 --- a/erpnext/patches/before_jan_2012/delivery_billing_status_patch.py +++ b/erpnext/patches/before_jan_2012/delivery_billing_status_patch.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes sql = webnotes.conn.sql diff --git a/erpnext/patches/before_jan_2012/deploy_email_digest.py b/erpnext/patches/before_jan_2012/deploy_email_digest.py index 8474b640dcd..238ff00a3b2 100644 --- a/erpnext/patches/before_jan_2012/deploy_email_digest.py +++ b/erpnext/patches/before_jan_2012/deploy_email_digest.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes def execute(): diff --git a/erpnext/patches/before_jan_2012/edigest_enable_income_year_to_date.py b/erpnext/patches/before_jan_2012/edigest_enable_income_year_to_date.py index 7d5b856d7fc..0403e01bc8c 100644 --- a/erpnext/patches/before_jan_2012/edigest_enable_income_year_to_date.py +++ b/erpnext/patches/before_jan_2012/edigest_enable_income_year_to_date.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.model.doc import Document diff --git a/erpnext/patches/before_jan_2012/employeewise_balance_leave_report.py b/erpnext/patches/before_jan_2012/employeewise_balance_leave_report.py index 83f2143a9ca..315b7844c8a 100644 --- a/erpnext/patches/before_jan_2012/employeewise_balance_leave_report.py +++ b/erpnext/patches/before_jan_2012/employeewise_balance_leave_report.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals """ This patch changes criteria name of search criteria "employeewise_balance_leave_report" diff --git a/erpnext/patches/before_jan_2012/erpnext_structure_cleanup.py b/erpnext/patches/before_jan_2012/erpnext_structure_cleanup.py index 0e0e68f79ab..2b9a8af1995 100644 --- a/erpnext/patches/before_jan_2012/erpnext_structure_cleanup.py +++ b/erpnext/patches/before_jan_2012/erpnext_structure_cleanup.py @@ -17,6 +17,7 @@ #Cleanup all unwanted documents and restructure of moduloes #---------------------------------------------------------- +from __future__ import unicode_literals import webnotes from webnotes.model import delete_doc from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/index_patch.py b/erpnext/patches/before_jan_2012/index_patch.py index fef48de9a1d..7cdc12ed61a 100644 --- a/erpnext/patches/before_jan_2012/index_patch.py +++ b/erpnext/patches/before_jan_2012/index_patch.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals """ This patch removes wrong indexs and add proper indexes in tables """ diff --git a/erpnext/patches/before_jan_2012/install_print_formats.py b/erpnext/patches/before_jan_2012/install_print_formats.py index 92bd60c7dbb..d3d8789c889 100644 --- a/erpnext/patches/before_jan_2012/install_print_formats.py +++ b/erpnext/patches/before_jan_2012/install_print_formats.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import os, sys import webnotes diff --git a/erpnext/patches/before_jan_2012/lcw_patch.py b/erpnext/patches/before_jan_2012/lcw_patch.py index dbf2f6de891..f5ed4c7d70d 100644 --- a/erpnext/patches/before_jan_2012/lcw_patch.py +++ b/erpnext/patches/before_jan_2012/lcw_patch.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/p1.py b/erpnext/patches/before_jan_2012/p1.py index 74d847061f9..10df0202906 100644 --- a/erpnext/patches/before_jan_2012/p1.py +++ b/erpnext/patches/before_jan_2012/p1.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes if not webnotes.conn.sql("select name from tabDocFormat where parent = 'Sales Invoice' and format != 'POS Invoice'"): diff --git a/erpnext/patches/before_jan_2012/packing_slip.py b/erpnext/patches/before_jan_2012/packing_slip.py index 7fe2d5d44f0..10ffa860147 100644 --- a/erpnext/patches/before_jan_2012/packing_slip.py +++ b/erpnext/patches/before_jan_2012/packing_slip.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/price_list_patch.py b/erpnext/patches/before_jan_2012/price_list_patch.py index d5d673e5ac8..41fbd5e7516 100644 --- a/erpnext/patches/before_jan_2012/price_list_patch.py +++ b/erpnext/patches/before_jan_2012/price_list_patch.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/print_hide_price_list.py b/erpnext/patches/before_jan_2012/print_hide_price_list.py index 8940ef35e3b..4295ab48da5 100644 --- a/erpnext/patches/before_jan_2012/print_hide_price_list.py +++ b/erpnext/patches/before_jan_2012/print_hide_price_list.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("update `tabDocField` set print_hide = 1 where fieldname in ('price_list_currency', 'plc_conversion_rate')") diff --git a/erpnext/patches/before_jan_2012/profile_mark_not_in_create.py b/erpnext/patches/before_jan_2012/profile_mark_not_in_create.py index 559266d5827..aae069476f7 100644 --- a/erpnext/patches/before_jan_2012/profile_mark_not_in_create.py +++ b/erpnext/patches/before_jan_2012/profile_mark_not_in_create.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes def execute(): """ diff --git a/erpnext/patches/before_jan_2012/project_patch.py b/erpnext/patches/before_jan_2012/project_patch.py index 80900294efe..735714d74c5 100644 --- a/erpnext/patches/before_jan_2012/project_patch.py +++ b/erpnext/patches/before_jan_2012/project_patch.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/reload_address.py b/erpnext/patches/before_jan_2012/reload_address.py index ae68f6f4933..781a00b1e0a 100644 --- a/erpnext/patches/before_jan_2012/reload_address.py +++ b/erpnext/patches/before_jan_2012/reload_address.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/reload_bom.py b/erpnext/patches/before_jan_2012/reload_bom.py index cbacce1c4b8..0492d72f502 100644 --- a/erpnext/patches/before_jan_2012/reload_bom.py +++ b/erpnext/patches/before_jan_2012/reload_bom.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/reload_doclayer.py b/erpnext/patches/before_jan_2012/reload_doclayer.py index 6c694a00772..deb6f05e50a 100644 --- a/erpnext/patches/before_jan_2012/reload_doclayer.py +++ b/erpnext/patches/before_jan_2012/reload_doclayer.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals """ Reload Customize Form, Customize Form Field and Print Format doctypes """ diff --git a/erpnext/patches/before_jan_2012/reload_email_digest.py b/erpnext/patches/before_jan_2012/reload_email_digest.py index 15cbfc32261..8e0852cfbf7 100644 --- a/erpnext/patches/before_jan_2012/reload_email_digest.py +++ b/erpnext/patches/before_jan_2012/reload_email_digest.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): from webnotes.modules import reload_doc reload_doc('Setup', 'DocType', 'Email Digest') diff --git a/erpnext/patches/before_jan_2012/reload_employeewise_balance_leave_report.py b/erpnext/patches/before_jan_2012/reload_employeewise_balance_leave_report.py index 53183cb1343..1e8ce40b9d9 100644 --- a/erpnext/patches/before_jan_2012/reload_employeewise_balance_leave_report.py +++ b/erpnext/patches/before_jan_2012/reload_employeewise_balance_leave_report.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/reload_flat_bom.py b/erpnext/patches/before_jan_2012/reload_flat_bom.py index 020bd7e5c6f..7c648ff3c51 100644 --- a/erpnext/patches/before_jan_2012/reload_flat_bom.py +++ b/erpnext/patches/before_jan_2012/reload_flat_bom.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): from webnotes.modules import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/reload_gl_mapper.py b/erpnext/patches/before_jan_2012/reload_gl_mapper.py index c43ab67081f..cf67c5c7f88 100644 --- a/erpnext/patches/before_jan_2012/reload_gl_mapper.py +++ b/erpnext/patches/before_jan_2012/reload_gl_mapper.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/reload_lc_wizard.py b/erpnext/patches/before_jan_2012/reload_lc_wizard.py index ac651778add..3de71da0a09 100644 --- a/erpnext/patches/before_jan_2012/reload_lc_wizard.py +++ b/erpnext/patches/before_jan_2012/reload_lc_wizard.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/reload_print_format.py b/erpnext/patches/before_jan_2012/reload_print_format.py index cac8d6e8a41..d775c0c9cc6 100644 --- a/erpnext/patches/before_jan_2012/reload_print_format.py +++ b/erpnext/patches/before_jan_2012/reload_print_format.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/reload_project_task.py b/erpnext/patches/before_jan_2012/reload_project_task.py index b21135be149..c6b38d55dd8 100644 --- a/erpnext/patches/before_jan_2012/reload_project_task.py +++ b/erpnext/patches/before_jan_2012/reload_project_task.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals """ Reload Task Doctype of Project Module """ diff --git a/erpnext/patches/before_jan_2012/reload_reco.py b/erpnext/patches/before_jan_2012/reload_reco.py index 782fc7fb822..2c303c5ff49 100644 --- a/erpnext/patches/before_jan_2012/reload_reco.py +++ b/erpnext/patches/before_jan_2012/reload_reco.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/reload_rv.py b/erpnext/patches/before_jan_2012/reload_rv.py index 43655636f4e..3c7b5be4c53 100644 --- a/erpnext/patches/before_jan_2012/reload_rv.py +++ b/erpnext/patches/before_jan_2012/reload_rv.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/reload_support_ticket.py b/erpnext/patches/before_jan_2012/reload_support_ticket.py index f889687ab43..0fe611b878a 100644 --- a/erpnext/patches/before_jan_2012/reload_support_ticket.py +++ b/erpnext/patches/before_jan_2012/reload_support_ticket.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/remove_duplicate_table_mapper_detail.py b/erpnext/patches/before_jan_2012/remove_duplicate_table_mapper_detail.py index fcc40d141f6..3594a70724c 100644 --- a/erpnext/patches/before_jan_2012/remove_duplicate_table_mapper_detail.py +++ b/erpnext/patches/before_jan_2012/remove_duplicate_table_mapper_detail.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals """ Removes duplicate entries created in """ diff --git a/erpnext/patches/before_jan_2012/remove_extra_button_from_email_digest.py b/erpnext/patches/before_jan_2012/remove_extra_button_from_email_digest.py index 1129f06a4f9..fa2481d9d5e 100644 --- a/erpnext/patches/before_jan_2012/remove_extra_button_from_email_digest.py +++ b/erpnext/patches/before_jan_2012/remove_extra_button_from_email_digest.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql(""" diff --git a/erpnext/patches/before_jan_2012/remove_old_cp_email_settings.py b/erpnext/patches/before_jan_2012/remove_old_cp_email_settings.py index 17d9c33da5d..64174411d9a 100644 --- a/erpnext/patches/before_jan_2012/remove_old_cp_email_settings.py +++ b/erpnext/patches/before_jan_2012/remove_old_cp_email_settings.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): """ remove control panel email settings if automail.webnotestech.com diff --git a/erpnext/patches/before_jan_2012/remove_page_break_from_defaults.py b/erpnext/patches/before_jan_2012/remove_page_break_from_defaults.py index 4687c1e62a4..8ee441a28ad 100644 --- a/erpnext/patches/before_jan_2012/remove_page_break_from_defaults.py +++ b/erpnext/patches/before_jan_2012/remove_page_break_from_defaults.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("""delete from `tabDefaultValue` where defkey in ('page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_searial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos', 'purchase_discounts', 'recurring_invoice') and parent = 'Control Panel'""") diff --git a/erpnext/patches/before_jan_2012/remove_previous_field_property_setter.py b/erpnext/patches/before_jan_2012/remove_previous_field_property_setter.py index c8e0029a7a4..a993a2528f5 100644 --- a/erpnext/patches/before_jan_2012/remove_previous_field_property_setter.py +++ b/erpnext/patches/before_jan_2012/remove_previous_field_property_setter.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes def execute(): webnotes.conn.sql("""\ diff --git a/erpnext/patches/before_jan_2012/repost_account_bal.py b/erpnext/patches/before_jan_2012/repost_account_bal.py index e44a49afae0..a87bfe0cfc4 100644 --- a/erpnext/patches/before_jan_2012/repost_account_bal.py +++ b/erpnext/patches/before_jan_2012/repost_account_bal.py @@ -15,6 +15,7 @@ # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes sql = webnotes.conn.sql diff --git a/erpnext/patches/before_jan_2012/repost_stock.py b/erpnext/patches/before_jan_2012/repost_stock.py index d8267ff9cea..3976ebaa448 100644 --- a/erpnext/patches/before_jan_2012/repost_stock.py +++ b/erpnext/patches/before_jan_2012/repost_stock.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes sql = webnotes.conn.sql diff --git a/erpnext/patches/before_jan_2012/sal_man_patch.py b/erpnext/patches/before_jan_2012/sal_man_patch.py index 626d2e3803f..b6dd6f04089 100644 --- a/erpnext/patches/before_jan_2012/sal_man_patch.py +++ b/erpnext/patches/before_jan_2012/sal_man_patch.py @@ -15,6 +15,7 @@ # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/task_email_notification.py b/erpnext/patches/before_jan_2012/task_email_notification.py index 9f7669ad020..5e8b3945c93 100644 --- a/erpnext/patches/before_jan_2012/task_email_notification.py +++ b/erpnext/patches/before_jan_2012/task_email_notification.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/before_jan_2012/update_0_idx.py b/erpnext/patches/before_jan_2012/update_0_idx.py index ec38b8aeef3..9a192e5cb8b 100644 --- a/erpnext/patches/before_jan_2012/update_0_idx.py +++ b/erpnext/patches/before_jan_2012/update_0_idx.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes def execute(): doc_type_list = webnotes.conn.sql("""SELECT DISTINCT parent FROM `tabDocField` where idx=0""") diff --git a/erpnext/patches/before_jan_2012/update_gle_against_voucher_for_jv.py b/erpnext/patches/before_jan_2012/update_gle_against_voucher_for_jv.py index 6f6f6b976c8..b262778ee91 100644 --- a/erpnext/patches/before_jan_2012/update_gle_against_voucher_for_jv.py +++ b/erpnext/patches/before_jan_2012/update_gle_against_voucher_for_jv.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model.code import get_obj diff --git a/erpnext/patches/jan_mar_2012/__init__.py b/erpnext/patches/jan_mar_2012/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/patches/jan_mar_2012/__init__.py +++ b/erpnext/patches/jan_mar_2012/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/patches/jan_mar_2012/account_type_patch.py b/erpnext/patches/jan_mar_2012/account_type_patch.py index 2029a3ab762..c6ac05c9bad 100644 --- a/erpnext/patches/jan_mar_2012/account_type_patch.py +++ b/erpnext/patches/jan_mar_2012/account_type_patch.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("""update `tabAccount` diff --git a/erpnext/patches/jan_mar_2012/add_roles_to_admin.py b/erpnext/patches/jan_mar_2012/add_roles_to_admin.py index 402675ae2cd..f2e91e968c3 100644 --- a/erpnext/patches/jan_mar_2012/add_roles_to_admin.py +++ b/erpnext/patches/jan_mar_2012/add_roles_to_admin.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): """ Adds various roles to Administrator. This patch is for making master db diff --git a/erpnext/patches/jan_mar_2012/allocated_to_profile.py b/erpnext/patches/jan_mar_2012/allocated_to_profile.py index ef0ee978fbe..b38f97b7fc9 100644 --- a/erpnext/patches/jan_mar_2012/allocated_to_profile.py +++ b/erpnext/patches/jan_mar_2012/allocated_to_profile.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): """ Changes allocated_to option to Profile in diff --git a/erpnext/patches/jan_mar_2012/apps/__init__.py b/erpnext/patches/jan_mar_2012/apps/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/patches/jan_mar_2012/apps/__init__.py +++ b/erpnext/patches/jan_mar_2012/apps/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/patches/jan_mar_2012/apps/todo_item.py b/erpnext/patches/jan_mar_2012/apps/todo_item.py index f9a02bd2718..ed0acc4b0b2 100644 --- a/erpnext/patches/jan_mar_2012/apps/todo_item.py +++ b/erpnext/patches/jan_mar_2012/apps/todo_item.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): """ * Reload ToDo diff --git a/erpnext/patches/jan_mar_2012/cancel_purchase_returned.py b/erpnext/patches/jan_mar_2012/cancel_purchase_returned.py index 8a6aaa8a4cc..ff287c56c43 100644 --- a/erpnext/patches/jan_mar_2012/cancel_purchase_returned.py +++ b/erpnext/patches/jan_mar_2012/cancel_purchase_returned.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): """ Set docstatus = 2 where status = 'Purchase Returned' for serial no diff --git a/erpnext/patches/jan_mar_2012/clear_session_cache.py b/erpnext/patches/jan_mar_2012/clear_session_cache.py index 5ba2104322b..0490f501114 100644 --- a/erpnext/patches/jan_mar_2012/clear_session_cache.py +++ b/erpnext/patches/jan_mar_2012/clear_session_cache.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes webnotes.clear_cache() diff --git a/erpnext/patches/jan_mar_2012/convert_tables_to_utf8.py b/erpnext/patches/jan_mar_2012/convert_tables_to_utf8.py index dad5da4bdbc..9378aba7f3d 100644 --- a/erpnext/patches/jan_mar_2012/convert_tables_to_utf8.py +++ b/erpnext/patches/jan_mar_2012/convert_tables_to_utf8.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes def execute(): diff --git a/erpnext/patches/jan_mar_2012/customer_address_contact_patch.py b/erpnext/patches/jan_mar_2012/customer_address_contact_patch.py index 32a21251434..8a3e67a53de 100644 --- a/erpnext/patches/jan_mar_2012/customer_address_contact_patch.py +++ b/erpnext/patches/jan_mar_2012/customer_address_contact_patch.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes def execute(): diff --git a/erpnext/patches/jan_mar_2012/delete_pur_of_service.py b/erpnext/patches/jan_mar_2012/delete_pur_of_service.py index da31300d835..18ded0d199c 100644 --- a/erpnext/patches/jan_mar_2012/delete_pur_of_service.py +++ b/erpnext/patches/jan_mar_2012/delete_pur_of_service.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model import delete_doc diff --git a/erpnext/patches/jan_mar_2012/deploy_packing_slip.py b/erpnext/patches/jan_mar_2012/deploy_packing_slip.py index d349dbc0348..a6ec881e734 100644 --- a/erpnext/patches/jan_mar_2012/deploy_packing_slip.py +++ b/erpnext/patches/jan_mar_2012/deploy_packing_slip.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/jan_mar_2012/doclabel_in_doclayer.py b/erpnext/patches/jan_mar_2012/doclabel_in_doclayer.py index 9091e95dcb3..4e6260e8996 100644 --- a/erpnext/patches/jan_mar_2012/doclabel_in_doclayer.py +++ b/erpnext/patches/jan_mar_2012/doclabel_in_doclayer.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes def execute(): """ diff --git a/erpnext/patches/jan_mar_2012/dt_map_fix.py b/erpnext/patches/jan_mar_2012/dt_map_fix.py index 37732dfa5bf..d682102a8da 100644 --- a/erpnext/patches/jan_mar_2012/dt_map_fix.py +++ b/erpnext/patches/jan_mar_2012/dt_map_fix.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/jan_mar_2012/email_settings_reload.py b/erpnext/patches/jan_mar_2012/email_settings_reload.py index 85c683e1f8f..fe6b26025ac 100644 --- a/erpnext/patches/jan_mar_2012/email_settings_reload.py +++ b/erpnext/patches/jan_mar_2012/email_settings_reload.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): """ * Change type of mail_port field to int diff --git a/erpnext/patches/jan_mar_2012/fix_packing_slip.py b/erpnext/patches/jan_mar_2012/fix_packing_slip.py index fb3a4dab636..218d89d2274 100644 --- a/erpnext/patches/jan_mar_2012/fix_packing_slip.py +++ b/erpnext/patches/jan_mar_2012/fix_packing_slip.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): """ * Change DN to PS mapper diff --git a/erpnext/patches/jan_mar_2012/jan_production_patches.py b/erpnext/patches/jan_mar_2012/jan_production_patches.py index 65dd5a8fcb0..87b92052b0d 100644 --- a/erpnext/patches/jan_mar_2012/jan_production_patches.py +++ b/erpnext/patches/jan_mar_2012/jan_production_patches.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes def execute(): """ diff --git a/erpnext/patches/jan_mar_2012/label_cleanup.py b/erpnext/patches/jan_mar_2012/label_cleanup.py index 642140b6d12..4f4fc4e8834 100644 --- a/erpnext/patches/jan_mar_2012/label_cleanup.py +++ b/erpnext/patches/jan_mar_2012/label_cleanup.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model import delete_doc diff --git a/erpnext/patches/jan_mar_2012/map_conversion_rate.py b/erpnext/patches/jan_mar_2012/map_conversion_rate.py index dcb212d6a05..7e5e7c574ae 100644 --- a/erpnext/patches/jan_mar_2012/map_conversion_rate.py +++ b/erpnext/patches/jan_mar_2012/map_conversion_rate.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.model.code import get_obj from webnotes.model.doc import addchild diff --git a/erpnext/patches/jan_mar_2012/mapper_fix.py b/erpnext/patches/jan_mar_2012/mapper_fix.py index a9b1a9bb6ab..e8e68e0a251 100644 --- a/erpnext/patches/jan_mar_2012/mapper_fix.py +++ b/erpnext/patches/jan_mar_2012/mapper_fix.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("delete from `tabTable Mapper Detail` where to_table = 'Sales Invoice Item' and parent = 'Delivery Note-Sales Invoice' and validation_logic = 'amount > ifnull(billed_amt, 0) and docstatus = 1'") diff --git a/erpnext/patches/jan_mar_2012/navupdate.py b/erpnext/patches/jan_mar_2012/navupdate.py index 1cfa879ad36..a99f92416fd 100644 --- a/erpnext/patches/jan_mar_2012/navupdate.py +++ b/erpnext/patches/jan_mar_2012/navupdate.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes import _mysql_exceptions diff --git a/erpnext/patches/jan_mar_2012/no_copy_patch.py b/erpnext/patches/jan_mar_2012/no_copy_patch.py index fb12824a118..c7d33cb7fb8 100644 --- a/erpnext/patches/jan_mar_2012/no_copy_patch.py +++ b/erpnext/patches/jan_mar_2012/no_copy_patch.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("update `tabDocField` set no_copy = 1 where fieldname = 'insert_after' and parent = 'Custom Field'") diff --git a/erpnext/patches/jan_mar_2012/pending_patches.py b/erpnext/patches/jan_mar_2012/pending_patches.py index c21030a6c1b..c1d19e713bd 100644 --- a/erpnext/patches/jan_mar_2012/pending_patches.py +++ b/erpnext/patches/jan_mar_2012/pending_patches.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model.code import get_obj diff --git a/erpnext/patches/jan_mar_2012/pos_setting_patch.py b/erpnext/patches/jan_mar_2012/pos_setting_patch.py index c974b35272d..436f1b9efe7 100644 --- a/erpnext/patches/jan_mar_2012/pos_setting_patch.py +++ b/erpnext/patches/jan_mar_2012/pos_setting_patch.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("update `tabDocField` set `default` = 1 where fieldname = 'conversion_rate' and parent = 'POS Setting'") diff --git a/erpnext/patches/jan_mar_2012/print_hide_totals.py b/erpnext/patches/jan_mar_2012/print_hide_totals.py index bf16a77f465..02aef92ed56 100644 --- a/erpnext/patches/jan_mar_2012/print_hide_totals.py +++ b/erpnext/patches/jan_mar_2012/print_hide_totals.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes def execute(): diff --git a/erpnext/patches/jan_mar_2012/production_cleanup.py b/erpnext/patches/jan_mar_2012/production_cleanup.py index e724ab885ba..4e5134a953a 100644 --- a/erpnext/patches/jan_mar_2012/production_cleanup.py +++ b/erpnext/patches/jan_mar_2012/production_cleanup.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/jan_mar_2012/reload_doctype.py b/erpnext/patches/jan_mar_2012/reload_doctype.py index 957864b0d41..f05ee765a1a 100644 --- a/erpnext/patches/jan_mar_2012/reload_doctype.py +++ b/erpnext/patches/jan_mar_2012/reload_doctype.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/jan_mar_2012/reload_item.py b/erpnext/patches/jan_mar_2012/reload_item.py index e42b50b376b..47800a2893a 100644 --- a/erpnext/patches/jan_mar_2012/reload_item.py +++ b/erpnext/patches/jan_mar_2012/reload_item.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/jan_mar_2012/reload_mapper.py b/erpnext/patches/jan_mar_2012/reload_mapper.py index 987d4a7732f..146747c4d79 100644 --- a/erpnext/patches/jan_mar_2012/reload_mapper.py +++ b/erpnext/patches/jan_mar_2012/reload_mapper.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/jan_mar_2012/reload_po_pr_mapper.py b/erpnext/patches/jan_mar_2012/reload_po_pr_mapper.py index 58664294ddd..6bed3b18547 100644 --- a/erpnext/patches/jan_mar_2012/reload_po_pr_mapper.py +++ b/erpnext/patches/jan_mar_2012/reload_po_pr_mapper.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/jan_mar_2012/reload_quote.py b/erpnext/patches/jan_mar_2012/reload_quote.py index 8df293f7a40..4d23f233c0c 100644 --- a/erpnext/patches/jan_mar_2012/reload_quote.py +++ b/erpnext/patches/jan_mar_2012/reload_quote.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/jan_mar_2012/reload_table.py b/erpnext/patches/jan_mar_2012/reload_table.py index 53583204b51..1bd48735dee 100644 --- a/erpnext/patches/jan_mar_2012/reload_table.py +++ b/erpnext/patches/jan_mar_2012/reload_table.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): pass diff --git a/erpnext/patches/jan_mar_2012/remove_archive.py b/erpnext/patches/jan_mar_2012/remove_archive.py index 5f5cea60fa2..43bb11146e6 100644 --- a/erpnext/patches/jan_mar_2012/remove_archive.py +++ b/erpnext/patches/jan_mar_2012/remove_archive.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # TODO take backup before running this patch +from __future__ import unicode_literals def execute(): """ * Restore archived data from arc tables diff --git a/erpnext/patches/jan_mar_2012/remove_get_tds_button.py b/erpnext/patches/jan_mar_2012/remove_get_tds_button.py index 8549e0d3350..9d254c35d8a 100644 --- a/erpnext/patches/jan_mar_2012/remove_get_tds_button.py +++ b/erpnext/patches/jan_mar_2012/remove_get_tds_button.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): """ Remove One Get TDS button, which is appearing twice in JV diff --git a/erpnext/patches/jan_mar_2012/remove_series_defval.py b/erpnext/patches/jan_mar_2012/remove_series_defval.py index 45eed574675..84117cf8aa7 100644 --- a/erpnext/patches/jan_mar_2012/remove_series_defval.py +++ b/erpnext/patches/jan_mar_2012/remove_series_defval.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("update `tabDocField` set `default`='' where parent = 'Sales Invoice' and fieldname = 'naming_series' and `default` = 'INV'") diff --git a/erpnext/patches/jan_mar_2012/rename_dt.py b/erpnext/patches/jan_mar_2012/rename_dt.py index a507a1c4abd..31a434cab64 100644 --- a/erpnext/patches/jan_mar_2012/rename_dt.py +++ b/erpnext/patches/jan_mar_2012/rename_dt.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import webnotes import conf import webnotes.model diff --git a/erpnext/patches/jan_mar_2012/serial_no_add_opt.py b/erpnext/patches/jan_mar_2012/serial_no_add_opt.py index ec45c278b95..7693fae0ad5 100644 --- a/erpnext/patches/jan_mar_2012/serial_no_add_opt.py +++ b/erpnext/patches/jan_mar_2012/serial_no_add_opt.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes opts = webnotes.conn.sql("""\ diff --git a/erpnext/patches/jan_mar_2012/stable_branch_shift_09_01_12.py b/erpnext/patches/jan_mar_2012/stable_branch_shift_09_01_12.py index 99366beaa95..177eb814722 100644 --- a/erpnext/patches/jan_mar_2012/stable_branch_shift_09_01_12.py +++ b/erpnext/patches/jan_mar_2012/stable_branch_shift_09_01_12.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/jan_mar_2012/stock_entry_others_patch.py b/erpnext/patches/jan_mar_2012/stock_entry_others_patch.py index 7562fcaf446..03cc105e9ca 100644 --- a/erpnext/patches/jan_mar_2012/stock_entry_others_patch.py +++ b/erpnext/patches/jan_mar_2012/stock_entry_others_patch.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/jan_mar_2012/subcon_default_val.py b/erpnext/patches/jan_mar_2012/subcon_default_val.py index 8164b0a9f8b..2d0891d3e29 100644 --- a/erpnext/patches/jan_mar_2012/subcon_default_val.py +++ b/erpnext/patches/jan_mar_2012/subcon_default_val.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql(""" diff --git a/erpnext/patches/jan_mar_2012/sync_ref_db.py b/erpnext/patches/jan_mar_2012/sync_ref_db.py index 91a53596cb1..5af1e54275f 100644 --- a/erpnext/patches/jan_mar_2012/sync_ref_db.py +++ b/erpnext/patches/jan_mar_2012/sync_ref_db.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import webnotes sql = webnotes.conn.sql from webnotes.model import delete_doc diff --git a/erpnext/patches/jan_mar_2012/update_purpose_se.py b/erpnext/patches/jan_mar_2012/update_purpose_se.py index e2b7d9fc50f..721ec46f3a9 100644 --- a/erpnext/patches/jan_mar_2012/update_purpose_se.py +++ b/erpnext/patches/jan_mar_2012/update_purpose_se.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("update `tabDocField` set options = replace(options, 'Others', 'Other') where fieldname = 'purpose' and parent = 'Stock Entry'") diff --git a/erpnext/patches/jan_mar_2012/update_se_fld_options.py b/erpnext/patches/jan_mar_2012/update_se_fld_options.py index 0428fc9934e..61512d3f236 100644 --- a/erpnext/patches/jan_mar_2012/update_se_fld_options.py +++ b/erpnext/patches/jan_mar_2012/update_se_fld_options.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("update `tabDocField` set options = 'BOM' where fieldname = 'bom_no' and parent = 'Stock Entry'") diff --git a/erpnext/patches/jan_mar_2012/update_stockreco_perm.py b/erpnext/patches/jan_mar_2012/update_stockreco_perm.py index 9c3c6974cd4..b5d270fb09e 100644 --- a/erpnext/patches/jan_mar_2012/update_stockreco_perm.py +++ b/erpnext/patches/jan_mar_2012/update_stockreco_perm.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("update `tabDocPerm` set cancel = 1 where parent = 'Stock Reconciliation' and ifnull(submit, 0) = 1") diff --git a/erpnext/patches/jan_mar_2012/website/__init__.py b/erpnext/patches/jan_mar_2012/website/__init__.py index 680c79a18ef..eb05a23c801 100644 --- a/erpnext/patches/jan_mar_2012/website/__init__.py +++ b/erpnext/patches/jan_mar_2012/website/__init__.py @@ -1,2 +1,3 @@ +from __future__ import unicode_literals \ No newline at end of file diff --git a/erpnext/patches/jan_mar_2012/website/all.py b/erpnext/patches/jan_mar_2012/website/all.py index 47be62a677a..fbb2e9dc2af 100644 --- a/erpnext/patches/jan_mar_2012/website/all.py +++ b/erpnext/patches/jan_mar_2012/website/all.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import patches.jan_mar_2012.website.login import patches.jan_mar_2012.website.feed import patches.jan_mar_2012.website.website diff --git a/erpnext/patches/jan_mar_2012/website/allow_product_delete.py b/erpnext/patches/jan_mar_2012/website/allow_product_delete.py index effec2e53f4..21dd4516982 100644 --- a/erpnext/patches/jan_mar_2012/website/allow_product_delete.py +++ b/erpnext/patches/jan_mar_2012/website/allow_product_delete.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): """ Allow deletion of products diff --git a/erpnext/patches/jan_mar_2012/website/analytics.py b/erpnext/patches/jan_mar_2012/website/analytics.py index b8afb59a556..b86c8ce9a88 100644 --- a/erpnext/patches/jan_mar_2012/website/analytics.py +++ b/erpnext/patches/jan_mar_2012/website/analytics.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): from webnotes.modules import reload_doc reload_doc('website', 'doctype', 'website_settings') diff --git a/erpnext/patches/jan_mar_2012/website/cleanups.py b/erpnext/patches/jan_mar_2012/website/cleanups.py index 16297d2d367..25cc63a5303 100644 --- a/erpnext/patches/jan_mar_2012/website/cleanups.py +++ b/erpnext/patches/jan_mar_2012/website/cleanups.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes def execute(): diff --git a/erpnext/patches/jan_mar_2012/website/domain_list.py b/erpnext/patches/jan_mar_2012/website/domain_list.py index 26824a4aec6..bbac836a5d4 100644 --- a/erpnext/patches/jan_mar_2012/website/domain_list.py +++ b/erpnext/patches/jan_mar_2012/website/domain_list.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/jan_mar_2012/website/feed.py b/erpnext/patches/jan_mar_2012/website/feed.py index 4af0140b79f..b81569810fa 100644 --- a/erpnext/patches/jan_mar_2012/website/feed.py +++ b/erpnext/patches/jan_mar_2012/website/feed.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.model.doc import Document from webnotes.modules import reload_doc diff --git a/erpnext/patches/jan_mar_2012/website/file_data_rename.py b/erpnext/patches/jan_mar_2012/website/file_data_rename.py index dc4110bbc5c..1871a784ec6 100644 --- a/erpnext/patches/jan_mar_2012/website/file_data_rename.py +++ b/erpnext/patches/jan_mar_2012/website/file_data_rename.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes def execute(): diff --git a/erpnext/patches/jan_mar_2012/website/getfile_rename.py b/erpnext/patches/jan_mar_2012/website/getfile_rename.py index d6d4c571ae7..58f70c573a2 100644 --- a/erpnext/patches/jan_mar_2012/website/getfile_rename.py +++ b/erpnext/patches/jan_mar_2012/website/getfile_rename.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes def execute(): diff --git a/erpnext/patches/jan_mar_2012/website/login.py b/erpnext/patches/jan_mar_2012/website/login.py index babd550beeb..dfd8517e9e8 100644 --- a/erpnext/patches/jan_mar_2012/website/login.py +++ b/erpnext/patches/jan_mar_2012/website/login.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.model.doc import Document from webnotes.modules import reload_doc diff --git a/erpnext/patches/jan_mar_2012/website/website.py b/erpnext/patches/jan_mar_2012/website/website.py index c6403e5b308..8c154caff42 100644 --- a/erpnext/patches/jan_mar_2012/website/website.py +++ b/erpnext/patches/jan_mar_2012/website/website.py @@ -16,6 +16,7 @@ # website patch +from __future__ import unicode_literals import webnotes from webnotes.model.doc import Document diff --git a/erpnext/patches/july_2012/__init__.py b/erpnext/patches/july_2012/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/patches/july_2012/__init__.py +++ b/erpnext/patches/july_2012/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/patches/july_2012/address_contact_perms.py b/erpnext/patches/july_2012/address_contact_perms.py index 1f14bd028f9..5b79f229373 100644 --- a/erpnext/patches/july_2012/address_contact_perms.py +++ b/erpnext/patches/july_2012/address_contact_perms.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("""\ diff --git a/erpnext/patches/july_2012/auth_table.py b/erpnext/patches/july_2012/auth_table.py new file mode 100644 index 00000000000..9700495fd33 --- /dev/null +++ b/erpnext/patches/july_2012/auth_table.py @@ -0,0 +1,14 @@ +from __future__ import unicode_literals +import webnotes +def execute(): + webnotes.conn.commit() + + from webnotes.install_lib.install import Installer + Installer(None, None).create_auth_table() + + webnotes.conn.begin() + + for user, password in webnotes.conn.sql("""select name, password from tabProfile"""): + if password: + webnotes.conn.sql("""insert into __Auth (user, `password`) values (%s, %s)""", + (user, password)) diff --git a/erpnext/patches/july_2012/bin_permission.py b/erpnext/patches/july_2012/bin_permission.py index e1d0ea6f953..d48460cd94e 100644 --- a/erpnext/patches/july_2012/bin_permission.py +++ b/erpnext/patches/july_2012/bin_permission.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("update `tabDocPerm` set permlevel = 0 where parent = 'Bin'") \ No newline at end of file diff --git a/erpnext/patches/july_2012/blog_guest_permission.py b/erpnext/patches/july_2012/blog_guest_permission.py index eb254b1fbd4..bc42a9d05c4 100644 --- a/erpnext/patches/july_2012/blog_guest_permission.py +++ b/erpnext/patches/july_2012/blog_guest_permission.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): """allocate read write permission to guest for doctype 'Blog'""" import webnotes diff --git a/erpnext/patches/july_2012/default_freeze_account.py b/erpnext/patches/july_2012/default_freeze_account.py new file mode 100644 index 00000000000..ddc025c72db --- /dev/null +++ b/erpnext/patches/july_2012/default_freeze_account.py @@ -0,0 +1,10 @@ +from __future__ import unicode_literals +def execute(): + import webnotes + webnotes.conn.sql("""update tabAccount set freeze_account='No' where freeze_account is null""") + webnotes.conn.sql("""update `tabPurchase Taxes and Charges` + set category='Valuation and Total' where category='For Both'""") + webnotes.conn.sql("""update `tabPurchase Taxes and Charges` + set category='Valuation' where category='For Valuation'""") + webnotes.conn.sql("""update `tabPurchase Taxes and Charges` + set category='Total' where category='For Total'""") \ No newline at end of file diff --git a/erpnext/patches/july_2012/deprecate_bulk_rename.py b/erpnext/patches/july_2012/deprecate_bulk_rename.py new file mode 100644 index 00000000000..06f1a211592 --- /dev/null +++ b/erpnext/patches/july_2012/deprecate_bulk_rename.py @@ -0,0 +1,8 @@ +from __future__ import unicode_literals +def execute(): + import webnotes + from webnotes.model import delete_doc + delete_doc('DocType', 'Bulk Rename Tool') + webnotes.conn.commit() + webnotes.conn.sql("drop table `tabBulk Rename Tool`") + webnotes.conn.begin() \ No newline at end of file diff --git a/erpnext/patches/july_2012/deprecate_import_data_control.py b/erpnext/patches/july_2012/deprecate_import_data_control.py index d0cd7de820f..d0a92a0d627 100644 --- a/erpnext/patches/july_2012/deprecate_import_data_control.py +++ b/erpnext/patches/july_2012/deprecate_import_data_control.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): """ deprecate: diff --git a/erpnext/patches/july_2012/packing_list_cleanup_and_serial_no.py b/erpnext/patches/july_2012/packing_list_cleanup_and_serial_no.py index 53cba4ccaa3..e65ae99b24d 100644 --- a/erpnext/patches/july_2012/packing_list_cleanup_and_serial_no.py +++ b/erpnext/patches/july_2012/packing_list_cleanup_and_serial_no.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.utils import flt diff --git a/erpnext/patches/july_2012/project_patch_repeat.py b/erpnext/patches/july_2012/project_patch_repeat.py index 4bb549c3f1b..bd525229388 100644 --- a/erpnext/patches/july_2012/project_patch_repeat.py +++ b/erpnext/patches/july_2012/project_patch_repeat.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("""update `tabPurchase Order Item` t1, `tabPurchase Order` t2 diff --git a/erpnext/patches/july_2012/reload_pr_po_mapper.py b/erpnext/patches/july_2012/reload_pr_po_mapper.py index 75ee5c4d71a..74b68c7c01e 100644 --- a/erpnext/patches/july_2012/reload_pr_po_mapper.py +++ b/erpnext/patches/july_2012/reload_pr_po_mapper.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/july_2012/remove_event_role_owner_match.py b/erpnext/patches/july_2012/remove_event_role_owner_match.py index a74ef8075d3..21ee2246725 100644 --- a/erpnext/patches/july_2012/remove_event_role_owner_match.py +++ b/erpnext/patches/july_2012/remove_event_role_owner_match.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("""\ diff --git a/erpnext/patches/july_2012/repost_stock_due_to_wrong_packing_list.py b/erpnext/patches/july_2012/repost_stock_due_to_wrong_packing_list.py index ac64f422177..40e081c9f7f 100644 --- a/erpnext/patches/july_2012/repost_stock_due_to_wrong_packing_list.py +++ b/erpnext/patches/july_2012/repost_stock_due_to_wrong_packing_list.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import webnotes def execute(): @@ -91,4 +92,4 @@ def repost_bin(item, wh): bin = webnotes.conn.sql("select name from `tabBin` \ where item_code = %s and warehouse = %s", (item, wh)) - get_obj('Bin', bin[0][0]).update_entries_after(posting_date = '2012-07-01', posting_time = '12:05') \ No newline at end of file + get_obj('Bin', bin[0][0]).update_entries_after(posting_date = '2012-07-01', posting_time = '12:05') diff --git a/erpnext/patches/july_2012/supplier_quotation.py b/erpnext/patches/july_2012/supplier_quotation.py index 023ead2ca6c..84809e52ba3 100644 --- a/erpnext/patches/july_2012/supplier_quotation.py +++ b/erpnext/patches/july_2012/supplier_quotation.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): """sync supplier quotatoin and create supplier quotation mappers""" from webnotes.model.sync import sync diff --git a/erpnext/patches/july_2012/sync_trial_balance.py b/erpnext/patches/july_2012/sync_trial_balance.py index 41e4cdf49f5..3755ed442bd 100644 --- a/erpnext/patches/july_2012/sync_trial_balance.py +++ b/erpnext/patches/july_2012/sync_trial_balance.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/july_2012/unicode_conf.py b/erpnext/patches/july_2012/unicode_conf.py new file mode 100644 index 00000000000..24ceed4209f --- /dev/null +++ b/erpnext/patches/july_2012/unicode_conf.py @@ -0,0 +1,6 @@ +from __future__ import unicode_literals + +def execute(): + """appends from __future__ import unicode_literals to py files if necessary""" + import wnf + wnf.append_future_import() \ No newline at end of file diff --git a/erpnext/patches/july_2012/update_purchase_tax.py b/erpnext/patches/july_2012/update_purchase_tax.py new file mode 100644 index 00000000000..3f785e5e708 --- /dev/null +++ b/erpnext/patches/july_2012/update_purchase_tax.py @@ -0,0 +1,9 @@ +from __future__ import unicode_literals +def execute(): + import webnotes + webnotes.conn.sql("""update `tabPurchase Taxes and Charges` + set category='Valuation and Total' where category='For Both'""") + webnotes.conn.sql("""update `tabPurchase Taxes and Charges` + set category='Valuation' where category='For Valuation'""") + webnotes.conn.sql("""update `tabPurchase Taxes and Charges` + set category='Total' where category='For Total'""") \ No newline at end of file diff --git a/erpnext/patches/june_2012/__init__.py b/erpnext/patches/june_2012/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/patches/june_2012/__init__.py +++ b/erpnext/patches/june_2012/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/patches/june_2012/alter_tabsessions.py b/erpnext/patches/june_2012/alter_tabsessions.py index 1ea4d7c07b0..4e0310bffb0 100644 --- a/erpnext/patches/june_2012/alter_tabsessions.py +++ b/erpnext/patches/june_2012/alter_tabsessions.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.commit() diff --git a/erpnext/patches/june_2012/barcode_in_feature_setup.py b/erpnext/patches/june_2012/barcode_in_feature_setup.py index fae75bff7d6..4e5217af246 100644 --- a/erpnext/patches/june_2012/barcode_in_feature_setup.py +++ b/erpnext/patches/june_2012/barcode_in_feature_setup.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model.code import get_obj diff --git a/erpnext/patches/june_2012/cache_item_table.py b/erpnext/patches/june_2012/cache_item_table.py index 552fe7dbb40..771b4095952 100644 --- a/erpnext/patches/june_2012/cache_item_table.py +++ b/erpnext/patches/june_2012/cache_item_table.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): """drop and create __CacheItem table again""" import webnotes diff --git a/erpnext/patches/june_2012/cms2.py b/erpnext/patches/june_2012/cms2.py index cf494c01863..673214f36cb 100644 --- a/erpnext/patches/june_2012/cms2.py +++ b/erpnext/patches/june_2012/cms2.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes import webnotes.model.sync diff --git a/erpnext/patches/june_2012/copy_uom_for_pur_inv_item.py b/erpnext/patches/june_2012/copy_uom_for_pur_inv_item.py index 83012e8f781..b3742499423 100644 --- a/erpnext/patches/june_2012/copy_uom_for_pur_inv_item.py +++ b/erpnext/patches/june_2012/copy_uom_for_pur_inv_item.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes diff --git a/erpnext/patches/june_2012/delete_old_parent_entries.py b/erpnext/patches/june_2012/delete_old_parent_entries.py index c74f609e0b7..6a87ff5503b 100644 --- a/erpnext/patches/june_2012/delete_old_parent_entries.py +++ b/erpnext/patches/june_2012/delete_old_parent_entries.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): """delete entries of child table having parent like old_par%% or ''""" import webnotes diff --git a/erpnext/patches/june_2012/fetch_organization_from_lead.py b/erpnext/patches/june_2012/fetch_organization_from_lead.py index 1d2485289a9..b3f1eddc748 100644 --- a/erpnext/patches/june_2012/fetch_organization_from_lead.py +++ b/erpnext/patches/june_2012/fetch_organization_from_lead.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("update `tabQuotation` t1, `tabLead` t2 set t1.organization = t2.company_name where ifnull(t1.lead, '') != '' and t1.quotation_to = 'Lead' and ifnull(t1.organization, '') = '' and t1.lead = t2.name") \ No newline at end of file diff --git a/erpnext/patches/june_2012/reports_list_permission.py b/erpnext/patches/june_2012/reports_list_permission.py index c713a7ee2c7..a02f4fa37f8 100644 --- a/erpnext/patches/june_2012/reports_list_permission.py +++ b/erpnext/patches/june_2012/reports_list_permission.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): """allow read permission to all for report list""" import webnotes diff --git a/erpnext/patches/june_2012/series_unique_patch.py b/erpnext/patches/june_2012/series_unique_patch.py index 6f85f21df36..b04e08e312f 100644 --- a/erpnext/patches/june_2012/series_unique_patch.py +++ b/erpnext/patches/june_2012/series_unique_patch.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): """add unique constraint to series table's name column""" import webnotes diff --git a/erpnext/patches/june_2012/set_recurring_type.py b/erpnext/patches/june_2012/set_recurring_type.py index bfb925c6b8e..79dd286fbc3 100644 --- a/erpnext/patches/june_2012/set_recurring_type.py +++ b/erpnext/patches/june_2012/set_recurring_type.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model.sync import sync diff --git a/erpnext/patches/june_2012/support_ticket_autoreply.py b/erpnext/patches/june_2012/support_ticket_autoreply.py index cdb47a21c22..9fb0534bdd2 100644 --- a/erpnext/patches/june_2012/support_ticket_autoreply.py +++ b/erpnext/patches/june_2012/support_ticket_autoreply.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): """New Send Autoreply checkbox in Email Settings""" import webnotes diff --git a/erpnext/patches/mar_2012/__init__.py b/erpnext/patches/mar_2012/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/patches/mar_2012/__init__.py +++ b/erpnext/patches/mar_2012/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/patches/mar_2012/add_fieldnames.py b/erpnext/patches/mar_2012/add_fieldnames.py index 3f9638075e5..d0ea04bf439 100644 --- a/erpnext/patches/mar_2012/add_fieldnames.py +++ b/erpnext/patches/mar_2012/add_fieldnames.py @@ -1,4 +1,5 @@ # do not run this patch +from __future__ import unicode_literals def execute(): import webnotes import webnotes.modules diff --git a/erpnext/patches/mar_2012/clean_property_setter.py b/erpnext/patches/mar_2012/clean_property_setter.py index 2d83fb1a0a7..08a0a94e1fe 100644 --- a/erpnext/patches/mar_2012/clean_property_setter.py +++ b/erpnext/patches/mar_2012/clean_property_setter.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import webnotes def execute(): diff --git a/erpnext/patches/mar_2012/cleanup_control_panel.py b/erpnext/patches/mar_2012/cleanup_control_panel.py index f26db152321..93dd769520f 100644 --- a/erpnext/patches/mar_2012/cleanup_control_panel.py +++ b/erpnext/patches/mar_2012/cleanup_control_panel.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import webnotes def execute(): webnotes.conn.sql("""\ diff --git a/erpnext/patches/mar_2012/create_custom_fields.py b/erpnext/patches/mar_2012/create_custom_fields.py index 759a4d58600..d4c1a134538 100644 --- a/erpnext/patches/mar_2012/create_custom_fields.py +++ b/erpnext/patches/mar_2012/create_custom_fields.py @@ -1,4 +1,5 @@ # do not run this patch +from __future__ import unicode_literals field_list = [ ['Contact', 'notes'], ['Contact', 'birthday'], diff --git a/erpnext/patches/mar_2012/delete_docformat.py b/erpnext/patches/mar_2012/delete_docformat.py index 77a6c825910..1b5b94e9731 100644 --- a/erpnext/patches/mar_2012/delete_docformat.py +++ b/erpnext/patches/mar_2012/delete_docformat.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("DELETE FROM `tabDocField` WHERE options='DocFormat'") diff --git a/erpnext/patches/mar_2012/doctype_get_refactor.py b/erpnext/patches/mar_2012/doctype_get_refactor.py index 147fb931ffc..26cee77910f 100644 --- a/erpnext/patches/mar_2012/doctype_get_refactor.py +++ b/erpnext/patches/mar_2012/doctype_get_refactor.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import webnotes def execute(): """ diff --git a/erpnext/patches/mar_2012/earning_deduction_type_patch.py b/erpnext/patches/mar_2012/earning_deduction_type_patch.py index 438b34e946e..39216d0444e 100644 --- a/erpnext/patches/mar_2012/earning_deduction_type_patch.py +++ b/erpnext/patches/mar_2012/earning_deduction_type_patch.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql(""" diff --git a/erpnext/patches/mar_2012/is_submittable_patch.py b/erpnext/patches/mar_2012/is_submittable_patch.py index d49160c0ee4..d97f8564761 100644 --- a/erpnext/patches/mar_2012/is_submittable_patch.py +++ b/erpnext/patches/mar_2012/is_submittable_patch.py @@ -1,4 +1,5 @@ # dont run this patch +from __future__ import unicode_literals def execute(): import webnotes import webnotes.model.doctype diff --git a/erpnext/patches/mar_2012/pos_invoice_fix.py b/erpnext/patches/mar_2012/pos_invoice_fix.py index 9848eb86094..d359408885a 100644 --- a/erpnext/patches/mar_2012/pos_invoice_fix.py +++ b/erpnext/patches/mar_2012/pos_invoice_fix.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): from webnotes.modules import reload_doc reload_doc('accounts', 'Print Format', 'POS Invoice') diff --git a/erpnext/patches/mar_2012/so_rv_mapper_fix.py b/erpnext/patches/mar_2012/so_rv_mapper_fix.py index 5d60b3c7caa..e018cf56ace 100644 --- a/erpnext/patches/mar_2012/so_rv_mapper_fix.py +++ b/erpnext/patches/mar_2012/so_rv_mapper_fix.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes count = webnotes.conn.sql("""SELECT COUNT(*) FROM `tabTable Mapper Detail` diff --git a/erpnext/patches/mar_2012/usertags.py b/erpnext/patches/mar_2012/usertags.py index eff25439976..f583b638f35 100644 --- a/erpnext/patches/mar_2012/usertags.py +++ b/erpnext/patches/mar_2012/usertags.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes doctype_list = webnotes.conn.sql("""SELECT name FROM `tabDocType` diff --git a/erpnext/patches/may_2012/__init__.py b/erpnext/patches/may_2012/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/patches/may_2012/__init__.py +++ b/erpnext/patches/may_2012/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/patches/may_2012/cleanup_notification_control.py b/erpnext/patches/may_2012/cleanup_notification_control.py index ef652509ea5..25a704e1987 100644 --- a/erpnext/patches/may_2012/cleanup_notification_control.py +++ b/erpnext/patches/may_2012/cleanup_notification_control.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql(""" diff --git a/erpnext/patches/may_2012/cleanup_property_setter.py b/erpnext/patches/may_2012/cleanup_property_setter.py index f4e3ef80677..e06de3285db 100644 --- a/erpnext/patches/may_2012/cleanup_property_setter.py +++ b/erpnext/patches/may_2012/cleanup_property_setter.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("delete from `tabProperty Setter` where property in ('width', 'previous_field')") diff --git a/erpnext/patches/may_2012/clear_session_cache.py b/erpnext/patches/may_2012/clear_session_cache.py index fee33dccbb7..2b10129a7ac 100644 --- a/erpnext/patches/may_2012/clear_session_cache.py +++ b/erpnext/patches/may_2012/clear_session_cache.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("delete from __SessionCache") \ No newline at end of file diff --git a/erpnext/patches/may_2012/create_report_manager_role.py b/erpnext/patches/may_2012/create_report_manager_role.py index 6952bc0a918..8912eb121e3 100644 --- a/erpnext/patches/may_2012/create_report_manager_role.py +++ b/erpnext/patches/may_2012/create_report_manager_role.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model.doc import Document diff --git a/erpnext/patches/may_2012/cs_server_readonly.py b/erpnext/patches/may_2012/cs_server_readonly.py index 0ad74f5ca80..b68060682cf 100644 --- a/erpnext/patches/may_2012/cs_server_readonly.py +++ b/erpnext/patches/may_2012/cs_server_readonly.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): """Make server custom script readonly for system manager""" import webnotes.model.doc diff --git a/erpnext/patches/may_2012/customize_form_cleanup.py b/erpnext/patches/may_2012/customize_form_cleanup.py index c81bd2240d5..a04eb79566d 100644 --- a/erpnext/patches/may_2012/customize_form_cleanup.py +++ b/erpnext/patches/may_2012/customize_form_cleanup.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes webnotes.conn.sql("delete from `tabCustomize Form Field`") diff --git a/erpnext/patches/may_2012/page_role_series_fix.py b/erpnext/patches/may_2012/page_role_series_fix.py index a44e0f8fba9..7533e9db4f3 100644 --- a/erpnext/patches/may_2012/page_role_series_fix.py +++ b/erpnext/patches/may_2012/page_role_series_fix.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes sr = webnotes.conn.sql("select max(name) from `tabPage Role`") diff --git a/erpnext/patches/may_2012/profile_perm_patch.py b/erpnext/patches/may_2012/profile_perm_patch.py index fe247872d9e..4423fdb15d6 100644 --- a/erpnext/patches/may_2012/profile_perm_patch.py +++ b/erpnext/patches/may_2012/profile_perm_patch.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): """Make profile readonly for role All""" import webnotes.model.doc diff --git a/erpnext/patches/may_2012/reload_customer_address_contact.py b/erpnext/patches/may_2012/reload_customer_address_contact.py index 9a3107975b6..4aec19d02d6 100644 --- a/erpnext/patches/may_2012/reload_customer_address_contact.py +++ b/erpnext/patches/may_2012/reload_customer_address_contact.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes import webnotes.modules diff --git a/erpnext/patches/may_2012/reload_reports.py b/erpnext/patches/may_2012/reload_reports.py index 3ac6960d76a..1cee3a0061c 100644 --- a/erpnext/patches/may_2012/reload_reports.py +++ b/erpnext/patches/may_2012/reload_reports.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/may_2012/reload_sales_invoice_pf.py b/erpnext/patches/may_2012/reload_sales_invoice_pf.py index 63acbedef13..b784469d00c 100644 --- a/erpnext/patches/may_2012/reload_sales_invoice_pf.py +++ b/erpnext/patches/may_2012/reload_sales_invoice_pf.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes import webnotes.modules diff --git a/erpnext/patches/may_2012/reload_so_pending_items.py b/erpnext/patches/may_2012/reload_so_pending_items.py index 8c9aee7d52c..999004e1fe9 100644 --- a/erpnext/patches/may_2012/reload_so_pending_items.py +++ b/erpnext/patches/may_2012/reload_so_pending_items.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model import delete_doc diff --git a/erpnext/patches/may_2012/remove_communication_log.py b/erpnext/patches/may_2012/remove_communication_log.py index 6ca05a712d1..28bfca1ff65 100644 --- a/erpnext/patches/may_2012/remove_communication_log.py +++ b/erpnext/patches/may_2012/remove_communication_log.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes import webnotes.model.sync diff --git a/erpnext/patches/may_2012/remove_euro_currency.py b/erpnext/patches/may_2012/remove_euro_currency.py index 2fb53738af0..edf27e19a0b 100644 --- a/erpnext/patches/may_2012/remove_euro_currency.py +++ b/erpnext/patches/may_2012/remove_euro_currency.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): """ * Replace EURO with EUR diff --git a/erpnext/patches/may_2012/rename_prev_doctype.py b/erpnext/patches/may_2012/rename_prev_doctype.py index 162fb047cf9..135b81de594 100644 --- a/erpnext/patches/may_2012/rename_prev_doctype.py +++ b/erpnext/patches/may_2012/rename_prev_doctype.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes dt_list = webnotes.conn.sql("select parent, fieldname from `tabDocField` where fieldname in ('against_doctype', 'prevdoc_doctype')") diff --git a/erpnext/patches/may_2012/renamedt_in_custom_search_criteria.py b/erpnext/patches/may_2012/renamedt_in_custom_search_criteria.py index 3ac1f8e0fb0..a5f73508ded 100644 --- a/erpnext/patches/may_2012/renamedt_in_custom_search_criteria.py +++ b/erpnext/patches/may_2012/renamedt_in_custom_search_criteria.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes rendt = { diff --git a/erpnext/patches/may_2012/same_purchase_rate_patch.py b/erpnext/patches/may_2012/same_purchase_rate_patch.py index 6cca178c106..d7b8d895f21 100644 --- a/erpnext/patches/may_2012/same_purchase_rate_patch.py +++ b/erpnext/patches/may_2012/same_purchase_rate_patch.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.model.code import get_obj diff --git a/erpnext/patches/may_2012/std_pf_readonly.py b/erpnext/patches/may_2012/std_pf_readonly.py index d758159f7d8..83b581325c8 100644 --- a/erpnext/patches/may_2012/std_pf_readonly.py +++ b/erpnext/patches/may_2012/std_pf_readonly.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): """Make standard print formats readonly for system manager""" import webnotes.model.doc diff --git a/erpnext/patches/may_2012/stock_reco_patch.py b/erpnext/patches/may_2012/stock_reco_patch.py index 7eb050fd5d9..96b071ff44d 100644 --- a/erpnext/patches/may_2012/stock_reco_patch.py +++ b/erpnext/patches/may_2012/stock_reco_patch.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 3acd97d1f4f..f07f20bdb04 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals patch_list = [ { 'patch_module': 'patches.jan_mar_2012', @@ -483,15 +484,38 @@ patch_list = [ 'description': "deprecate doctype - Import Data Control and page - Import Data" }, { - 'patch_module': 'patches.june_2012', + 'patch_module': 'patches.july_2012', + 'patch_file': 'default_freeze_account', + 'description': "set default freeze_account as 'No' where NULL" + }, + { + 'patch_module': 'patches.july_2012', + 'patch_file': 'update_purchase_tax', + 'description': "rename options in purchase taxes and charges" + }, + { 'patch_module': 'patches.june_2012', 'patch_file': 'cms2', 'description': 'cms2 release patches' }, + { 'patch_module': 'patches.july_2012', + 'patch_file': 'auth_table', + 'description': 'create new __Auth table' + }, { 'patch_module': 'patches.july_2012', 'patch_file': 'remove_event_role_owner_match', 'description': "Remove Owner match from Event DocType's Permissions" }, + { + 'patch_module': 'patches.july_2012', + 'patch_file': 'deprecate_bulk_rename', + 'description': "Remove Bulk Rename Tool" + }, + { + 'patch_module': 'patches.july_2012', + 'patch_file': 'unicode_conf', + 'description': "appends from __future__ import unicode_literals to py files if necessary" + }, { 'patch_module': 'patches.july_2012', 'patch_file': 'sync_trial_balance', @@ -521,6 +545,14 @@ patch_list = [ 'patch_module': 'patches.august_2012', 'patch_file': 'report_supplier_quotations', }, + { + 'patch_module': 'patches.august_2012', + 'patch_file': 'task_allocated_to_assigned', + }, + { + 'patch_module': 'patches.august_2012', + 'patch_file': 'change_profile_permission', + }, { 'patch_module': 'patches.august_2012', 'patch_file': 'changed_blog_date_format', @@ -545,4 +577,12 @@ patch_list = [ 'patch_module': 'patches.september_2012', 'patch_file': 'reload_criteria_stock_ledger', }, + { + 'patch_module': 'patches.september_2012', + 'patch_file': 'all_permissions_patch', + }, + { + 'patch_module': 'patches.september_2012', + 'patch_file': 'customer_permission_patch', + }, ] diff --git a/erpnext/patches/september_2012/all_permissions_patch.py b/erpnext/patches/september_2012/all_permissions_patch.py new file mode 100644 index 00000000000..eea4345deb2 --- /dev/null +++ b/erpnext/patches/september_2012/all_permissions_patch.py @@ -0,0 +1,23 @@ +import webnotes +def execute(): + web_cache_perms() + stock_perms() + project_perms() + account_perms() + +def web_cache_perms(): + webnotes.conn.sql("""update `tabDocPerm` + set role='Guest' where parent='Web Cache' and role='All' and permlevel=0""") + +def project_perms(): + webnotes.conn.sql("""delete from `tabDocPerm` + where parent in ('Task', 'Project Activity') and role='All'""") + +def stock_perms(): + webnotes.conn.sql("""delete from `tabDocPerm` + where parent in ('Landed Cost Master', 'Landed Cost Wizard', + 'Sales and Purchase Return Tool') and role='All' and permlevel=0""") + +def account_perms(): + # since it is a child doctype, it does not need permissions + webnotes.conn.sql("""delete from tabDocPerm where parent='TDS Detail'""") diff --git a/erpnext/patches/september_2012/customer_permission_patch.py b/erpnext/patches/september_2012/customer_permission_patch.py new file mode 100644 index 00000000000..d8d0eab1bba --- /dev/null +++ b/erpnext/patches/september_2012/customer_permission_patch.py @@ -0,0 +1,28 @@ +def execute(): + from webnotes.model.doc import Document + perms = [] + # create permissions for permlevel 2 assigned to "Credit Days" and "Credit Limit" + # 2 Accounts Manager r,w + # 2 System Manager r,w + perms.append([2, "Accounts Manager", 1, 1, 0, 0]) + perms.append([2, "System Manager", 1, 1, 0, 0]) + perms.append([2, "All", 1, 0, 0, 0]) + + # read, write, create, cancel perm for Accounts Manager for permlevel 0 + perms.append([0, "Accounts Manager", 1, 1, 1, 1]) + + # permlevel 1 read permission for 'All' + # 1 All r + perms.append([1, "All", 1, 0, 0, 0]) + + for p in perms: + d = Document("DocPerm", fielddata={ + "parent": "Customer", + "parentfield": "permissions", + "permlevel": p[0], + "role": p[1], + "read": p[2], + "write": p[3], + "create": p[4], + "cancel": p[5] + }).save(1) \ No newline at end of file diff --git a/erpnext/production/__init__.py b/erpnext/production/__init__.py index 4fb00a34be4..9ca5e3bf87d 100644 --- a/erpnext/production/__init__.py +++ b/erpnext/production/__init__.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals install_docs = [ {"doctype":"Role", "role_name":"Production Manager", "name":"Production Manager"}, {"doctype":"Role", "role_name":"Production User", "name":"Production User"}, diff --git a/erpnext/production/doctype/__init__.py b/erpnext/production/doctype/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/doctype/__init__.py +++ b/erpnext/production/doctype/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/doctype/bom/__init__.py b/erpnext/production/doctype/bom/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/doctype/bom/__init__.py +++ b/erpnext/production/doctype/bom/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/doctype/bom/bom.py b/erpnext/production/doctype/bom/bom.py index df64bb6678d..5f6954f2175 100644 --- a/erpnext/production/doctype/bom/bom.py +++ b/erpnext/production/doctype/bom/bom.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.utils import cint, cstr, flt, get_defaults, getdate, now, nowdate from webnotes.model.doc import Document, addchild, getchildren, make_autoname @@ -106,7 +107,6 @@ class DocType: return ret_item - def get_rm_rate(self, arg): """ Get raw material rate as per selected method, if bom exists takes bom cost """ @@ -295,7 +295,6 @@ class DocType: self.validate_main_item() self.validate_operations() self.validate_materials() - self.validate_operations() @@ -355,8 +354,6 @@ class DocType: }) - - # Get Current Flat BOM Items # ----------------------------- def get_current_flat_bom_items(self): diff --git a/erpnext/production/doctype/bom_control/__init__.py b/erpnext/production/doctype/bom_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/doctype/bom_control/__init__.py +++ b/erpnext/production/doctype/bom_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/doctype/bom_control/bom_control.py b/erpnext/production/doctype/bom_control/bom_control.py index 7638173e2ab..cc325333af8 100644 --- a/erpnext/production/doctype/bom_control/bom_control.py +++ b/erpnext/production/doctype/bom_control/bom_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals import webnotes from webnotes.utils import cint, flt diff --git a/erpnext/production/doctype/bom_explosion_item/__init__.py b/erpnext/production/doctype/bom_explosion_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/doctype/bom_explosion_item/__init__.py +++ b/erpnext/production/doctype/bom_explosion_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/doctype/bom_item/__init__.py b/erpnext/production/doctype/bom_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/doctype/bom_item/__init__.py +++ b/erpnext/production/doctype/bom_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/doctype/bom_operation/__init__.py b/erpnext/production/doctype/bom_operation/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/doctype/bom_operation/__init__.py +++ b/erpnext/production/doctype/bom_operation/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/doctype/production_control/__init__.py b/erpnext/production/doctype/production_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/doctype/production_control/__init__.py +++ b/erpnext/production/doctype/production_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/doctype/production_control/production_control.py b/erpnext/production/doctype/production_control/production_control.py index 8fb7eddd2ff..b7ce73cb17c 100644 --- a/erpnext/production/doctype/production_control/production_control.py +++ b/erpnext/production/doctype/production_control/production_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/production/doctype/production_order/__init__.py b/erpnext/production/doctype/production_order/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/doctype/production_order/__init__.py +++ b/erpnext/production/doctype/production_order/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/doctype/production_order/production_order.py b/erpnext/production/doctype/production_order/production_order.py index ba50ea24980..19b3f335eed 100644 --- a/erpnext/production/doctype/production_order/production_order.py +++ b/erpnext/production/doctype/production_order/production_order.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/production/doctype/production_plan_item/__init__.py b/erpnext/production/doctype/production_plan_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/doctype/production_plan_item/__init__.py +++ b/erpnext/production/doctype/production_plan_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/doctype/production_plan_sales_order/__init__.py b/erpnext/production/doctype/production_plan_sales_order/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/doctype/production_plan_sales_order/__init__.py +++ b/erpnext/production/doctype/production_plan_sales_order/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/doctype/production_planning_tool/__init__.py b/erpnext/production/doctype/production_planning_tool/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/doctype/production_planning_tool/__init__.py +++ b/erpnext/production/doctype/production_planning_tool/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/doctype/production_planning_tool/production_planning_tool.py b/erpnext/production/doctype/production_planning_tool/production_planning_tool.py index 21ef599e4db..8c66b535754 100644 --- a/erpnext/production/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/production/doctype/production_planning_tool/production_planning_tool.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.utils import cint, cstr, flt, getdate, now, nowdate from webnotes.model.doc import addchild diff --git a/erpnext/production/doctype/workstation/__init__.py b/erpnext/production/doctype/workstation/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/doctype/workstation/__init__.py +++ b/erpnext/production/doctype/workstation/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/doctype/workstation/workstation.py b/erpnext/production/doctype/workstation/workstation.py index 3f30e0373b0..6d9f3ae1be3 100644 --- a/erpnext/production/doctype/workstation/workstation.py +++ b/erpnext/production/doctype/workstation/workstation.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/production/page/__init__.py b/erpnext/production/page/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/page/__init__.py +++ b/erpnext/production/page/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/page/production_home/__init__.py b/erpnext/production/page/production_home/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/page/production_home/__init__.py +++ b/erpnext/production/page/production_home/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/search_criteria/__init__.py b/erpnext/production/search_criteria/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/search_criteria/__init__.py +++ b/erpnext/production/search_criteria/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/search_criteria/consumption_against_production/__init__.py b/erpnext/production/search_criteria/consumption_against_production/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/search_criteria/consumption_against_production/__init__.py +++ b/erpnext/production/search_criteria/consumption_against_production/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/search_criteria/itemwise_production_report/__init__.py b/erpnext/production/search_criteria/itemwise_production_report/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/search_criteria/itemwise_production_report/__init__.py +++ b/erpnext/production/search_criteria/itemwise_production_report/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/production/search_criteria/production_orders_in_process/__init__.py b/erpnext/production/search_criteria/production_orders_in_process/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/production/search_criteria/production_orders_in_process/__init__.py +++ b/erpnext/production/search_criteria/production_orders_in_process/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/__init__.py b/erpnext/projects/__init__.py index 61a6eb6a1a1..8f35855de89 100644 --- a/erpnext/projects/__init__.py +++ b/erpnext/projects/__init__.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals install_docs = [ {"doctype":"Role", "role_name":"Projects User", "name":"Projects User"}, ] diff --git a/erpnext/projects/doctype/__init__.py b/erpnext/projects/doctype/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/doctype/__init__.py +++ b/erpnext/projects/doctype/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/doctype/activity_type/activity_type.txt b/erpnext/projects/doctype/activity_type/activity_type.txt deleted file mode 100644 index 46ed91718f0..00000000000 --- a/erpnext/projects/doctype/activity_type/activity_type.txt +++ /dev/null @@ -1,78 +0,0 @@ -# DocType, Activity Type -[ - - # These values are common in all dictionaries - { - 'creation': '2012-03-27 14:36:05', - 'docstatus': 0, - 'modified': '2012-03-27 14:36:05', - 'modified_by': u'Administrator', - 'owner': u'Administrator' - }, - - # These values are common for all DocType - { - 'autoname': u'field:activity_type', - 'colour': u'White:FFF', - 'doctype': 'DocType', - 'in_dialog': 1, - 'module': u'Projects', - 'name': '__common__', - 'section_style': u'Simple', - 'server_code_error': u' ', - 'version': 12 - }, - - # These values are common for all DocField - { - 'doctype': u'DocField', - 'fieldname': u'activity_type', - 'fieldtype': u'Data', - 'label': u'Activity Type', - 'name': '__common__', - 'parent': u'Activity Type', - 'parentfield': u'fields', - 'parenttype': u'DocType', - 'permlevel': 0, - 'reqd': 1 - }, - - # These values are common for all DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 1, - 'doctype': u'DocPerm', - 'name': '__common__', - 'parent': u'Activity Type', - 'parentfield': u'permissions', - 'parenttype': u'DocType', - 'permlevel': 0, - 'read': 1, - 'submit': 0, - 'write': 1 - }, - - # DocType, Activity Type - { - 'doctype': 'DocType', - 'name': u'Activity Type' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'role': u'System Manager' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'role': u'Projects User' - }, - - # DocField - { - 'doctype': u'DocField' - } -] \ No newline at end of file diff --git a/erpnext/projects/doctype/project/__init__.py b/erpnext/projects/doctype/project/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/doctype/project/__init__.py +++ b/erpnext/projects/doctype/project/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/doctype/project/project.js b/erpnext/projects/doctype/project/project.js index faa175fdeda..eca926190a9 100644 --- a/erpnext/projects/doctype/project/project.js +++ b/erpnext/projects/doctype/project/project.js @@ -14,42 +14,16 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -//-------------------------- Onload --------------------------- -cur_frm.cscript.onload = function(doc, cdt, cdn) { - if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'}); -} +// show tasks -//------------------- Get Contact Person based on customer selected --------------------------- -cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { - if(doc.customer) - return 'SELECT `tabContact`.contact_name FROM `tabContact` WHERE (`tabContact`.is_customer = 1 AND `tabContact`.customer_name = "'+ doc.customer+'") AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50'; - else - msgprint("Please select Customer first") -} - -//-------------------------------- get query select Territory ------------------------------------------ -cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; -} - -//------------------------ Customer and its primary contact Details ------------------------------------ -cur_frm.cscript.customer = function(doc, cdt, cdn) { - if(doc.customer) get_server_fields('get_customer_details', '','', doc, cdt, cdn, 1); -} - -//--------------------- Customer's Contact Person Details -------------------------------------------- -cur_frm.cscript.contact_person = function(doc, cdt, cdn) { - if(doc.contact_person) { - get_server_fields('get_contact_details','','',doc, cdt, cdn, 1); - } -} - -//--------- calculate gross profit -------------------------------- -cur_frm.cscript.project_value = function(doc, cdt, cdn){ - get_server_fields('get_gross_profit','','',doc, cdt, cdn, 1); -} - -//--------- calculate gross profit -------------------------------- -cur_frm.cscript.est_material_cost = function(doc, cdt, cdn){ - get_server_fields('get_gross_profit','','',doc, cdt, cdn, 1); -} +cur_frm.cscript.refresh = function(doc) { + if(!doc.__islocal) { + // refresh gantt chart + wn.require('erpnext/projects/gantt_task.js'); + if(!cur_frm.gantt_area) + cur_frm.gantt_area = $('
    ') + .appendTo(cur_frm.fields_dict.project_tasks.wrapper); + cur_frm.gantt_area.empty(); + erpnext.show_task_gantt(cur_frm.gantt_area, cur_frm.docname); + } +} \ No newline at end of file diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index 3db66f050d2..659e7570710 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 @@ -108,4 +109,4 @@ class DocType: event.event_type = 'Public' event.ref_type = 'Project' event.ref_name = self.doc.name - event.save(1) \ No newline at end of file + event.save(1) diff --git a/erpnext/projects/doctype/project/project.txt b/erpnext/projects/doctype/project/project.txt index 43cab3958e5..1463f78d97a 100644 --- a/erpnext/projects/doctype/project/project.txt +++ b/erpnext/projects/doctype/project/project.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-05-03 18:41:42', + 'creation': '2012-08-08 13:25:19', 'docstatus': 0, - 'modified': '2012-08-07 15:48:47', + 'modified': '2012-08-08 13:55:01', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -225,6 +225,8 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'Milestones will be added as Events in the Calendar', 'doctype': u'DocField', 'fieldname': u'project_milestones', 'fieldtype': u'Table', @@ -237,6 +239,26 @@ 'search_index': 0 }, + # DocField + { + 'colour': u'White:FFF', + 'description': u'Tasks belonging to this Project.', + 'doctype': u'DocField', + 'fieldname': u'sb_tasks', + 'fieldtype': u'Section Break', + 'label': u'Tasks', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'project_tasks', + 'fieldtype': u'HTML', + 'label': u'Project Tasks', + 'permlevel': 0 + }, + # DocField { 'doctype': u'DocField', @@ -282,7 +304,7 @@ 'oldfieldname': u'project_value', 'oldfieldtype': u'Currency', 'permlevel': 0, - 'reqd': 1, + 'reqd': 0, 'search_index': 0, 'trigger': u'Client' }, @@ -322,7 +344,7 @@ 'oldfieldname': u'gross_margin_value', 'oldfieldtype': u'Currency', 'permlevel': 0, - 'reqd': 1, + 'reqd': 0, 'search_index': 0 }, @@ -336,7 +358,7 @@ 'oldfieldname': u'per_gross_margin', 'oldfieldtype': u'Currency', 'permlevel': 0, - 'reqd': 1, + 'reqd': 0, 'search_index': 0 }, diff --git a/erpnext/projects/doctype/project/project_list.js b/erpnext/projects/doctype/project/project_list.js index 0ed42cab498..9adbe721f98 100644 --- a/erpnext/projects/doctype/project/project_list.js +++ b/erpnext/projects/doctype/project/project_list.js @@ -9,7 +9,7 @@ wn.doclistviews['Project'] = wn.views.ListView.extend({ '`tabProject`.priority', 'IFNULL(`tabProject`.project_value, 0) as project_value', 'IFNULL(`tabProject`.per_gross_margin, 0) as per_gross_margin', - '`tabProject`.completion_date', + '`tabProject`.creation', ]); //this.stats = this.stats.concat(['company']); }, @@ -46,8 +46,8 @@ wn.doclistviews['Project'] = wn.views.ListView.extend({ }, css: {'text-align': 'right'}, }, - {width: '12%', content:'completion_date', css: { - 'text-align': 'right', 'color':'#777' - }}, + { + width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'} + }, ] }); diff --git a/erpnext/projects/doctype/project_activity/__init__.py b/erpnext/projects/doctype/project_activity/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/erpnext/projects/doctype/project_activity/project_activity.js b/erpnext/projects/doctype/project_activity/project_activity.js deleted file mode 100644 index ad33e3cd7f4..00000000000 --- a/erpnext/projects/doctype/project_activity/project_activity.js +++ /dev/null @@ -1,99 +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 . - -cur_frm.cscript.onload = function(doc, dt, dn) { - // created? - if(cur_frm.mylist) { - cur_frm.mylist.run(); - return; - } else { - - // create a new listing - var lst = new Listing('Activities Updates'); - - lst.colwidths = ['5%','30%','40%','25%']; - - // define options - var opts = {}; - - opts.head_main_style = {}; - opts.cell_style = { padding:'3px 2px', borderRight : '0px', borderBottom : '1px solid #AAA', verticalAlign: 'top'} - opts.head_style = { padding:'3px 2px', borderBottom : '1px solid #AAA'} - opts.alt_cell_style = {}; - opts.hide_print = 1; - opts.no_border = 1; - - opts.hide_export = 1; - opts.hide_print = 1; - opts.hide_rec_label = 1; - - lst.opts = opts; - - // query - lst.get_query = function() { - var doc = cur_frm.doc; - this.query = "select owner,creation,`update`, hours from `tabProject Activity Update` where parent = '"+doc.name+"'"; - this.query_max = "select count(*) from `tabProject Activity Update` where parent = '"+doc.name+"'"; - } - - lst.show_cell = function(cell,ri,ci,d){ - - // owner and date - if (ci==0){ - var d1 = $a(cell,'div'); - var img = $a(cell,'img','',{width:'40px'}); - img.src = wn.user_info(d[ri][0]).image; - var d2 = $a(cell,'div'); - d2.innerHTML = d[ri][0] + ' on: ' + date.str_to_user(d[ri][1]); - } - - // update - if(ci==1) { - cell.innerHTML = replace_newlines(d[ri][2]); - } - - // Hours - if (ci==2) { - cell.innerHTML = d[ri][3] + ' hrs'; - } - } - - lst.make(cur_frm.fields_dict['updates_html'].wrapper); - cur_frm.mylist = lst; - lst.run(); - } -} - -cur_frm.cscript.refresh = function(doc, dt, dn) { - - // show activities only after project is saved - - var fl = ['new_update','add','hours','updates_html']; - if(doc.__islocal) { - hide_field(fl);} - else { - unhide_field(fl); } -} - -cur_frm.cscript.add = function(doc, dt, dn) { - var callback = function(r,rt) { - - // refresh listing - cur_frm.mylist.run(); - - } - $c_obj(make_doclist(doc.doctype, doc.name),'add_update','',callback); -} diff --git a/erpnext/projects/doctype/project_activity/project_activity.py b/erpnext/projects/doctype/project_activity/project_activity.py deleted file mode 100644 index 950e7e83c0e..00000000000 --- a/erpnext/projects/doctype/project_activity/project_activity.py +++ /dev/null @@ -1,48 +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 . - -# 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, getchildren, make_autoname -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 - -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): - self.doc, self.doclist = d, dl - - def add_update(self): - d = Document('Project Activity Update') - d.parent = self.doc.name - d.update = self.doc.new_update - d.hours = self.doc.hours - d.save(1) - - self.doc.new_update = '' - self.doc.hours = '' \ No newline at end of file diff --git a/erpnext/projects/doctype/project_activity/project_activity.txt b/erpnext/projects/doctype/project_activity/project_activity.txt deleted file mode 100644 index 544716522c1..00000000000 --- a/erpnext/projects/doctype/project_activity/project_activity.txt +++ /dev/null @@ -1,167 +0,0 @@ -# DocType, Project Activity -[ - - # These values are common in all dictionaries - { - 'creation': '2012-03-27 14:36:06', - 'docstatus': 0, - 'modified': '2012-03-27 14:36:06', - 'modified_by': u'Administrator', - 'owner': u'Administrator' - }, - - # These values are common for all DocType - { - 'autoname': u'Activity.######', - 'colour': u'White:FFF', - 'doctype': 'DocType', - 'module': u'Projects', - 'name': '__common__', - 'section_style': u'Simple', - 'server_code_error': u' ', - 'version': 15 - }, - - # These values are common for all DocField - { - 'doctype': u'DocField', - 'name': '__common__', - 'parent': u'Project Activity', - 'parentfield': u'fields', - 'parenttype': u'DocType', - 'permlevel': 0 - }, - - # These values are common for all DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'name': '__common__', - 'parent': u'Project Activity', - 'parentfield': u'permissions', - 'parenttype': u'DocType', - 'permlevel': 0, - 'read': 1, - 'role': u'All', - 'write': 1 - }, - - # DocType, Project Activity - { - 'doctype': 'DocType', - 'name': u'Project Activity' - }, - - # DocPerm - { - 'doctype': u'DocPerm' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'project', - 'fieldtype': u'Link', - 'label': u'Project', - 'oldfieldname': u'project', - 'oldfieldtype': u'Link', - 'options': u'Project' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'activity_name', - 'fieldtype': u'Data', - 'label': u'Activity Name', - 'oldfieldname': u'activity_name', - 'oldfieldtype': u'Data', - 'print_hide': 1, - 'reqd': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'percent_complete', - 'fieldtype': u'Select', - 'label': u'Percent Complete', - 'oldfieldname': u'percent_complete', - 'oldfieldtype': u'Select', - 'options': u'0\n5\n10\n15\n20\n25\n30\n35\n40\n45\n50\n55\n60\n65\n70\n75\n80\n85\n90\n95\n100', - 'reqd': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'last_update', - 'fieldtype': u'Date', - 'hidden': 1, - 'label': u'Last Update', - 'oldfieldname': u'last_update', - 'oldfieldtype': u'Date', - 'print_hide': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'last_update_by', - 'fieldtype': u'Data', - 'hidden': 1, - 'label': u'Last Update By', - 'oldfieldname': u'last_update_by', - 'oldfieldtype': u'Data', - 'print_hide': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'updates', - 'fieldtype': u'Section Break', - 'label': u'Updates', - 'oldfieldtype': u'Section Break' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'updates_html', - 'fieldtype': u'HTML', - 'label': u'Updates HTML', - 'oldfieldtype': u'HTML' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'new_update', - 'fieldtype': u'Text', - 'label': u'New Update', - 'oldfieldname': u'new_update', - 'oldfieldtype': u'Text' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'hours', - 'fieldtype': u'Float', - 'label': u'Hours', - 'oldfieldname': u'hours', - 'oldfieldtype': u'Float' - }, - - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'add', - 'fieldtype': u'Button', - 'label': u'Add', - 'oldfieldtype': u'Button', - 'trigger': u'Client' - } -] \ No newline at end of file diff --git a/erpnext/projects/doctype/project_activity_update/__init__.py b/erpnext/projects/doctype/project_activity_update/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/erpnext/projects/doctype/project_activity_update/project_activity_update.txt b/erpnext/projects/doctype/project_activity_update/project_activity_update.txt deleted file mode 100644 index 8155ccf0690..00000000000 --- a/erpnext/projects/doctype/project_activity_update/project_activity_update.txt +++ /dev/null @@ -1,61 +0,0 @@ -# DocType, Project Activity Update -[ - - # These values are common in all dictionaries - { - 'creation': '2012-03-27 14:36:06', - 'docstatus': 0, - 'modified': '2012-03-27 14:36:06', - 'modified_by': u'Administrator', - 'owner': u'Administrator' - }, - - # These values are common for all DocType - { - 'colour': u'White:FFF', - 'doctype': 'DocType', - 'istable': 1, - 'module': u'Projects', - 'name': '__common__', - 'section_style': u'Simple', - 'version': 1 - }, - - # These values are common for all DocField - { - 'doctype': u'DocField', - 'name': '__common__', - 'parent': u'Project Activity Update', - 'parentfield': u'fields', - 'parenttype': u'DocType', - 'permlevel': 0 - }, - - # DocType, Project Activity Update - { - 'doctype': 'DocType', - 'name': u'Project Activity Update' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'update', - 'fieldtype': u'Text', - 'label': u'Update', - 'oldfieldname': u'update', - 'oldfieldtype': u'Text' - }, - - # DocField - { - 'colour': u'White:FFF', - 'description': u'e.g. 0.5, 2.5 etc', - 'doctype': u'DocField', - 'fieldname': u'hours', - 'fieldtype': u'Float', - 'label': u'Hours', - 'oldfieldname': u'hours', - 'oldfieldtype': u'Float' - } -] \ No newline at end of file diff --git a/erpnext/projects/doctype/project_control/__init__.py b/erpnext/projects/doctype/project_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/doctype/project_control/__init__.py +++ b/erpnext/projects/doctype/project_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/doctype/project_control/project_control.py b/erpnext/projects/doctype/project_control/project_control.py index 9928ffd35a8..8369aabbf1e 100644 --- a/erpnext/projects/doctype/project_control/project_control.py +++ b/erpnext/projects/doctype/project_control/project_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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, set_default, str_esc_quote, user_format, validate_email_add, add_days diff --git a/erpnext/projects/doctype/project_control/project_control.txt b/erpnext/projects/doctype/project_control/project_control.txt deleted file mode 100644 index 76861cc5735..00000000000 --- a/erpnext/projects/doctype/project_control/project_control.txt +++ /dev/null @@ -1,30 +0,0 @@ -# DocType, Project Control -[ - - # These values are common in all dictionaries - { - 'creation': '2012-03-27 14:36:06', - 'docstatus': 0, - 'modified': '2012-03-27 14:36:06', - 'modified_by': u'Administrator', - 'owner': u'harshada@webnotestech.com' - }, - - # These values are common for all DocType - { - 'colour': u'White:FFF', - 'doctype': 'DocType', - 'issingle': 1, - 'module': u'Projects', - 'name': '__common__', - 'section_style': u'Simple', - 'server_code_error': u' ', - 'version': 30 - }, - - # DocType, Project Control - { - 'doctype': 'DocType', - 'name': u'Project Control' - } -] \ No newline at end of file diff --git a/erpnext/projects/doctype/project_milestone/__init__.py b/erpnext/projects/doctype/project_milestone/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/doctype/project_milestone/__init__.py +++ b/erpnext/projects/doctype/project_milestone/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/doctype/task/__init__.py b/erpnext/projects/doctype/task/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/doctype/task/__init__.py +++ b/erpnext/projects/doctype/task/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/doctype/task/task.js b/erpnext/projects/doctype/task/task.js index af4864bc444..d1317aeb65d 100644 --- a/erpnext/projects/doctype/task/task.js +++ b/erpnext/projects/doctype/task/task.js @@ -14,49 +14,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -cur_frm.cscript.onload = function(doc,cdt,cdn){ - if(!doc.senders_name) { - doc.senders_name = user_fullname; - doc.senders_email = user; - refresh_many(['senders_name', 'senders_email']); - } - - if(doc.__islocal) { - doc.status = 'Open'; - doc.opening_date = get_today(); - refresh_many(['status', 'opening_date']); - } - else{ - if(!doc.opening_date){ - doc.opening_date = dateutil.str_to_user(only_date(doc.creation)); - refresh_field('opening_date'); - } - } - - //hide unhide field depends on status - if(doc.status == 'Open') doc.review_date = doc.closing_date = ''; - else if(doc.status == 'Pending Review') doc.closing_date = ''; - refresh_many(['closing_date','review_date']); - - if(doc.project) cur_frm.cscript.project(doc, cdt, cdn); -} - -cur_frm.cscript.refresh = function(doc,cdt,cdn) { - cur_frm.clear_custom_buttons(); - if(doc.status == 'Pending Review' && (doc.senders_name == user_fullname || doc.senders_email == user)) { - cur_frm.add_custom_button('Declare Completed', cur_frm.cscript.declare_completed); - cur_frm.add_custom_button('Reopen Task', cur_frm.cscript['Reopen Task']); - } - if(doc.status == 'Open' && !doc.__islocal) { - cur_frm.add_custom_button('Cancel Task', cur_frm.cscript['Cancel Task']); - if(doc.allocated_to == user) cur_frm.add_custom_button('Get Approval', cur_frm.cscript['Get Approval']); - } -} - cur_frm.fields_dict['project'].get_query = function(doc,cdt,cdn){ var cond=''; - if(doc.customer) cond = 'ifnull(`tabProject`.customer, "") = "'+doc.customer+'" AND'; - + if(doc.customer) cond = 'ifnull(`tabProject`.customer, "") = "'+doc.customer+'" AND'; return repl('SELECT distinct `tabProject`.`name` FROM `tabProject` WHERE %(cond)s `tabProject`.`name` LIKE "%s" ORDER BY `tabProject`.`name` ASC LIMIT 50', {cond:cond}); } @@ -68,7 +28,6 @@ cur_frm.cscript.project = function(doc, cdt, cdn){ cur_frm.fields_dict['customer'].get_query = function(doc,cdt,cdn){ var cond=''; if(doc.project) cond = 'ifnull(`tabProject`.customer, "") = `tabCustomer`.name AND ifnull(`tabProject`.name, "") = "'+doc.project+'" AND'; - return repl('SELECT distinct `tabCustomer`.`name` FROM `tabCustomer`, `tabProject` WHERE %(cond)s `tabCustomer`.`name` LIKE "%s" ORDER BY `tabCustomer`.`name` ASC LIMIT 50', {cond:cond}); } @@ -77,46 +36,4 @@ cur_frm.cscript.customer = function(doc, cdt, cdn){ else doc.customer_name =''; } -cur_frm.cscript.allocated_to = function(doc,cdt,cdn){ - get_server_fields('get_allocated_to_name','','',doc,cdt,cdn,1); -} -cur_frm.cscript['Get Approval'] = function(){ - $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'set_for_review', '',function(r, rt) { - if(r.message == 'true'){ - doc.status = 'Pending Review'; //for refresh - refresh_many(['review_date','status']); - cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name); - } - }); -} - -cur_frm.cscript['Reopen Task'] = function(){ - $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'reopen_task', '',function(r, rt) { - if(r.message == 'true'){ - doc.status = 'Open'; //for refresh - refresh_many(['status']); - cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name); - } - }); -} - -cur_frm.cscript['Cancel Task'] = function(){ - $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'cancel_task', '',function(r, rt) { - if(r.message == 'true'){ - doc.status = 'Cancelled'; //for refresh - refresh_many(['status']); - cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name); - } - }); -} - -cur_frm.cscript.declare_completed = function(){ - $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_completed', '',function(r, rt) { - if(r.message == 'true'){ - doc.status = 'Closed'; //for refresh - refresh_many(['review_date', 'closing_date', 'status']); - cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name); - } - }); -} diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py index 7f023ca41fd..c9b106faffa 100644 --- a/erpnext/projects/doctype/task/task.py +++ b/erpnext/projects/doctype/task/task.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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, set_default, str_esc_quote, user_format, validate_email_add @@ -26,8 +27,6 @@ from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updated from webnotes import session, form, is_testing, msgprint, errprint sql = webnotes.conn.sql -set = webnotes.conn.set -get_value = webnotes.conn.get_value # ----------------------------------------------------------------------------------------- @@ -48,15 +47,6 @@ class DocType: if cust: ret = {'customer_name': cust and cust[0][0] or ''} return ret - - def get_allocated_to_name(self): - as_em = sql("select first_name, last_name from `tabProfile` where name=%s",str(self.doc.allocated_to)) - ret = { 'allocated_to_name' : as_em and (cstr(as_em[0][0]) + ' ' + cstr(as_em[0][1])) or ''} - return ret - - # validate - #-------------------------------------------- - def validate(self): if self.doc.exp_start_date and self.doc.exp_end_date and getdate(self.doc.exp_start_date) > getdate(self.doc.exp_end_date): @@ -67,159 +57,3 @@ class DocType: msgprint("'Actual Start Date' can not be greater than 'Actual End Date'") raise Exception - # on update - #-------------------------------------------- - - def on_update(self): - if self.doc.status =='Open' and self.doc.allocated_to: - if self.doc.task_email_notify: - self.send_notification() - if self.doc.exp_start_date: - sql("delete from tabEvent where ref_type='Task' and ref_name=%s", self.doc.name) - self.add_calendar_event() - else: - msgprint("Tip: Add an expected start date to create a calendar event.") - - - def validate_for_pending_review(self): - if not self.doc.allocated_to: - msgprint("Please enter Allocated To.") - raise Exception - self.validate_with_timesheet_dates() - - #Sent Notification - def send_notification(self): - i = { - 'name' : self.doc.name, - 'senders_name': self.doc.senders_name, - 'opening_date': self.doc.opening_date, - 'exp_start_date': self.doc.exp_start_date, - 'exp_end_date' : self.doc.exp_end_date, - 'subject' : self.doc.subject, - 'project': self.doc.project, - 'review_date': self.doc.review_date, - 'description': self.doc.description - } - - task_label = '[Task Updated] ' - if self.doc.creation==self.doc.modified: - task_label = '[New Task] ' - - msg2="""

    %(name)s

    -

    This is a Notification for the task %(name)s that has been assigned / updated to you - by %(senders_name)s on %(opening_date)s

    -

    Subject: %(subject)s

    -

    Project: %(project)s

    -

    Review Date: %(review_date)s

    -

    Expected Start Date: %(exp_start_date)s

    -

    Expected End Date: %(exp_end_date)s

    -

    Details: %(description)s

    -

    (This notification is autogenerated)

    """ % i - sendmail(self.doc.allocated_to, msg=msg2,subject= task_label + self.doc.subject) - - #validate before closing task - def validate_for_closed(self): - self.check_non_submitted_timesheets() - self.get_actual_total_hrs() - - def check_non_submitted_timesheets(self): - chk = sql("select t1.name from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent=t1.name and t2.task_id=%s and t1.status='Draft'", self.doc.name) - if chk: - chk_lst = [x[0] for x in chk] - msgprint("Please submit timesheet(s) : "+','.join(chk_lst)+" before declaring this task as completed. As details of this task present in timesheet(s)") - raise Exception - - #calculate actual total hours taken to complete task from timesheets - def get_actual_total_hrs(self): - import datetime - import time - chk = sql("select t2.act_total_hrs from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status = 'Submitted' and ifnull(t2.act_total_hrs, '')!='' order by t1.timesheet_date asc", self.doc.name) - if chk: - chk_lst = [x[0] for x in chk] - actual_total = total =0 - - for m in chk_lst: - m1, m2=[], 0 - m1 = m.split(":") - m2 = (datetime.timedelta(minutes=cint(m1[1]), hours=cint(m1[0]))).seconds - total = total + m2 - - actual_total = time.strftime("%H:%M", time.gmtime(total)) - set(self.doc, 'act_total_hrs', actual_total) - - # validate and fetch actual start and end date - def validate_with_timesheet_dates(self): - chk = sql("select t1.name, t1.timesheet_date from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status = 'Submitted' order by t1.timesheet_date asc", self.doc.name, as_dict=1) - if chk: - if self.doc.act_start_date: - if chk[0]['timesheet_date'] > getdate(self.doc.act_start_date) or chk[0]['timesheet_date'] < getdate(self.doc.act_start_date): - msgprint("Actual start date of this task is "+cstr(chk[0]['timesheet_date'])+" as per timesheet "+cstr(chk[0]['name'])) - raise Exception - else: - self.doc.act_start_date = chk[0]['timesheet_date'] - - if self.doc.act_end_date: - if chk[len(chk)-1]['timesheet_date'] < getdate(self.doc.act_end_date) or chk[len(chk)-1]['timesheet_date'] > getdate(self.doc.act_end_date): - msgprint("Actual end date of this task is "+cstr(chk[len(chk)-1]['timesheet_date'])+" as per timesheet "+cstr(chk[len(chk)-1]['name'])) - raise Exception - else: - self.doc.act_end_date = chk[len(chk)-1]['timesheet_date'] - - def set_for_review(self): - self.check_non_submitted_timesheets() - self.validate_for_pending_review() - self.get_actual_total_hrs() - self.doc.review_date = nowdate() - self.doc.status = 'Pending Review' - self.doc.save() - return cstr('true') - - def reopen_task(self): - self.doc.status = 'Open' - self.doc.save() - return cstr('true') - - def declare_completed(self): - if self.doc.status == 'Open': - self.validate_for_pending_review() - self.doc.review_date = nowdate() - else: - self.validate_with_timesheet_dates() - self.validate_for_closed() - - self.doc.closing_date = nowdate() - self.doc.status = 'Closed' - self.doc.docstatus = 1 - self.doc.save() - - self.remove_event_from_calender() - return cstr('true') - - def remove_event_from_calender(self): - sql("delete from tabEvent where ref_type='Task' and ref_name=%s", self.doc.name) - - def cancel_task(self): - chk = sql("select distinct t1.name from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status!='Cancelled'", self.doc.name) - if chk: - chk_lst = [x[0] for x in chk] - msgprint("Timesheet(s) "+','.join(chk_lst)+" created against this task. Thus can not be cancelled") - raise Exception - else: - self.doc.status = 'Cancelled' - self.doc.docstatus = 2 - self.remove_event_from_calender() - self.doc.save() - return cstr('true') - - - def add_calendar_event(self): - """ Add calendar event for task in calendar of Allocated person""" - event = Document('Event') - event.owner = self.doc.allocated_to - event.description = self.doc.subject - event.event_date = self.doc.exp_start_date and self.doc.exp_start_date or '' - event.event_hour = self.doc.event_hour and self.doc.event_hour or '10:00' - event.event_type = 'Private' - event.ref_type = 'Task' - event.ref_name = self.doc.name - event.save(1) diff --git a/erpnext/projects/doctype/task/task.txt b/erpnext/projects/doctype/task/task.txt index eedb651f38a..07a9343027f 100644 --- a/erpnext/projects/doctype/task/task.txt +++ b/erpnext/projects/doctype/task/task.txt @@ -3,24 +3,24 @@ # These values are common in all dictionaries { - 'creation': '2012-04-02 16:02:06', - 'docstatus': 0, - 'modified': '2012-06-04 12:33:35', - 'modified_by': u'Administrator', - 'owner': u'Administrator' + u'creation': '2012-08-08 15:39:55', + u'docstatus': 0, + u'modified': '2012-09-17 10:58:32', + u'modified_by': u'Administrator', + u'owner': u'Administrator' }, # These values are common for all DocType { '_last_update': u'1324880734', 'allow_trash': 1, - 'autoname': u'TIC/.####', + 'autoname': u'TASK.#####', 'colour': u'White:FFF', 'default_print_format': u'Standard', - 'doctype': 'DocType', + u'doctype': u'DocType', 'document_type': u'Master', 'module': u'Projects', - 'name': '__common__', + u'name': u'__common__', 'section_style': u'Tray', 'server_code_error': u' ', 'show_in_menu': 0, @@ -31,182 +31,117 @@ # These values are common for all DocField { - 'doctype': u'DocField', - 'name': '__common__', + u'doctype': u'DocField', + u'name': u'__common__', 'parent': u'Task', 'parentfield': u'fields', - 'parenttype': u'DocType' + 'parenttype': u'DocType', + 'permlevel': 0 }, # These values are common for all DocPerm { - 'doctype': u'DocPerm', - 'name': '__common__', + u'doctype': u'DocPerm', + u'name': u'__common__', 'parent': u'Task', 'parentfield': u'permissions', 'parenttype': u'DocType', - 'read': 1 + 'read': 1, + 'role': u'Projects User' }, # DocType, Task { - 'doctype': 'DocType', - 'name': u'Task' - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'All', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'All', - 'write': 0 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Projects User', - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Projects User' + u'doctype': u'DocType', + u'name': u'Task' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'task_details', 'fieldtype': u'Section Break', 'label': u'Task Details', 'oldfieldtype': u'Section Break', - 'permlevel': 0, 'search_index': 0, 'width': u'50%' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'subject', 'fieldtype': u'Data', 'in_filter': 1, 'label': u'Subject', 'oldfieldname': u'subject', 'oldfieldtype': u'Data', - 'permlevel': 0, 'reqd': 1 }, # DocField { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'allocated_to', - 'fieldtype': u'Link', - 'label': u'Allocated To', - 'oldfieldname': u'allocated_to', - 'oldfieldtype': u'Link', - 'options': u'Profile', - 'permlevel': 0, - 'trigger': u'Client' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'task_email_notify', - 'fieldtype': u'Check', - 'label': u'Send Mail Notification', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'exp_start_date', 'fieldtype': u'Date', 'label': u'Expected Start Date', 'oldfieldname': u'exp_start_date', 'oldfieldtype': u'Date', - 'permlevel': 0, 'reqd': 0 }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'exp_end_date', 'fieldtype': u'Date', 'in_filter': 1, 'label': u'Expected End Date', 'oldfieldname': u'exp_end_date', 'oldfieldtype': u'Date', - 'permlevel': 0, 'reqd': 0, 'search_index': 1 }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break0', 'fieldtype': u'Column Break', 'oldfieldtype': u'Column Break', - 'permlevel': 0, 'width': u'50%' }, # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'project', 'fieldtype': u'Link', 'label': u'Project', 'oldfieldname': u'project', 'oldfieldtype': u'Link', 'options': u'Project', - 'permlevel': 0, 'trigger': u'Client' }, # DocField { - 'doctype': u'DocField', + 'colour': u'White:FFF', + u'doctype': u'DocField', 'fieldname': u'status', 'fieldtype': u'Select', 'label': u'Status', 'no_copy': 1, 'oldfieldname': u'status', 'oldfieldtype': u'Select', - 'options': u'Open\nPending Review\nClosed\nCancelled', - 'permlevel': 1, + 'options': u'Open\nWorking\nPending Review\nClosed\nCancelled', 'trigger': u'Client' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'priority', 'fieldtype': u'Select', 'in_filter': 1, @@ -214,325 +149,167 @@ 'oldfieldname': u'priority', 'oldfieldtype': u'Select', 'options': u'Low\nMedium\nHigh\nUrgent', - 'permlevel': 0, 'reqd': 0, 'search_index': 1 }, # DocField { - 'doctype': u'DocField', - 'fieldname': u'allocated_to_name', - 'fieldtype': u'Data', - 'hidden': 1, - 'label': u'Allocated To Name', - 'oldfieldname': u'allocated_to_name', - 'oldfieldtype': u'Data', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'section_break0', 'fieldtype': u'Section Break', 'oldfieldtype': u'Section Break', - 'options': u'Simple', - 'permlevel': 0 + 'options': u'Simple' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'description', 'fieldtype': u'Text Editor', 'label': u'Details', 'oldfieldname': u'description', 'oldfieldtype': u'Text Editor', - 'permlevel': 0, 'reqd': 0, 'width': u'300px' }, # DocField { - 'colour': u'White:FFF', - 'description': u'If linked to a Customer', - 'doctype': u'DocField', - 'fieldname': u'customer_details', - 'fieldtype': u'Section Break', - 'label': u'Customer Details', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'external_or_internal', - 'fieldtype': u'Select', - 'label': u'External or Internal', - 'oldfieldname': u'external_or_internal', - 'oldfieldtype': u'Select', - 'options': u'External\nInternal', - 'permlevel': 0 - }, - - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'customer', - 'fieldtype': u'Link', - 'label': u'Customer', - 'oldfieldname': u'customer', - 'oldfieldtype': u'Link', - 'options': u'Customer', - 'permlevel': 0, - 'trigger': u'Client' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'customer_name', - 'fieldtype': u'Data', - 'label': u'Customer Name', - 'oldfieldname': u'customer_name', - 'oldfieldtype': u'Data', - 'permlevel': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'senders_name', - 'fieldtype': u'Data', - 'in_filter': 1, - 'label': u'Raised By', - 'oldfieldname': u'senders_name', - 'oldfieldtype': u'Data', - 'permlevel': 0, - 'reqd': 1, - 'search_index': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'senders_email', - 'fieldtype': u'Data', - 'label': u'Email', - 'oldfieldname': u'senders_email', - 'oldfieldtype': u'Data', - 'permlevel': 0, - 'reqd': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'column_break25', - 'fieldtype': u'Column Break', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'senders_contact_no', - 'fieldtype': u'Data', - 'label': u'Senders Contact No', - 'oldfieldname': u'senders_contact_no', - 'oldfieldtype': u'Data', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'senders_company', - 'fieldtype': u'Data', - 'label': u'Senders Company', - 'oldfieldname': u'senders_company', - 'oldfieldtype': u'Data', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'time_and_budget', 'fieldtype': u'Section Break', 'label': u'Time and Budget', - 'oldfieldtype': u'Section Break', - 'permlevel': 0 + 'oldfieldtype': u'Section Break' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'expected', 'fieldtype': u'Column Break', 'label': u'Expected', 'oldfieldtype': u'Column Break', - 'permlevel': 0, 'width': u'50%' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'exp_total_hrs', 'fieldtype': u'Data', 'label': u'Total Hours (Expected)', 'oldfieldname': u'exp_total_hrs', 'oldfieldtype': u'Data', - 'permlevel': 0, 'reqd': 0 }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'allocated_budget', 'fieldtype': u'Currency', 'label': u'Allocated Budget', 'oldfieldname': u'allocated_budget', - 'oldfieldtype': u'Currency', - 'permlevel': 0 + 'oldfieldtype': u'Currency' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'actual', 'fieldtype': u'Column Break', 'label': u'Actual', 'oldfieldtype': u'Column Break', - 'permlevel': 0, 'width': u'50%' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'act_start_date', 'fieldtype': u'Date', 'label': u'Actual Start Date', 'oldfieldname': u'act_start_date', - 'oldfieldtype': u'Date', - 'permlevel': 0 + 'oldfieldtype': u'Date' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'act_end_date', 'fieldtype': u'Date', 'label': u'Actual End Date', 'oldfieldname': u'act_end_date', - 'oldfieldtype': u'Date', - 'permlevel': 0 + 'oldfieldtype': u'Date' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'act_total_hrs', 'fieldtype': u'Data', 'label': u'Total Hours (Actual)', 'oldfieldname': u'act_total_hrs', - 'oldfieldtype': u'Data', - 'permlevel': 0 + 'oldfieldtype': u'Data' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'actual_budget', 'fieldtype': u'Currency', 'label': u'Actual Budget', 'oldfieldname': u'actual_budget', - 'oldfieldtype': u'Currency', - 'permlevel': 0 + 'oldfieldtype': u'Currency' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'more_details', 'fieldtype': u'Section Break', - 'label': u'More Details', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'opening_date', - 'fieldtype': u'Date', - 'label': u'Creation Date', - 'oldfieldname': u'opening_date', - 'oldfieldtype': u'Date', - 'permlevel': 0, - 'reqd': 1 + 'label': u'More Details' }, # DocField { 'colour': u'White:FFF', 'depends_on': u'eval:doc.status == "Closed" || doc.status == "Pending Review"', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'review_date', 'fieldtype': u'Date', 'hidden': 1, 'label': u'Review Date', 'oldfieldname': u'review_date', - 'oldfieldtype': u'Date', - 'permlevel': 0 + 'oldfieldtype': u'Date' }, # DocField { 'colour': u'White:FFF', 'depends_on': u'eval:doc.status == "Closed"', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'closing_date', 'fieldtype': u'Date', 'hidden': 1, 'label': u'Closing Date', 'oldfieldname': u'closing_date', - 'oldfieldtype': u'Date', - 'permlevel': 0 + 'oldfieldtype': u'Date' }, - # DocField + # DocPerm { - 'doctype': u'DocField', - 'fieldname': u'amended_from', - 'fieldtype': u'Data', - 'hidden': 1, - 'label': u'Amended From', - 'no_copy': 1, - 'oldfieldname': u'amended_from', - 'oldfieldtype': u'Data', - 'permlevel': 1, - 'print_hide': 1, - 'report_hide': 1 + 'cancel': 1, + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'write': 1 }, - # DocField + # DocPerm { - 'doctype': u'DocField', - 'fieldname': u'amendment_date', - 'fieldtype': u'Date', - 'hidden': 1, - 'label': u'Amendment Date', - 'no_copy': 1, - 'oldfieldname': u'amendment_date', - 'oldfieldtype': u'Date', - 'permlevel': 1, - 'print_hide': 1, - 'report_hide': 1 + u'doctype': u'DocPerm', + 'permlevel': 1 } ] \ No newline at end of file diff --git a/erpnext/projects/doctype/timesheet/__init__.py b/erpnext/projects/doctype/timesheet/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/doctype/timesheet/__init__.py +++ b/erpnext/projects/doctype/timesheet/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py index d9042d5028f..4dbbc91dfe8 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.py +++ b/erpnext/projects/doctype/timesheet/timesheet.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/projects/doctype/timesheet_detail/__init__.py b/erpnext/projects/doctype/timesheet_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/doctype/timesheet_detail/__init__.py +++ b/erpnext/projects/doctype/timesheet_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/page/__init__.py b/erpnext/projects/page/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/page/__init__.py +++ b/erpnext/projects/page/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/page/projects/__init__.py b/erpnext/projects/page/projects/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/page/projects/__init__.py +++ b/erpnext/projects/page/projects/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/page/projects/projects.js b/erpnext/projects/page/projects/projects.js index 7dc93586779..8f91f12fe47 100644 --- a/erpnext/projects/page/projects/projects.js +++ b/erpnext/projects/page/projects/projects.js @@ -14,58 +14,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pscript.queries_bg_dict = { - 'Urgent':'RED', - 'High':'ORANGE', - 'Low':'BLUE', - 'Closed':'GREEN', - 'Pending Review':'YELLOW' -} - pscript.onload_Projects = function(wrapper) { wn.ui.make_app_page({parent:wrapper, title:'Gantt Chart: All Tasks', single_column:true}); - - $(wrapper).find('.layout-main').html('
    Loading...
    ') - - - wn.require('js/lib/jQuery.Gantt/css/style.css'); - wn.require('js/lib/jQuery.Gantt/js/jquery.fn.gantt.min.js'); - - wn.call({ - method: 'projects.page.projects.projects.get_tasks', - callback: function(r) { - $(wrapper).find('.layout-main').empty(); - - var source = []; - // projects - $.each(r.message, function(i,v) { - source.push({ - name: v.project, - desc: v.subject, - values: [{ - label: v.subject, - desc: v.description || v.subject, - from: '/Date("'+v.exp_start_date+'")/', - to: '/Date("'+v.exp_end_date+'")/' - }] - }) - }) - - var gantt_area = $('
    ').appendTo($(wrapper).find('.layout-main')); - gantt_area.gantt({ - source: source, - navigate: "scroll", - scale: "weeks", - minScale: "weeks", - maxScale: "months", - onItemClick: function(data) { - alert("Item clicked - show some details"); - }, - onAddClick: function(dt, rowId) { - //alert("Empty space clicked - add an item!"); - } - }); - - } - }) + if(!erpnext.show_task_gantt) + wn.require('js/app/gantt_task.js'); + + var gantt_area = $('
    ').appendTo($(wrapper).find('.layout-main')); + erpnext.show_task_gantt(gantt_area); } \ No newline at end of file diff --git a/erpnext/projects/page/projects/projects.py b/erpnext/projects/page/projects/projects.py index 8f170def251..59495182533 100644 --- a/erpnext/projects/page/projects/projects.py +++ b/erpnext/projects/page/projects/projects.py @@ -14,12 +14,16 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes @webnotes.whitelist() def get_tasks(): + cond = '' + if webnotes.form_dict.get('project'): + cond = ' and project="%s"' % webnotes.form_dict.get('project') return webnotes.conn.sql("""select name, project, subject, exp_start_date, exp_end_date, - description from tabTask where + description, status from tabTask where project is not null and exp_start_date is not null - and exp_end_date is not null""", as_dict=True) \ No newline at end of file + and exp_end_date is not null %s""" % cond, as_dict=True) \ No newline at end of file diff --git a/erpnext/projects/page/projects_home/__init__.py b/erpnext/projects/page/projects_home/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/page/projects_home/__init__.py +++ b/erpnext/projects/page/projects_home/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/search_criteria/__init__.py b/erpnext/projects/search_criteria/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/search_criteria/__init__.py +++ b/erpnext/projects/search_criteria/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/search_criteria/projectwise_delivered_qty_and_costs/__init__.py b/erpnext/projects/search_criteria/projectwise_delivered_qty_and_costs/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/search_criteria/projectwise_delivered_qty_and_costs/__init__.py +++ b/erpnext/projects/search_criteria/projectwise_delivered_qty_and_costs/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/search_criteria/projectwise_pending_qty_and_costs/__init__.py b/erpnext/projects/search_criteria/projectwise_pending_qty_and_costs/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/search_criteria/projectwise_pending_qty_and_costs/__init__.py +++ b/erpnext/projects/search_criteria/projectwise_pending_qty_and_costs/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/search_criteria/projectwise_purchase_details/__init__.py b/erpnext/projects/search_criteria/projectwise_purchase_details/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/search_criteria/projectwise_purchase_details/__init__.py +++ b/erpnext/projects/search_criteria/projectwise_purchase_details/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.py b/erpnext/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.py index 4dab05c082a..ed82cebc791 100644 --- a/erpnext/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.py +++ b/erpnext/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals based_on = filter_values.get('based_on') # make default columns #for r in res: diff --git a/erpnext/projects/search_criteria/projectwise_sales_details/__init__.py b/erpnext/projects/search_criteria/projectwise_sales_details/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/search_criteria/projectwise_sales_details/__init__.py +++ b/erpnext/projects/search_criteria/projectwise_sales_details/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.py b/erpnext/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.py index 065a03d94d6..50ade660a32 100644 --- a/erpnext/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.py +++ b/erpnext/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals based_on = filter_values.get('based_on') cols=[] diff --git a/erpnext/projects/search_criteria/projectwise_sales_orders/__init__.py b/erpnext/projects/search_criteria/projectwise_sales_orders/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/search_criteria/projectwise_sales_orders/__init__.py +++ b/erpnext/projects/search_criteria/projectwise_sales_orders/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/projects/search_criteria/timesheet_report/__init__.py b/erpnext/projects/search_criteria/timesheet_report/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/projects/search_criteria/timesheet_report/__init__.py +++ b/erpnext/projects/search_criteria/timesheet_report/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/sandbox/__init__.py b/erpnext/sandbox/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/sandbox/__init__.py +++ b/erpnext/sandbox/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/sandbox/test_leave.py b/erpnext/sandbox/test_leave.py index 407b0f10a28..52715eca634 100644 --- a/erpnext/sandbox/test_leave.py +++ b/erpnext/sandbox/test_leave.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import unittest import webnotes diff --git a/erpnext/sandbox/test_stock_entry.py b/erpnext/sandbox/test_stock_entry.py index 7721a3ebdbf..e11d5672267 100644 --- a/erpnext/sandbox/test_stock_entry.py +++ b/erpnext/sandbox/test_stock_entry.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import unittest import webnotes diff --git a/erpnext/sandbox/test_stock_reco.py b/erpnext/sandbox/test_stock_reco.py index 1d78277e26f..d02d6f5c42d 100644 --- a/erpnext/sandbox/test_stock_reco.py +++ b/erpnext/sandbox/test_stock_reco.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import unittest import webnotes diff --git a/erpnext/sandbox/testdata/__init__.py b/erpnext/sandbox/testdata/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/sandbox/testdata/__init__.py +++ b/erpnext/sandbox/testdata/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/sandbox/testdata/leaves.py b/erpnext/sandbox/testdata/leaves.py index d8ed12232aa..db8b431e5ad 100644 --- a/erpnext/sandbox/testdata/leaves.py +++ b/erpnext/sandbox/testdata/leaves.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals from webnotes.model.doc import Document emp = Document( diff --git a/erpnext/sandbox/testdata/masters.py b/erpnext/sandbox/testdata/masters.py index 61fa2cb982c..c59253b3a93 100644 --- a/erpnext/sandbox/testdata/masters.py +++ b/erpnext/sandbox/testdata/masters.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals """ All master data in one place, can be created by 1 function call diff --git a/erpnext/sandbox/testdata/sle_data.py b/erpnext/sandbox/testdata/sle_data.py index 3469c10237d..5cd6dc26653 100644 --- a/erpnext/sandbox/testdata/sle_data.py +++ b/erpnext/sandbox/testdata/sle_data.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals from webnotes.model.doc import Document # Existing SLE data diff --git a/erpnext/sandbox/testdata/stock_entry.py b/erpnext/sandbox/testdata/stock_entry.py index 91aaed448ca..e617c083137 100644 --- a/erpnext/sandbox/testdata/stock_entry.py +++ b/erpnext/sandbox/testdata/stock_entry.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals from webnotes.model.doc import Document # Material Receipt diff --git a/erpnext/sandbox/testdata/stock_reco.py b/erpnext/sandbox/testdata/stock_reco.py index 14e28ff1df1..87e3eb23474 100644 --- a/erpnext/sandbox/testdata/stock_reco.py +++ b/erpnext/sandbox/testdata/stock_reco.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals from webnotes.model.doc import Document # Stock Reconciliation diff --git a/erpnext/selling/__init__.py b/erpnext/selling/__init__.py index f8a457a4cf9..beb4975e621 100644 --- a/erpnext/selling/__init__.py +++ b/erpnext/selling/__init__.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals install_docs = [ {"doctype":"Role", "role_name":"Customer", "name":"Customer"}, {"doctype":"Role", "role_name":"Partner", "name":"Partner"}, diff --git a/erpnext/selling/doctype/__init__.py b/erpnext/selling/doctype/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/__init__.py +++ b/erpnext/selling/doctype/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/campaign/__init__.py b/erpnext/selling/doctype/campaign/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/campaign/__init__.py +++ b/erpnext/selling/doctype/campaign/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/campaign/campaign.txt b/erpnext/selling/doctype/campaign/campaign.txt index 0912fe7085f..41c0e777090 100644 --- a/erpnext/selling/doctype/campaign/campaign.txt +++ b/erpnext/selling/doctype/campaign/campaign.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:07', + 'creation': '2012-07-03 13:30:38', 'docstatus': 0, - 'modified': '2012-03-27 14:36:07', + 'modified': '2012-07-12 13:21:52', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -17,6 +17,7 @@ 'autoname': u'field:campaign_name', 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'Keep Track of Sales Campaigns. Keep track of Leads, Quotations, Sales Order etc from Campaigns to gauge Return on Investment. ', 'doctype': 'DocType', 'document_type': u'Master', 'module': u'Selling', @@ -24,7 +25,7 @@ 'section_style': u'Simple', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 7 + 'version': 1 }, # These values are common for all DocField @@ -54,6 +55,56 @@ 'name': u'Campaign' }, + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales Manager', + 'write': 0 + }, + + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales Manager', + 'write': 0 + }, + + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales Master Manager', + 'write': 0 + }, + + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales User', + 'write': 0 + }, + + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales User', + 'write': 0 + }, + # DocPerm { 'cancel': 1, @@ -64,56 +115,6 @@ 'write': 1 }, - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Manager', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales Manager', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Master Manager', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales User', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales User', - 'write': 0 - }, - # DocField { 'doctype': u'DocField', diff --git a/erpnext/selling/doctype/customer/__init__.py b/erpnext/selling/doctype/customer/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/customer/__init__.py +++ b/erpnext/selling/doctype/customer/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index 0dd36350cd3..0bf499b57c4 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals import webnotes from webnotes.utils import cstr, date_diff, flt, formatdate, get_defaults, getdate, has_common, now, nowdate, replace_newlines, sendmail, set_default, user_format, validate_email_add diff --git a/erpnext/selling/doctype/customer/customer.txt b/erpnext/selling/doctype/customer/customer.txt index 121fa325fcf..f95121f9961 100644 --- a/erpnext/selling/doctype/customer/customer.txt +++ b/erpnext/selling/doctype/customer/customer.txt @@ -3,11 +3,11 @@ # These values are common in all dictionaries { - 'creation': '2012-07-18 16:07:05', - 'docstatus': 0, - 'modified': '2012-07-18 17:11:25', - 'modified_by': u'Administrator', - 'owner': u'Administrator' + u'creation': '2012-07-18 20:34:41', + u'docstatus': 0, + u'modified': '2012-09-17 11:31:55', + u'modified_by': u'Administrator', + u'owner': u'Administrator' }, # These values are common for all DocType @@ -17,10 +17,10 @@ 'allow_trash': 1, 'colour': u'White:FFF', 'default_print_format': u'Standard', - 'doctype': 'DocType', + u'doctype': u'DocType', 'document_type': u'Master', 'module': u'Selling', - 'name': '__common__', + u'name': u'__common__', 'search_fields': u'customer_name,customer_group,country,territory', 'section_style': u'Tabbed', 'server_code_error': u' ', @@ -32,8 +32,8 @@ # These values are common for all DocField { - 'doctype': u'DocField', - 'name': '__common__', + u'doctype': u'DocField', + u'name': u'__common__', 'parent': u'Customer', 'parentfield': u'fields', 'parenttype': u'DocType' @@ -41,87 +41,25 @@ # These values are common for all DocPerm { - 'amend': 0, - 'doctype': u'DocPerm', - 'name': '__common__', + u'doctype': u'DocPerm', + u'name': u'__common__', 'parent': u'Customer', 'parentfield': u'permissions', 'parenttype': u'DocType', - 'read': 1, - 'submit': 0 + 'read': 1 }, # DocType, Customer { - 'doctype': 'DocType', - 'name': u'Customer' - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Manager', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales Manager', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales User', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales User', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales Master Manager', - 'write': 1 - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Master Manager', - 'write': 0 + u'doctype': u'DocType', + u'name': u'Customer' }, # DocField { 'colour': u'White:FFF', 'description': u'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'basic_info', 'fieldtype': u'Section Break', 'label': u'Basic Info', @@ -132,7 +70,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'customer_name', 'fieldtype': u'Data', 'hidden': 0, @@ -150,7 +88,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'customer_type', 'fieldtype': u'Select', 'label': u'Customer Type', @@ -163,7 +101,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'naming_series', 'fieldtype': u'Select', 'label': u'Series', @@ -177,7 +115,7 @@ { 'colour': u'White:FFF', 'description': u'Fetch lead which will be converted into customer.', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'lead_name', 'fieldtype': u'Link', 'hidden': 0, @@ -195,7 +133,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break0', 'fieldtype': u'Column Break', 'permlevel': 0, @@ -206,7 +144,7 @@ { 'colour': u'White:FFF', 'description': u'To manage Customer Groups, click here', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'customer_group', 'fieldtype': u'Link', 'hidden': 0, @@ -226,7 +164,7 @@ { 'colour': u'White:FFF', 'description': u'To manage Territory, click here', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'territory', 'fieldtype': u'Link', 'label': u'Territory', @@ -242,7 +180,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'address_contacts', 'fieldtype': u'Section Break', 'label': u'Address & Contacts', @@ -253,7 +191,7 @@ { 'colour': u'White:FFF', 'depends_on': u'eval:doc.__islocal', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'address_desc', 'fieldtype': u'HTML', 'label': u'Address Desc', @@ -264,7 +202,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'address_html', 'fieldtype': u'HTML', 'label': u'Address HTML', @@ -273,7 +211,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break1', 'fieldtype': u'Column Break', 'permlevel': 0, @@ -284,7 +222,7 @@ { 'colour': u'White:FFF', 'depends_on': u'eval:doc.__islocal', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'contact_desc', 'fieldtype': u'HTML', 'label': u'Contact Desc', @@ -295,7 +233,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'contact_html', 'fieldtype': u'HTML', 'label': u'Contact HTML', @@ -305,7 +243,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'communication_history', 'fieldtype': u'Section Break', 'label': u'Communication History', @@ -314,7 +252,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'communication_html', 'fieldtype': u'HTML', 'label': u'Communication HTML', @@ -324,7 +262,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'more_info', 'fieldtype': u'Section Break', 'label': u'More Info', @@ -334,7 +272,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break2', 'fieldtype': u'Column Break', 'permlevel': 0, @@ -345,7 +283,7 @@ { 'colour': u'White:FFF', 'description': u'To create an Account Head under a different company, select the company and save customer.', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'company', 'fieldtype': u'Link', 'in_filter': 1, @@ -360,7 +298,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'default_price_list', 'fieldtype': u'Link', 'label': u'Default Price List', @@ -372,7 +310,7 @@ { 'colour': u'White:FFF', 'description': u'This currency will get fetched in Sales transactions of this customer', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'default_currency', 'fieldtype': u'Select', 'label': u'Default Currency', @@ -385,7 +323,7 @@ { 'colour': u'White:FFF', 'description': u"Your Customer's TAX registration numbers (if applicable) or any general information", - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'customer_details', 'fieldtype': u'Text', 'label': u'Customer Details', @@ -396,7 +334,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break3', 'fieldtype': u'Column Break', 'permlevel': 0, @@ -405,29 +343,29 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'credit_days', 'fieldtype': u'Int', 'label': u'Credit Days', 'oldfieldname': u'credit_days', 'oldfieldtype': u'Int', - 'permlevel': 0 + 'permlevel': 2 }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'credit_limit', 'fieldtype': u'Currency', 'label': u'Credit Limit', 'oldfieldname': u'credit_limit', 'oldfieldtype': u'Currency', - 'permlevel': 0 + 'permlevel': 2 }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'website', 'fieldtype': u'Data', 'label': u'Website', @@ -436,7 +374,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'sales_team_section_break', 'fieldtype': u'Section Break', 'label': u'Sales Team', @@ -446,7 +384,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'default_sales_partner', 'fieldtype': u'Link', 'label': u'Default Sales Partner', @@ -458,7 +396,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'default_commission_rate', 'fieldtype': u'Currency', 'label': u'Default Commission Rate', @@ -469,7 +407,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'sales_team', 'fieldtype': u'Table', 'label': u'Sales Team Details', @@ -483,7 +421,7 @@ { 'colour': u'White:FFF', 'depends_on': u'eval:!doc.__islocal', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'transaction_history', 'fieldtype': u'Section Break', 'label': u'Transaction History', @@ -494,7 +432,7 @@ { 'colour': u'White:FFF', 'depends_on': u'eval:!doc.__islocal', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'history_html', 'fieldtype': u'HTML', 'label': u'History HTML', @@ -504,12 +442,93 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'trash_reason', 'fieldtype': u'Small Text', 'label': u'Trash Reason', 'oldfieldname': u'trash_reason', 'oldfieldtype': u'Small Text', 'permlevel': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 1, + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales Master Manager', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + 'cancel': 1, + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Accounts Manager', + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'All', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 2, + 'role': u'Accounts Manager', + 'write': 1 + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 2, + 'role': u'System Manager', + 'write': 1 + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 2, + 'role': u'All' } ] \ No newline at end of file diff --git a/erpnext/selling/doctype/industry_type/__init__.py b/erpnext/selling/doctype/industry_type/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/industry_type/__init__.py +++ b/erpnext/selling/doctype/industry_type/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/installation_note/__init__.py b/erpnext/selling/doctype/installation_note/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/installation_note/__init__.py +++ b/erpnext/selling/doctype/installation_note/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/installation_note/installation_note.py b/erpnext/selling/doctype/installation_note/installation_note.py index 9c17f9de9c8..2af258adf72 100644 --- a/erpnext/selling/doctype/installation_note/installation_note.py +++ b/erpnext/selling/doctype/installation_note/installation_note.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/selling/doctype/installation_note_item/__init__.py b/erpnext/selling/doctype/installation_note_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/installation_note_item/__init__.py +++ b/erpnext/selling/doctype/installation_note_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/lead/__init__.py b/erpnext/selling/doctype/lead/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/lead/__init__.py +++ b/erpnext/selling/doctype/lead/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/lead/lead.py b/erpnext/selling/doctype/lead/lead.py index 912d54bd17d..eda3cd6b0dd 100644 --- a/erpnext/selling/doctype/lead/lead.py +++ b/erpnext/selling/doctype/lead/lead.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/selling/doctype/lead/lead.txt b/erpnext/selling/doctype/lead/lead.txt index 056fc16bae1..9c74de987ec 100644 --- a/erpnext/selling/doctype/lead/lead.txt +++ b/erpnext/selling/doctype/lead/lead.txt @@ -3,11 +3,11 @@ # These values are common in all dictionaries { - 'creation': '2012-06-05 20:03:20', - 'docstatus': 0, - 'modified': '2012-08-03 10:49:22', - 'modified_by': u'Administrator', - 'owner': u'Administrator' + u'creation': '2012-06-05 20:03:20', + u'docstatus': 0, + u'modified': '2012-08-06 14:49:48', + u'modified_by': u'Administrator', + u'owner': u'Administrator' }, # These values are common for all DocType @@ -16,10 +16,10 @@ 'allow_trash': 1, 'colour': u'White:FFF', 'default_print_format': u'Standard', - 'doctype': 'DocType', + u'doctype': u'DocType', 'document_type': u'Master', 'module': u'Selling', - 'name': '__common__', + u'name': u'__common__', 'search_fields': u'lead_name,lead_owner,status', 'section_style': u'Tabbed', 'server_code_error': u' ', @@ -31,8 +31,8 @@ # These values are common for all DocField { - 'doctype': u'DocField', - 'name': '__common__', + u'doctype': u'DocField', + u'name': u'__common__', 'parent': u'Lead', 'parentfield': u'fields', 'parenttype': u'DocType' @@ -40,8 +40,8 @@ # These values are common for all DocPerm { - 'doctype': u'DocPerm', - 'name': '__common__', + u'doctype': u'DocPerm', + u'name': u'__common__', 'parent': u'Lead', 'parentfield': u'permissions', 'parenttype': u'DocType', @@ -50,90 +50,14 @@ # DocType, Lead { - 'doctype': 'DocType', - 'name': u'Lead' - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales Manager', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales User', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'All' - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'System Manager', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Guest', - 'write': 1 + u'doctype': u'DocType', + u'name': u'Lead' }, # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'basic_info', 'fieldtype': u'Section Break', 'label': u'Basic Info', @@ -143,7 +67,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break0', 'fieldtype': u'Column Break', 'oldfieldtype': u'Column Break', @@ -155,7 +79,7 @@ { 'colour': u'White:FFF', 'description': u'To manage multiple series please go to Setup > Manage Series', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'naming_series', 'fieldtype': u'Select', 'label': u'Naming Series', @@ -170,7 +94,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'lead_name', 'fieldtype': u'Data', 'in_filter': 1, @@ -186,7 +110,7 @@ { 'colour': u'White:FFF', 'description': u'Name of organization from where lead has come', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'company_name', 'fieldtype': u'Data', 'in_filter': 1, @@ -202,7 +126,8 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + 'description': u'Source of the lead. If via a campaign, select "Campaign"', + u'doctype': u'DocField', 'fieldname': u'source', 'fieldtype': u'Select', 'in_filter': 1, @@ -210,7 +135,7 @@ 'no_copy': 1, 'oldfieldname': u'source', 'oldfieldtype': u'Select', - 'options': u"\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWebsite", + 'options': u'\nAdvertisement\nBlog\nCampaign\nCall\nCustomer\nExhibition\nSupplier\nWebsite', 'permlevel': 0, 'reqd': 1, 'search_index': 0, @@ -221,7 +146,8 @@ { 'colour': u'White:FFF', 'depends_on': u"eval:doc.source == 'Existing Customer'", - 'doctype': u'DocField', + 'description': u'Source of th', + u'doctype': u'DocField', 'fieldname': u'customer', 'fieldtype': u'Link', 'hidden': 0, @@ -237,7 +163,7 @@ 'colour': u'White:FFF', 'depends_on': u"eval:doc.source == 'Campaign'", 'description': u'Enter campaign name if the source of lead is campaign.', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'campaign_name', 'fieldtype': u'Link', 'hidden': 0, @@ -250,7 +176,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break1', 'fieldtype': u'Column Break', 'permlevel': 0, @@ -261,7 +187,7 @@ { 'colour': u'White:FFF', 'default': u'Open', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'status', 'fieldtype': u'Select', 'in_filter': 1, @@ -279,7 +205,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'type', 'fieldtype': u'Select', 'in_filter': 1, @@ -293,7 +219,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'remark', 'fieldtype': u'Small Text', 'label': u'Remark', @@ -304,7 +230,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'communication_history', 'fieldtype': u'Section Break', 'label': u'Communication History', @@ -315,7 +241,7 @@ { 'allow_on_submit': 0, 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'communication_html', 'fieldtype': u'HTML', 'label': u'Communication HTML', @@ -326,7 +252,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'contact_info', 'fieldtype': u'Section Break', 'label': u'Contact Info', @@ -337,7 +263,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'phone', 'fieldtype': u'Data', 'label': u'Phone', @@ -349,7 +275,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'mobile_no', 'fieldtype': u'Data', 'label': u'Mobile No.', @@ -360,7 +286,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'email_id', 'fieldtype': u'Data', 'label': u'Email Id', @@ -372,7 +298,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'fax', 'fieldtype': u'Data', 'label': u'Fax', @@ -383,7 +309,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'website', 'fieldtype': u'Data', 'label': u'Website', @@ -396,7 +322,7 @@ { 'colour': u'White:FFF', 'description': u'To manage Territory, click here', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'territory', 'fieldtype': u'Link', 'label': u'Territory', @@ -409,7 +335,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break2', 'fieldtype': u'Column Break', 'permlevel': 0 @@ -417,7 +343,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'address_line1', 'fieldtype': u'Data', 'label': u'Address Line 1', @@ -430,7 +356,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'address_line2', 'fieldtype': u'Data', 'label': u'Address Line 2', @@ -442,7 +368,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'city', 'fieldtype': u'Data', 'label': u'City', @@ -455,7 +381,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'country', 'fieldtype': u'Select', 'label': u'Country', @@ -471,7 +397,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'state', 'fieldtype': u'Data', 'label': u'State', @@ -484,7 +410,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'pincode', 'fieldtype': u'Data', 'label': u'Pin Code', @@ -497,7 +423,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'more_info', 'fieldtype': u'Section Break', 'label': u'More Info', @@ -508,7 +434,7 @@ # DocField { 'default': u'__user', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'lead_owner', 'fieldtype': u'Link', 'in_filter': 1, @@ -522,7 +448,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'market_segment', 'fieldtype': u'Select', 'hidden': 0, @@ -538,7 +464,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'industry', 'fieldtype': u'Link', 'label': u'Industry', @@ -550,7 +476,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'request_type', 'fieldtype': u'Select', 'label': u'Request Type', @@ -562,7 +488,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'fiscal_year', 'fieldtype': u'Select', 'hidden': 1, @@ -576,7 +502,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break3', 'fieldtype': u'Column Break', 'oldfieldtype': u'Column Break', @@ -588,7 +514,7 @@ { 'allow_on_submit': 0, 'depends_on': u"eval:doc.status == 'Lead Lost'", - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'order_lost_reason', 'fieldtype': u'Link', 'hidden': 0, @@ -604,7 +530,7 @@ 'allow_on_submit': 0, 'colour': u'White:FFF', 'description': u'Your sales person who will contact the lead in future', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'contact_by', 'fieldtype': u'Link', 'hidden': 0, @@ -624,7 +550,7 @@ 'allow_on_submit': 0, 'colour': u'White:FFF', 'description': u'Your sales person will get a reminder on this date to contact the lead', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'contact_date', 'fieldtype': u'Date', 'in_filter': 1, @@ -642,7 +568,7 @@ 'colour': u'White:FFF', 'depends_on': u'eval:!doc.__islocal', 'description': u'Date on which the lead was last contacted', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'last_contact_date', 'fieldtype': u'Date', 'label': u'Last Contact Date', @@ -655,7 +581,8 @@ # DocField { - 'doctype': u'DocField', + 'colour': u'White:FFF', + u'doctype': u'DocField', 'fieldname': u'company', 'fieldtype': u'Link', 'label': u'Company', @@ -663,12 +590,12 @@ 'oldfieldtype': u'Link', 'options': u'Company', 'permlevel': 0, - 'reqd': 1 + 'reqd': 0 }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'trash_reason', 'fieldtype': u'Small Text', 'label': u'Trash Reason', @@ -681,7 +608,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'unsubscribed', 'fieldtype': u'Check', 'label': u'Unsubscribed', @@ -690,10 +617,86 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'blog_subscriber', 'fieldtype': u'Check', 'label': u'Blog Subscriber', 'permlevel': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 1, + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales Manager', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales User', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'All' + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'System Manager', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Guest', + 'write': 1 } ] \ No newline at end of file diff --git a/erpnext/selling/doctype/opportunity/__init__.py b/erpnext/selling/doctype/opportunity/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/opportunity/__init__.py +++ b/erpnext/selling/doctype/opportunity/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/opportunity/opportunity.py b/erpnext/selling/doctype/opportunity/opportunity.py index 20dcef386a8..c3a6fb7596e 100644 --- a/erpnext/selling/doctype/opportunity/opportunity.py +++ b/erpnext/selling/doctype/opportunity/opportunity.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/selling/doctype/opportunity_item/__init__.py b/erpnext/selling/doctype/opportunity_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/opportunity_item/__init__.py +++ b/erpnext/selling/doctype/opportunity_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/plot_control/__init__.py b/erpnext/selling/doctype/plot_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/plot_control/__init__.py +++ b/erpnext/selling/doctype/plot_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/plot_control/plot_control.py b/erpnext/selling/doctype/plot_control/plot_control.py index bff25d8d7c6..d0b24b4d2e7 100644 --- a/erpnext/selling/doctype/plot_control/plot_control.py +++ b/erpnext/selling/doctype/plot_control/plot_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/selling/doctype/quotation/__init__.py b/erpnext/selling/doctype/quotation/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/quotation/__init__.py +++ b/erpnext/selling/doctype/quotation/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 175133d7488..2f97badd00c 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -63,7 +63,9 @@ cur_frm.cscript.onload_post_render = function(doc, dt, dn) { // hide - unhide fields based on lead or customer.. // ======================================================================================================================= cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){ - hide_field(['lead', 'lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group', 'organization']); + hide_field(['lead', 'lead_name','customer','customer_address','contact_person', + 'customer_name','address_display','contact_display','contact_mobile','contact_email', + 'territory','customer_group', 'organization']); if(doc.quotation_to == 'Lead') unhide_field(['lead']); else if(doc.quotation_to == 'Customer') unhide_field(['customer']); @@ -283,34 +285,50 @@ cur_frm.cscript.validate = function(doc,cdt,cdn){ //================ Last Quoted Price and Last Sold Price suggestion ====================== cur_frm.fields_dict['quotation_details'].grid.get_field('item_code').get_query= function(doc, cdt, cdn) { var d = locals[cdt][cdn]; - var cond = (doc.order_type == 'Maintenance')? " and tabItem.is_service_item = 'Yes'" : " and tabItem.is_sales_item = 'Yes'" - if(doc.customer) - return repl("SELECT i.name,i.item_code,concat('Last quoted at - ',cast(quote_rate as char)) as quote_rate,concat('Last sold at - ',cast(sales_rate as char)) as sales_rate, i.item_name, i.description FROM\ - (\ - select item_code,name, item_name, description from tabItem where tabItem.%(key)s like '%s' %(cond)s\ - )i\ - left join\ - (\ - select q.item_code,q.quote_rate from\ - (\ - select q.transaction_date,qd.item_code,qd.basic_rate as quote_rate from `tabQuotation Item` qd, `tabQuotation` q where q.name=qd.parent and q.docstatus=1 and customer='%(cust)s'\ - )q,\ - (\ - select qd.item_code,max(q.transaction_date) as transaction_date from `tabQuotation Item` qd, `tabQuotation` q where q.name=qd.parent and q.docstatus=1 and customer='%(cust)s' group by qd.item_code\ - )m where q.item_code=m.item_code and q.transaction_date=m.transaction_date\ - )q on i.item_code=q.item_code\ - left join\ - (\ - select r.item_code,r.sales_rate from\ - (\ - select r.voucher_date,rd.item_code,rd.basic_rate as sales_rate from `tabSales Invoice Item` rd, `tabSales Invoice` r where r.name=rd.parent and r.docstatus=1 and r.customer='%(cust)s'\ - )r,\ - (\ - select rd.item_code,max(r.voucher_date) as voucher_date from `tabSales Invoice Item` rd, `tabSales Invoice` r where r.name=rd.parent and r.docstatus=1 and r.customer='%(cust)s' group by rd.item_code\ - )m where r.item_code=m.item_code and r.voucher_date=m.voucher_date\ - )s on i.item_code=s.item_code ORDER BY i.item_code LIMIT 50",{cust:doc.customer, cond:cond}); - else - return repl("SELECT name, item_name, description FROM tabItem WHERE `tabItem`.%(key)s LIKE '%s' %(cond)s ORDER BY tabItem.item_code DESC LIMIT 50", {cond:cond}); + var cond = (doc.order_type == 'Maintenance') ? " and item.is_service_item = 'Yes'" : " and item.is_sales_item = 'Yes'"; + if(doc.customer) { + var export_rate_field = wn.meta.get_docfield(cdt, 'export_rate', cdn); + var precision = (export_rate_field && export_rate_field.fieldtype) === 'Float' ? 6 : 2; + return repl("\ + select \ + item.name, \ + ( \ + select concat('Last Quote @ ', q.currency, ' ', \ + format(q_item.export_rate, %(precision)s)) \ + from `tabQuotation` q, `tabQuotation Item` q_item \ + where \ + q.name = q_item.parent \ + and q_item.item_code = item.name \ + and q.docstatus = 1 \ + and q.customer = \"%(cust)s\" \ + order by q.transaction_date desc \ + limit 1 \ + ) as quote_rate, \ + ( \ + select concat('Last Sale @ ', si.currency, ' ', \ + format(si_item.basic_rate, %(precision)s)) \ + from `tabSales Invoice` si, `tabSales Invoice Item` si_item \ + where \ + si.name = si_item.parent \ + and si_item.item_code = item.name \ + and si.docstatus = 1 \ + and si.customer = \"%(cust)s\" \ + order by si.voucher_date desc \ + limit 1 \ + ) as sales_rate, \ + item.item_name, item.description \ + from `tabItem` item \ + where \ + item.%(key)s like \"%s\" \ + %(cond)s \ + limit 25", { + cust: doc.customer, + cond: cond, + precision: precision + }); + } else { + return repl("SELECT name, item_name, description FROM `tabItem` item WHERE item.%(key)s LIKE '%s' %(cond)s ORDER BY item.item_code DESC LIMIT 50", {cond:cond}); + } } cur_frm.cscript.on_submit = function(doc, cdt, cdn) { diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index a3481f33f4c..7bb94aa17e4 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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, load_json diff --git a/erpnext/selling/doctype/quotation/quotation.txt b/erpnext/selling/doctype/quotation/quotation.txt index 1b34c51ebc0..6a42cda6376 100644 --- a/erpnext/selling/doctype/quotation/quotation.txt +++ b/erpnext/selling/doctype/quotation/quotation.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-06-08 15:33:49', + 'creation': '2012-07-05 11:04:12', 'docstatus': 0, - 'modified': '2012-06-08 16:10:44', + 'modified': '2012-07-16 16:23:50', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -61,100 +61,6 @@ 'name': u'Quotation' }, - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales Manager', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales User', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'match': u'customer_name', - 'permlevel': 0, - 'role': u'Customer' - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Maintenance Manager', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Maintenance Manager' - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Maintenance User', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Maintenance User' - }, - # DocField { 'colour': u'White:FFF', @@ -547,7 +453,7 @@ 'description': u"Rate at which Price list currency is converted to company's base currency", 'doctype': u'DocField', 'fieldname': u'plc_conversion_rate', - 'fieldtype': u'Currency', + 'fieldtype': u'Float', 'label': u'Price List Currency Conversion Rate', 'permlevel': 0, 'print_hide': 1, @@ -590,7 +496,7 @@ 'description': u"Rate at which customer's currency is converted to company's base currency", 'doctype': u'DocField', 'fieldname': u'conversion_rate', - 'fieldtype': u'Currency', + 'fieldtype': u'Float', 'label': u'Conversion Rate', 'oldfieldname': u'conversion_rate', 'oldfieldtype': u'Currency', @@ -1271,5 +1177,99 @@ 'no_copy': 1, 'permlevel': 0, 'print_hide': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales Manager', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales User', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'match': u'customer_name', + 'permlevel': 0, + 'role': u'Customer' + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Maintenance Manager', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Maintenance Manager' + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Maintenance User', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Maintenance User' } ] \ No newline at end of file diff --git a/erpnext/selling/doctype/quotation_item/__init__.py b/erpnext/selling/doctype/quotation_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/quotation_item/__init__.py +++ b/erpnext/selling/doctype/quotation_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/sales_and_purchase_return_item/__init__.py b/erpnext/selling/doctype/sales_and_purchase_return_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/sales_and_purchase_return_item/__init__.py +++ b/erpnext/selling/doctype/sales_and_purchase_return_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/sales_common/__init__.py b/erpnext/selling/doctype/sales_common/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/sales_common/__init__.py +++ b/erpnext/selling/doctype/sales_common/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js index 5670433539d..fe5582d613a 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.js +++ b/erpnext/selling/doctype/sales_common/sales_common.js @@ -127,10 +127,35 @@ cur_frm.cscript.dynamic_label = function(doc, cdt, cdn, base_curr, callback) { cur_frm.cscript.base_currency = base_curr; set_dynamic_label_par(doc, cdt, cdn, base_curr); set_dynamic_label_child(doc, cdt, cdn, base_curr); + set_sales_bom_help(doc); if (callback) callback(doc, cdt, cdn); } +// Help for Sales BOM items +var set_sales_bom_help = function(doc) { + if(!cur_frm.fields_dict.packing_list) return; + if (getchildren('Delivery Note Packing Item', doc.name, 'packing_details').length) { + $(cur_frm.fields_dict.packing_list.row.wrapper).toggle(true); + + if (inList(['Delivery Note', 'Sales Invoice'], doc.doctype)) { + help_msg = "
    \ + For 'Sales BOM' items, warehouse, serial no and batch no \ + will be considered from the 'Packing List' table. \ + If warehouse and batch no are same for all packing items for any 'Sales BOM' item, \ + those values can be entered in the main item table, values will be copied to 'Packing List' table. \ +
    "; + wn.meta.get_docfield(doc.doctype, 'sales_bom_help', doc.name).options = help_msg; + } + } else { + $(cur_frm.fields_dict.packing_list.row.wrapper).toggle(false); + if (inList(['Delivery Note', 'Sales Invoice'], doc.doctype)) { + wn.meta.get_docfield(doc.doctype, 'sales_bom_help', doc.name).options = ''; + } + } + refresh_field('sales_bom_help'); +} + // hide / unhide price list currency based on availability of price list in customer's currency //--------------------------------------------------------------------------------------------------- @@ -318,7 +343,7 @@ cur_frm.cscript.basic_rate = function(doc, cdt, cdn) { Please either
    \ * Specify Basic Rate (i.e. Rate which will be displayed in print)
    \ -- or --
    \ - * Uncheck 'Included in Print Rate' in the tax entries of Taxes section."); + * Uncheck 'Is this Tax included in Basic Rate?' in the tax entries of Taxes section."); } } } @@ -340,7 +365,12 @@ cur_frm.cscript.export_rate = function(doc,cdt,cdn) { // ************* GET OTHER CHARGES BASED ON COMPANY ************* cur_frm.fields_dict.charge.get_query = function(doc) { - return 'SELECT DISTINCT `tabSales Taxes and Charges Master`.name FROM `tabSales Taxes and Charges Master` WHERE `tabSales Taxes and Charges Master`.company = "'+doc.company+'" AND `tabSales Taxes and Charges Master`.company is not NULL AND `tabSales Taxes and Charges Master`.docstatus != 2 AND `tabSales Taxes and Charges Master`.%(key)s LIKE "%s" ORDER BY `tabSales Taxes and Charges Master`.name LIMIT 50'; + return 'SELECT DISTINCT `tabSales Taxes and Charges Master`.name FROM \ + `tabSales Taxes and Charges Master` WHERE `tabSales Taxes and Charges Master`.company = "' + +doc.company+'" AND `tabSales Taxes and Charges Master`.company is not NULL \ + AND `tabSales Taxes and Charges Master`.docstatus != 2 \ + AND `tabSales Taxes and Charges Master`.%(key)s LIKE "%s" \ + ORDER BY `tabSales Taxes and Charges Master`.name LIMIT 50'; } // ********************* Get Charges **************************** @@ -626,27 +656,15 @@ cur_frm.cscript.included_in_print_rate = function(doc, cdt, cdn) { var tax = locals[cdt][cdn]; if(tax.included_in_print_rate==1) { if(!inList(['On Net Total', 'On Previous Row Total', 'On Previous Row Amount'], tax.charge_type)) { - msgprint("Included in Print Rate (i.e. Inclusive Price) is only valid for charges of type:
    \ + msgprint("'Is this Tax included in Basic Rate?' (i.e. Inclusive Price) is only valid for charges of type:
    \ * On Net Total
    \ * On Previous Row Amount
    \ * On Previous Row Total"); tax.included_in_print_rate = 0; refresh_field('included_in_print_rate', tax.name, cur_frm.cscript.other_fname); - } else if(inList(['On Previous Row Total', 'On Previous Row Amount'], tax.charge_type)){ - if(tax.row_id) { - var tax_list = getchildren('Sales Taxes and Charges', doc.name, cur_frm.cscript.other_fname, doc.doctype); - if(tax_list[tax.row_id-1].charge_type=='Actual') { - msgprint("Row of type 'Actual' cannot be depended on for type '" + tax.charge_type + "'\ - when using tax inclusive prices.
    \ - This will lead to incorrect values.

    \ - Please specify correct value in 'Enter Row' column of Row: " - + tax.idx + " in Taxes table"); - validated = false; - tax.included_in_print_rate = 0; - refresh_field('included_in_print_rate', tax.name, cur_frm.cscript.other_fname); - } - } - } + } + var tax_list = getchildren('Sales Taxes and Charges', doc.name, cur_frm.cscript.other_fname, doc.doctype); + cur_frm.cscript.validate_print_rate_option(doc, tax_list, tax.idx-1); } } @@ -728,6 +746,32 @@ cur_frm.cscript.recalculate_values = function(doc, cdt, cdn) { cur_frm.cscript.calculate_charges(doc,cdt,cdn); } +cur_frm.cscript.validate_print_rate_option = function(doc, taxes, i) { + if(in_list(['On Previous Row Amount','On Previous Row Total'], taxes[i].charge_type)) { + if(!taxes[i].row_id){ + alert("Please Enter Row on which amount needs to be calculated for row : "+taxes[i].idx); + validated = false; + } else if(taxes[i].included_in_print_rate && taxes[taxes[i].row_id-1].charge_type=='Actual') { + msgprint("Row of type 'Actual' cannot be depended on for type '" + taxes[i].charge_type + "'\ + when using tax inclusive prices.
    \ + This will lead to incorrect values.

    \ + Please specify correct value in 'Enter Row' column of Row: " + + taxes[i].idx + " in Taxes table"); + validated = false; + taxes[i].included_in_print_rate = 0; + refresh_field('included_in_print_rate', taxes[i].name, other_fname); + } else if ((taxes[i].included_in_print_rate && !taxes[taxes[i].row_id-1].included_in_print_rate) || + (!taxes[i].included_in_print_rate && taxes[taxes[i].row_id-1].included_in_print_rate)) { + msgprint("If any row in the tax table depends on 'Previous Row Amount/Total',
    \ + 'Is this Tax included in Basic Rate?' column should be same for both row
    \ + i.e for that row and the previous row.

    \ + The same is violated for row #"+(i+1)+" and row #"+taxes[i].row_id + ); + validated = false; + } + } +} + cur_frm.cscript.calculate_charges = function(doc, cdt, cdn) { var other_fname = cur_frm.cscript.other_fname; @@ -737,21 +781,7 @@ cur_frm.cscript.calculate_charges = function(doc, cdt, cdn) { cl[i].total_amount = 0; cl[i].tax_amount = 0; // this is done to calculate other charges cl[i].total = 0; - if(in_list(['On Previous Row Amount','On Previous Row Total'], cl[i].charge_type)) { - if(!cl[i].row_id){ - alert("Please Enter Row on which amount needs to be calculated for row : "+cl[i].idx); - validated = false; - } else if(cl[i].included_in_print_rate && cl[cl[i].row_id-1].charge_type=='Actual') { - msgprint("Row of type 'Actual' cannot be depended on for type '" + cl[i].charge_type + "'\ - when using tax inclusive prices.
    \ - This will lead to incorrect values.

    \ - Please specify correct value in 'Enter Row' column of Row: " - + cl[i].idx + " in Taxes table"); - validated = false; - cl[i].included_in_print_rate = 0; - refresh_field('included_in_print_rate', cl[i].name, other_fname); - } - } + cur_frm.cscript.validate_print_rate_option(doc, cl, i); } cur_frm.cscript.recalc(doc, 1); } diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py index f131491553c..5411a5a04b6 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.py +++ b/erpnext/selling/doctype/sales_common/sales_common.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 @@ -385,7 +386,7 @@ class DocType(TransactionBase): return ret - def get_item_list(self, obj, is_stopped): + def get_item_list(self, obj, is_stopped=0): """get item list""" il = [] for d in getlist(obj.doclist,obj.fname): @@ -394,7 +395,7 @@ class DocType(TransactionBase): if is_stopped: qty = flt(d.qty) > flt(d.delivered_qty) and flt(flt(d.qty) - flt(d.delivered_qty)) or 0 - if d.prevdoc_doctype == 'Sales Order': + if d.prevdoc_doctype == 'Sales Order': # used in delivery note to reduce reserved_qty # Eg.: if SO qty is 10 and there is tolerance of 20%, then it will allow DN of 12. # But in this case reserved qty should only be reduced by 10 and not 12. @@ -413,7 +414,7 @@ class DocType(TransactionBase): if p.parent_detail_docname == d.name and p.parent_item == d.item_code: # the packing details table's qty is already multiplied with parent's qty il.append({ - 'warehouse': d.warehouse, + 'warehouse': p.warehouse, 'reserved_warehouse': reserved_wh, 'item_code': p.item_code, 'qty': flt(p.qty), @@ -496,23 +497,21 @@ class DocType(TransactionBase): pi.qty = flt(qty) pi.actual_qty = bin and flt(bin['actual_qty']) or 0 pi.projected_qty = bin and flt(bin['projected_qty']) or 0 - pi.warehouse = warehouse pi.prevdoc_doctype = line.prevdoc_doctype - if packing_item_code == line.item_code: - pi.serial_no = cstr(line.serial_no) + if not pi.warehouse: + pi.warehouse = warehouse + if not pi.batch_no: pi.batch_no = cstr(line.batch_no) pi.idx = self.packing_list_idx - # has to be saved, since this function is called on_update of delivery note + # saved, since this function is called on_update of delivery note pi.save() self.packing_list_idx += 1 - # ------------------ - # make packing list from sales bom if exists or directly copy item with balance - # ------------------ def make_packing_list(self, obj, fname): + """make packing list for sales bom item""" self.packing_list_idx = 0 parent_items = [] for d in getlist(obj.doclist, fname): @@ -520,10 +519,9 @@ class DocType(TransactionBase): if self.has_sales_bom(d.item_code): for i in self.get_sales_bom_items(d.item_code): self.update_packing_list_item(obj, i['item_code'], flt(i['qty'])*flt(d.qty), warehouse, d) - else: - self.update_packing_list_item(obj, d.item_code, d.qty, warehouse, d) - if [d.item_code, d.name] not in parent_items: - parent_items.append([d.item_code, d.name]) + + if [d.item_code, d.name] not in parent_items: + parent_items.append([d.item_code, d.name]) obj.doclist = self.cleanup_packing_list(obj, parent_items) diff --git a/erpnext/selling/doctype/sales_order/__init__.py b/erpnext/selling/doctype/sales_order/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/sales_order/__init__.py +++ b/erpnext/selling/doctype/sales_order/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index d9846002053..32c2e2694c2 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 @@ -181,19 +182,28 @@ class DocType(TransactionBase): if getdate(self.doc.transaction_date) > getdate(self.doc.delivery_date): msgprint("Expected Delivery Date cannot be before Sales Order Date") raise Exception - - # Validate P.O Date - # ------------------ - def validate_po_date(self): - # validate p.o date v/s delivery date - if self.doc.po_date and self.doc.delivery_date and getdate(self.doc.po_date) > getdate(self.doc.delivery_date): - msgprint("Expected Delivery Date cannot be before Purchase Order Date") - raise Exception # amendment date is necessary if document is amended if self.doc.amended_from and not self.doc.amendment_date: msgprint("Please Enter Amendment Date") raise Exception + + # Validate P.O Date + # ------------------ + def validate_po(self): + # validate p.o date v/s delivery date + if self.doc.po_date and self.doc.delivery_date and getdate(self.doc.po_date) > getdate(self.doc.delivery_date): + msgprint("Expected Delivery Date cannot be before Purchase Order Date") + raise Exception + + if self.doc.po_no and self.doc.customer: + so = webnotes.conn.sql("select name from `tabSales Order` \ + where ifnull(po_no, '') = %s and name != %s and docstatus < 2\ + and customer = %s", (self.doc.po_no, self.doc.name, self.doc.customer)) + if so and so[0][0]: + msgprint("""Another Sales Order (%s) exists against same PO No and Customer. + Please be sure, you are not making duplicate entry.""" % so[0][0]) + # Validations of Details Table # ----------------------------- def validate_for_items(self): @@ -277,7 +287,7 @@ class DocType(TransactionBase): self.validate_order_type() self.validate_mandatory() self.validate_proj_cust() - self.validate_po_date() + self.validate_po() #self.validate_reference_value() self.validate_for_items() sales_com_obj = get_obj(dt = 'Sales Common') diff --git a/erpnext/selling/doctype/sales_order/sales_order.txt b/erpnext/selling/doctype/sales_order/sales_order.txt index ca24ce2e079..bdb61263f10 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.txt +++ b/erpnext/selling/doctype/sales_order/sales_order.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-05-09 10:56:36', + 'creation': '2012-07-11 11:54:24', 'docstatus': 0, - 'modified': '2012-05-09 11:06:28', + 'modified': '2012-07-16 16:24:26', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -58,128 +58,6 @@ 'name': u'Sales Order' }, - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'match': u'owner', - 'permlevel': 0, - 'role': u'Sales User', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Maintenance User', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Maintenance Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Maintenance Manager', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales Manager', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 2, - 'role': u'Accounts User', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'match': u'customer', - 'permlevel': 0, - 'role': u'Customer', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Maintenance User', - 'submit': 0, - 'write': 0 - }, - # DocField { 'colour': u'White:FFF', @@ -588,7 +466,7 @@ 'description': u"Rate at which Price list currency is converted to company's base currency", 'doctype': u'DocField', 'fieldname': u'plc_conversion_rate', - 'fieldtype': u'Currency', + 'fieldtype': u'Float', 'label': u'Price List Currency Conversion Rate', 'permlevel': 0, 'print_hide': 1, @@ -628,7 +506,7 @@ 'description': u"Rate at which customer's currency is converted to company's base currency", 'doctype': u'DocField', 'fieldname': u'conversion_rate', - 'fieldtype': u'Currency', + 'fieldtype': u'Float', 'label': u'Conversion Rate', 'oldfieldname': u'conversion_rate', 'oldfieldtype': u'Currency', @@ -1391,5 +1269,107 @@ 'no_copy': 1, 'permlevel': 0, 'print_hide': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales Manager', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales User', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'match': u'customer_name', + 'permlevel': 0, + 'role': u'Customer' + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 2, + 'role': u'Accounts User', + 'write': 1 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Maintenance Manager', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Maintenance Manager' + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Maintenance User', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Maintenance User' } ] \ No newline at end of file diff --git a/erpnext/selling/doctype/sales_order_item/__init__.py b/erpnext/selling/doctype/sales_order_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/sales_order_item/__init__.py +++ b/erpnext/selling/doctype/sales_order_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/sales_team/__init__.py b/erpnext/selling/doctype/sales_team/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/sales_team/__init__.py +++ b/erpnext/selling/doctype/sales_team/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/shipping_address/__init__.py b/erpnext/selling/doctype/shipping_address/__init__.py index e69de29bb2d..baffc488252 100755 --- a/erpnext/selling/doctype/shipping_address/__init__.py +++ b/erpnext/selling/doctype/shipping_address/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/shipping_address/shipping_address.py b/erpnext/selling/doctype/shipping_address/shipping_address.py index 179e2d4937e..ac50d44a080 100755 --- a/erpnext/selling/doctype/shipping_address/shipping_address.py +++ b/erpnext/selling/doctype/shipping_address/shipping_address.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes sql = webnotes.conn.sql diff --git a/erpnext/selling/doctype/sms_center/__init__.py b/erpnext/selling/doctype/sms_center/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/doctype/sms_center/__init__.py +++ b/erpnext/selling/doctype/sms_center/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/doctype/sms_center/sms_center.py b/erpnext/selling/doctype/sms_center/sms_center.py index 579f1a8bcc4..372edb742ab 100644 --- a/erpnext/selling/doctype/sms_center/sms_center.py +++ b/erpnext/selling/doctype/sms_center/sms_center.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/selling/page/__init__.py b/erpnext/selling/page/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/page/__init__.py +++ b/erpnext/selling/page/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/page/sales_browser/__init__.py b/erpnext/selling/page/sales_browser/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/page/sales_browser/__init__.py +++ b/erpnext/selling/page/sales_browser/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/page/sales_browser/sales_browser.js b/erpnext/selling/page/sales_browser/sales_browser.js index 532728a99df..8dde63d0032 100644 --- a/erpnext/selling/page/sales_browser/sales_browser.js +++ b/erpnext/selling/page/sales_browser/sales_browser.js @@ -31,7 +31,12 @@ pscript['onload_Sales Browser'] = function(wrapper){ pscript['onshow_Sales Browser'] = function(wrapper){ // set route var ctype = wn.get_route()[1] || 'Territory'; - wrapper.appframe.title(ctype + ' Tree'); + + wrapper.appframe.clear_breadcrumbs(); + wrapper.appframe.add_breadcrumb(ctype+' Tree') + document.title = ctype+' Tree'; + + wrapper.appframe.add_breadcrumb(' in Selling'); if(erpnext.sales_chart && erpnext.sales_chart.ctype != ctype) { wrapper.make_tree(); diff --git a/erpnext/selling/page/sales_browser/sales_browser.py b/erpnext/selling/page/sales_browser/sales_browser.py index d5419f55758..92c75e0fcdb 100644 --- a/erpnext/selling/page/sales_browser/sales_browser.py +++ b/erpnext/selling/page/sales_browser/sales_browser.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import webnotes @webnotes.whitelist() diff --git a/erpnext/selling/page/sales_dashboard/__init__.py b/erpnext/selling/page/sales_dashboard/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/page/sales_dashboard/__init__.py +++ b/erpnext/selling/page/sales_dashboard/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/page/selling_home/__init__.py b/erpnext/selling/page/selling_home/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/page/selling_home/__init__.py +++ b/erpnext/selling/page/selling_home/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/page/selling_home/selling_home.html b/erpnext/selling/page/selling_home/selling_home.html index 4857def11be..164d3653e57 100644 --- a/erpnext/selling/page/selling_home/selling_home.html +++ b/erpnext/selling/page/selling_home/selling_home.html @@ -77,6 +77,11 @@ title = "Commission partners and targets" href="#!List/Sales Partner">Sales Partner
    + diff --git a/erpnext/selling/search_criteria/__init__.py b/erpnext/selling/search_criteria/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/__init__.py +++ b/erpnext/selling/search_criteria/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/customer_address_contact/__init__.py b/erpnext/selling/search_criteria/customer_address_contact/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/customer_address_contact/__init__.py +++ b/erpnext/selling/search_criteria/customer_address_contact/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.py b/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.py index 2d3e4c304bf..4ec0e1afc7a 100644 --- a/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.py +++ b/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals col_defs = [ {'label': 'Id', 'type': 'Link', 'width': '', 'options': 'Customer'}, {'label': 'Customer Name'}, diff --git a/erpnext/selling/search_criteria/delivered_items_to_be_install/__init__.py b/erpnext/selling/search_criteria/delivered_items_to_be_install/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/delivered_items_to_be_install/__init__.py +++ b/erpnext/selling/search_criteria/delivered_items_to_be_install/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/delivery_note_itemwise_pending_to_bill/__init__.py b/erpnext/selling/search_criteria/delivery_note_itemwise_pending_to_bill/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/delivery_note_itemwise_pending_to_bill/__init__.py +++ b/erpnext/selling/search_criteria/delivery_note_itemwise_pending_to_bill/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/draft_sales_orders/__init__.py b/erpnext/selling/search_criteria/draft_sales_orders/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/draft_sales_orders/__init__.py +++ b/erpnext/selling/search_criteria/draft_sales_orders/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/follow_up_report/__init__.py b/erpnext/selling/search_criteria/follow_up_report/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/follow_up_report/__init__.py +++ b/erpnext/selling/search_criteria/follow_up_report/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/follow_up_report/follow_up_report.py b/erpnext/selling/search_criteria/follow_up_report/follow_up_report.py index 85c37dcd361..40066274d22 100644 --- a/erpnext/selling/search_criteria/follow_up_report/follow_up_report.py +++ b/erpnext/selling/search_criteria/follow_up_report/follow_up_report.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals follow_up_on = filter_values.get('follow_up_on') cols = [['Document Type', 'Data', '150px', ''] diff --git a/erpnext/selling/search_criteria/gross_profit/__init__.py b/erpnext/selling/search_criteria/gross_profit/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/gross_profit/__init__.py +++ b/erpnext/selling/search_criteria/gross_profit/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/gross_profit/gross_profit.py b/erpnext/selling/search_criteria/gross_profit/gross_profit.py index d1b0a864e4d..97821d3aecb 100644 --- a/erpnext/selling/search_criteria/gross_profit/gross_profit.py +++ b/erpnext/selling/search_criteria/gross_profit/gross_profit.py @@ -16,6 +16,7 @@ # Add Columns # ------------ +from __future__ import unicode_literals colnames[colnames.index('Rate*')] = 'Rate' col_idx['Rate'] = col_idx['Rate*'] col_idx.pop('Rate*') diff --git a/erpnext/selling/search_criteria/itemwise_delivery_details/__init__.py b/erpnext/selling/search_criteria/itemwise_delivery_details/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/itemwise_delivery_details/__init__.py +++ b/erpnext/selling/search_criteria/itemwise_delivery_details/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.py b/erpnext/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.py index 8f868e92ddb..0529d1b92de 100644 --- a/erpnext/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.py +++ b/erpnext/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals out=[] qty,amt,bill_amt=0,0,0 diff --git a/erpnext/selling/search_criteria/itemwise_sales_details/__init__.py b/erpnext/selling/search_criteria/itemwise_sales_details/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/itemwise_sales_details/__init__.py +++ b/erpnext/selling/search_criteria/itemwise_sales_details/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.py b/erpnext/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.py index ba161dd5c73..1b7a19524fd 100644 --- a/erpnext/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.py +++ b/erpnext/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals out=[] qty,amt,del_qty,bill_amt=0,0,0,0 diff --git a/erpnext/selling/search_criteria/lead_to_follow_up/__init__.py b/erpnext/selling/search_criteria/lead_to_follow_up/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/lead_to_follow_up/__init__.py +++ b/erpnext/selling/search_criteria/lead_to_follow_up/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/opportunity_to_follow_up/__init__.py b/erpnext/selling/search_criteria/opportunity_to_follow_up/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/opportunity_to_follow_up/__init__.py +++ b/erpnext/selling/search_criteria/opportunity_to_follow_up/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/sales_order_pending_items/__init__.py b/erpnext/selling/search_criteria/sales_order_pending_items/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/sales_order_pending_items/__init__.py +++ b/erpnext/selling/search_criteria/sales_order_pending_items/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/sales_orderwise_booking_&_delivery_summary/__init__.py b/erpnext/selling/search_criteria/sales_orderwise_booking_&_delivery_summary/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/sales_orderwise_booking_&_delivery_summary/__init__.py +++ b/erpnext/selling/search_criteria/sales_orderwise_booking_&_delivery_summary/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/sales_orderwise_pending_amount_to_bill/__init__.py b/erpnext/selling/search_criteria/sales_orderwise_pending_amount_to_bill/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/sales_orderwise_pending_amount_to_bill/__init__.py +++ b/erpnext/selling/search_criteria/sales_orderwise_pending_amount_to_bill/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/sales_orderwise_pending_qty_to_deliver/__init__.py b/erpnext/selling/search_criteria/sales_orderwise_pending_qty_to_deliver/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/sales_orderwise_pending_qty_to_deliver/__init__.py +++ b/erpnext/selling/search_criteria/sales_orderwise_pending_qty_to_deliver/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/__init__.py b/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/__init__.py +++ b/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.py b/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.py index e3f8d6730f0..9656a756f29 100644 --- a/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.py +++ b/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # validate Filters +from __future__ import unicode_literals flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period', 'under' : 'Under', 'sales_person':'Sales Person', 'target_on':'Target On'} for f in flt_dict: if not filter_values.get(f): diff --git a/erpnext/selling/search_criteria/sales_personwise_transaction_summary/__init__.py b/erpnext/selling/search_criteria/sales_personwise_transaction_summary/__init__.py index e69de29bb2d..baffc488252 100755 --- a/erpnext/selling/search_criteria/sales_personwise_transaction_summary/__init__.py +++ b/erpnext/selling/search_criteria/sales_personwise_transaction_summary/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.py b/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.py index 7b1d6b9c6c0..632e5459052 100755 --- a/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.py +++ b/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals if filter_values.get('based_on') == 'Sales Invoice': based_on_dt = 'Sales Invoice' else: diff --git a/erpnext/selling/search_criteria/serial_no_amc_expiring_this_month/__init__.py b/erpnext/selling/search_criteria/serial_no_amc_expiring_this_month/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/serial_no_amc_expiring_this_month/__init__.py +++ b/erpnext/selling/search_criteria/serial_no_amc_expiring_this_month/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/serial_no_warranty_expiring_this_month/__init__.py b/erpnext/selling/search_criteria/serial_no_warranty_expiring_this_month/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/serial_no_warranty_expiring_this_month/__init__.py +++ b/erpnext/selling/search_criteria/serial_no_warranty_expiring_this_month/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/target_variance_report/__init__.py b/erpnext/selling/search_criteria/target_variance_report/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/target_variance_report/__init__.py +++ b/erpnext/selling/search_criteria/target_variance_report/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/target_variance_report/target_variance_report.py b/erpnext/selling/search_criteria/target_variance_report/target_variance_report.py index aa673559547..ea11f1b67f0 100644 --- a/erpnext/selling/search_criteria/target_variance_report/target_variance_report.py +++ b/erpnext/selling/search_criteria/target_variance_report/target_variance_report.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # validate Filters +from __future__ import unicode_literals flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period', 'company':'Company', 'under' : 'Under', 'based_on' : 'Based On'} for f in flt_dict: if not filter_values.get(f): diff --git a/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/__init__.py b/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/__init__.py +++ b/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.py b/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.py index 85eb52808da..0ba3fc31f17 100644 --- a/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.py +++ b/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # validate Filters +from __future__ import unicode_literals flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period', 'under' : 'Under', 'territory':'Territory', 'target_on':'Target On'} for f in flt_dict: if not filter_values.get(f): diff --git a/erpnext/selling/search_criteria/territory_sales___variance_report/__init__.py b/erpnext/selling/search_criteria/territory_sales___variance_report/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/territory_sales___variance_report/__init__.py +++ b/erpnext/selling/search_criteria/territory_sales___variance_report/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.py b/erpnext/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.py index 0cc3af99bc8..e9e40aa6140 100644 --- a/erpnext/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.py +++ b/erpnext/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals if filter_values.get('period'): period_values = filter_values['period'] if len(period_values.split(NEWLINE))>1: diff --git a/erpnext/selling/search_criteria/total_target_variance_report/__init__.py b/erpnext/selling/search_criteria/total_target_variance_report/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/total_target_variance_report/__init__.py +++ b/erpnext/selling/search_criteria/total_target_variance_report/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/total_target_variance_report/total_target_variance_report.py b/erpnext/selling/search_criteria/total_target_variance_report/total_target_variance_report.py index fde72371965..a0663fd82ae 100644 --- a/erpnext/selling/search_criteria/total_target_variance_report/total_target_variance_report.py +++ b/erpnext/selling/search_criteria/total_target_variance_report/total_target_variance_report.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # validate Filters +from __future__ import unicode_literals flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period', 'under' : 'Under', 'based_on' : 'Based On','target_on':'Target On'} for f in flt_dict: if not filter_values.get(f): diff --git a/erpnext/selling/search_criteria/variance_report/__init__.py b/erpnext/selling/search_criteria/variance_report/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/selling/search_criteria/variance_report/__init__.py +++ b/erpnext/selling/search_criteria/variance_report/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/selling/search_criteria/variance_report/variance_report.py b/erpnext/selling/search_criteria/variance_report/variance_report.py index f200f111a02..7b6856c157f 100644 --- a/erpnext/selling/search_criteria/variance_report/variance_report.py +++ b/erpnext/selling/search_criteria/variance_report/variance_report.py @@ -16,6 +16,7 @@ # Add columns # ----------- +from __future__ import unicode_literals row_list = [['ID','Data','150px','']] for r in row_list: diff --git a/erpnext/setup/__init__.py b/erpnext/setup/__init__.py index c4b3773744f..dfc93b57a79 100644 --- a/erpnext/setup/__init__.py +++ b/erpnext/setup/__init__.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals install_docs = [ {'doctype':'Role', 'role_name': 'System Manager', 'name': 'System Manager'} ] diff --git a/erpnext/setup/doctype/__init__.py b/erpnext/setup/doctype/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/__init__.py +++ b/erpnext/setup/doctype/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/authorization_control/__init__.py b/erpnext/setup/doctype/authorization_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/authorization_control/__init__.py +++ b/erpnext/setup/doctype/authorization_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/authorization_control/authorization_control.py b/erpnext/setup/doctype/authorization_control/authorization_control.py index 33b63b83e63..a49c3f81f19 100644 --- a/erpnext/setup/doctype/authorization_control/authorization_control.py +++ b/erpnext/setup/doctype/authorization_control/authorization_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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, make_esc diff --git a/erpnext/setup/doctype/authorization_rule/__init__.py b/erpnext/setup/doctype/authorization_rule/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/authorization_rule/__init__.py +++ b/erpnext/setup/doctype/authorization_rule/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/authorization_rule/authorization_rule.py b/erpnext/setup/doctype/authorization_rule/authorization_rule.py index 17b4df63ec3..0d5721b2389 100644 --- a/erpnext/setup/doctype/authorization_rule/authorization_rule.py +++ b/erpnext/setup/doctype/authorization_rule/authorization_rule.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/setup/doctype/brand/__init__.py b/erpnext/setup/doctype/brand/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/brand/__init__.py +++ b/erpnext/setup/doctype/brand/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/company/__init__.py b/erpnext/setup/doctype/company/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/company/__init__.py +++ b/erpnext/setup/doctype/company/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 11ed655ce49..38c689e0bce 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 @@ -166,6 +167,8 @@ class DocType: ac.fields[d] = (d == 'parent_account' and lst[self.fld_dict[d]]) and lst[self.fld_dict[d]] +' - '+ self.doc.abbr or lst[self.fld_dict[d]] ac.old_parent = '' ac_obj = get_obj(doc=ac) + ac_obj.doc.freeze_account='No' + ac_obj.doc.master_type = '' ac_obj.validate() ac_obj.doc.save(1) ac_obj.on_update() diff --git a/erpnext/setup/doctype/company/company.txt b/erpnext/setup/doctype/company/company.txt index f625ac5d054..1502ed420e6 100644 --- a/erpnext/setup/doctype/company/company.txt +++ b/erpnext/setup/doctype/company/company.txt @@ -85,11 +85,11 @@ # DocField { - 'description': u'Please Enter Company Name and Abbr and save the document. Once saved Accounting Settings will be populated automatically', + 'colour': u'White:FFF', 'doctype': u'DocField', 'fieldname': u'details', 'fieldtype': u'Section Break', - 'label': u'Details', + 'label': u'Company Details', 'oldfieldtype': u'Section Break', 'permlevel': 0 }, @@ -108,6 +108,14 @@ 'reqd': 1 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'cb0', + 'fieldtype': u'Column Break', + 'permlevel': 0 + }, + # DocField { 'colour': u'White:FFF', @@ -252,6 +260,8 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'For reference only.', 'doctype': u'DocField', 'fieldname': u'company_info', 'fieldtype': u'Section Break', diff --git a/erpnext/setup/doctype/contact_control/__init__.py b/erpnext/setup/doctype/contact_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/contact_control/__init__.py +++ b/erpnext/setup/doctype/contact_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/contact_control/contact_control.py b/erpnext/setup/doctype/contact_control/contact_control.py index afa4d05e466..09088d1cae9 100644 --- a/erpnext/setup/doctype/contact_control/contact_control.py +++ b/erpnext/setup/doctype/contact_control/contact_control.py @@ -1,4 +1,5 @@ # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/setup/doctype/country/__init__.py b/erpnext/setup/doctype/country/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/country/__init__.py +++ b/erpnext/setup/doctype/country/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/currency/__init__.py b/erpnext/setup/doctype/currency/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/currency/__init__.py +++ b/erpnext/setup/doctype/currency/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/currency/currency.js b/erpnext/setup/doctype/currency/currency.js new file mode 100644 index 00000000000..cd42c189565 --- /dev/null +++ b/erpnext/setup/doctype/currency/currency.js @@ -0,0 +1,3 @@ +cur_frm.cscript.refresh = function(doc) { + cur_frm.set_intro(doc.__islocal ? "" : "There is nothing to edit.") +} \ No newline at end of file diff --git a/erpnext/setup/doctype/currency/currency.txt b/erpnext/setup/doctype/currency/currency.txt index 5abf9c5932f..906e2f8a7d4 100644 --- a/erpnext/setup/doctype/currency/currency.txt +++ b/erpnext/setup/doctype/currency/currency.txt @@ -3,17 +3,19 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:19', + 'creation': '2012-07-03 13:30:55', 'docstatus': 0, - 'modified': '2012-03-27 14:36:19', + 'modified': '2012-07-11 16:11:45', 'modified_by': u'Administrator', 'owner': u'Administrator' }, # These values are common for all DocType { + 'allow_trash': 1, 'autoname': u'field:currency_name', 'colour': u'White:FFF', + 'description': u'**Currency** Master', 'doctype': 'DocType', 'in_create': 0, 'module': u'Setup', @@ -22,7 +24,7 @@ 'section_style': u'Simple', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 3 + 'version': 1 }, # These values are common for all DocField @@ -60,10 +62,17 @@ 'name': u'Currency' }, + # DocPerm + { + 'cancel': 1, + 'doctype': u'DocPerm', + 'role': u'Accounts Manager' + }, + # DocPerm { 'amend': 0, - 'cancel': 0, + 'cancel': 1, 'doctype': u'DocPerm', 'role': u'Sales Master Manager', 'submit': 0 @@ -78,12 +87,6 @@ 'submit': 0 }, - # DocPerm - { - 'doctype': u'DocPerm', - 'role': u'Accounts Manager' - }, - # DocField { 'doctype': u'DocField' diff --git a/erpnext/setup/doctype/customer_group/__init__.py b/erpnext/setup/doctype/customer_group/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/customer_group/__init__.py +++ b/erpnext/setup/doctype/customer_group/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/customer_group/customer_group.js b/erpnext/setup/doctype/customer_group/customer_group.js index 11794cc56a2..67bc29368ea 100644 --- a/erpnext/setup/doctype/customer_group/customer_group.js +++ b/erpnext/setup/doctype/customer_group/customer_group.js @@ -14,21 +14,22 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . - - -cur_frm.cscript.onload = function(){ - - if(doc.__islocal){ - doc.parent_customer_group = 'Root'; - refresh('parent_customer_group'); - } +cur_frm.cscript.set_breadcrumbs = function(barea) { + cur_frm.frm_head.appframe.add_breadcrumb(cur_frm.docname); + cur_frm.frm_head.appframe.add_breadcrumb(' in \ + Customer Group Tree'); + cur_frm.frm_head.appframe.add_breadcrumb(' in Selling'); } + cur_frm.cscript.refresh = function(doc, cdt, cdn) { } //get query select Customer Group cur_frm.fields_dict['parent_customer_group'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabCustomer Group`.`name`,`tabCustomer Group`.`parent_customer_group` FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "Yes" AND `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50'; + return 'SELECT `tabCustomer Group`.`name`,`tabCustomer Group`.`parent_customer_group` \ + FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "Yes" AND \ + `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" \ + ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50'; } \ No newline at end of file diff --git a/erpnext/setup/doctype/customer_group/customer_group.py b/erpnext/setup/doctype/customer_group/customer_group.py index 375fd7d4814..9831024e069 100644 --- a/erpnext/setup/doctype/customer_group/customer_group.py +++ b/erpnext/setup/doctype/customer_group/customer_group.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/setup/doctype/customer_group/customer_group.txt b/erpnext/setup/doctype/customer_group/customer_group.txt index ceda674306a..5e44bef6a8d 100644 --- a/erpnext/setup/doctype/customer_group/customer_group.txt +++ b/erpnext/setup/doctype/customer_group/customer_group.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-04-13 11:56:30', + 'creation': '2012-07-03 13:30:55', 'docstatus': 0, - 'modified': '2012-04-19 17:50:43', + 'modified': '2012-07-12 09:47:20', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -22,6 +22,7 @@ 'in_create': 1, 'module': u'Setup', 'name': '__common__', + 'read_only': 1, 'search_fields': u'name,parent_customer_group', 'section_style': u'Simple', 'server_code_error': u' ', @@ -140,18 +141,6 @@ 'reqd': 1 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'description', - 'fieldtype': u'Text', - 'label': u'Description', - 'oldfieldname': u'description', - 'oldfieldtype': u'Text', - 'permlevel': 0, - 'width': u'300px' - }, - # DocField { 'colour': u'White:FFF', @@ -184,6 +173,16 @@ # DocField { + 'doctype': u'DocField', + 'fieldname': u'cb0', + 'fieldtype': u'Column Break', + 'permlevel': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'This Price List will be selected as default for all Customers under this Group.', 'doctype': u'DocField', 'fieldname': u'default_price_list', 'fieldtype': u'Link', diff --git a/erpnext/setup/doctype/email_digest/__init__.py b/erpnext/setup/doctype/email_digest/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/email_digest/__init__.py +++ b/erpnext/setup/doctype/email_digest/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/email_digest/email_digest.js b/erpnext/setup/doctype/email_digest/email_digest.js index 1380e779ab5..0ff57363d79 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.js +++ b/erpnext/setup/doctype/email_digest/email_digest.js @@ -22,7 +22,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) { cur_frm.add_custom_button('View Now', function() { doc = locals[dt][dn]; if(doc.__unsaved != 1) { - $c_obj(make_doclist(dt, dn), 'get', '', function(r, rt) { + $c_obj(make_doclist(dt, dn), 'get_digest_msg', '', function(r, rt) { if(r.exc) { msgprint(err_msg); console.log(r.exc); @@ -33,7 +33,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) { width: 800 }); - $a(d.body, 'div', '', '', r['message'][1]); + $a(d.body, 'div', '', '', r['message']); d.show(); } @@ -116,7 +116,7 @@ cur_frm.cscript.add_to_rec_list = function(doc, tab, length) { } } doc.recipient_list = rec_list.join('\n'); - //console.log(doc.recipient_list); cur_frm.rec_dialog.hide(); + cur_frm.save(); cur_frm.refresh_fields(); } diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py index 6a637442e89..a34066c5050 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.py +++ b/erpnext/setup/doctype/email_digest/email_digest.py @@ -14,698 +14,333 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes -import webnotes.utils +from webnotes.utils import fmt_money, formatdate, now_datetime, cstr, esc +from datetime import timedelta +from dateutil.relativedelta import relativedelta + +content_sequence = ["income_year_to_date", "bank_balance", + "income", "expenses_booked", "collections", "payments", + "invoiced_amount", "payables", + "new_leads", "new_enquiries", "new_quotations", "new_sales_orders", + "new_delivery_notes", "new_purchase_requests", "new_supplier_quotations", + "new_purchase_orders", "new_purchase_receipts", "new_stock_entries", + "new_support_tickets", "new_communications", "new_projects"] class DocType: def __init__(self, doc, doclist=[]): self.doc, self.doclist = doc, doclist - self.sending = False - def get_profiles(self): - """ - Get a list of profiles - """ + """get list of profiles""" import webnotes profile_list = webnotes.conn.sql(""" - SELECT name, enabled FROM tabProfile - WHERE docstatus=0 AND name NOT IN ('Administrator', 'Guest') - ORDER BY enabled DESC, name ASC""", as_dict=1) + select name, enabled from tabProfile + where docstatus=0 and name not in ('Administrator', 'Guest') + order by enabled desc, name asc""", as_dict=1) + if self.doc.recipient_list: recipient_list = self.doc.recipient_list.split("\n") else: recipient_list = [] for p in profile_list: - if p['name'] in recipient_list: p['checked'] = 1 - else: p['checked'] = 0 + p["checked"] = p["name"] in recipient_list and 1 or 0 + webnotes.response['profile_list'] = profile_list - - - def get_standard_data(self): - """ - Executes standard queries - """ - res = {} - query_dict = { - - 'invoiced_amount': self.generate_gle_query({ - 'type': 'invoiced_amount', - 'field': 'debit', - 'master_type': 'Customer', - }), - - 'payables': self.generate_gle_query({ - 'type': 'payables', - 'field': 'credit', - 'master_type': 'Supplier', - }), - - 'collections': self.generate_gle_query({ - 'type': 'collections', - 'field': 'credit', - 'master_type': 'Customer', - }), - - 'payments': self.generate_gle_query({ - 'type': 'payments', - 'field': 'debit', - 'master_type': 'Supplier', - }), - - 'income': self.generate_gle_query({ - 'type': 'income', - 'debit_or_credit': 'Credit' - }), - - 'income_year_to_date': self.generate_gle_query({ - 'type': 'income_year_to_date', - 'debit_or_credit': 'Credit' - }), - - 'expenses_booked': self.generate_gle_query({ - 'type': 'expenses_booked', - 'debit_or_credit': 'Debit' - }), - - 'bank_balance': self.generate_gle_query({ - 'type': 'bank_balance' - }), - - 'new_leads': self.generate_new_type_query({ - 'type': 'new_leads', - 'doctype': 'Lead' - }), - - 'new_enquiries': self.generate_new_type_query({ - 'type': 'new_enquiries', - 'doctype': 'Opportunity' - }), - - 'new_quotations': self.generate_new_type_query({ - 'type': 'new_quotations', - 'doctype': 'Quotation', - 'sum_col': 'grand_total' - }), - - 'new_sales_orders': self.generate_new_type_query({ - 'type': 'new_sales_orders', - 'doctype': 'Sales Order', - 'sum_col': 'grand_total' - }), - - 'new_purchase_orders': self.generate_new_type_query({ - 'type': 'new_purchase_orders', - 'doctype': 'Purchase Order', - 'sum_col': 'grand_total' - }), - - 'new_transactions': self.generate_new_type_query({ - 'type': 'new_transactions', - 'doctype': 'Feed' - }), - - 'stock_below_rl': "" - } - - result = {} - - for query in query_dict.keys(): - if self.doc.fields[query] and query_dict[query]: - # webnotes.errprint(query) - res = webnotes.conn.sql(query_dict[query], as_dict=1) - if query in ['income', 'income_year_to_date']: - for r in res: - r['value'] = float(r['credit'] - r['debit']) - elif query in ['expenses_booked', 'bank_balance']: - for r in res: - r['value'] = float(r['debit'] - r['credit']) - #webnotes.msgprint(query) - #webnotes.msgprint(res) - result[query] = res and (len(res)==1 and res[0]) or (res or None) - if result[query] is None: - del result[query] - - return result - - - def generate_gle_query(self, args): - """ - Returns generated query string based 'tabGL Entry' and 'tabAccount' - """ - self.process_args(args) - - query = None - - if args['type'] in ['invoiced_amount', 'payables']: - query = """ - SELECT - IFNULL(SUM(IFNULL(gle.%(field)s, 0)), 0) AS '%(field)s', - %(common_select)s - FROM - %(common_from)s - WHERE - %(common_where)s AND - ac.master_type = '%(master_type)s' AND - %(start_date_condition)s AND - %(end_date_condition)s""" % args - - elif args['type'] in ['collections', 'payments']: - args['bc_accounts_regex'] = self.get_bc_accounts_regex() - if args['bc_accounts_regex']: - query = """ - SELECT - IFNULL(SUM(IFNULL(gle.%(field)s, 0)), 0) AS '%(field)s', - %(common_select)s - FROM - %(common_from)s - WHERE - %(common_where)s AND - ac.master_type = '%(master_type)s' AND - gle.against REGEXP '%(bc_accounts_regex)s' AND - %(start_date_condition)s AND - %(end_date_condition)s""" % args - - elif args['type'] in ['income', 'expenses_booked']: - query = """ - SELECT - IFNULL(SUM(IFNULL(gle.debit, 0)), 0) AS 'debit', - IFNULL(SUM(IFNULL(gle.credit, 0)), 0) AS 'credit', - %(common_select)s - FROM - %(common_from)s - WHERE - %(common_where)s AND - ac.is_pl_account = 'Yes' AND - ac.debit_or_credit = '%(debit_or_credit)s' AND - %(start_date_condition)s AND - %(end_date_condition)s""" % args - - elif args['type'] == 'income_year_to_date': - query = """ - SELECT - IFNULL(SUM(IFNULL(gle.debit, 0)), 0) AS 'debit', - IFNULL(SUM(IFNULL(gle.credit, 0)), 0) AS 'credit', - %(common_select)s - FROM - %(common_from)s - WHERE - %(common_where)s AND - ac.is_pl_account = 'Yes' AND - ac.debit_or_credit = '%(debit_or_credit)s' AND - %(fiscal_start_date_condition)s AND - %(end_date_condition)s""" % args - - elif args['type'] == 'bank_balance': - query = """ - SELECT - ac.account_name AS 'name', - IFNULL(SUM(IFNULL(gle.debit, 0)), 0) AS 'debit', - IFNULL(SUM(IFNULL(gle.credit, 0)), 0) AS 'credit', - %(common_select)s - FROM - %(common_from)s - WHERE - %(common_where)s AND - ac.account_type = 'Bank or Cash' AND - %(end_date_condition)s - GROUP BY - ac.account_name""" % args - - return query - - - def process_args(self, args): - """ - Adds common conditions in dictionary "args" - """ - start_date, end_date = self.get_start_end_dates() - fiscal_year = webnotes.utils.get_defaults()['fiscal_year'] - fiscal_start_date = webnotes.conn.get_value('Fiscal Year', fiscal_year, - 'year_start_date') - - if 'new' in args['type']: - args.update({ - 'company': self.doc.company, - 'start_date': start_date, - 'end_date': end_date, - 'sum_if_reqd': '' - }) - if args['type'] in ['new_quotations', 'new_sales_orders', 'new_purchase_orders']: - args['sum_if_reqd'] = "IFNULL(SUM(IFNULL(%(sum_col)s, 0)), 0) AS '%(sum_col)s'," % args - - if args['type'] == 'new_transactions': - # tabFeed doesn't have company column - # using this arg to set condition of feed_type as null - # so that comments, logins and assignments are not counted - args['company_condition'] = "feed_type IS NULL AND" - else: - args['company_condition'] = "company = '%(company)s' AND" % args - - else: - args.update({ - 'common_select': "COUNT(*) AS 'count'", - - 'common_from': "`tabGL Entry` gle, `tabAccount` ac", - - 'common_where': """ - gle.company = '%s' AND - gle.account = ac.name AND - ac.docstatus < 2 AND - IFNULL(gle.is_cancelled, 'No') = 'No'""" % self.doc.company, - - 'start_date_condition': "gle.posting_date >= '%s'" % start_date, - - 'end_date_condition': "gle.posting_date <= '%s'" % end_date, - - 'fiscal_start_date_condition': "gle.posting_date >= '%s'" % fiscal_start_date - }) - - - def get_start_end_dates(self): - """ - Returns start and end date depending on the frequency of email digest - """ - from datetime import datetime, date, timedelta - from webnotes.utils import now_datetime - today = now_datetime().date() - year, month, day = today.year, today.month, today.day - - if self.doc.frequency == 'Daily': - if self.sending: - start_date = end_date = today - timedelta(days=1) - else: - start_date = end_date = today - - elif self.doc.frequency == 'Weekly': - if self.sending: - start_date = today - timedelta(days=today.weekday(), weeks=1) - end_date = start_date + timedelta(days=6) - else: - start_date = today - timedelta(days=today.weekday()) - end_date = start_date + timedelta(days=6) - - else: - import calendar - - if self.sending: - if month == 1: - year = year - 1 - prev_month = 12 - else: - prev_month = month - 1 - start_date = date(year, prev_month, 1) - last_day = calendar.monthrange(year, prev_month)[1] - end_date = date(year, prev_month, last_day) - else: - start_date = date(year, month, 1) - last_day = calendar.monthrange(year, month)[1] - end_date = date(year, month, last_day) - - return start_date, end_date - - - def generate_new_type_query(self, args): - """ - Returns generated query string for calculating new transactions created - """ - self.process_args(args) - - query = """ - SELECT - %(sum_if_reqd)s - COUNT(*) AS 'count' - FROM - `tab%(doctype)s` - WHERE - docstatus < 2 AND - %(company_condition)s - DATE(creation) >= '%(start_date)s' AND - DATE(creation) <= '%(end_date)s'""" % args - - return query - - def get_bc_accounts_regex(self): - """ - Returns a regular expression of 'Bank or Cash' type account list - """ - bc_account_list = webnotes.conn.sql(""" - SELECT name - FROM `tabAccount` - WHERE account_type = 'Bank or Cash'""", as_list=1) - - if bc_account_list: - return '(' + '|'.join([ac[0] for ac in bc_account_list]) + ')' - - - def get(self): - """ - * Execute Query - * Prepare Email Body from Print Format - """ - result, email_body = self.execute_queries() - #webnotes.msgprint(result) - #webnotes.msgprint(email_body) - return result, email_body - - - def execute_queries(self): - """ - * If standard==1, execute get_standard_data - * If standard==0, execute python code in custom_code field - """ - result = {} - if int(self.doc.use_standard)==1: - result = self.get_standard_data() - email_body = self.get_standard_body(result) - else: - result, email_body = self.execute_custom_code(self.doc) - - #webnotes.msgprint(result) - - return result, email_body - - - def execute_custom_code(self, doc): - """ - Execute custom python code - """ - pass - - def send(self): - """ - * Execute get method - * Send email to recipients - """ - if not self.doc.recipient_list: return - - self.sending = True - result, email_body = self.get() + # send email only to enabled users + valid_users = [p[0] for p in webnotes.conn.sql("""select name from `tabProfile` + where enabled=1""")] + recipients = filter(lambda r: r in valid_users, + self.doc.recipient_list.split("\n")) - recipient_list = self.doc.recipient_list.split("\n") - - # before sending, check if user is disabled or not - # do not send if disabled - profile_list = webnotes.conn.sql("SELECT name, enabled FROM tabProfile", as_dict=1) - for profile in profile_list: - if profile['name'] in recipient_list and profile['enabled'] == 0: - del recipient_list[recipient_list.index(profile['name'])] - from webnotes.utils.email_lib import sendmail - try: - sendmail( - recipients=recipient_list, - sender='notifications+email_digest@erpnext.com', - subject=self.doc.frequency + ' Digest', - msg=email_body - ) - except Exception, e: - webnotes.msgprint('There was a problem in sending your email. Please contact support@erpnext.com') - webnotes.errprint(webnotes.getTraceback()) + sendmail(recipients=recipients, subject=(self.doc.frequency + " Digest"), + sender="ERPNext Notifications ", + msg=self.get_digest_msg()) + + def get_digest_msg(self): + """""" + self.from_date, self.to_date = self.get_from_to_date() + self.currency = webnotes.conn.get_value("Company", self.doc.company, + "default_currency") + + out = [] + for ctype in content_sequence: + if self.doc.fields.get(ctype) and hasattr(self, "get_"+ctype): + # appends [value, html] + out.append(getattr(self, "get_"+ctype)()) + + return self.get_msg_html(out) + + def get_msg_html(self, out): + with_value = "\n".join([o[1] for o in out if o[0]]) + + # seperate out no value items + no_value = [o[1] for o in out if not o[0]] + if no_value: + no_value = """

    No Updates For:


    """ + "\n".join(no_value) + + date = self.doc.frequency == "Daily" and formatdate(self.from_date) or \ + "%s to %s" % (formatdate(self.from_date), formatdate(self.to_date)) + + msg = """

    %(digest)s

    +

    %(date)s

    +

    %(company)s

    +
    + %(with_value)s + %(no_value)s""" % { + "digest": self.doc.frequency + " Digest", + "date": date, + "company": self.doc.company, + "with_value": with_value, + "no_value": no_value or "" + } + + return msg + + def get_income_year_to_date(self): + return self.get_income(webnotes.conn.get_defaults("year_start_date"), + "Income Year To Date") + + def get_bank_balance(self): + # account is of type "Bank or Cash" + accounts = dict([[a["name"], [a["account_name"], 0]] for a in self.get_accounts() + if a["account_type"]=="Bank or Cash"]) + ackeys = accounts.keys() + + for gle in self.get_gl_entries(None, self.to_date): + if gle["account"] in ackeys: + accounts[gle["account"]][1] += gle["debit"] - gle["credit"] + + # build html + out = self.get_html("Bank/Cash Balance", "", "") + for ac in ackeys: + if accounts[ac][1]: + out += "\n" + self.get_html(accounts[ac][0], self.currency, + fmt_money(accounts[ac][1]), style="margin-left: 17px") + return sum((accounts[ac][1] for ac in ackeys)), out + + def get_income(self, from_date=None, label=None): + # account is PL Account and Credit type account + accounts = [a["name"] for a in self.get_accounts() + if a["is_pl_account"]=="Yes" and a["debit_or_credit"]=="Credit"] + + income = 0 + for gle in self.get_gl_entries(from_date or self.from_date, self.to_date): + if gle["account"] in accounts: + income += gle["credit"] - gle["debit"] + + return income, self.get_html(label or "Income", self.currency, fmt_money(income)) + + def get_expenses_booked(self): + # account is PL Account and Debit type account + accounts = [a["name"] for a in self.get_accounts() + if a["is_pl_account"]=="Yes" and a["debit_or_credit"]=="Debit"] + + expense = 0 + for gle in self.get_gl_entries(self.from_date, self.to_date): + if gle["account"] in accounts: + expense += gle["debit"] - gle["credit"] + + return expense, self.get_html("Expenses", self.currency, fmt_money(expense)) + + def get_collections(self): + return self.get_party_total("Customer", "credit", "Collections") + + def get_payments(self): + return self.get_party_total("Supplier", "debit", "Payments") + + def get_party_total(self, party_type, gle_field, label): + import re + # account is of master_type Customer or Supplier + accounts = [a["name"] for a in self.get_accounts() + if a["master_type"]==party_type] + # account is "Bank or Cash" + bc_accounts = [esc(a["name"], "()|") for a in self.get_accounts() + if a["account_type"]=="Bank or Cash"] + bc_regex = re.compile("""(%s)""" % "|".join(bc_accounts)) + + total = 0 + for gle in self.get_gl_entries(self.from_date, self.to_date): + # check that its made against a bank or cash account + if gle["account"] in accounts and gle["against"] and \ + bc_regex.findall(gle["against"]): + total += gle[gle_field] + + return total, self.get_html(label, self.currency, fmt_money(total)) + + def get_invoiced_amount(self): + # aka receivables + return self.get_booked_total("Customer", "debit", "Receivables") + + def get_payables(self): + return self.get_booked_total("Supplier", "credit", "Payables") + + def get_booked_total(self, party_type, gle_field, label): + # account is of master_type Customer or Supplier + accounts = [a["name"] for a in self.get_accounts() + if a["master_type"]==party_type] + + total = 0 + for gle in self.get_gl_entries(self.from_date, self.to_date): + if gle["account"] in accounts: + total += gle[gle_field] + + return total, self.get_html(label, self.currency, fmt_money(total)) + + def get_new_leads(self): + return self.get_new_count("Lead", "New Leads") + + def get_new_enquiries(self): + return self.get_new_count("Opportunity", "New Opportunities") + + def get_new_quotations(self): + return self.get_new_sum("Quotation", "New Quotations", "grand_total") + + def get_new_sales_orders(self): + return self.get_new_sum("Sales Order", "New Sales Orders", "grand_total") + + def get_new_delivery_notes(self): + return self.get_new_sum("Delivery Note", "New Delivery Notes", "grand_total") + + def get_new_purchase_requests(self): + return self.get_new_count("Purchase Request", "New Purchase Requests") + + def get_new_supplier_quotations(self): + return self.get_new_sum("Supplier Quotation", "New Supplier Quotations", + "grand_total") + + def get_new_purchase_orders(self): + return self.get_new_sum("Purchase Order", "New Purchase Orders", "grand_total") + + def get_new_purchase_receipts(self): + return self.get_new_sum("Purchase Receipt", "New Purchase Receipts", + "grand_total") + + def get_new_stock_entries(self): + return self.get_new_sum("Stock Entry", "New Stock Entries", "total_amount") + + def get_new_support_tickets(self): + return self.get_new_count("Support Ticket", "New Support Tickets", False) + + def get_new_communications(self): + return self.get_new_count("Communication", "New Communications", False) + + def get_new_projects(self): + return self.get_new_count("Project", "New Projects", False) + + def get_new_count(self, doctype, label, filter_by_company=True): + if filter_by_company: + company = """and company="%s" """ % self.doc.company + else: + company = "" + count = webnotes.conn.sql("""select count(*) from `tab%s` + where docstatus < 2 %s and + date(creation)>=%s and date(creation)<=%s""" % (doctype, company, "%s", "%s"), + (self.from_date, self.to_date)) + count = count and count[0][0] or 0 + + return count, self.get_html(label, None, count) + + def get_new_sum(self, doctype, label, sum_field): + count_sum = webnotes.conn.sql("""select count(*), sum(ifnull(`%s`, 0)) + from `tab%s` where docstatus < 2 and company = %s and + date(creation)>=%s and date(creation)<=%s""" % (sum_field, doctype, "%s", + "%s", "%s"), (self.doc.company, self.from_date, self.to_date)) + count, total = count_sum and count_sum[0] or (0, 0) + + return count, self.get_html(label, self.currency, + "%s - (%s)" % (fmt_money(total), cstr(count))) + + def get_html(self, label, currency, value, style=None): + """get html output""" + return """

    + %(label)s: + + %(currency)s%(value)s +

    """ % { + "style": style or "", + "label": label, + "currency": currency and (currency+" ") or "", + "value": value + } + + def get_gl_entries(self, from_date=None, to_date=None): + """get valid GL Entries filtered by company and posting date""" + if from_date==self.from_date and to_date==self.to_date and \ + hasattr(self, "gl_entries"): + return self.gl_entries + + gl_entries = webnotes.conn.sql("""select `account`, + ifnull(credit, 0) as credit, ifnull(debit, 0) as debit, `against` + from `tabGL Entry` + where company=%s and ifnull(is_cancelled, "No")="No" and + posting_date <= %s %s""" % ("%s", "%s", + from_date and "and posting_date>='%s'" % from_date or ""), + (self.doc.company, to_date or self.to_date), as_dict=1) + + # cache if it is the normal cases + if from_date==self.from_date and to_date==self.to_date: + self.gl_entries = gl_entries + + return gl_entries + + def get_accounts(self): + if not hasattr(self, "accounts"): + self.accounts = webnotes.conn.sql("""select name, is_pl_account, + debit_or_credit, account_type, account_name, master_type + from `tabAccount` where company=%s and docstatus < 2""", + (self.doc.company,), as_dict=1) + return self.accounts + + def get_from_to_date(self): + today = now_datetime().date() + + # decide from date based on email digest frequency + if self.doc.frequency == "Daily": + # from date, to_date is yesterday + from_date = to_date = today - timedelta(days=1) + elif self.doc.frequency == "Weekly": + # from date is the previous week's monday + from_date = today - timedelta(days=today.weekday(), weeks=1) + # to date is sunday i.e. the previous day + to_date = from_date + timedelta(days=6) + else: + # from date is the 1st day of the previous month + from_date = today - relativedelta(days=today.day-1, months=1) + # to date is the last day of the previous month + to_date = today - relativedelta(days=today.day) + + return from_date, to_date def get_next_sending(self): - import datetime - - start_date, end_date = self.get_start_end_dates() - - send_date = end_date + datetime.timedelta(days=1) - - from webnotes.utils import formatdate - str_date = formatdate(str(send_date)) - - self.doc.next_send = str_date + " at midnight" + from_date, to_date = self.get_from_to_date() + send_date = to_date + timedelta(days=1) + + if self.doc.frequency == "Daily": + next_send_date = send_date + timedelta(days=1) + elif self.doc.frequency == "Weekly": + next_send_date = send_date + timedelta(weeks=1) + else: + next_send_date = send_date + relativedelta(months=1) + self.doc.next_send = formatdate(next_send_date) + " at midnight" + return send_date - - + def onload(self): - """ - - """ self.get_next_sending() - - def get_standard_body(self, result): - """ - Generate email body depending on the result - """ - from webnotes.utils import fmt_money - from webnotes.model.doc import Document - company = Document('Company', self.doc.company) - currency = company.default_currency - - def table(args): - table_body = "" - - if isinstance(args['body'], basestring): - return """

    %(head)s: %(body)s

    """ % args - else: - return ("""

    %(head)s:

    """ % args) +\ - "".join(map(lambda b: "

    %s

    " % b, args['body'])) - - - currency_amount_str = "%s %s" - - body_dict = { - - 'invoiced_amount': { - 'table': result.get('invoiced_amount') and \ - table({ - 'head': 'Invoiced Amount', - 'body': currency_amount_str \ - % (currency, fmt_money(result['invoiced_amount'].get('debit'))) - }), - 'idx': 300, - 'value': result.get('invoiced_amount') and result['invoiced_amount'].get('debit') - }, - - 'payables': { - 'table': result.get('payables') and \ - table({ - 'head': 'Payables', - 'body': currency_amount_str \ - % (currency, fmt_money(result['payables'].get('credit'))) - }), - 'idx': 200, - 'value': result.get('payables') and result['payables'].get('credit') - }, - - 'collections': { - 'table': result.get('collections') and \ - table({ - 'head': 'Collections', - 'body': currency_amount_str \ - % (currency, fmt_money(result['collections'].get('credit'))) - }), - 'idx': 301, - 'value': result.get('collections') and result['collections'].get('credit') - }, - - 'payments': { - 'table': result.get('payments') and \ - table({ - 'head': 'Payments', - 'body': currency_amount_str \ - % (currency, fmt_money(result['payments'].get('debit'))) - }), - 'idx': 201, - 'value': result.get('payments') and result['payments'].get('debit') - }, - - 'income': { - 'table': result.get('income') and \ - table({ - 'head': 'Income', - 'body': currency_amount_str \ - % (currency, fmt_money(result['income'].get('value'))) - }), - 'idx': 302, - 'value': result.get('income') and result['income'].get('value') - }, - - 'income_year_to_date': { - 'table': result.get('income_year_to_date') and \ - table({ - 'head': 'Income Year To Date', - 'body': currency_amount_str \ - % (currency, fmt_money(result['income_year_to_date'].get('value'))) - }), - 'idx': 303, - 'value': result.get('income_year_to_date') and \ - result['income_year_to_date'].get('value') - }, - - 'expenses_booked': { - 'table': result.get('expenses_booked') and \ - table({ - 'head': 'Expenses Booked', - 'body': currency_amount_str \ - % (currency, fmt_money(result['expenses_booked'].get('value'))) - }), - 'idx': 202, - 'value': result.get('expenses_booked') and result['expenses_booked'].get('value') - }, - - 'bank_balance': { - 'table': result.get('bank_balance') and \ - table({ - 'head': 'Bank / Cash Balance', - 'body': [(bank['name'] + ": " \ - + currency_amount_str % \ - (currency, fmt_money(bank.get('value'))) + '') - for bank in (isinstance(result['bank_balance'], list) and \ - result['bank_balance'] or \ - [result['bank_balance']]) - ] - }), - 'idx': 0, - 'value': 0.1 - }, - - 'new_leads': { - 'table': result.get('new_leads') and \ - table({ - 'head': 'New Leads', - 'body': '%s' % result['new_leads'].get('count') - }), - 'idx': 100, - 'value': result.get('new_leads') and result['new_leads'].get('count') - }, - - 'new_enquiries': { - 'table': result.get('new_enquiries') and \ - table({ - 'head': 'New Enquiries', - 'body': '%s' % result['new_enquiries'].get('count') - }), - 'idx': 101, - 'value': result.get('new_enquiries') and result['new_enquiries'].get('count') - }, - - 'new_quotations': { - 'table': result.get('new_quotations') and \ - table({ - 'head': 'New Quotations', - 'body': '%s' % result['new_quotations'].get('count') - }), - 'idx': 102, - 'value': result.get('new_quotations') and result['new_quotations'].get('count') - }, - - 'new_sales_orders': { - 'table': result.get('new_sales_orders') and \ - table({ - 'head': 'New Sales Orders', - 'body': '%s' % result['new_sales_orders'].get('count') - }), - 'idx': 103, - 'value': result.get('new_sales_orders') and result['new_sales_orders'].get('count') - }, - - 'new_purchase_orders': { - 'table': result.get('new_purchase_orders') and \ - table({ - 'head': 'New Purchase Orders', - 'body': '%s' % result['new_purchase_orders'].get('count') - }), - 'idx': 104, - 'value': result.get('new_purchase_orders') and \ - result['new_purchase_orders'].get('count') - }, - - 'new_transactions': { - 'table': result.get('new_transactions') and \ - table({ - 'head': 'New Transactions', - 'body': '%s' % result['new_transactions'].get('count') - }), - 'idx': 105, - 'value': result.get('new_transactions') and result['new_transactions'].get('count') - } - - #'stock_below_rl': - } - - table_list = [] - - # Sort these keys depending on idx value - bd_keys = sorted(body_dict, key=lambda x: \ - (-webnotes.utils.flt(body_dict[x]['value']), body_dict[x]['idx'])) - - new_section = False - - def set_new_section(new_section): - if not new_section: - table_list.append("

    No Updates For:


    ") - new_section = True - return new_section - - for k in bd_keys: - if self.doc.fields[k]: - if k in result: - if not body_dict[k].get('value') and not new_section: - new_section = set_new_section(new_section) - table_list.append(body_dict[k]['table']) - elif k in ['collections', 'payments']: - new_section = set_new_section(new_section) - table_list.append(\ - "

    [" + \ - k.capitalize() + \ - "]
    Missing: Account of type 'Bank or Cash'\ -

    ") - elif k=='bank_balance': - new_section = set_new_section(new_section) - table_list.append(\ - "

    [" + \ - "Bank Balance" + \ - "]
    Alert: GL Entry not found for Account of type 'Bank or Cash'\ -

    ") - - - from webnotes.utils import formatdate - start_date, end_date = self.get_start_end_dates() - digest_daterange = self.doc.frequency=='Daily' \ - and formatdate(str(start_date)) \ - or (formatdate(str(start_date)) + " to " + (formatdate(str(end_date)))) - - email_body = """ -

    %s

    -

    %s

    -

    %s

    -
    - """ \ - % ((self.doc.frequency + " Digest"), \ - digest_daterange, self.doc.company) \ - + "".join(table_list) + """\ -

    - """ - - return email_body - - def send(): - """ - - """ - edigest_list = webnotes.conn.sql(""" - SELECT name FROM `tabEmail Digest` - WHERE enabled=1 and docstatus<2 - """, as_list=1) - from webnotes.model.code import get_obj - from webnotes.utils import now_datetime - now_date = now_datetime().date() - for ed in edigest_list: - if ed[0]: - ed_obj = get_obj('Email Digest', ed[0]) - ed_obj.sending = True - send_date = ed_obj.get_next_sending() - #webnotes.msgprint([ed[0], now_date, send_date]) - - if (now_date == send_date): - ed_obj.send() + for ed in webnotes.conn.sql("""select name from `tabEmail Digest` + where enabled=1 and docstatus<2""", as_list=1): + ed_obj = get_obj('Email Digest', ed[0]) + if (now_date == ed_obj.get_next_sending()): + ed_obj.send() diff --git a/erpnext/setup/doctype/email_digest/email_digest.txt b/erpnext/setup/doctype/email_digest/email_digest.txt index 0a29a8caf3f..9de8c2842fb 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.txt +++ b/erpnext/setup/doctype/email_digest/email_digest.txt @@ -3,11 +3,11 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:20', - 'docstatus': 0, - 'modified': '2012-03-27 14:36:20', - 'modified_by': u'Administrator', - 'owner': u'Administrator' + u'creation': '2012-07-12 23:29:44', + u'docstatus': 0, + u'modified': '2012-09-15 19:34:37', + u'modified_by': u'Administrator', + u'owner': u'Administrator' }, # These values are common for all DocType @@ -15,19 +15,20 @@ '_last_update': u'1324556758', 'autoname': u'Prompt', 'colour': u'White:FFF', - 'doctype': 'DocType', + 'description': u'Send regular summary reports via Email.', + u'doctype': u'DocType', 'document_type': u'System', 'module': u'Setup', - 'name': '__common__', + u'name': u'__common__', 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 81 + 'version': 1 }, # These values are common for all DocField { - 'doctype': u'DocField', - 'name': '__common__', + u'doctype': u'DocField', + u'name': u'__common__', 'parent': u'Email Digest', 'parentfield': u'fields', 'parenttype': u'DocType' @@ -35,8 +36,8 @@ # These values are common for all DocPerm { - 'doctype': u'DocPerm', - 'name': '__common__', + u'doctype': u'DocPerm', + u'name': u'__common__', 'parent': u'Email Digest', 'parentfield': u'permissions', 'parenttype': u'DocType', @@ -46,37 +47,22 @@ # DocType, Email Digest { - 'doctype': 'DocType', - 'name': u'Email Digest' - }, - - # DocPerm - { - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1 + u'doctype': u'DocType', + u'name': u'Email Digest' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'settings', 'fieldtype': u'Section Break', - 'label': u'Settings', + 'label': u'Email Digest Settings', 'permlevel': 0 }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break0', 'fieldtype': u'Column Break', 'permlevel': 0 @@ -84,7 +70,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'enabled', 'fieldtype': u'Check', 'label': u'Enabled', @@ -93,7 +79,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'company', 'fieldtype': u'Select', 'label': u'For Company', @@ -105,11 +91,11 @@ # DocField { 'allow_on_submit': 0, - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'frequency', 'fieldtype': u'Select', 'label': u'How frequently?', - 'options': u'\nDaily\nWeekly\nMonthly', + 'options': u'Daily\nWeekly\nMonthly', 'permlevel': 0, 'reqd': 1 }, @@ -117,7 +103,7 @@ # DocField { 'depends_on': u'eval:doc.enabled', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'next_send', 'fieldtype': u'Data', 'label': u'Next email will be sent on:', @@ -126,38 +112,16 @@ # DocField { - 'default': u'1', - 'doctype': u'DocField', - 'fieldname': u'use_standard', - 'fieldtype': u'Check', - 'hidden': 1, - 'label': u'Use standard?', - 'permlevel': 0, - 'search_index': 0 - }, - - # DocField - { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break1', 'fieldtype': u'Column Break', 'permlevel': 0 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'addremove_recipients', - 'fieldtype': u'Button', - 'label': u'Add/Remove Recipients', - 'permlevel': 0, - 'trigger': u'Client' - }, - # DocField { 'description': u'Note: Email will not be sent to disabled users', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'recipient_list', 'fieldtype': u'Text', 'label': u'Recipients', @@ -167,8 +131,19 @@ # DocField { - 'depends_on': u'eval:doc.use_standard', - 'doctype': u'DocField', + u'doctype': u'DocField', + 'fieldname': u'addremove_recipients', + 'fieldtype': u'Button', + 'label': u'Add/Remove Recipients', + 'permlevel': 0, + 'trigger': u'Client' + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'Check all the items below that you want to send in this digest.', + u'doctype': u'DocField', 'fieldname': u'select_digest_content', 'fieldtype': u'Section Break', 'label': u'Select Digest Content', @@ -177,8 +152,8 @@ # DocField { - 'depends_on': u'eval:doc.use_standard', - 'doctype': u'DocField', + 'colour': u'White:FFF', + u'doctype': u'DocField', 'fieldname': u'new_leads', 'fieldtype': u'Check', 'label': u'New Leads', @@ -187,8 +162,7 @@ # DocField { - 'depends_on': u'eval:doc.use_standard', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'new_enquiries', 'fieldtype': u'Check', 'label': u'New Enquiries', @@ -197,8 +171,7 @@ # DocField { - 'depends_on': u'eval:doc.use_standard', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'new_quotations', 'fieldtype': u'Check', 'label': u'New Quotations', @@ -207,8 +180,7 @@ # DocField { - 'depends_on': u'eval:doc.use_standard', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'new_sales_orders', 'fieldtype': u'Check', 'label': u'New Sales Orders', @@ -217,8 +189,34 @@ # DocField { - 'depends_on': u'eval:doc.use_standard', - 'doctype': u'DocField', + u'doctype': u'DocField', + 'fieldname': u'new_delivery_notes', + 'fieldtype': u'Check', + 'label': u'New Delivery Notes', + 'permlevel': 0 + }, + + # DocField + { + u'doctype': u'DocField', + 'fieldname': u'new_purchase_requests', + 'fieldtype': u'Check', + 'label': u'New Purchase Requests', + 'permlevel': 0 + }, + + # DocField + { + u'doctype': u'DocField', + 'fieldname': u'new_supplier_quotations', + 'fieldtype': u'Check', + 'label': u'New Supplier Quotations', + 'permlevel': 0 + }, + + # DocField + { + u'doctype': u'DocField', 'fieldname': u'new_purchase_orders', 'fieldtype': u'Check', 'label': u'New Purchase Orders', @@ -227,78 +225,60 @@ # DocField { - 'depends_on': u'eval:doc.use_standard', - 'doctype': u'DocField', - 'fieldname': u'new_transactions', + u'doctype': u'DocField', + 'fieldname': u'new_purchase_receipts', 'fieldtype': u'Check', - 'label': u'New Transactions', + 'label': u'New Purchase Receipts', 'permlevel': 0 }, # DocField { - 'depends_on': u'eval:doc.use_standard', - 'doctype': u'DocField', - 'fieldname': u'payables', + u'doctype': u'DocField', + 'fieldname': u'new_stock_entries', 'fieldtype': u'Check', - 'label': u'Payables', + 'label': u'New Stock Entries', 'permlevel': 0 }, # DocField { - 'depends_on': u'eval:doc.use_standard', - 'doctype': u'DocField', - 'fieldname': u'payments', + u'doctype': u'DocField', + 'fieldname': u'new_support_tickets', 'fieldtype': u'Check', - 'label': u'Payments', + 'label': u'New Support Tickets', 'permlevel': 0 }, # DocField { - 'depends_on': u'eval:doc.use_standard', - 'doctype': u'DocField', - 'fieldname': u'expenses_booked', + u'doctype': u'DocField', + 'fieldname': u'new_communications', 'fieldtype': u'Check', - 'label': u'Expenses Booked', + 'label': u'New Communications', 'permlevel': 0 }, # DocField { - 'depends_on': u'eval:doc.use_standard', - 'doctype': u'DocField', - 'fieldname': u'invoiced_amount', + u'doctype': u'DocField', + 'fieldname': u'new_projects', 'fieldtype': u'Check', - 'label': u'Invoiced Amount (Receivables)', + 'label': u'New Projects', 'permlevel': 0 }, # DocField { - 'depends_on': u'eval:doc.use_standard', - 'doctype': u'DocField', - 'fieldname': u'collections', - 'fieldtype': u'Check', - 'label': u'Collections', + u'doctype': u'DocField', + 'fieldname': u'cb1', + 'fieldtype': u'Column Break', 'permlevel': 0 }, # DocField { - 'depends_on': u'eval:doc.use_standard', - 'doctype': u'DocField', - 'fieldname': u'income', - 'fieldtype': u'Check', - 'label': u'Income', - 'permlevel': 0 - }, - - # DocField - { - 'depends_on': u'eval:doc.use_standard', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'income_year_to_date', 'fieldtype': u'Check', 'label': u'Income Year to Date', @@ -307,8 +287,7 @@ # DocField { - 'depends_on': u'eval:doc.use_standard', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'bank_balance', 'fieldtype': u'Check', 'label': u'Bank Balance', @@ -317,41 +296,70 @@ # DocField { - 'doctype': u'DocField', - 'fieldname': u'stock_below_rl', + u'doctype': u'DocField', + 'fieldname': u'income', 'fieldtype': u'Check', - 'hidden': 1, - 'label': u'Stock Items below re-order level', + 'label': u'Income', 'permlevel': 0 }, # DocField { - 'depends_on': u'eval:!doc.use_standard', - 'doctype': u'DocField', - 'fieldname': u'enter_custom_code', - 'fieldtype': u'Section Break', - 'label': u'Enter Custom Code', + u'doctype': u'DocField', + 'fieldname': u'expenses_booked', + 'fieldtype': u'Check', + 'label': u'Expenses Booked', 'permlevel': 0 }, # DocField { - 'depends_on': u'eval:!doc.use_standard', - 'doctype': u'DocField', - 'fieldname': u'custom_code', - 'fieldtype': u'Code', - 'label': u'Custom Python Code', + u'doctype': u'DocField', + 'fieldname': u'collections', + 'fieldtype': u'Check', + 'label': u'Collections', 'permlevel': 0 }, # DocField { - 'depends_on': u'eval:!doc.use_standard', - 'doctype': u'DocField', - 'fieldname': u'email_template', - 'fieldtype': u'Code', - 'label': u'Email Template', + u'doctype': u'DocField', + 'fieldname': u'payments', + 'fieldtype': u'Check', + 'label': u'Payments', 'permlevel': 0 + }, + + # DocField + { + u'doctype': u'DocField', + 'fieldname': u'invoiced_amount', + 'fieldtype': u'Check', + 'label': u'Receivables', + 'permlevel': 0 + }, + + # DocField + { + u'doctype': u'DocField', + 'fieldname': u'payables', + 'fieldtype': u'Check', + 'label': u'Payables', + 'permlevel': 0 + }, + + # DocPerm + { + 'cancel': 1, + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'write': 1 + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1 } ] \ No newline at end of file diff --git a/erpnext/setup/doctype/email_settings/__init__.py b/erpnext/setup/doctype/email_settings/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/email_settings/__init__.py +++ b/erpnext/setup/doctype/email_settings/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/email_settings/email_settings.py b/erpnext/setup/doctype/email_settings/email_settings.py index e3056de121b..e17f55cb1c3 100644 --- a/erpnext/setup/doctype/email_settings/email_settings.py +++ b/erpnext/setup/doctype/email_settings/email_settings.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes sql = webnotes.conn.sql @@ -30,16 +31,17 @@ class DocType: def validate_outgoing(self): """Checks incoming email settings""" + self.doc.encode() if self.doc.outgoing_mail_server: from webnotes.utils import cint from webnotes.utils.email_lib.smtp import SMTPServer - smtpserver = SMTPServer(login = self.doc.mail_login.encode("utf-8"), - password = self.doc.mail_password.encode("utf-8"), + smtpserver = SMTPServer(login = self.doc.mail_login, + password = self.doc.mail_password, server = self.doc.outgoing_mail_server, port = cint(self.doc.mail_port), use_ssl = self.doc.use_ssl ) - + # exceptions are handled in session connect sess = smtpserver.sess @@ -51,15 +53,17 @@ class DocType: from webnotes.utils.email_lib.receive import POP3Mailbox from webnotes.model.doc import Document import _socket, poplib + inc_email = Document('Incoming Email Settings') - inc_email.host = self.doc.support_host.encode('utf-8') + inc_email.encode() + inc_email.host = self.doc.support_host inc_email.use_ssl = self.doc.support_use_ssl try: err_msg = 'User Name or Support Password missing. Please enter and try again.' if not (self.doc.support_username and self.doc.support_password): raise AttributeError, err_msg - inc_email.username = self.doc.support_username.encode('utf-8') - inc_email.password = self.doc.support_password.encode('utf-8') + inc_email.username = self.doc.support_username + inc_email.password = self.doc.support_password except AttributeError, e: webnotes.msgprint(err_msg) raise e diff --git a/erpnext/setup/doctype/email_settings/email_settings.txt b/erpnext/setup/doctype/email_settings/email_settings.txt index 27723672639..cf9d4431981 100644 --- a/erpnext/setup/doctype/email_settings/email_settings.txt +++ b/erpnext/setup/doctype/email_settings/email_settings.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-05-15 12:15:01', + 'creation': '2012-07-03 13:30:55', 'docstatus': 0, - 'modified': '2012-06-14 14:47:49', + 'modified': '2012-07-12 16:16:27', 'modified_by': u'Administrator', 'owner': u'harshada@webnotestech.com' }, @@ -18,6 +18,7 @@ 'allow_print': 1, 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'Email Settings for Outgoing and Incoming Emails.', 'doctype': 'DocType', 'in_create': 1, 'issingle': 1, @@ -70,6 +71,8 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'Set your outgoing mail SMTP settings here. All system generated notifications, emails will go from this mail server. If you are not sure, leave this blank to use ERPNext servers (emails will still be sent from your email id) or contact your email provider.', 'doctype': u'DocField', 'fieldname': u'outgoing_mails', 'fieldtype': u'Section Break', @@ -78,29 +81,14 @@ # DocField { - 'doctype': u'DocField', - 'fieldname': u'html1', - 'fieldtype': u'HTML', - 'label': u'1', - 'options': u'
    Set your outgoing mail settings here. All system generated notifications, emails will go from this mail server
    ' - }, - - # DocField - { + 'colour': u'White:FFF', + 'description': u'SMTP Server (e.g. smtp.gmail.com)', 'doctype': u'DocField', 'fieldname': u'outgoing_mail_server', 'fieldtype': u'Data', 'label': u'Outgoing Mail Server' }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'mail_port', - 'fieldtype': u'Int', - 'label': u'Mail Port' - }, - # DocField { 'doctype': u'DocField', @@ -111,6 +99,25 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'If non standard port (e.g. 587)', + 'doctype': u'DocField', + 'fieldname': u'mail_port', + 'fieldtype': u'Int', + 'label': u'Mail Port' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'cb0', + 'fieldtype': u'Column Break' + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'Set Login and Password if authentication is required.', 'doctype': u'DocField', 'fieldname': u'mail_login', 'fieldtype': u'Data', @@ -127,6 +134,8 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'System generated mails will be sent from this email id.', 'doctype': u'DocField', 'fieldname': u'auto_email_id', 'fieldtype': u'Data', @@ -144,19 +153,12 @@ # DocField { - 'doctype': u'DocField', - 'fieldname': u'html2', - 'fieldtype': u'HTML', - 'label': u'2', - 'options': u'
    To automatically create Support Tickets from your incoming mail, set your pop3 settings here.
    ' - }, - - # DocField - { + 'colour': u'White:FFF', + 'description': u'To automatically create Support Tickets from your incoming mail, set your POP3 settings here. You must ideally create a separate email id for the erp system so that all emails will be synced into the system from that mail id. If you are not sure, please contact your EMail Provider.', 'doctype': u'DocField', 'fieldname': u'section_break0', 'fieldtype': u'Section Break', - 'options': u'Simple' + 'label': u'Incoming Mail Setting' }, # DocField @@ -216,7 +218,7 @@ # DocField { 'doctype': u'DocField', - 'fieldname': u'column_break0', + 'fieldname': u'cb1', 'fieldtype': u'Column Break' }, diff --git a/erpnext/setup/doctype/features_setup/__init__.py b/erpnext/setup/doctype/features_setup/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/features_setup/__init__.py +++ b/erpnext/setup/doctype/features_setup/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/features_setup/features_setup.py b/erpnext/setup/doctype/features_setup/features_setup.py index e26ca47b350..50b253585cf 100644 --- a/erpnext/setup/doctype/features_setup/features_setup.py +++ b/erpnext/setup/doctype/features_setup/features_setup.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals class DocType: def __init__(self, d, dl): self.doc, self.doclist = d, dl diff --git a/erpnext/setup/doctype/global_defaults/__init__.py b/erpnext/setup/doctype/global_defaults/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/global_defaults/__init__.py +++ b/erpnext/setup/doctype/global_defaults/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.py b/erpnext/setup/doctype/global_defaults/global_defaults.py index 9d308852fdb..b4b23819389 100644 --- a/erpnext/setup/doctype/global_defaults/global_defaults.py +++ b/erpnext/setup/doctype/global_defaults/global_defaults.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals """Global Defaults""" import webnotes diff --git a/erpnext/setup/doctype/item_group/__init__.py b/erpnext/setup/doctype/item_group/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/item_group/__init__.py +++ b/erpnext/setup/doctype/item_group/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/item_group/item_group.js b/erpnext/setup/doctype/item_group/item_group.js index db7582ce112..e5e108a3dd4 100644 --- a/erpnext/setup/doctype/item_group/item_group.js +++ b/erpnext/setup/doctype/item_group/item_group.js @@ -14,21 +14,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . - - -cur_frm.cscript.onload = function(){ - - if(doc.__islocal){ - doc.parent_item_group = 'Root'; - refresh('parent_item_group'); - } +cur_frm.cscript.set_breadcrumbs = function(barea) { + cur_frm.frm_head.appframe.add_breadcrumb(cur_frm.docname); + cur_frm.frm_head.appframe.add_breadcrumb(' in \ + Item Group Tree'); + cur_frm.frm_head.appframe.add_breadcrumb(' in Selling'); } //get query select item group cur_frm.fields_dict['parent_item_group'].get_query = function(doc,cdt,cdn) { return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.`is_group` = "Yes" AND `tabItem Group`.`docstatus`!= 2 AND `tabItem Group`.`name` !="'+doc.item_group_name+'" AND `tabItem Group`.%(key)s LIKE "%s" ORDER BY `tabItem Group`.`name` ASC LIMIT 50'; -} - -cur_frm.cscript.refresh = function(doc, cdt, cdn) { - } \ No newline at end of file diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py index 7e92f53cf49..c623c7803f9 100644 --- a/erpnext/setup/doctype/item_group/item_group.py +++ b/erpnext/setup/doctype/item_group/item_group.py @@ -14,66 +14,16 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Please edit this list and import only required elements +from __future__ import unicode_literals 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, getchildren, make_autoname -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.model.doclist import getlist +from webnotes.utils import flt -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 - -# ----------------------------------------------------------------------------------------- +from webnotes.utils.nestedset import DocTypeNestedSet - -class DocType: - def __init__(self,d,dl): - self.doc, self.doclist = d,dl - self.nsm_parent_field = 'parent_item_group'; - - # update Node Set Model - def update_nsm_model(self): - import webnotes - import webnotes.utils.nestedset - webnotes.utils.nestedset.update_nsm(self) - - # ON UPDATE - #-------------------------------------- - def on_update(self): - # update nsm - self.update_nsm_model() - - def validate(self): - if self.doc.lft and self.doc.rgt: - res = sql("select name from `tabItem Group` where is_group = 'Yes' and docstatus!= 2 and name ='%s' and name !='%s'"%(self.doc.parent_item_group,self.doc.item_group_name)) - if not res: - msgprint("Please enter proper parent item group.") - raise Exception - - r = sql("select name from `tabItem Group` where name = '%s' and docstatus = 2"%(self.doc.item_group_name)) - if r: - msgprint("'%s' record is trashed. To untrash please go to Setup & click on Trash."%(self.doc.item_group_name)) - raise Exception - - def on_trash(self): - item = sql("select name from `tabItem` where ifnull(item_group, '') = %s", self.doc.name) - item = [d[0] for d in item] - - if item: - msgprint("""Item Group: %s can not be trashed/deleted because it is used in item: %s. - To trash/delete this, remove/change item group in item master""" % (self.doc.name, item or ''), raise_exception=1) - - if sql("select name from `tabItem Group` where parent_item_group = %s and docstatus != 2", self.doc.name): - msgprint("Child item group exists for this item group. You can not trash/cancel/delete this item group.", raise_exception=1) - - - # rebuild tree - set(self.doc,'old_parent', '') - self.update_nsm_model() +class DocType(DocTypeNestedSet): + def __init__(self, doc, doclist=[]): + self.doc = doc + self.doclist = doclist + self.nsm_parent_field = 'parent_item_group'; \ No newline at end of file diff --git a/erpnext/setup/doctype/item_group/item_group.txt b/erpnext/setup/doctype/item_group/item_group.txt index b56b8da7b1b..bd9887fafdd 100644 --- a/erpnext/setup/doctype/item_group/item_group.txt +++ b/erpnext/setup/doctype/item_group/item_group.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:21', + 'creation': '2012-07-03 13:30:53', 'docstatus': 0, - 'modified': '2012-03-27 14:36:21', + 'modified': '2012-07-12 11:26:21', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -17,6 +17,7 @@ 'autoname': u'field:item_group_name', 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'Item Classification', 'doctype': 'DocType', 'document_type': u'Master', 'in_create': 1, @@ -27,7 +28,7 @@ 'section_style': u'Simple', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 59 + 'version': 1 }, # These values are common for all DocField @@ -55,6 +56,54 @@ 'name': u'Item Group' }, + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material User', + 'submit': 0, + 'write': 0 + }, + # DocPerm { 'cancel': 1, @@ -75,54 +124,6 @@ 'write': 1 }, - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Material Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Material User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material User', - 'submit': 0, - 'write': 0 - }, - # DocField { 'doctype': u'DocField', @@ -137,20 +138,6 @@ 'search_index': 0 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'description', - 'fieldtype': u'Text', - 'label': u'Description', - 'no_copy': 0, - 'oldfieldname': u'description', - 'oldfieldtype': u'Text', - 'permlevel': 0, - 'search_index': 0, - 'width': u'300px' - }, - # DocField { 'colour': u'White:FFF', @@ -167,14 +154,9 @@ # DocField { 'doctype': u'DocField', - 'fieldname': u'show_in_catalogue', - 'fieldtype': u'Check', - 'label': u'Show in catalogue', - 'no_copy': 0, - 'oldfieldname': u'show_in_catalogue', - 'oldfieldtype': u'Check', - 'permlevel': 0, - 'search_index': 0 + 'fieldname': u'cb0', + 'fieldtype': u'Column Break', + 'permlevel': 0 }, # DocField diff --git a/erpnext/setup/doctype/market_segment/__init__.py b/erpnext/setup/doctype/market_segment/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/market_segment/__init__.py +++ b/erpnext/setup/doctype/market_segment/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/naming_series/__init__.py b/erpnext/setup/doctype/naming_series/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/naming_series/__init__.py +++ b/erpnext/setup/doctype/naming_series/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/naming_series/naming_series.js b/erpnext/setup/doctype/naming_series/naming_series.js index 7e702c45f4b..967e8b01284 100644 --- a/erpnext/setup/doctype/naming_series/naming_series.js +++ b/erpnext/setup/doctype/naming_series/naming_series.js @@ -8,33 +8,47 @@ // // 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 +// 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 . +// along with this program. If not, see . // Settings cur_frm.cscript.onload = function(doc, cdt, cdn){ - var callback = function(r, rt){ - set_field_options('select_doc_for_series', r.message); - } - $c_obj(make_doclist(doc.doctype, doc.name),'get_transactions','',callback); - cur_frm.cscript.refresh(); - // add page head - //var ph = new PageHeader(cur_frm.fields_dict['head_html'].wrapper, 'Setup Series', 'Set prefix for numbering series on your transactions'); + cur_frm.call_server('get_transactions', '', cur_frm.cscript.update_selects); + + cur_frm.cscript.select_doc_for_series(doc); } -cur_frm.cscript.refresh = function(doc, cdt, cdn) { - // hide buttons - $('.appframe-toolbar').toggle(false); +cur_frm.cscript.update_selects = function(r) { + set_field_options('select_doc_for_series', r.message.transactions); + set_field_options('prefix', r.message.prefixes); } + cur_frm.cscript.select_doc_for_series = function(doc, cdt, cdn) { - var callback = function(r, rt){ - locals[cdt][cdn].set_options = r.message; - refresh_field('set_options'); - } + cur_frm.toggle_display(['help_html','set_options', 'user_must_always_select', 'update'], + doc.select_doc_for_series) - $c_obj(make_doclist(doc.doctype, doc.name),'get_options','',callback) + var callback = function(r, rt){ + locals[cdt][cdn].set_options = r.message; + refresh_field('set_options'); + if(r.message && r.message.split('\n')[0]=='') { + cur_frm.set_value('user_must_always_select', 1) + } + } + + if(doc.select_doc_for_series) + $c_obj(make_doclist(doc.doctype, doc.name),'get_options','',callback) +} + +cur_frm.cscript.update = function() { + cur_frm.call_server('update_series', '', cur_frm.cscript.update_selects) +} + +cur_frm.cscript.prefix = function(doc) { + cur_frm.call_server('get_current', '', function(r) { + refresh_field('current_value'); + }) } diff --git a/erpnext/setup/doctype/naming_series/naming_series.py b/erpnext/setup/doctype/naming_series/naming_series.py index 5a9a26579a1..689b40990b8 100644 --- a/erpnext/setup/doctype/naming_series/naming_series.py +++ b/erpnext/setup/doctype/naming_series/naming_series.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Please edit this list and import only required elements +from __future__ import unicode_literals import webnotes from webnotes.utils import cint, cstr @@ -22,23 +22,37 @@ from webnotes import msgprint, errprint import webnotes.model.doctype sql = webnotes.conn.sql - -# ----------------------------------------------------------------------------------------- - class DocType: def __init__(self, d, dl): self.doc, self.doclist = d, dl - #----------------------------------------------------------------------------------------------------------------------------------- - def get_transactions(self): - return "\n".join([''] + [i[0] for i in sql("SELECT `tabDocField`.`parent` FROM `tabDocField`, `tabDocType` WHERE `tabDocField`.`fieldname` = 'naming_series' and `tabDocType`.name=`tabDocField`.parent order by `tabDocField`.parent")]) + def get_transactions(self, arg=None): + return { + "transactions": "\n".join([''] + [i[0] for i in sql("""select `tabDocField`.`parent` + FROM `tabDocField`, `tabDocType` WHERE `tabDocField`.`fieldname` = 'naming_series' + and `tabDocType`.name=`tabDocField`.parent order by `tabDocField`.parent""")]), + "prefixes": "\n".join([''] + [i[0] for i in sql("""select name from tabSeries""")])} def scrub_options_list(self, ol): options = filter(lambda x: x, [cstr(n.upper()).strip() for n in ol]) return options + + def update_series(self, arg=None): + """update series list""" + self.check_duplicate() + series_list = self.doc.set_options.split("\n") + + # set in doctype + self.set_series_for(self.doc.select_doc_for_series, series_list) + + # create series + map(self.insert_series, series_list) + + msgprint('Series Updated') + + return self.get_transactions() - #----------------------------------------------------------------------------------------------------------------------------------- def set_series_for(self, doctype, ol): options = self.scrub_options_list(ol) @@ -78,14 +92,7 @@ class DocType: from webnotes.utils.cache import CacheItem CacheItem(doctype).clear() - - #----------------------------------------------------------------------------------------------------------------------------------- - def update_series(self): - self.check_duplicate() - self.set_series_for(self.doc.select_doc_for_series, self.doc.set_options.split("\n")) - msgprint('Series Updated') - #----------------------------------------------------------------------------------------------------------------------------------- def check_duplicate(self): from core.doctype.doctype.doctype import DocType dt = DocType() @@ -100,27 +107,31 @@ class DocType: if series in i[0].split("\n"): msgprint("Oops! Series name %s is already in use in %s. Please select a new one" % (series, i[1]), raise_exception=1) - #----------------------------------------------------------------------------------------------------------------------------------- def validate_series_name(self, n): import re if not re.match('[a-zA-Z0-9]+(([-/][a-zA-Z0-9])?[-/][a-zA-Z0-9]*)*',n): msgprint('Special Characters except "-" and "/" not allowed in naming series') raise Exception - #----------------------------------------------------------------------------------------------------------------------------------- def get_options(self, arg=''): - sr = webnotes.model.doctype.get_property(self.doc.select_doc_for_series, 'options', 'naming_series') + sr = webnotes.model.doctype.get_property(self.doc.select_doc_for_series, + 'options', 'naming_series') return sr + def get_current(self, arg=None): + """get series current""" + self.doc.current_value = webnotes.conn.sql("""select current from tabSeries where name=%s""", + self.doc.prefix)[0][0] + + def insert_series(self, series): + """insert series if missing""" + if not webnotes.conn.exists('Series', series): + sql("insert into tabSeries (name, current) values (%s,0)", (series)) - #----------------------------------------------------------------------------------------------------------------------------------- def update_series_start(self): if self.doc.prefix: - ser_det = sql("select name from `tabSeries` where name = %s", self.doc.prefix) - if ser_det: - sql("update `tabSeries` set current = '%s' where name = '%s'" % (self.doc.starts_from-1,self.doc.prefix)) - else: - sql("insert into tabSeries (name, current) values (%s,%s)",(cstr(self.doc.prefix),cint(self.doc.starts_from)-1)) + self.insert_series(self.doc.prefix) + sql("update `tabSeries` set current = '%s' where name = '%s'" % (self.doc.current_value,self.doc.prefix)) msgprint("Series Updated Successfully") else: msgprint("Please select prefix first") diff --git a/erpnext/setup/doctype/naming_series/naming_series.txt b/erpnext/setup/doctype/naming_series/naming_series.txt index 6cb1dab6b4e..ff83af82d5c 100644 --- a/erpnext/setup/doctype/naming_series/naming_series.txt +++ b/erpnext/setup/doctype/naming_series/naming_series.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-04-10 13:01:16', + 'creation': '2012-07-03 13:30:54', 'docstatus': 0, - 'modified': '2012-04-10 18:45:34', + 'modified': '2012-07-12 15:59:52', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -16,7 +16,7 @@ 'description': u'Set prefix for numbering series on your transactions', 'doctype': 'DocType', 'hide_heading': 0, - 'hide_toolbar': 0, + 'hide_toolbar': 1, 'issingle': 1, 'module': u'Setup', 'name': '__common__', @@ -24,7 +24,7 @@ 'section_style': u'Tray', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 66 + 'version': 1 }, # These values are common for all DocField @@ -123,7 +123,7 @@ 'fieldname': u'help_html', 'fieldtype': u'HTML', 'label': u'Help HTML', - 'options': u'
    \nWrite the list of series options in the list below. Each on a new line
    \nAllowed special characters are "/" and "-"
    \nExamples:
    \nINV-
    \nINV-10-
    \nINVK-
    \n
    ' + 'options': u'
    \nEdit list of Series in the box below. Each Series Prefix on a new line.

    \nAllowed special characters are "/" and "-"
    \nExamples:
    \nINV-
    \nINV-10-
    \nINVK-
    \n
    ' }, # DocField @@ -131,7 +131,7 @@ 'doctype': u'DocField', 'fieldname': u'set_options', 'fieldtype': u'Text', - 'label': u'Set Series' + 'label': u'Series List for this Transaction' }, # DocField @@ -146,16 +146,17 @@ # DocField { + 'colour': u'White:FFF', 'doctype': u'DocField', 'fieldname': u'update', 'fieldtype': u'Button', - 'label': u'Update', - 'options': u'update_series' + 'label': u'Update' }, # DocField { - 'description': u'Set starting number for series of your transactions', + 'colour': u'White:FFF', + 'description': u'Change the starting / current sequence number of an existing series.', 'doctype': u'DocField', 'fieldname': u'update_series', 'fieldtype': u'Section Break', @@ -166,24 +167,27 @@ { 'doctype': u'DocField', 'fieldname': u'prefix', - 'fieldtype': u'Data', + 'fieldtype': u'Select', 'label': u'Prefix' }, # DocField { + 'colour': u'White:FFF', + 'description': u'This is the number of the last created transaction with this prefix', 'doctype': u'DocField', - 'fieldname': u'starts_from', + 'fieldname': u'current_value', 'fieldtype': u'Int', - 'label': u'Starts From' + 'label': u'Current Value' }, # DocField { + 'colour': u'White:FFF', 'doctype': u'DocField', 'fieldname': u'update_series_start', 'fieldtype': u'Button', - 'label': u'Update Series Start', + 'label': u'Update Series Number', 'options': u'update_series_start' } ] \ No newline at end of file diff --git a/erpnext/setup/doctype/naming_series_options/__init__.py b/erpnext/setup/doctype/naming_series_options/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/naming_series_options/__init__.py +++ b/erpnext/setup/doctype/naming_series_options/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/notification_control/__init__.py b/erpnext/setup/doctype/notification_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/notification_control/__init__.py +++ b/erpnext/setup/doctype/notification_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/notification_control/notification_control.py b/erpnext/setup/doctype/notification_control/notification_control.py index 8602fe2ab1b..f8b0ee2ad5a 100644 --- a/erpnext/setup/doctype/notification_control/notification_control.py +++ b/erpnext/setup/doctype/notification_control/notification_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals import webnotes from webnotes.utils import validate_email_add, cint, cstr diff --git a/erpnext/setup/doctype/notification_control/notification_control.txt b/erpnext/setup/doctype/notification_control/notification_control.txt index 000902e54be..15c8eb2769d 100644 --- a/erpnext/setup/doctype/notification_control/notification_control.txt +++ b/erpnext/setup/doctype/notification_control/notification_control.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-05-03 16:16:21', + 'creation': '2012-07-03 13:30:56', 'docstatus': 0, - 'modified': '2012-05-03 16:23:29', + 'modified': '2012-07-12 16:20:36', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -16,6 +16,7 @@ 'allow_email': 1, 'allow_print': 1, 'colour': u'White:FFF', + 'description': u'Send automatic emails to Contacts on Submitting transactions.', 'doctype': 'DocType', 'issingle': 1, 'module': u'Setup', @@ -70,10 +71,12 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'When any of the checked transactions are "Submitted", an email is automatically sent to the associated "Contact" in that transaction, with the transaction as an attachment.', 'doctype': u'DocField', 'fieldname': u'send_autonotification_for', 'fieldtype': u'Section Break', - 'label': u'Send Auto-notification for' + 'label': u'Send Email Automatically on Submission of' }, # DocField @@ -152,6 +155,8 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'Customize the introductory text that goes as a part of that email. Each transaction has a separate introductory text.', 'doctype': u'DocField', 'fieldname': u'customize_the_notification', 'fieldtype': u'Section Break', diff --git a/erpnext/setup/doctype/period/__init__.py b/erpnext/setup/doctype/period/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/period/__init__.py +++ b/erpnext/setup/doctype/period/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/period_control/__init__.py b/erpnext/setup/doctype/period_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/period_control/__init__.py +++ b/erpnext/setup/doctype/period_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/period_control/period_control.py b/erpnext/setup/doctype/period_control/period_control.py index cb6c2fd3e4f..727664e59e9 100644 --- a/erpnext/setup/doctype/period_control/period_control.py +++ b/erpnext/setup/doctype/period_control/period_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/setup/doctype/permission_control/__init__.py b/erpnext/setup/doctype/permission_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/permission_control/__init__.py +++ b/erpnext/setup/doctype/permission_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/permission_control/permission_control.py b/erpnext/setup/doctype/permission_control/permission_control.py index 9d6f428a14a..988c954b735 100644 --- a/erpnext/setup/doctype/permission_control/permission_control.py +++ b/erpnext/setup/doctype/permission_control/permission_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/setup/doctype/price_list/__init__.py b/erpnext/setup/doctype/price_list/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/price_list/__init__.py +++ b/erpnext/setup/doctype/price_list/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/price_list/price_list.js b/erpnext/setup/doctype/price_list/price_list.js index a222a65f08f..11993f8c3b1 100644 --- a/erpnext/setup/doctype/price_list/price_list.js +++ b/erpnext/setup/doctype/price_list/price_list.js @@ -14,24 +14,34 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . - -//--------- ONLOAD ------------- -cur_frm.cscript.onload = function(doc, cdt, cdn) { -} - cur_frm.cscript.refresh = function(doc, cdt, cdn) { if(doc.__islocal) { - set_field_options('price_help', ''); return; + cur_frm.set_intro("Save this list to begin."); + return; } if(!doc.file_list) { - set_field_options('price_help', '
    To upload a price list, please attach a (.csv) file with 3 columns - Item Code, Price and Currency (no headings necessary). See attachments box in the right column
    ') - } else { - set_field_options('price_help', '
    To update prices from the attachment, please click on "Update Prices"
    ') - } -} + cur_frm.set_intro('

    1. Click on "Download Template" \ + to download the template of all Items.

    ' + +'

    2. Update prices and Currency.

    ' + +'

    3. Save it as a CSV (.csv) file.

    ' + +'

    4. Upload the file.

    '); + + cur_frm.add_custom_button('Download Template', function() { + $c_obj_csv(cur_frm.get_doclist(), 'download_template'); + }, 'icon-download') + + cur_frm.add_custom_button('Upload Price List', function() { + cur_frm.attachments.add_attachment(); + }, 'icon-upload') + -cur_frm.cscript.clear_prices = function(doc, cdt, cdn) { - if(confirm("This action will clear all rates for '"+ doc.name +"' from the Item Master and cannot be un-done. Are you sure you want to continue?")) { - $c_obj(make_doclist(doc.doctype, doc.name), 'clear_prices', '', function(r, rt) { }); + } else { + cur_frm.set_intro('To update prices from the attachment, click on "Update Prices". \ + To reset prices, delete the attachment (in the sidebar) and upload again.'); + + // Update Prices + cur_frm.add_custom_button('Update Prices', function() { + cur_frm.call_server('update_prices'); + }, 'icon-refresh') } } diff --git a/erpnext/setup/doctype/price_list/price_list.py b/erpnext/setup/doctype/price_list/price_list.py index 73ec12b216c..fed2768fd1d 100644 --- a/erpnext/setup/doctype/price_list/price_list.py +++ b/erpnext/setup/doctype/price_list/price_list.py @@ -14,23 +14,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Please edit this list and import only required elements +from __future__ import unicode_literals 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, getchildren, make_autoname -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 - -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 - -# ----------------------------------------------------------------------------------------- +from webnotes.model.doc import Document +from webnotes import msgprint class DocType: @@ -43,30 +31,44 @@ class DocType: if currency in self.cl: return 1 - if sql("select name from tabCurrency where name=%s", currency): + if webnotes.conn.sql("select name from tabCurrency where name=%s", currency): self.cl.append(currency) return 1 else: return 0 + + def download_template(self, arg=None): + """download 3 column template with all Items""" + default_currency = webnotes.conn.get_default('currency') + item_list = webnotes.conn.sql("""select name from tabItem where + (ifnull(is_sales_item,'')='Yes' or ifnull(is_service_item,'')='Yes')""") + data = [self.get_price(i[0], default_currency) for i in item_list] + return [['Item', 'Rate', 'Currency']] + data + + def get_price(self, item, default_currency): + rate = webnotes.conn.sql("""select ref_rate, ref_currency from `tabItem Price` + where parent=%s and price_list_name=%s""", (item, self.doc.name)) + return [item, rate and rate[0][0] or 0, rate and rate[0][1] or default_currency] # update prices in Price List def update_prices(self): + from core.page.data_import_tool.data_import_tool import read_csv_content + + data = read_csv_content(self.get_csv_data()) webnotes.conn.auto_commit_on_many_writes = 1 - import csv - data = csv.reader(self.get_csv_data().splitlines()) updated = 0 for line in data: - if line and len(line)==3: + if line and len(line)==3 and line[0]!='Item': # if item exists - if sql("select name from tabItem where name=%s", line[0]): + if webnotes.conn.sql("select name from tabItem where name=%s", line[0]): if self.is_currency_valid(line[2]): # if price exists - ref_ret_detail = sql("select name from `tabItem Price` where parent=%s and price_list_name=%s and ref_currency=%s", \ + ref_ret_detail = webnotes.conn.sql("select name from `tabItem Price` where parent=%s and price_list_name=%s and ref_currency=%s", \ (line[0], self.doc.name, line[2])) if ref_ret_detail: - sql("update `tabItem Price` set ref_rate=%s where name=%s", (line[1], ref_ret_detail[0][0])) + webnotes.conn.sql("update `tabItem Price` set ref_rate=%s where name=%s", (line[1], ref_ret_detail[0][0])) else: d = Document('Item Price') d.parent = line[0] @@ -81,18 +83,10 @@ class DocType: msgprint("[Ignored] Unknown currency '%s' for Item '%s'" % (line[2], line[0])) else: msgprint("[Ignored] Did not find Item '%s'" % line[1]) - else: - msgprint("[Ignored] Incorrect format: %s" % str(line)) msgprint("%s items updated" % updated) webnotes.conn.auto_commit_on_many_writes = 0 - # clear prices - def clear_prices(self): - cnt = sql("select count(*) from `tabItem Price` where price_list_name = %s", self.doc.name) - sql("delete from `tabItem Price` where price_list_name = %s", self.doc.name) - msgprint("%s prices cleared" % cnt[0][0]) - # Update CSV data def get_csv_data(self): if not self.doc.file_list: @@ -101,11 +95,11 @@ class DocType: fid = self.doc.file_list.split(',')[1] - from webnotes.utils import file_manager - fn, content = file_manager.get_file(fid) - - # NOTE: Don't know why this condition exists - if not isinstance(content, basestring) and hasattr(content, 'tostring'): - content = content.tostring() + try: + from webnotes.utils import file_manager + fn, content = file_manager.get_file(fid) + except Exception, e: + webnotes.msgprint("Unable to open attached file. Please try again.") + raise e return content diff --git a/erpnext/setup/doctype/price_list/price_list.txt b/erpnext/setup/doctype/price_list/price_list.txt index 2881cd7122d..79a7644c674 100644 --- a/erpnext/setup/doctype/price_list/price_list.txt +++ b/erpnext/setup/doctype/price_list/price_list.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-05-15 12:15:02', + 'creation': '2012-07-03 13:30:55', 'docstatus': 0, - 'modified': '2012-06-22 10:51:23', + 'modified': '2012-07-11 17:35:10', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -14,9 +14,13 @@ { '_last_update': u'1303100817', 'allow_attach': 1, + 'allow_copy': 1, + 'allow_email': 1, + 'allow_print': 1, 'allow_trash': 1, 'autoname': u'field:price_list_name', 'colour': u'White:FFF', + 'description': u'Maintain multiple selling rates for the same **Item** using **Price Lists**. You can upload / edit multiple prices by downloading and uploading the template.', 'doctype': 'DocType', 'document_type': u'Master', 'max_attachments': 1, @@ -34,7 +38,8 @@ 'name': '__common__', 'parent': u'Price List', 'parentfield': u'fields', - 'parenttype': u'DocType' + 'parenttype': u'DocType', + 'permlevel': 0 }, # These values are common for all DocPerm @@ -105,17 +110,6 @@ 'write': 1 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'trash_reason', - 'fieldtype': u'Small Text', - 'label': u'Trash Reason', - 'oldfieldname': u'trash_reason', - 'oldfieldtype': u'Small Text', - 'permlevel': 1 - }, - # DocField { 'doctype': u'DocField', @@ -124,55 +118,15 @@ 'label': u'Price List Name', 'oldfieldname': u'price_list_name', 'oldfieldtype': u'Data', - 'permlevel': 0, 'reqd': 1 }, - # DocField - { - 'colour': u'White:FFF', - 'depends_on': u'eval:!doc.__islocal', - 'doctype': u'DocField', - 'fieldname': u'price_help', - 'fieldtype': u'HTML', - 'label': u'Price Help', - 'permlevel': 0 - }, - - # DocField - { - 'colour': u'White:FFF', - 'depends_on': u'eval:!doc.__islocal', - 'description': u'Click on this button to clear prices for this list in all items', - 'doctype': u'DocField', - 'fieldname': u'clear_prices', - 'fieldtype': u'Button', - 'label': u'Clear Prices', - 'permlevel': 0, - 'trigger': u'Client' - }, - # DocField { 'doctype': u'DocField', 'fieldname': u'file_list', 'fieldtype': u'Text', 'hidden': 1, - 'label': u'File List', - 'permlevel': 0 - }, - - # DocField - { - 'colour': u'White:FFF', - 'depends_on': u'eval:!doc.__islocal', - 'description': u'Update prices from the attachment', - 'doctype': u'DocField', - 'fieldname': u'update_prices', - 'fieldtype': u'Button', - 'label': u'Update Prices', - 'options': u'update_prices', - 'permlevel': 0, - 'trigger': u'Server' + 'label': u'File List' } ] \ No newline at end of file diff --git a/erpnext/setup/doctype/print_heading/__init__.py b/erpnext/setup/doctype/print_heading/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/print_heading/__init__.py +++ b/erpnext/setup/doctype/print_heading/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/print_heading/print_heading.py b/erpnext/setup/doctype/print_heading/print_heading.py index b147bc87472..04ee345818a 100644 --- a/erpnext/setup/doctype/print_heading/print_heading.py +++ b/erpnext/setup/doctype/print_heading/print_heading.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/setup/doctype/quotation_lost_reason/__init__.py b/erpnext/setup/doctype/quotation_lost_reason/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/quotation_lost_reason/__init__.py +++ b/erpnext/setup/doctype/quotation_lost_reason/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/sales_browser_control/__init__.py b/erpnext/setup/doctype/sales_browser_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/sales_browser_control/__init__.py +++ b/erpnext/setup/doctype/sales_browser_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/sales_browser_control/sales_browser_control.py b/erpnext/setup/doctype/sales_browser_control/sales_browser_control.py index 74d60515a10..76ae1ba748b 100644 --- a/erpnext/setup/doctype/sales_browser_control/sales_browser_control.py +++ b/erpnext/setup/doctype/sales_browser_control/sales_browser_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/setup/doctype/sales_partner/__init__.py b/erpnext/setup/doctype/sales_partner/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/sales_partner/__init__.py +++ b/erpnext/setup/doctype/sales_partner/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.js b/erpnext/setup/doctype/sales_partner/sales_partner.js index 92c9966fc67..4f2aba2a193 100644 --- a/erpnext/setup/doctype/sales_partner/sales_partner.js +++ b/erpnext/setup/doctype/sales_partner/sales_partner.js @@ -95,55 +95,7 @@ cur_frm.cscript.make_contact = function() { } -// ******************** ITEM Group ******************************** cur_frm.fields_dict['partner_target_details'].grid.get_field("item_group").get_query = function(doc, dt, dn) { return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50' } -// make sales order list -cur_frm.cscript.make_so_list = function(parent, doc){ - var lst = new Listing(); - lst.colwidths = ['5%','20%','20%','15%','20%','20%']; - lst.colnames = ['Sr.','Id','Status','SO Date','Total Commission','Grand Total']; - lst.coltypes = ['Data','Link','Data','Data','Currency','Currency']; - lst.coloptions = ['','Sales Order','','','','','']; - - cur_frm.cscript.set_list_opts(lst); - - var q = repl("select name,status,transaction_date, total_commission,grand_total from `tabSales Order` where sales_partner='%(sp)s'", {'sp':doc.name}); - var q_max = repl("select count(name) from `tabSales Order` where sales_partner='%(cust)s'", {'sp':doc.name}); - - cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Order','Sales Order'); -} - -// make delivery note list -cur_frm.cscript.make_dn_list = function(parent,doc){ - var lst = new Listing(); - lst.colwidths = ['5%','20%','20%','15%','20%','20%']; - lst.colnames = ['Sr.','Id','Status','Date','Total Commission','Grand Total']; - lst.coltypes = ['Data','Link','Data','Data','Currency','Currency']; - lst.coloptions = ['','Delivery Note','','','','','']; - - cur_frm.cscript.set_list_opts(lst); - - var q = repl("select name,status,transaction_date, total_commission,grand_total from `tabDelivery Note` where sales_partner='%(sp)s'", {'sp':doc.name}); - var q_max = repl("select count(name) from `tabDelivery Note` where sales_partner='%(cust)s'", {'sp':doc.name}); - - cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Delivery Note','Delivery Note'); -} - -// make sales invoice list -cur_frm.cscript.make_si_list = function(parent,doc){ - var lst = new Listing(); - lst.colwidths = ['5%','25%','20%','25%','25%']; - lst.colnames = ['Sr.','Id','Invoice Date','Total Commission','Grand Total']; - lst.coltypes = ['Data','Link','Data','Data','Currency','Currency']; - lst.coloptions = ['','Sales Invoice','','','','']; - - cur_frm.cscript.set_list_opts(lst); - - var q = repl("select name,posting_date, total_commission,grand_total from `tabSales Invoice` where sales_partner='%(sp)s'", {'sp':doc.name}); - var q_max = repl("select count(name) from `tabSales Invoice` where sales_partner='%(cust)s'", {'sp':doc.name}); - - cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Invoice','Sales Invoice'); -} diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.py b/erpnext/setup/doctype/sales_partner/sales_partner.py index cd787df1345..b9bf561a23e 100644 --- a/erpnext/setup/doctype/sales_partner/sales_partner.py +++ b/erpnext/setup/doctype/sales_partner/sales_partner.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.txt b/erpnext/setup/doctype/sales_partner/sales_partner.txt index 0aa2de70436..4e792617aba 100644 --- a/erpnext/setup/doctype/sales_partner/sales_partner.txt +++ b/erpnext/setup/doctype/sales_partner/sales_partner.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:23', + 'creation': '2012-07-03 13:30:54', 'docstatus': 0, - 'modified': '2012-03-27 18:49:33', + 'modified': '2012-07-12 11:22:15', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -17,6 +17,7 @@ 'autoname': u'field:partner_name', 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'A **Sales Partner** is a third party distributor / dealer / commission agent / affiliate / reseller who sells the companies products for a commission. This is useful if you make the end sale to the **Customer**, involving your **Sales Partner**.\n\nIf you sell to your **Sales Partner** who in-turn sells it to the **Customer**, then you must make a **Customer** instead.', 'doctype': 'DocType', 'document_type': u'Master', 'in_create': 0, @@ -26,7 +27,7 @@ 'section_style': u'Tabbed', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 74 + 'version': 1 }, # These values are common for all DocField @@ -54,49 +55,6 @@ 'name': u'Sales Partner' }, - # DocPerm - { - 'amend': 0, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales Master Manager', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Master Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'System Manager', - 'write': 1 - }, - - # DocPerm - { - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'System Manager', - 'write': 0 - }, - # DocPerm { 'amend': 0, @@ -145,6 +103,49 @@ 'write': 0 }, + # DocPerm + { + 'amend': 0, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales Master Manager', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales Master Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'System Manager', + 'write': 1 + }, + + # DocPerm + { + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'System Manager', + 'write': 0 + }, + # DocField { 'colour': u'White:FFF', @@ -152,7 +153,7 @@ 'doctype': u'DocField', 'fieldname': u'basic_info', 'fieldtype': u'Section Break', - 'label': u'Basic Info', + 'label': u'Sales Partner Details', 'oldfieldtype': u'Section Break', 'permlevel': 0 }, @@ -282,23 +283,11 @@ 'doctype': u'DocField', 'fieldname': u'partner_target_details_section_break', 'fieldtype': u'Section Break', - 'label': u'Partner Target Details', + 'label': u'Sales Partner Target', 'oldfieldtype': u'Section Break', 'permlevel': 0 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'distribution_id', - 'fieldtype': u'Link', - 'label': u'Distribution Id', - 'oldfieldname': u'distribution_id', - 'oldfieldtype': u'Link', - 'options': u'Budget Distribution', - 'permlevel': 0 - }, - # DocField { 'doctype': u'DocField', @@ -312,37 +301,17 @@ 'reqd': 0 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'manage_html', - 'fieldtype': u'HTML', - 'hidden': 1, - 'label': u'Manage HTML', - 'oldfieldtype': u'HTML', - 'permlevel': 0, - 'print_hide': 1 - }, - # DocField { 'colour': u'White:FFF', - 'depends_on': u'eval:!doc.__islocal', + 'description': u'Select Budget Distribution to unevenly distribute targets across months.', 'doctype': u'DocField', - 'fieldname': u'transaction_history', - 'fieldtype': u'Section Break', - 'label': u'Transaction History', - 'oldfieldtype': u'Section Break', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'history_html', - 'fieldtype': u'HTML', - 'label': u'History HTML', - 'oldfieldtype': u'HTML', + 'fieldname': u'distribution_id', + 'fieldtype': u'Link', + 'label': u'Target Distribution', + 'oldfieldname': u'distribution_id', + 'oldfieldtype': u'Link', + 'options': u'Budget Distribution', 'permlevel': 0 }, diff --git a/erpnext/setup/doctype/sales_person/__init__.py b/erpnext/setup/doctype/sales_person/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/sales_person/__init__.py +++ b/erpnext/setup/doctype/sales_person/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/sales_person/sales_person.js b/erpnext/setup/doctype/sales_person/sales_person.js index 453d88a454f..a1cac8a8bed 100644 --- a/erpnext/setup/doctype/sales_person/sales_person.js +++ b/erpnext/setup/doctype/sales_person/sales_person.js @@ -14,30 +14,19 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +cur_frm.cscript.set_breadcrumbs = function(barea) { + cur_frm.frm_head.appframe.add_breadcrumb(cur_frm.docname); + cur_frm.frm_head.appframe.add_breadcrumb(' in \ + Sales Person Tree'); + cur_frm.frm_head.appframe.add_breadcrumb(' in Selling'); +} cur_frm.cscript.refresh = function(doc, cdt, cdn) { } cur_frm.cscript.onload = function(){ - if(doc.__islocal){ - doc.parent_sales_person = 'Root'; - refresh('parent_sales_person'); - } -} -cur_frm.cscript.country = function(doc, cdt, cdn) { - var mydoc=doc; - $c('runserverobj', args={'method':'check_state', 'docs':compress_doclist(make_doclist(doc.doctype, doc.name))}, - function(r,rt){ - if(r.message) { - var doc = locals[mydoc.doctype][mydoc.name]; - doc.state = ''; - get_field(doc.doctype, 'state' , doc.name).options = r.message; - refresh_field('state'); - } - } - ); -} +} //get query select sales person cur_frm.fields_dict['parent_sales_person'].get_query = function(doc,cdt,cdn) { diff --git a/erpnext/setup/doctype/sales_person/sales_person.py b/erpnext/setup/doctype/sales_person/sales_person.py index d8c6e43e660..0e0bd9351ba 100644 --- a/erpnext/setup/doctype/sales_person/sales_person.py +++ b/erpnext/setup/doctype/sales_person/sales_person.py @@ -15,81 +15,22 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals import webnotes -from webnotes.model.doc import Document from webnotes.model.doclist import getlist -from webnotes.model.code import get_obj -from webnotes import session, form, is_testing, msgprint, errprint -from webnotes.utils import flt, cstr +from webnotes.utils import flt -sql = webnotes.conn.sql -convert_to_lists = webnotes.conn.convert_to_lists - -# ----------------------------------------------------------------------------------------- +from webnotes.utils.nestedset import DocTypeNestedSet -class DocType: +class DocType(DocTypeNestedSet): def __init__(self, doc, doclist=[]): self.doc = doc self.doclist = doclist self.nsm_parent_field = 'parent_sales_person'; - - def check_state(self): - return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)]) - - - # update Node Set Model - def update_nsm_model(self): - import webnotes - import webnotes.utils.nestedset - webnotes.utils.nestedset.update_nsm(self) - - # ON UPDATE - #-------------------------------------- - def on_update(self): - # update nsm - self.update_nsm_model() - def validate(self): for d in getlist(self.doclist, 'target_details'): if not flt(d.target_qty) and not flt(d.target_amount): - msgprint("Either target qty or target amount is mandatory.") + webnotes.msgprint("Either target qty or target amount is mandatory.") raise Exception - - #self.sync_with_contact() - - def sync_with_contact(self): - cid = sql("select name from tabContact where sales_person_id = %s and is_sales_person=1", self.doc.name) - if cid: - d = Document('Contact', cid[0][0]) - else: - d = Document('Contact') - - name_split = self.doc.sales_person_name.split() - d.contact_name = self.doc.sales_person_name - d.first_name = name_split[0] - d.last_name = len(name_split) > 1 and name_split[1] or '' - d.email_id = self.doc.email_id - d.contact_no = d.mobile_no = self.doc.mobile_no - d.designation = self.doc.designation - d.department = self.doc.department - d.sales_person_id = self.doc.name - d.is_sales_person = 1 - - d.save(new = (not d.name)) - - - def on_trash(self): - st = sql("select parent, parenttype from `tabSales Team` where ifnull(sales_person, '') = %s and docstatus != 2", self.doc.name) - st = [(d[1] + ' : ' + d[0]) for d in st] - if st: - msgprint("""Sales Person: %s can not be trashed/deleted because it is used in %s. - To trash/delete this, remove/change sales person in %s""" % (self.doc.name, st or '', st or ''), raise_exception=1) - - if sql("select name from `tabSales Person` where parent_sales_person = %s and docstatus != 2", self.doc.name): - msgprint("Child sales person exists for this sales person. You can not trash/cancel this sales person.", raise_exception=1) - - # rebuild tree - webnotes.conn.set(self.doc,'old_parent', '') - self.update_nsm_model() diff --git a/erpnext/setup/doctype/sales_person/sales_person.txt b/erpnext/setup/doctype/sales_person/sales_person.txt index 5ff8e9414dc..028d828ceb1 100644 --- a/erpnext/setup/doctype/sales_person/sales_person.txt +++ b/erpnext/setup/doctype/sales_person/sales_person.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-04-13 11:56:32', + 'creation': '2012-07-03 13:30:54', 'docstatus': 0, - 'modified': '2012-05-31 11:28:32', + 'modified': '2012-07-12 10:33:10', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -16,6 +16,7 @@ 'allow_trash': 1, 'autoname': u'field:sales_person_name', 'colour': u'White:FFF', + 'description': u'All Sales Transactions can be tagged against multiple **Sales Persons** so that you can set and monitor targets.', 'doctype': 'DocType', 'document_type': u'Master', 'in_create': 1, @@ -126,17 +127,6 @@ 'permlevel': 1 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'general_info', - 'fieldtype': u'Section Break', - 'label': u'General Info', - 'oldfieldtype': u'Section Break', - 'options': u'Simple', - 'permlevel': 0 - }, - # DocField { 'doctype': u'DocField', @@ -167,17 +157,6 @@ 'trigger': u'Client' }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'sphelp', - 'fieldtype': u'HTML', - 'label': u'SPHelp', - 'oldfieldtype': u'HTML', - 'options': u'To manage Sales Person, click here', - 'permlevel': 0 - }, - # DocField { 'doctype': u'DocField', @@ -191,6 +170,14 @@ 'reqd': 1 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'cb0', + 'fieldtype': u'Column Break', + 'permlevel': 0 + }, + # DocField { 'doctype': u'DocField', @@ -201,125 +188,6 @@ 'permlevel': 0 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'department', - 'fieldtype': u'Data', - 'label': u'Department', - 'oldfieldname': u'department', - 'oldfieldtype': u'Data', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'designation', - 'fieldtype': u'Data', - 'label': u'Designation', - 'oldfieldname': u'designation', - 'oldfieldtype': u'Data', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'mobile_no', - 'fieldtype': u'Data', - 'label': u'Mobile No', - 'oldfieldname': u'mobile_no', - 'oldfieldtype': u'Data', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'column_break0', - 'fieldtype': u'Column Break', - 'oldfieldtype': u'Column Break', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'email_id', - 'fieldtype': u'Data', - 'label': u'Email Id', - 'oldfieldname': u'email_id', - 'oldfieldtype': u'Data', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'country', - 'fieldtype': u'Select', - 'in_filter': 1, - 'label': u'Country', - 'oldfieldname': u'country', - 'oldfieldtype': u'Select', - 'options': u'link:Country', - 'permlevel': 0, - 'search_index': 0, - 'trigger': u'Client' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'state', - 'fieldtype': u'Select', - 'in_filter': 1, - 'label': u'State', - 'oldfieldname': u'state', - 'oldfieldtype': u'Select', - 'options': u'link:State', - 'permlevel': 0, - 'search_index': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'city', - 'fieldtype': u'Data', - 'label': u'City', - 'oldfieldname': u'city', - 'oldfieldtype': u'Data', - 'permlevel': 0, - 'reqd': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'territory', - 'fieldtype': u'Link', - 'hidden': 0, - 'label': u'Territory', - 'oldfieldname': u'territory', - 'oldfieldtype': u'Link', - 'options': u'Territory', - 'permlevel': 0, - 'search_index': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'territory_help', - 'fieldtype': u'HTML', - 'label': u'Territory Help', - 'oldfieldtype': u'HTML', - 'options': u'To manage Territories, click here', - 'permlevel': 0 - }, - # DocField { 'doctype': u'DocField', @@ -368,25 +236,13 @@ # DocField { - 'doctype': u'DocField', - 'fieldname': u'distribution_id', - 'fieldtype': u'Link', - 'label': u'Distribution Id', - 'oldfieldname': u'distribution_id', - 'oldfieldtype': u'Link', - 'options': u'Budget Distribution', - 'permlevel': 0, - 'search_index': 0 - }, - - # DocField - { + 'colour': u'White:FFF', + 'description': u'Set targets Item Group-wise for this Sales Person.', 'doctype': u'DocField', 'fieldname': u'target_details_section_break', 'fieldtype': u'Section Break', - 'label': u'Target Details', + 'label': u'Sales Person Targets', 'oldfieldtype': u'Section Break', - 'options': u'Simple', 'permlevel': 0 }, @@ -400,5 +256,20 @@ 'oldfieldtype': u'Table', 'options': u'Target Detail', 'permlevel': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'Select Budget Distribution to unevenly distribute targets across months.', + 'doctype': u'DocField', + 'fieldname': u'distribution_id', + 'fieldtype': u'Link', + 'label': u'Target Distribution', + 'oldfieldname': u'distribution_id', + 'oldfieldtype': u'Link', + 'options': u'Budget Distribution', + 'permlevel': 0, + 'search_index': 0 } ] \ No newline at end of file diff --git a/erpnext/setup/doctype/series_detail/__init__.py b/erpnext/setup/doctype/series_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/series_detail/__init__.py +++ b/erpnext/setup/doctype/series_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/setup_control/__init__.py b/erpnext/setup/doctype/setup_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/setup_control/__init__.py +++ b/erpnext/setup/doctype/setup_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/setup_control/setup_control.py b/erpnext/setup/doctype/setup_control/setup_control.py index 444b796f3cc..1eca582f2ca 100644 --- a/erpnext/setup/doctype/setup_control/setup_control.py +++ b/erpnext/setup/doctype/setup_control/setup_control.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.utils import cint, cstr, flt, getdate, now, nowdate @@ -49,9 +50,7 @@ class DocType: master_dict = {'Fiscal Year':{ 'year': curr_fiscal_year, 'year_start_date': fy_start_date, - 'abbreviation': fy_abbr, - 'company': args.get('company_name'), - 'is_fiscal_year_closed': 'No'}} + 'company': args.get('company_name')}} self.create_records(master_dict) # Company diff --git a/erpnext/setup/doctype/sms_parameter/__init__.py b/erpnext/setup/doctype/sms_parameter/__init__.py index e69de29bb2d..baffc488252 100755 --- a/erpnext/setup/doctype/sms_parameter/__init__.py +++ b/erpnext/setup/doctype/sms_parameter/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/sms_settings/__init__.py b/erpnext/setup/doctype/sms_settings/__init__.py index e69de29bb2d..baffc488252 100755 --- a/erpnext/setup/doctype/sms_settings/__init__.py +++ b/erpnext/setup/doctype/sms_settings/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/state/__init__.py b/erpnext/setup/doctype/state/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/state/__init__.py +++ b/erpnext/setup/doctype/state/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/supplier_type/__init__.py b/erpnext/setup/doctype/supplier_type/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/supplier_type/__init__.py +++ b/erpnext/setup/doctype/supplier_type/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/supplier_type/supplier_type.js b/erpnext/setup/doctype/supplier_type/supplier_type.js index 306ead0928d..945dec0823b 100644 --- a/erpnext/setup/doctype/supplier_type/supplier_type.js +++ b/erpnext/setup/doctype/supplier_type/supplier_type.js @@ -14,14 +14,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . - - -// ONLOAD -// =================================================================================== -cur_frm.cscript.onload = function(doc, cdt, cdn) { - -} - -cur_frm.cscript.refresh = function(doc, cdt, cdn) { - +cur_frm.cscript.refresh = function(doc) { + cur_frm.set_intro(doc.__islocal ? "" : "There is nothing to edit.") } \ No newline at end of file diff --git a/erpnext/setup/doctype/target_detail/__init__.py b/erpnext/setup/doctype/target_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/target_detail/__init__.py +++ b/erpnext/setup/doctype/target_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/terms_and_conditions/__init__.py b/erpnext/setup/doctype/terms_and_conditions/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/terms_and_conditions/__init__.py +++ b/erpnext/setup/doctype/terms_and_conditions/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.txt b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.txt index 09d71f4ad9f..c120b2c4ff1 100644 --- a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.txt +++ b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:25', + 'creation': '2012-07-03 13:30:54', 'docstatus': 0, - 'modified': '2012-03-27 14:36:25', + 'modified': '2012-07-12 11:37:56', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -17,6 +17,7 @@ 'autoname': u'field:title', 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'Standard Terms and Conditions that can be added to Sales and Purchases.\n\nExamples:\n\n1. Validity of the offer.\n1. Payment Terms (In Advance, On Credit, part advance etc).\n1. What is extra (or payable by the Customer).\n1. Safety / usage warning.\n1. Warranty if any.\n1. Returns Policy.\n1. Terms of shipping, if applicable.\n1. Ways of addressing disputes, indemnity, liability, etc.\n1. Address and Contact of your Company.', 'doctype': 'DocType', 'document_type': u'Master', 'module': u'Setup', @@ -24,7 +25,7 @@ 'section_style': u'Simple', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 11 + 'version': 1 }, # These values are common for all DocField @@ -52,6 +53,42 @@ 'name': u'Terms and Conditions' }, + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales Master Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales Master Manager', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales User', + 'submit': 0, + 'write': 0 + }, + # DocPerm { 'amend': 0, @@ -91,42 +128,6 @@ 'write': 1 }, - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Master Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales Master Manager', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales User', - 'submit': 0, - 'write': 0 - }, - # DocField { 'doctype': u'DocField', diff --git a/erpnext/setup/doctype/territory/__init__.py b/erpnext/setup/doctype/territory/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/territory/__init__.py +++ b/erpnext/setup/doctype/territory/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/territory/territory.js b/erpnext/setup/doctype/territory/territory.js index 46312c4e51a..9b36d0c6f05 100644 --- a/erpnext/setup/doctype/territory/territory.js +++ b/erpnext/setup/doctype/territory/territory.js @@ -15,17 +15,19 @@ // along with this program. If not, see . +cur_frm.cscript.set_breadcrumbs = function(barea) { + cur_frm.frm_head.appframe.add_breadcrumb(cur_frm.docname); + cur_frm.frm_head.appframe.add_breadcrumb(' in \ + Territory Tree'); + cur_frm.frm_head.appframe.add_breadcrumb(' in Selling'); +} cur_frm.cscript.refresh = function(doc, cdt, cdn) { } cur_frm.cscript.onload = function(){ - - if(doc.__islocal){ - doc.parent_territory = 'All Territories'; - refresh('parent_territory'); - } + } diff --git a/erpnext/setup/doctype/territory/territory.py b/erpnext/setup/doctype/territory/territory.py index 606efa8ef93..ebc25ea740c 100644 --- a/erpnext/setup/doctype/territory/territory.py +++ b/erpnext/setup/doctype/territory/territory.py @@ -8,87 +8,29 @@ # # 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 +# 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 . +# along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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, getchildren, make_autoname -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.model.doclist import getlist +from webnotes.utils import flt -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 +from webnotes.utils.nestedset import DocTypeNestedSet -# ----------------------------------------------------------------------------------------- +class DocType(DocTypeNestedSet): + def __init__(self, doc, doclist=[]): + self.doc = doc + self.doclist = doclist + self.nsm_parent_field = 'parent_territory' - -class DocType: - def __init__(self, doc, doclist=[]): - self.doc = doc - self.doclist = doclist - self.nsm_parent_field = 'parent_territory' - - def check_state(self): - return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)]) - - - - # update Node Set Model - def update_nsm_model(self): - import webnotes - import webnotes.utils.nestedset - webnotes.utils.nestedset.update_nsm(self) - - # ON UPDATE - #-------------------------------------- - def on_update(self): - - # update nsm - self.update_nsm_model() - - - - def validate(self): - if self.doc.lft and self.doc.rgt: - res = sql("select name from `tabTerritory` where is_group = 'Yes' and docstatus!= 2 and name ='%s' and name !='%s'"%(self.doc.parent_territory,self.doc.territory_name)) - if not res: - msgprint("Please enter proper parent territory.") - raise Exception - - r = sql("select name from `tabTerritory` where name = '%s' and docstatus = 2"%(self.doc.territory_name)) - if r: - msgprint("%s record is trashed. To untrash please go to Setup & click on Trash."%(self.doc.territory_name)) - raise Exception - - for d in getlist(self.doclist, 'target_details'): - if not flt(d.target_qty) and not flt(d.target_amount): - msgprint("Either target qty or target amount is mandatory.") - raise Exception - - - def on_trash(self): - cust = sql("select name from `tabCustomer` where ifnull(territory, '') = %s", self.doc.name) - cust = [d[0] for d in cust] - - if cust: - msgprint("""Territory: %s can not be trashed/deleted because it is used in customer: %s. - To trash/delete this, remove/change territory in customer master""" % (self.doc.name, cust or ''), raise_exception=1) - - - if sql("select name from `tabTerritory` where parent_territory = %s and docstatus != 2", self.doc.name): - msgprint("Child territory exists for this territory. You can not trash/cancel/delete this territory.", raise_exception=1) - - # rebuild tree - set(self.doc,'old_parent', '') - self.update_nsm_model() + def validate(self): + for d in getlist(self.doclist, 'target_details'): + if not flt(d.target_qty) and not flt(d.target_amount): + msgprint("Either target qty or target amount is mandatory.") + raise Exception diff --git a/erpnext/setup/doctype/territory/territory.txt b/erpnext/setup/doctype/territory/territory.txt index 363280128cb..a9cdf058000 100644 --- a/erpnext/setup/doctype/territory/territory.txt +++ b/erpnext/setup/doctype/territory/territory.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-04-13 11:56:32', + 'creation': '2012-07-03 13:30:55', 'docstatus': 0, - 'modified': '2012-05-31 11:39:33', + 'modified': '2012-07-12 10:01:47', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -17,12 +17,14 @@ 'autoname': u'field:territory_name', 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'You can create **Territories** If your organization operates in multiple regions (could be countries, states or cities). Once you group **Customers** by **Territories**, you can set annual targets for each **Item Group** and get reports that will show your actual performance in the territory v/s what you had planned.', 'doctype': 'DocType', 'document_type': u'Master', 'in_create': 1, 'module': u'Setup', 'name': '__common__', 'name_case': u'Title Case', + 'read_only': 1, 'search_fields': u'name,parent_territory,territory_manager', 'section_style': u'Simple', 'server_code_error': u' ', @@ -141,20 +143,6 @@ 'reqd': 1 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'territory_manager', - 'fieldtype': u'Link', - 'in_filter': 1, - 'label': u'Territory Manager', - 'oldfieldname': u'territory_manager', - 'oldfieldtype': u'Link', - 'options': u'Sales Person', - 'permlevel': 0, - 'search_index': 1 - }, - # DocField { 'doctype': u'DocField', @@ -169,17 +157,6 @@ 'trigger': u'Client' }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'territoryhelp', - 'fieldtype': u'HTML', - 'label': u'TerritoryHelp', - 'oldfieldtype': u'HTML', - 'options': u'To manage Territories, click here', - 'permlevel': 0 - }, - # DocField { 'colour': u'White:FFF', @@ -195,6 +172,30 @@ 'reqd': 1 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'cb0', + 'fieldtype': u'Column Break', + 'permlevel': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'For reference', + 'doctype': u'DocField', + 'fieldname': u'territory_manager', + 'fieldtype': u'Link', + 'in_filter': 1, + 'label': u'Territory Manager', + 'oldfieldname': u'territory_manager', + 'oldfieldtype': u'Link', + 'options': u'Sales Person', + 'permlevel': 0, + 'search_index': 1 + }, + # DocField { 'doctype': u'DocField', @@ -247,22 +248,12 @@ # DocField { - 'doctype': u'DocField', - 'fieldname': u'distribution_id', - 'fieldtype': u'Link', - 'label': u'Distribution Id', - 'oldfieldname': u'distribution_id', - 'oldfieldtype': u'Link', - 'options': u'Budget Distribution', - 'permlevel': 0 - }, - - # DocField - { + 'colour': u'White:FFF', + 'description': u'Set Item Group-wise budgets on this Territory. You can also include seasonality by setting the Distribution.', 'doctype': u'DocField', 'fieldname': u'target_details_section_break', 'fieldtype': u'Section Break', - 'label': u'Target Details', + 'label': u'Territory Targets', 'oldfieldtype': u'Section Break', 'permlevel': 0 }, @@ -272,10 +263,24 @@ 'doctype': u'DocField', 'fieldname': u'target_details', 'fieldtype': u'Table', - 'label': u'Target Details1', + 'label': u'Target Details', 'oldfieldname': u'target_details', 'oldfieldtype': u'Table', 'options': u'Target Detail', 'permlevel': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'Select Budget Distribution to unevenly distribute targets across months.', + 'doctype': u'DocField', + 'fieldname': u'distribution_id', + 'fieldtype': u'Link', + 'label': u'Target Distribution', + 'oldfieldname': u'distribution_id', + 'oldfieldtype': u'Link', + 'options': u'Budget Distribution', + 'permlevel': 0 } ] \ No newline at end of file diff --git a/erpnext/setup/doctype/uom/__init__.py b/erpnext/setup/doctype/uom/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/uom/__init__.py +++ b/erpnext/setup/doctype/uom/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/warehouse_type/__init__.py b/erpnext/setup/doctype/warehouse_type/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/warehouse_type/__init__.py +++ b/erpnext/setup/doctype/warehouse_type/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/workflow_action_detail/__init__.py b/erpnext/setup/doctype/workflow_action_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/workflow_action_detail/__init__.py +++ b/erpnext/setup/doctype/workflow_action_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/workflow_engine/__init__.py b/erpnext/setup/doctype/workflow_engine/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/workflow_engine/__init__.py +++ b/erpnext/setup/doctype/workflow_engine/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/workflow_engine/workflow_engine.py b/erpnext/setup/doctype/workflow_engine/workflow_engine.py index ce15416170e..82152b90c95 100644 --- a/erpnext/setup/doctype/workflow_engine/workflow_engine.py +++ b/erpnext/setup/doctype/workflow_engine/workflow_engine.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/setup/doctype/workflow_rule/__init__.py b/erpnext/setup/doctype/workflow_rule/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/workflow_rule/__init__.py +++ b/erpnext/setup/doctype/workflow_rule/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/workflow_rule/workflow_rule.py b/erpnext/setup/doctype/workflow_rule/workflow_rule.py index c5b198b64e4..ca09f2fd0f7 100644 --- a/erpnext/setup/doctype/workflow_rule/workflow_rule.py +++ b/erpnext/setup/doctype/workflow_rule/workflow_rule.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/setup/doctype/workflow_rule_detail/__init__.py b/erpnext/setup/doctype/workflow_rule_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/doctype/workflow_rule_detail/__init__.py +++ b/erpnext/setup/doctype/workflow_rule_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/page/__init__.py b/erpnext/setup/page/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/page/__init__.py +++ b/erpnext/setup/page/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/page/modules_setup/__init__.py b/erpnext/setup/page/modules_setup/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/page/modules_setup/__init__.py +++ b/erpnext/setup/page/modules_setup/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/page/modules_setup/modules_setup.py b/erpnext/setup/page/modules_setup/modules_setup.py index ee36dfaeaac..3a3504a226b 100644 --- a/erpnext/setup/page/modules_setup/modules_setup.py +++ b/erpnext/setup/page/modules_setup/modules_setup.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import webnotes @webnotes.whitelist() diff --git a/erpnext/setup/page/permission_engine/__init__.py b/erpnext/setup/page/permission_engine/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/page/permission_engine/__init__.py +++ b/erpnext/setup/page/permission_engine/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/page/setup/__init__.py b/erpnext/setup/page/setup/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/page/setup/__init__.py +++ b/erpnext/setup/page/setup/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/setup/page/setup/setup.html b/erpnext/setup/page/setup/setup.html index 70143a4c205..1eca285065e 100644 --- a/erpnext/setup/page/setup/setup.html +++ b/erpnext/setup/page/setup/setup.html @@ -19,7 +19,7 @@

    Users and Permissions

    - Users
    + Users
    Add/remove users, set roles, passwords etc

    @@ -49,10 +49,6 @@ Rename Master
    Rename a single master record

    -

    - Rename Many
    - Rename by uploading a csv file -

    Email and Notifications

    diff --git a/erpnext/setup/page/webforms/__init__.py b/erpnext/setup/page/webforms/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/setup/page/webforms/__init__.py +++ b/erpnext/setup/page/webforms/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/startup/__init__.py b/erpnext/startup/__init__.py index cd443a082c1..c763d9c0544 100644 --- a/erpnext/startup/__init__.py +++ b/erpnext/startup/__init__.py @@ -14,6 +14,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# default settings that can be made for a profile. +from __future__ import unicode_literals + +product_name = "ERPNext" +profile_defaults = { + "Company": "company", + "Territory": "territory" +} + # add startup propertes mail_footer = """
    Sent via ERPNext
    """ @@ -24,4 +33,4 @@ def get_monthly_bulk_mail_limit(): if webnotes.conn.get_value('Email Settings', None, 'outgoing_mail_server'): return 999999 else: - return 500 \ No newline at end of file + return 500 diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py index 0c5eae18921..ffbf11373b0 100644 --- a/erpnext/startup/event_handlers.py +++ b/erpnext/startup/event_handlers.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.utils import cint import home @@ -40,8 +41,9 @@ def on_login_post_session(login_manager): if webnotes.session['user'] not in ('Guest', 'demo@webnotestech.com'): # create feed from webnotes.utils import nowtime + from webnotes.profile import get_user_fullname home.make_feed('Login', 'Profile', login_manager.user, login_manager.user, - '%s logged in at %s' % (login_manager.user_fullname, nowtime()), + '%s logged in at %s' % (get_user_fullname, nowtime()), login_manager.user=='Administrator' and '#8CA2B3' or '#1B750D') @@ -85,7 +87,7 @@ def boot_session(bootinfo): # load subscription info import conf - for key in ['max_users', 'expires_on', 'max_space', 'status']: + for key in ['max_users', 'expires_on', 'max_space', 'status', 'developer_mode']: if hasattr(conf, key): bootinfo[key] = getattr(conf, key) company = webnotes.conn.sql("select name, default_currency from `tabCompany`", as_dict=1) @@ -94,7 +96,7 @@ def boot_session(bootinfo): company_dict.setdefault(c['name'], {}).update(c) bootinfo['company'] = company_dict - + def get_letter_heads(): """load letter heads with startup""" import webnotes diff --git a/erpnext/startup/report_data_map.py b/erpnext/startup/report_data_map.py index aa23ade5216..38c2dd25c92 100644 --- a/erpnext/startup/report_data_map.py +++ b/erpnext/startup/report_data_map.py @@ -20,11 +20,16 @@ data_map = { "company"], "order_by": "lft" }, + "Cost Center": { + "columns": ["name", "parent_cost_center", "lft", "rgt", "debit_or_credit", + "company"], + "order_by": "lft" + }, "GL Entry": { "columns": ["account", "posting_date", "cost_center", "debit", "credit", "is_opening", - "company"], + "company", "voucher_type", "voucher_no", "remarks"], "conditions": ["ifnull(is_cancelled, 'No')='No'"], - "order_by": "posting_date" + "order_by": "posting_date, account" }, "Company": { "columns": ["name"], @@ -32,6 +37,6 @@ data_map = { }, "Fiscal Year": { "columns": ["name", "year_start_date", - "adddate(year_start_date, interval 1 year) as year_end_date"] + "adddate(adddate(year_start_date, interval 1 year), interval -1 day) as year_end_date"] } } diff --git a/erpnext/startup/schedule_handlers.py b/erpnext/startup/schedule_handlers.py index 2df7a5789d2..f3eb05a8245 100644 --- a/erpnext/startup/schedule_handlers.py +++ b/erpnext/startup/schedule_handlers.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals """will be called by scheduler""" import webnotes @@ -27,10 +28,6 @@ def execute_all(): # pull emails from support.doctype.support_ticket import get_support_mails run_fn(get_support_mails) - - # run recurring invoices - from accounts.doctype.gl_control.gl_control import manage_recurring_invoices - run_fn(manage_recurring_invoices) # bulk email from webnotes.utils.email_lib.bulk import flush @@ -41,6 +38,10 @@ def execute_daily(): from setup.doctype.email_digest.email_digest import send run_fn(send) + # run recurring invoices + from accounts.doctype.gl_control.gl_control import manage_recurring_invoices + run_fn(manage_recurring_invoices) + # send bulk emails from webnotes.utils.email_lib.bulk import clear_outbox run_fn(clear_outbox) diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js index 60104645b02..7fb48c12bf3 100644 --- a/erpnext/startup/startup.js +++ b/erpnext/startup/startup.js @@ -76,7 +76,7 @@ erpnext.startup.start = function() { // complete registration if(in_list(user_roles,'System Manager') && (wn.boot.setup_complete=='No')) { - wn.require("js/complete_setup.js"); + wn.require("js/app/complete_setup.js"); erpnext.complete_setup.show(); } if(wn.boot.expires_on && in_list(user_roles, 'System Manager')) { @@ -100,10 +100,6 @@ erpnext.startup.start = function() { if(wn.control_panel.custom_startup_code) eval(wn.control_panel.custom_startup_code); } - - - $('body').append('') } diff --git a/erpnext/stock/__init__.py b/erpnext/stock/__init__.py index f1714250066..7c2a0d4493b 100644 --- a/erpnext/stock/__init__.py +++ b/erpnext/stock/__init__.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals install_docs = [ {"doctype":"Role", "role_name":"Material Manager", "name":"Material Manager"}, {"doctype":"Role", "role_name":"Material Master Manager", "name":"Material Master Manager"}, diff --git a/erpnext/stock/doctype/__init__.py b/erpnext/stock/doctype/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/__init__.py +++ b/erpnext/stock/doctype/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/batch/__init__.py b/erpnext/stock/doctype/batch/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/batch/__init__.py +++ b/erpnext/stock/doctype/batch/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/bin/__init__.py b/erpnext/stock/doctype/bin/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/bin/__init__.py +++ b/erpnext/stock/doctype/bin/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index e413c028934..348ec13fc75 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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, set_default, str_esc_quote, user_format, validate_email_add diff --git a/erpnext/stock/doctype/delivery_note/__init__.py b/erpnext/stock/doctype/delivery_note/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/delivery_note/__init__.py +++ b/erpnext/stock/doctype/delivery_note/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 32315234bee..06f14d4acc7 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 @@ -196,51 +197,6 @@ class DocType(TransactionBase): get_obj('DocType Mapper', 'Sales Order-Delivery Note', with_children = 1).validate_reference_value(self, self.doc.name) - def validate_prevdoc_details(self): - for d in getlist(self.doclist,'delivery_note_details'): - prevdoc = d.prevdoc_doctype - prevdoc_docname = d.prevdoc_docname - - if prevdoc_docname and prevdoc: - # Validates Transaction Date of DN and previous doc (i.e. SO , PO, PR) - trans_date = sql("select posting_date from `tab%s` where name = '%s'" %(prevdoc,prevdoc_docname))[0][0] - if trans_date and getdate(self.doc.posting_date) < (trans_date): - msgprint("Your Posting Date cannot be before "+cstr(prevdoc)+" Date.") - raise Exception - # Validates DN and previous doc details - get_name = sql("select name from `tab%s` where name = '%s'" % (prevdoc, prevdoc_docname)) - name = get_name and get_name[0][0] or '' - if name: #check for incorrect docname - if prevdoc == 'Sales Order': - dt = sql("select company, docstatus, customer, currency, sales_partner from `tab%s` where name = '%s'" % (prevdoc, name)) - cust_name = dt and dt[0][2] or '' - if cust_name != self.doc.customer: - msgprint(cstr(prevdoc) + ": " + cstr(prevdoc_docname) + " customer :" + cstr(cust_name) + " does not match with customer : " + cstr(self.doc.customer) + " of current document.") - raise Exception, "Validation Error. " - sal_partner = dt and dt[0][4] or '' - if sal_partner != self.doc.sales_partner: - msgprint(cstr(prevdoc) + ": " + cstr(prevdoc_docname) + " sales partner name :" + cstr(sal_partner) + " does not match with sales partner name : " + cstr(self.doc.sales_partner_name) + " of current document.") - raise Exception, "Validation Error. " - else: - dt = sql("select company, docstatus, supplier, currency from `tab%s` where name = '%s'" % (prevdoc, name)) - supp_name = dt and dt[0][2] or '' - company_name = dt and dt[0][0] or '' - docstatus = dt and dt[0][1] or 0 - currency = dt and dt[0][3] or '' - if (currency != self.doc.currency): - msgprint(cstr(prevdoc) + ": " + cstr(prevdoc_docname) + " currency : "+ cstr(currency) + "does not match with Currency: " + cstr(self.doc.currency) + "of current document") - raise Exception, "Validation Error." - if (company_name != self.doc.company): - msgprint(cstr(prevdoc) + ": " + cstr(prevdoc_docname) + " does not belong to the Company: " + cstr(self.doc.company_name)) - raise Exception, "Validation Error." - if (docstatus != 1): - msgprint(cstr(prevdoc) + ": " + cstr(prevdoc_docname) + " is not Submitted Document.") - raise Exception, "Validation Error." - else: - msgprint(cstr(prevdoc) + ": " + cstr(prevdoc_docname) + " is not a valid " + cstr(prevdoc)) - raise Exception, "Validation Error." - - def validate_for_items(self): check_list, chk_dupl_itm = [], [] for d in getlist(self.doclist,'delivery_note_details'): @@ -291,11 +247,22 @@ class DocType(TransactionBase): set(self.doc, 'message', 'Items against your Order #%s have been delivered. Delivery #%s: ' % (self.doc.po_no, self.doc.name)) # Check for Approving Authority get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total, self) + + # validate serial no for item table (non-sales-bom item) and packing list (sales-bom item) sl_obj = get_obj("Stock Ledger") + sl_obj.validate_serial_no(self, 'delivery_note_details') + sl_obj.validate_serial_no_warehouse(self, 'delivery_note_details') sl_obj.validate_serial_no(self, 'packing_details') sl_obj.validate_serial_no_warehouse(self, 'packing_details') + + # update delivery details in serial no + sl_obj.update_serial_record(self, 'delivery_note_details', is_submit = 1, is_incoming = 0) sl_obj.update_serial_record(self, 'packing_details', is_submit = 1, is_incoming = 0) + + # update delivered qty in sales order get_obj("Sales Common").update_prevdoc_detail(1,self) + + # create stock ledger entry self.update_stock_ledger(update_stock = 1) self.credit_limit() @@ -331,10 +298,14 @@ class DocType(TransactionBase): sales_com_obj = get_obj(dt = 'Sales Common') sales_com_obj.check_stop_sales_order(self) self.check_next_docstatus() - get_obj('Stock Ledger').update_serial_record(self, 'packing_details', is_submit = 0, is_incoming = 0) + + # remove delivery details from serial no + sl = get_obj('Stock Ledger') + sl.update_serial_record(self, 'delivery_note_details', is_submit = 0, is_incoming = 0) + sl.update_serial_record(self, 'packing_details', is_submit = 0, is_incoming = 0) + sales_com_obj.update_prevdoc_detail(0,self) self.update_stock_ledger(update_stock = -1) - # :::::: set DN status ::::::: set(self.doc, 'status', 'Cancelled') self.cancel_packing_slips() @@ -434,7 +405,7 @@ class DocType(TransactionBase): def on_update(self): self.doclist = get_obj('Sales Common').make_packing_list(self,'delivery_note_details') - self.set_actual_qty() - get_obj('Stock Ledger').scrub_serial_nos(self) - + sl = get_obj('Stock Ledger') + sl.scrub_serial_nos(self) + sl.scrub_serial_nos(self, 'packing_details') diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.txt b/erpnext/stock/doctype/delivery_note/delivery_note.txt index 7db951328be..2520c479922 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.txt +++ b/erpnext/stock/doctype/delivery_note/delivery_note.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-05-15 12:15:05', + 'creation': '2012-07-13 11:57:15', 'docstatus': 0, - 'modified': '2012-05-18 18:06:26', + 'modified': '2012-07-16 16:24:46', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -58,68 +58,6 @@ 'name': u'Delivery Note' }, - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material User', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales User', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material Master Manager', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material Manager', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'All' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 2, - 'role': u'All' - }, - # DocField { 'colour': u'White:FFF', @@ -340,6 +278,7 @@ # DocField { 'allow_on_submit': 1, + 'colour': u'White:FFF', 'doctype': u'DocField', 'fieldname': u'delivery_note_details', 'fieldtype': u'Table', @@ -352,6 +291,16 @@ 'print_hide': 0 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'sales_bom_help', + 'fieldtype': u'HTML', + 'label': u'Sales BOM Help', + 'permlevel': 0, + 'print_hide': 1 + }, + # DocField { 'doctype': u'DocField', @@ -486,7 +435,7 @@ 'description': u"Rate at which Price list currency is converted to company's base currency", 'doctype': u'DocField', 'fieldname': u'plc_conversion_rate', - 'fieldtype': u'Currency', + 'fieldtype': u'Float', 'label': u'Price List Currency Conversion Rate', 'permlevel': 0, 'print_hide': 1, @@ -525,7 +474,7 @@ 'description': u"Rate at which customer's currency is converted to company's base currency", 'doctype': u'DocField', 'fieldname': u'conversion_rate', - 'fieldtype': u'Currency', + 'fieldtype': u'Float', 'label': u'Conversion Rate', 'no_copy': 0, 'oldfieldname': u'conversion_rate', @@ -1412,5 +1361,111 @@ 'no_copy': 1, 'permlevel': 0, 'print_hide': 1 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material User', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material Manager', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales User', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Accounts User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Accounts User' + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'match': u'customer_name', + 'permlevel': 0, + 'role': u'Customer' + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 2, + 'role': u'All', + 'write': 1 } ] \ No newline at end of file diff --git a/erpnext/stock/doctype/delivery_note_item/__init__.py b/erpnext/stock/doctype/delivery_note_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/delivery_note_item/__init__.py +++ b/erpnext/stock/doctype/delivery_note_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/delivery_note_packing_item/__init__.py b/erpnext/stock/doctype/delivery_note_packing_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/delivery_note_packing_item/__init__.py +++ b/erpnext/stock/doctype/delivery_note_packing_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/delivery_note_packing_item/delivery_note_packing_item.txt b/erpnext/stock/doctype/delivery_note_packing_item/delivery_note_packing_item.txt index 51001fc9a0f..db512c64c04 100644 --- a/erpnext/stock/doctype/delivery_note_packing_item/delivery_note_packing_item.txt +++ b/erpnext/stock/doctype/delivery_note_packing_item/delivery_note_packing_item.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-04-13 11:56:35', + 'creation': '2012-06-11 12:10:10', 'docstatus': 0, - 'modified': '2012-05-09 12:55:23', + 'modified': '2012-07-10 12:05:31', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -111,7 +111,7 @@ 'oldfieldname': u'warehouse', 'oldfieldtype': u'Link', 'options': u'Warehouse', - 'permlevel': 1 + 'permlevel': 0 }, # DocField diff --git a/erpnext/stock/doctype/item/__init__.py b/erpnext/stock/doctype/item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/item/__init__.py +++ b/erpnext/stock/doctype/item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index 572a790264c..0a255d1291b 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -35,8 +35,8 @@ cur_frm.cscript.refresh = function(doc) { cur_frm.cscript.hide_website_fields = function(doc) { var website_fields_list = ['page_name', 'website_image', 'web_short_description', - 'web_long_description'] - if (cint(doc.show_in_website)) { + 'web_long_description']; + if (doc && cint(doc.show_in_website)) { unhide_field(website_fields_list); } else { hide_field(website_fields_list); diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index c21b5522322..6a0f200698a 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 @@ -222,7 +223,7 @@ class DocType: import website.utils # if same name, do not repeat twice - if self.doc.name == self.doc.item_name: + if self.doc.name == self.doc.item_name or not self.doc.item_name: page_name = self.doc.name else: page_name = self.doc.name + " " + self.doc.item_name diff --git a/erpnext/stock/doctype/item/item.txt b/erpnext/stock/doctype/item/item.txt index d87f56d2f93..c624fc13798 100644 --- a/erpnext/stock/doctype/item/item.txt +++ b/erpnext/stock/doctype/item/item.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-06-08 12:54:51', + 'creation': '2012-07-03 13:30:46', 'docstatus': 0, - 'modified': '2012-07-04 11:10:51', + 'modified': '2012-07-11 09:57:42', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -196,7 +196,7 @@ # DocField { 'colour': u'White:FFF', - 'description': u'Classify your item in any one item group by clicking on the magnifying glass', + 'description': u'Manage Item Groups', 'doctype': u'DocField', 'fieldname': u'item_group', 'fieldtype': u'Link', @@ -209,17 +209,6 @@ 'reqd': 1 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'ighelp', - 'fieldtype': u'HTML', - 'label': u'IGHelp', - 'oldfieldtype': u'HTML', - 'options': u'To manage Item Groups, click here', - 'permlevel': 0 - }, - # DocField { 'doctype': u'DocField', diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py index 43ace79fdbf..b48e2d27734 100644 --- a/erpnext/stock/doctype/item/test_item.py +++ b/erpnext/stock/doctype/item/test_item.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import unittest import webnotes import copy diff --git a/erpnext/stock/doctype/item_customer_detail/__init__.py b/erpnext/stock/doctype/item_customer_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/item_customer_detail/__init__.py +++ b/erpnext/stock/doctype/item_customer_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/item_price/__init__.py b/erpnext/stock/doctype/item_price/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/item_price/__init__.py +++ b/erpnext/stock/doctype/item_price/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/item_quality_inspection_parameter/__init__.py b/erpnext/stock/doctype/item_quality_inspection_parameter/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/item_quality_inspection_parameter/__init__.py +++ b/erpnext/stock/doctype/item_quality_inspection_parameter/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/item_supplier/__init__.py b/erpnext/stock/doctype/item_supplier/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/item_supplier/__init__.py +++ b/erpnext/stock/doctype/item_supplier/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/item_tax/__init__.py b/erpnext/stock/doctype/item_tax/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/item_tax/__init__.py +++ b/erpnext/stock/doctype/item_tax/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/landed_cost_item/__init__.py b/erpnext/stock/doctype/landed_cost_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/landed_cost_item/__init__.py +++ b/erpnext/stock/doctype/landed_cost_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/landed_cost_master/__init__.py b/erpnext/stock/doctype/landed_cost_master/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/landed_cost_master/__init__.py +++ b/erpnext/stock/doctype/landed_cost_master/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/landed_cost_master/landed_cost_master.txt b/erpnext/stock/doctype/landed_cost_master/landed_cost_master.txt index f84eafea100..7271b68d0b6 100644 --- a/erpnext/stock/doctype/landed_cost_master/landed_cost_master.txt +++ b/erpnext/stock/doctype/landed_cost_master/landed_cost_master.txt @@ -3,11 +3,11 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:34', - 'docstatus': 0, - 'modified': '2012-03-27 14:36:34', - 'modified_by': u'Administrator', - 'owner': u'Administrator' + u'creation': '2012-07-03 13:29:45', + u'docstatus': 0, + u'modified': '2012-09-17 10:53:26', + u'modified_by': u'Administrator', + u'owner': u'Administrator' }, # These values are common for all DocType @@ -15,19 +15,19 @@ '_last_update': u'1309508838', 'autoname': u'field:title', 'colour': u'White:FFF', - 'doctype': 'DocType', + u'doctype': u'DocType', 'document_type': u'Master', 'module': u'Stock', - 'name': '__common__', + u'name': u'__common__', 'section_style': u'Simple', 'server_code_error': u' ', - 'version': 2 + 'version': 1 }, # These values are common for all DocField { - 'doctype': u'DocField', - 'name': '__common__', + u'doctype': u'DocField', + u'name': u'__common__', 'parent': u'Landed Cost Master', 'parentfield': u'fields', 'parenttype': u'DocType' @@ -35,8 +35,8 @@ # These values are common for all DocPerm { - 'doctype': u'DocPerm', - 'name': '__common__', + u'doctype': u'DocPerm', + u'name': u'__common__', 'parent': u'Landed Cost Master', 'parentfield': u'permissions', 'parenttype': u'DocType', @@ -45,75 +45,13 @@ # DocType, Landed Cost Master { - 'doctype': 'DocType', - 'name': u'Landed Cost Master' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'All' - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Purchase Manager', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'System Manager', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Purchase User', - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'All' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'System Manager' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Purchase User' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Purchase Manager' + u'doctype': u'DocType', + u'name': u'Landed Cost Master' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'trash_reason', 'fieldtype': u'Small Text', 'label': u'Trash Reason', @@ -124,7 +62,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'title', 'fieldtype': u'Data', 'label': u'Title', @@ -135,7 +73,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'landed_cost_details', 'fieldtype': u'Section Break', 'label': u'Landed Cost Items', @@ -145,7 +83,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'landed_cost', 'fieldtype': u'Table', 'label': u'Landed Cost', @@ -153,5 +91,60 @@ 'oldfieldtype': u'Table', 'options': u'Landed Cost Master Detail', 'permlevel': 0 + }, + + # DocPerm + { + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Purchase Manager', + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'System Manager', + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Purchase User', + 'write': 1 + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'All' + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'System Manager' + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Purchase User' + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Purchase Manager' } ] \ No newline at end of file diff --git a/erpnext/stock/doctype/landed_cost_master_detail/__init__.py b/erpnext/stock/doctype/landed_cost_master_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/landed_cost_master_detail/__init__.py +++ b/erpnext/stock/doctype/landed_cost_master_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/landed_cost_purchase_receipt/__init__.py b/erpnext/stock/doctype/landed_cost_purchase_receipt/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/landed_cost_purchase_receipt/__init__.py +++ b/erpnext/stock/doctype/landed_cost_purchase_receipt/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/landed_cost_wizard/__init__.py b/erpnext/stock/doctype/landed_cost_wizard/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/landed_cost_wizard/__init__.py +++ b/erpnext/stock/doctype/landed_cost_wizard/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py index f73845c80a6..6d235aef351 100644 --- a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py +++ b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.utils import cint, cstr, flt from webnotes.model.doc import addchild, getchildren diff --git a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt index c8db02e6867..0b91c947642 100644 --- a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt +++ b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt @@ -3,11 +3,11 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:34', - 'docstatus': 0, - 'modified': '2012-03-27 14:36:34', - 'modified_by': u'Administrator', - 'owner': u'wasim@webnotestech.com' + u'creation': '2012-07-03 13:29:45', + u'docstatus': 0, + u'modified': '2012-09-17 10:54:21', + u'modified_by': u'Administrator', + u'owner': u'wasim@webnotestech.com' }, # These values are common for all DocType @@ -15,20 +15,20 @@ '_last_update': u'1321441191', 'colour': u'White:FFF', 'default_print_format': u'Standard', - 'doctype': 'DocType', + u'doctype': u'DocType', 'issingle': 1, 'module': u'Stock', - 'name': '__common__', + u'name': u'__common__', 'section_style': u'Simple', 'server_code_error': u' ', 'show_in_menu': 1, - 'version': 35 + 'version': 1 }, # These values are common for all DocField { - 'doctype': u'DocField', - 'name': '__common__', + u'doctype': u'DocField', + u'name': u'__common__', 'parent': u'Landed Cost Wizard', 'parentfield': u'fields', 'parenttype': u'DocType', @@ -37,8 +37,8 @@ # These values are common for all DocPerm { - 'doctype': u'DocPerm', - 'name': '__common__', + u'doctype': u'DocPerm', + u'name': u'__common__', 'parent': u'Landed Cost Wizard', 'parentfield': u'permissions', 'parenttype': u'DocType', @@ -47,79 +47,13 @@ # DocType, Landed Cost Wizard { - 'doctype': 'DocType', - 'name': u'Landed Cost Wizard' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'All', - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Purchase Manager', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'System Manager', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Purchase User', - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'All' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'System Manager' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Purchase User' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Purchase Manager' + u'doctype': u'DocType', + u'name': u'Landed Cost Wizard' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'process', 'fieldtype': u'HTML', 'label': u'Process', @@ -128,7 +62,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'section_break0', 'fieldtype': u'Section Break', 'options': u'Simple' @@ -136,7 +70,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'from_pr_date', 'fieldtype': u'Date', 'label': u'From PR Date', @@ -145,7 +79,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'to_pr_date', 'fieldtype': u'Date', 'label': u'To PR Date', @@ -154,7 +88,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'currency', 'fieldtype': u'Select', 'label': u'Currency', @@ -164,7 +98,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'get_purchase_receipt', 'fieldtype': u'Button', 'label': u'Get Purchase Receipt', @@ -173,7 +107,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'lc_pr_details', 'fieldtype': u'Table', 'label': u'Landed Cost Purchase Receipts', @@ -182,7 +116,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'section_break1', 'fieldtype': u'Section Break', 'options': u'Simple' @@ -190,7 +124,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'landed_cost', 'fieldtype': u'Link', 'label': u'Select Landed Cost Items Master', @@ -200,7 +134,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'get_details', 'fieldtype': u'Button', 'label': u'Get Details', @@ -209,7 +143,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'landed_cost_details', 'fieldtype': u'Table', 'label': u'Landed Cost Items', @@ -218,10 +152,68 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'update_pr', 'fieldtype': u'Button', 'label': u'Update PR', 'options': u'update_landed_cost' + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Purchase Manager', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'System Manager', + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Purchase User', + 'write': 1 + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'All' + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'System Manager' + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Purchase User' + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Purchase Manager' } ] \ No newline at end of file diff --git a/erpnext/stock/doctype/packing_slip/__init__.py b/erpnext/stock/doctype/packing_slip/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/packing_slip/__init__.py +++ b/erpnext/stock/doctype/packing_slip/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.py b/erpnext/stock/doctype/packing_slip/packing_slip.py index 74c80365687..9e544b62d8c 100644 --- a/erpnext/stock/doctype/packing_slip/packing_slip.py +++ b/erpnext/stock/doctype/packing_slip/packing_slip.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.utils import flt, cint diff --git a/erpnext/stock/doctype/packing_slip_item/__init__.py b/erpnext/stock/doctype/packing_slip_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/packing_slip_item/__init__.py +++ b/erpnext/stock/doctype/packing_slip_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py b/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py index 761c572683e..cfd57e79b55 100644 --- a/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py +++ b/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes class DocType: diff --git a/erpnext/stock/doctype/purchase_receipt/__init__.py b/erpnext/stock/doctype/purchase_receipt/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/purchase_receipt/__init__.py +++ b/erpnext/stock/doctype/purchase_receipt/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 807b3658a7c..2be671ed5a6 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt index ea50db25cf5..af6b4840133 100755 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-05-10 12:42:13', + 'creation': '2012-06-11 12:10:11', 'docstatus': 0, - 'modified': '2012-05-10 14:01:16', + 'modified': '2012-07-16 16:26:24', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -56,89 +56,6 @@ 'name': u'Purchase Receipt' }, - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Material Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material Manager', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Material User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material User', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Purchase User', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Purchase User' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'match': u'supplier', - 'permlevel': 0, - 'role': u'Supplier' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 2, - 'role': u'All', - 'write': 1 - }, - # DocField { 'colour': u'White:FFF', @@ -449,7 +366,7 @@ 'description': u"Rate at which supplier's currency is converted to company's base currency", 'doctype': u'DocField', 'fieldname': u'conversion_rate', - 'fieldtype': u'Currency', + 'fieldtype': u'Float', 'label': u'Conversion Rate', 'oldfieldname': u'conversion_rate', 'oldfieldtype': u'Currency', @@ -1183,5 +1100,88 @@ 'no_copy': 1, 'permlevel': 0, 'print_hide': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material Manager', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material User', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'amend': 1, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Purchase User', + 'submit': 1, + 'write': 1 + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Purchase User' + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'match': u'supplier', + 'permlevel': 0, + 'role': u'Supplier' + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 2, + 'role': u'All', + 'write': 1 } ] \ No newline at end of file diff --git a/erpnext/stock/doctype/purchase_receipt_item/__init__.py b/erpnext/stock/doctype/purchase_receipt_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/purchase_receipt_item/__init__.py +++ b/erpnext/stock/doctype/purchase_receipt_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/sales_and_purchase_return_tool/__init__.py b/erpnext/stock/doctype/sales_and_purchase_return_tool/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/sales_and_purchase_return_tool/__init__.py +++ b/erpnext/stock/doctype/sales_and_purchase_return_tool/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py b/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py index 00319bdfee3..d8ff6046a14 100644 --- a/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py +++ b/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.txt b/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.txt index c5d4d6d5054..8bec19e38a3 100644 --- a/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.txt +++ b/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.txt @@ -3,34 +3,34 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:36', - 'docstatus': 0, - 'modified': '2012-03-27 14:36:36', - 'modified_by': u'Administrator', - 'owner': u'wasim@webnotestech.com' + u'creation': '2012-07-03 13:29:45', + u'docstatus': 0, + u'modified': '2012-09-17 10:55:11', + u'modified_by': u'Administrator', + u'owner': u'wasim@webnotestech.com' }, # These values are common for all DocType { 'colour': u'White:FFF', - 'doctype': 'DocType', + u'doctype': u'DocType', 'is_transaction_doc': 0, 'issingle': 1, 'istable': 0, 'menu_index': 1, 'module': u'Stock', - 'name': '__common__', + u'name': u'__common__', 'parent_node': u'Materials', 'section_style': u'Simple', 'server_code_error': u' ', 'show_in_menu': 1, - 'version': 46 + 'version': 1 }, # These values are common for all DocField { - 'doctype': u'DocField', - 'name': '__common__', + u'doctype': u'DocField', + u'name': u'__common__', 'parent': u'Sales and Purchase Return Tool', 'parentfield': u'fields', 'parenttype': u'DocType' @@ -38,8 +38,8 @@ # These values are common for all DocPerm { - 'doctype': u'DocPerm', - 'name': '__common__', + u'doctype': u'DocPerm', + u'name': u'__common__', 'parent': u'Sales and Purchase Return Tool', 'parentfield': u'permissions', 'parenttype': u'DocType', @@ -48,197 +48,13 @@ # DocType, Sales and Purchase Return Tool { - 'doctype': 'DocType', - 'name': u'Sales and Purchase Return Tool' - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'All', - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'System Manager', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'All' - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'System Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Accounts Manager' - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Purchase Manager', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Purchase User', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales Manager', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales User', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Accounts User', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Accounts Manager', - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Accounts User' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales User' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Manager' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Purchase User' - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Purchase Manager' - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Material Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material Manager', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Material User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material User', - 'submit': 0, - 'write': 1 + u'doctype': u'DocType', + u'name': u'Sales and Purchase Return Tool' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'return_date', 'fieldtype': u'Date', 'label': u'Return Date', @@ -251,7 +67,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'return_type', 'fieldtype': u'Select', 'label': u'Return Type', @@ -266,7 +82,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'delivery_note_no', 'fieldtype': u'Link', 'hidden': 1, @@ -281,7 +97,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'sales_invoice_no', 'fieldtype': u'Link', 'hidden': 1, @@ -292,7 +108,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'purchase_receipt_no', 'fieldtype': u'Link', 'hidden': 1, @@ -306,7 +122,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'cust_supp', 'fieldtype': u'Data', 'hidden': 1, @@ -317,7 +133,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'cust_supp_name', 'fieldtype': u'Data', 'hidden': 1, @@ -328,7 +144,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'cust_supp_address', 'fieldtype': u'Small Text', 'hidden': 1, @@ -340,7 +156,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'get_items', 'fieldtype': u'Button', 'hidden': 1, @@ -352,7 +168,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'return_details', 'fieldtype': u'Table', 'hidden': 1, @@ -366,7 +182,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'make_stock_entry', 'fieldtype': u'Button', 'hidden': 1, @@ -378,7 +194,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'make_excise_invoice', 'fieldtype': u'Button', 'hidden': 1, @@ -390,7 +206,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'make_credit_note', 'fieldtype': u'Button', 'hidden': 1, @@ -402,7 +218,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'make_debit_note', 'fieldtype': u'Button', 'hidden': 1, @@ -410,5 +226,180 @@ 'oldfieldtype': u'Button', 'permlevel': 0, 'trigger': u'Client' + }, + + # DocPerm + { + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Accounts Manager', + 'write': 1 + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'All' + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'System Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Accounts Manager' + }, + + # DocPerm + { + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Purchase Manager', + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Purchase User', + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales Manager', + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales User', + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Accounts User', + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'System Manager', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Accounts User' + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales User' + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales Manager' + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Purchase User' + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Purchase Manager' + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material Manager', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material User', + 'submit': 0, + 'write': 1 } ] \ No newline at end of file diff --git a/erpnext/stock/doctype/sales_bom/__init__.py b/erpnext/stock/doctype/sales_bom/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/sales_bom/__init__.py +++ b/erpnext/stock/doctype/sales_bom/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.js b/erpnext/stock/doctype/sales_bom/sales_bom.js index 275af6a85a9..b6ba77953fa 100644 --- a/erpnext/stock/doctype/sales_bom/sales_bom.js +++ b/erpnext/stock/doctype/sales_bom/sales_bom.js @@ -14,35 +14,26 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . - - -cur_frm.cscript.onload = function(doc, cdt, cdn) { - - if(!doc.price_list) set_multiple(cdt,cdn,{price_list:sys_defaults.price_list_name}); -} - cur_frm.cscript.refresh = function(doc, cdt, cdn) { + cur_frm.toggle_enable('new_item_code', doc.__islocal); if(!doc.__islocal) { - get_field(doc.doctype, 'new_item_code', doc.name).permlevel = 1; + cur_frm.add_custom_button("Check for Duplicates", function() { + cur_frm.call_server('check_duplicate', 1) + }, 'icon-search') } } -/* Get Item Code */ +cur_frm.fields_dict.new_item_code.get_query = function() { + return 'select name, description from tabItem where is_stock_item="No" and is_sales_item="Yes"\ + and name not in (select name from `tabSales BOM`)\ + and `%(key)s` like "%s"' +} +cur_frm.fields_dict.new_item_code.query_description = 'Select Item where "Is Stock Item" is "No" \ + and "Is Sales Item" is "Yes" and there is no other Sales BOM'; + cur_frm.cscript.item_code = function(doc, dt, dn) { - var d = locals[dt][dn]; - if (d.item_code){ - get_server_fields('get_item_details', d.item_code, 'sales_bom_items', doc ,dt, dn, 1); - } -} - -cur_frm.cscript.price_list = function(doc, cdt, cdn) { - $c_obj(make_doclist(cdt,cdn), 'get_rates', '', function(r,rt){refresh_field('sales_bom_items');}); -} - -cur_frm.cscript.currency = function(doc, cdt, cdn) { - $c_obj(make_doclist(cdt,cdn), 'get_rates', '', function(r,rt){refresh_field('sales_bom_items');}); -} - -cur_frm.cscript.find_sales_bom = function(doc, dt, dn) { - $c_obj(make_doclist(dt,dn), 'check_duplicate', 1, ''); -} + var d = locals[dt][dn]; + if (d.item_code){ + get_server_fields('get_item_details', d.item_code, 'sales_bom_items', doc ,dt, dn, 1); + } +} \ No newline at end of file diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.py b/erpnext/stock/doctype/sales_bom/sales_bom.py index 03e1bd04e61..03479ebb95d 100644 --- a/erpnext/stock/doctype/sales_bom/sales_bom.py +++ b/erpnext/stock/doctype/sales_bom/sales_bom.py @@ -14,24 +14,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Please edit this list and import only required elements +from __future__ import unicode_literals 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, getchildren, make_autoname -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 - -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 - -# ----------------------------------------------------------------------------------------- - +from webnotes.utils import flt +from webnotes.model.utils import getlist class DocType: def __init__(self,d,dl): @@ -40,139 +26,53 @@ class DocType: def autoname(self): self.doc.name = self.doc.new_item_code - # Get Ref Rates - # -------------- - def get_rates(self): - for d in getlist(self.doclist, "sales_bom_items"): - r = sql("select ref_rate from `tabItem Price` where price_list_name=%s and parent=%s and ref_currency = %s", (self.doc.price_list, d.item_code, self.doc.currency)) - d.rate = r and flt(r[0][0]) or 0.00 - - - # Get Item Details - # ----------------- - def get_item_details(self, name): - det = sql("select description, stock_uom from `tabItem` where name = '%s' " % cstr(name)) - rate = sql("select ref_rate from `tabItem Price` where price_list_name = %s and parent = %s and ref_currency = %s", (self.doc.price_list, name, self.doc.currency)) - return {'description' : det and det[0][0] or '', 'uom': det and det[0][1] or '', 'rate': rate and flt(rate[0][0]) or 0.00} - - - def get_main_item(self): - is_main_item = [] - for d in getlist(self.doclist,'sales_bom_items'): - if d.is_main_item == 'Yes': - is_main_item.append(d.item_code) - # Check that Sales Bom Item cannot be child of Sales Bom. - if d.item_code == self.doc.new_item_code: - msgprint("Sales Bom Item " + d.new_item_code +" cannot be child item.") - raise Exception - if len(is_main_item) > 1: - msgprint('Main item cannot be more than one.') - raise Exception , " Validation Error." - if len(is_main_item) == 0: - msgprint("At least one item should be main item.") - raise Exception , " Validation Error." - return is_main_item[0] - - - # Make Item - # --------- - def create_new_item(self): - i = Document("Item") - i.item_code = self.doc.new_item_code - i.item_name = self.doc.new_item_name - i.name = i.item_code - i.is_sales_item = 'Yes' - i.is_stock_item = 'No' - i.save(1) - - # Update Rate - def update_ref_rate(self, i): - ref_rate = 0 - if self.doc.price_list: - if not cstr(self.doc.currency): - msgprint("Please enter Currency.") - raise Exception - for d in getlist(self.doclist, "sales_bom_items"): - item_rate = sql("select ref_rate,ref_currency from `tabItem Price` where price_list_name=%s and parent=%s", (self.doc.price_list, d.item_code)) - ref_rate += flt(d.qty) * (item_rate and flt(item_rate[0][0]) or 0) - - if ref_rate: - # clear old rates - sql("delete from `tabItem Price` where parent=%s and price_list_name = %s", (i.name, self.doc.price_list)) - - pld = addchild(i,"ref_rate_details", "Item Price") - pld.price_list_name = self.doc.price_list - pld.ref_rate = flt(ref_rate) - pld.ref_currency = self.doc.currency - pld.save() - - # Update Items - # ------------ - def update_item(self): - i = Document("Item", self.doc.new_item_code) - - # update fields - i.brand = self.doc.new_item_brand - i.stock_uom = self.doc.stock_uom - i.item_group = self.doc.item_group - - - i.item_name = self.doc.new_item_name - i.description = self.doc.description - - # set default as 'No' or 0 - i.is_sample_item = 'No' - i.is_asset_item = 'No' - i.is_purchase_item = 'No' - i.is_manufactured_item = 'No' - i.is_sub_contracted_item = 'No' - i.is_service_item = 'No' - i.inspection_required = 'No' - i.has_serial_no = 'No' - i.lead_time_days = flt(0) - # update rates - self.update_ref_rate(i) - i.save() - msgprint("Items: %s updated successfully. To update more details open and edit item master" % self.doc.new_item_code) - - def validate(self): # check for duplicate self.check_duplicate() - item_code = self.get_main_item() - if not self.doc.new_item_code: - self.doc.new_item_code = make_autoname(item_code +'.###') + self.validate_main_item() - - def on_update(self): - # if no item code, create new item code - if not sql("select name from tabItem where name=%s", self.doc.new_item_code): - self.create_new_item() - self.update_item() + def validate_main_item(self): + """main item must have Is Stock Item as No and Is Sales Item as Yes""" + if not webnotes.conn.sql("""select name from tabItem where name=%s and + ifnull(is_stock_item,'')='No' and ifnull(is_sales_item,'')='Yes'""", self.doc.new_item_code): + webnotes.msgprint("""Parent Item %s is either a Stock Item or a not a Sales Item""", + raise_exception=1) + def get_item_details(self, name): + det = webnotes.conn.sql("""select description, stock_uom from `tabItem` + where name = %s""", name) + rate = webnotes.conn.sql("""select ref_rate from `tabItem Price` + where price_list_name = %s and parent = %s + and ref_currency = %s""", (self.doc.price_list, name, self.doc.currency)) + return { + 'description' : det and det[0][0] or '', + 'uom': det and det[0][1] or '', + 'rate': rate and flt(rate[0][0]) or 0.00 + } def check_duplicate(self, finder=0): il = getlist(self.doclist, "sales_bom_items") if not il: - msgprint("Add atleast one item") + webnotes.msgprint("Add atleast one item") return # get all Sales BOM that have the first item - 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)) + sbl = webnotes.conn.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: - t = sql("select item_code, qty from `tabSales BOM Item` where parent=%s and docstatus != 2", s[0]) + t = webnotes.conn.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]) + webnotes.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.") - + webnotes.msgprint("There is no Sales BOM present with the following Combination.") def has_same_items(self, l1, l2): if len(l1)!=len(l2): return 0 diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.txt b/erpnext/stock/doctype/sales_bom/sales_bom.txt index 29fcd3142fb..74268215dd5 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-30 12:08:49', + 'creation': '2012-07-03 13:30:44', 'docstatus': 0, - 'modified': '2012-05-04 09:53:08', + 'modified': '2012-07-12 18:00:16', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -15,10 +15,10 @@ '_last_update': u'1322549701', 'allow_trash': 1, 'colour': u'White:FFF', - 'description': u'Aggregate item and accessories to form a Sales Item. There is no inventory of the new item but of the sub-components.', + 'description': u'Aggregate group of **Items** into another **Item**. This is useful if you are bundling a certain **Items** into a package and you maintain stock of the packed **Items** and not the aggregate **Item**. \n\nThe package **Item** will have "Is Stock Item" as "No" and "Is Sales Item" as "Yes".\n\nFor Example: If you are selling Laptops and Backpacks separately and have a special price if the customer buys both, then the Laptop + Backpack will be a new Sales BOM Item.\n\nNote: BOM = Bill of Materials', 'doctype': 'DocType', 'document_type': u'Master', - 'is_submittable': 1, + 'is_submittable': 0, 'module': u'Stock', 'name': '__common__', 'section_style': u'Simple', @@ -33,17 +33,20 @@ 'name': '__common__', 'parent': u'Sales BOM', 'parentfield': u'fields', - 'parenttype': u'DocType' + 'parenttype': u'DocType', + 'permlevel': 0 }, # These values are common for all DocPerm { + 'amend': 0, 'doctype': u'DocPerm', 'name': '__common__', 'parent': u'Sales BOM', 'parentfield': u'permissions', 'parenttype': u'DocType', - 'read': 1 + 'read': 1, + 'submit': 0 }, # DocType, Sales BOM @@ -54,73 +57,61 @@ # DocPerm { - 'amend': 0, 'cancel': 0, - 'create': 0, + 'create': 1, 'doctype': u'DocPerm', 'permlevel': 1, 'role': u'Material Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material Manager', - 'submit': 1, 'write': 1 }, # DocPerm { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Material User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, 'cancel': 1, 'create': 1, 'doctype': u'DocPerm', 'permlevel': 0, - 'role': u'Sales User', - 'submit': 0, + 'role': u'Material Manager', + 'write': 1 + }, + + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material User', + 'write': 0 + }, + + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material User', + 'write': 0 + }, + + # DocPerm + { + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales User', 'write': 1 }, # DocPerm { - 'amend': 0, 'cancel': 0, 'create': 0, 'doctype': u'DocPerm', 'permlevel': 1, 'role': u'Sales User', - 'submit': 0, 'write': 0 }, @@ -129,167 +120,32 @@ '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%' + 'label': u'Sales BOM Item' }, # DocField { 'colour': u'White:FFF', - 'description': u'Item code of the new aggregate item.', + 'description': u'The Item that represents the Package. This Item must have "Is Stock Item" as "No" and "Is Sales Item" as "Yes"', 'doctype': u'DocField', 'fieldname': u'new_item_code', - 'fieldtype': u'Data', - 'label': u'New Item Code', + 'fieldtype': u'Link', + 'label': u'Parent Item', 'no_copy': 1, 'oldfieldname': u'new_item_code', 'oldfieldtype': u'Data', + 'options': u'Item', 'reqd': 1 }, # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'new_item_name', - 'fieldtype': u'Data', - 'label': u'New Item Name', - 'oldfieldname': u'new_item_name', - 'oldfieldtype': u'Data', - 'permlevel': 0, - 'reqd': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'new_item_brand', - 'fieldtype': u'Data', - 'label': u'New Item Brand', - 'oldfieldname': u'new_item_brand', - 'oldfieldtype': u'Data', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'description', - 'fieldtype': u'Text', - 'label': u'New Description', - 'oldfieldname': u'description', - 'oldfieldtype': u'Text', - 'permlevel': 0, - 'reqd': 1, - 'width': u'300px' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'col2', - 'fieldtype': u'Column Break', - 'permlevel': 0, - 'width': u'50%' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'item_group', - 'fieldtype': u'Link', - 'label': u'Item Group', - 'oldfieldname': u'item_group', - 'oldfieldtype': u'Link', - 'options': u'Item Group', - 'permlevel': 0, - '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, - 'reqd': 1 - }, - - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'price_list', - 'fieldtype': u'Select', - 'label': u'Price List', - 'oldfieldname': u'price_list', - 'oldfieldtype': u'Select', - 'options': u'link:Price List', - 'permlevel': 0, - 'trigger': u'Client' - }, - - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'currency', - 'fieldtype': u'Select', - 'label': u'Currency', - 'oldfieldname': u'currency', - 'oldfieldtype': u'Select', - 'options': u'link:Currency', - 'permlevel': 0, - 'trigger': u'Client' - }, - - # DocField - { - 'depends_on': u'eval:doc.amended_from', - 'description': u'The date at which current entry is corrected in the system.', - 'doctype': u'DocField', - 'fieldname': u'amendment_date', - 'fieldtype': u'Date', - 'label': u'Amendment Date', - 'no_copy': 1, - 'permlevel': 1, - 'print_hide': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'amended_from', - 'fieldtype': u'Link', - 'label': u'Amended From', - 'no_copy': 1, - 'options': u'Sales BOM', - 'permlevel': 1, - 'print_hide': 1 - }, - - # DocField - { - 'colour': u'White:FFF', - 'description': u'List items that form a package. One of the items has to be a "main item".', + 'description': u'List items that form the package.', 'doctype': u'DocField', 'fieldname': u'item_section', 'fieldtype': u'Section Break', - 'label': u'Items', - 'permlevel': 0 + 'label': u'Package Items' }, # DocField @@ -301,30 +157,6 @@ 'oldfieldname': u'sales_bom_items', 'oldfieldtype': u'Table', 'options': u'Sales BOM Item', - 'permlevel': 0 - }, - - # DocField - { - 'colour': u'White:FFF', - 'description': u'Add a few items and find if there are any Sales BOM created with the same combination to help you identify duplication.', - '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'trash_reason', - 'fieldtype': u'Small Text', - 'label': u'Trash Reason', - 'oldfieldname': u'trash_reason', - 'oldfieldtype': u'Small Text', - 'permlevel': 1 + 'reqd': 1 } ] \ No newline at end of file diff --git a/erpnext/stock/doctype/sales_bom_item/__init__.py b/erpnext/stock/doctype/sales_bom_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/sales_bom_item/__init__.py +++ b/erpnext/stock/doctype/sales_bom_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/sales_bom_item/sales_bom_item.txt b/erpnext/stock/doctype/sales_bom_item/sales_bom_item.txt index 8cf93f5702d..76e3f26a9fe 100644 --- a/erpnext/stock/doctype/sales_bom_item/sales_bom_item.txt +++ b/erpnext/stock/doctype/sales_bom_item/sales_bom_item.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:37', + 'creation': '2012-07-03 13:30:46', 'docstatus': 0, - 'modified': '2012-03-27 14:36:37', + 'modified': '2012-07-11 18:56:27', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -20,7 +20,7 @@ 'section_style': u'Tray', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 3 + 'version': 1 }, # These values are common for all DocField @@ -38,18 +38,6 @@ 'name': u'Sales BOM Item' }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'is_main_item', - 'fieldtype': u'Select', - 'label': u'Is Main Item', - 'oldfieldname': u'is_main_item', - 'oldfieldtype': u'Select', - 'options': u'\nYes\nNo', - 'permlevel': 0 - }, - # DocField { 'doctype': u'DocField', @@ -64,6 +52,18 @@ 'trigger': u'Client' }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'qty', + 'fieldtype': u'Currency', + 'label': u'Qty', + 'oldfieldname': u'qty', + 'oldfieldtype': u'Currency', + 'permlevel': 0, + 'reqd': 1 + }, + # DocField { 'doctype': u'DocField', @@ -87,18 +87,6 @@ 'permlevel': 0 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'qty', - 'fieldtype': u'Currency', - 'label': u'Qty', - 'oldfieldname': u'qty', - 'oldfieldtype': u'Currency', - 'permlevel': 0, - 'reqd': 1 - }, - # DocField { 'doctype': u'DocField', diff --git a/erpnext/stock/doctype/serial_no/__init__.py b/erpnext/stock/doctype/serial_no/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/serial_no/__init__.py +++ b/erpnext/stock/doctype/serial_no/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py index b6dd6900239..e811d738168 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.py +++ b/erpnext/stock/doctype/serial_no/serial_no.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals import webnotes from webnotes.utils import cint, flt, cstr, getdate, nowdate diff --git a/erpnext/stock/doctype/stock_entry/__init__.py b/erpnext/stock/doctype/stock_entry/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/stock_entry/__init__.py +++ b/erpnext/stock/doctype/stock_entry/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 1cc49f825b4..5fa9eb6536f 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/stock/doctype/stock_entry_detail/__init__.py b/erpnext/stock/doctype/stock_entry_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/stock_entry_detail/__init__.py +++ b/erpnext/stock/doctype/stock_entry_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/stock_ledger/__init__.py b/erpnext/stock/doctype/stock_ledger/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/stock_ledger/__init__.py +++ b/erpnext/stock/doctype/stock_ledger/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/stock_ledger/stock_ledger.py b/erpnext/stock/doctype/stock_ledger/stock_ledger.py index d529ae320e0..8b51b5cc0fb 100644 --- a/erpnext/stock/doctype/stock_ledger/stock_ledger.py +++ b/erpnext/stock/doctype/stock_ledger/stock_ledger.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 @@ -51,19 +52,16 @@ class DocType: self.doclist = doclist - # ----------------- - # scrub serial nos - # ----------------- - def scrub_serial_nos(self, obj): - for d in getlist(obj.doclist, obj.fname): + def scrub_serial_nos(self, obj, table_name = ''): + if not table_name: + table_name = obj.fname + + for d in getlist(obj.doclist, table_name): if d.serial_no: d.serial_no = d.serial_no.replace(',', '\n') d.save() - # ----------------------------- - # validate serial no warehouse - # ----------------------------- def validate_serial_no_warehouse(self, obj, fname): for d in getlist(obj.doclist, fname): wh = d.warehouse or d.s_warehouse @@ -80,10 +78,8 @@ class DocType: msgprint("Serial No : %s for Item : %s doesn't exists in Warehouse : %s" % (s, d.item_code, wh), raise_exception = 1) - # ------------------------------------ - # check whether serial no is required - # ------------------------------------ def validate_serial_no(self, obj, fname): + """check whether serial no is required""" for d in getlist(obj.doclist, fname): is_stock_item = get_value('Item', d.item_code, 'is_stock_item') ar_required = get_value('Item', d.item_code, 'has_serial_no') @@ -105,18 +101,10 @@ class DocType: msgprint("Rejected serial no is mandatory for rejected qty of item: "+ d.item_code, raise_exception = 1) - - - - # ------------------- - # get serial no list - # ------------------- def get_sr_no_list(self, sr_nos, qty = 0, item_code = ''): return get_sr_no_list(sr_nos, qty, item_code) - # --------------------- - # set serial no values - # --------------------- + def set_pur_serial_no_values(self, obj, serial_no, d, s, new_rec): item_details = sql("select item_group, warranty_period from `tabItem` where name = '%s' and \ (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now()) " %(d.item_code), as_dict=1) @@ -147,9 +135,6 @@ class DocType: s.save(new_rec) - # ---------------------------------- - # update serial no purchase details - # ---------------------------------- def update_serial_purchase_details(self, obj, d, serial_no, is_submit, purpose = ''): exists = sql("select name, status, docstatus from `tabSerial No` where name = '%s'" % (serial_no)) if is_submit: @@ -172,9 +157,6 @@ class DocType: sql("update `tabSerial No` set docstatus = 2, status = 'Not in Use', purchase_document_type = '', purchase_document_no = '', purchase_date = null, purchase_rate = 0, supplier = null, supplier_name = '', supplier_address = '', warehouse = '' where name = '%s'" % serial_no) - # ------------------------------- - # check whether serial no exists - # ------------------------------- def check_serial_no_exists(self, serial_no, item_code): chk = sql("select name, status, docstatus, item_code from `tabSerial No` where name = %s", (serial_no), as_dict=1) if not chk: @@ -186,9 +168,7 @@ class DocType: elif chk and chk[0]['status'] == 'Delivered': msgprint("Serial No: %s of Item : %s is already delivered." % (serial_no, item_code), raise_exception = 1) - # --------------------- - # set serial no values - # --------------------- + def set_delivery_serial_no_values(self, obj, serial_no): s = Document('Serial No', serial_no) s.delivery_document_type = obj.doc.doctype @@ -207,9 +187,6 @@ class DocType: s.save() - # ---------------------------------- - # update serial no delivery details - # ---------------------------------- def update_serial_delivery_details(self, obj, d, serial_no, is_submit): if is_submit: self.check_serial_no_exists(serial_no, d.item_code) @@ -218,9 +195,6 @@ class DocType: sql("update `tabSerial No` set docstatus = 0, status = 'In Store', delivery_document_type = '', delivery_document_no = '', delivery_date = null, customer = null, customer_name = '', delivery_address = '', territory = null where name = '%s'" % (serial_no)) - # --------------------- - # update serial record - # --------------------- def update_serial_record(self, obj, fname, is_submit = 1, is_incoming = 0): import datetime for d in getlist(obj.doclist, fname): @@ -239,11 +213,6 @@ class DocType: self.update_serial_purchase_details(obj, d, a, is_submit) - - - # ------------- - # update stock - # ------------- def update_stock(self, values, is_amended = 'No'): for v in values: sle_id, serial_nos = '', '' @@ -265,9 +234,6 @@ class DocType: v["posting_date"], sle_id, v["posting_time"], '', v["is_cancelled"],v["voucher_type"],v["voucher_no"], is_amended) - # ----------- - # make entry - # ----------- def make_entry(self, args): sle = Document(doctype = 'Stock Ledger Entry') for k in args.keys(): diff --git a/erpnext/stock/doctype/stock_ledger_entry/__init__.py b/erpnext/stock/doctype/stock_ledger_entry/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/__init__.py +++ b/erpnext/stock/doctype/stock_ledger_entry/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py index b545d7d9c6c..645b7c95d1f 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py +++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals import webnotes from webnotes.utils import cstr, cint, flt, cstr, getdate diff --git a/erpnext/stock/doctype/stock_reconciliation/__init__.py b/erpnext/stock/doctype/stock_reconciliation/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/stock_reconciliation/__init__.py +++ b/erpnext/stock/doctype/stock_reconciliation/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 06b0cc493b8..d922a11b45c 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.utils import cstr, flt, get_defaults, nowdate from webnotes import msgprint, errprint @@ -46,10 +47,6 @@ class DocType: from webnotes.utils import file_manager fn, content = file_manager.get_file(filename[1]) - - # NOTE: Don't know why this condition exists - if not isinstance(content, basestring) and hasattr(content, 'tostring'): - content = content.tostring() else: content = self.doc.diff_info @@ -81,8 +78,10 @@ class DocType: def get_reconciliation_data(self,submit = 1): """Read and validate csv data""" - import csv - data = csv.reader(self.get_csv_file_data(submit).splitlines()) + import csv + from core.page.data_import_tool.data_import_tool import read_csv_content + csv_content = self.get_csv_file_data(submit).encode('utf-8') + data = read_csv_content(csv_content) self.convert_into_list(data, submit) @@ -185,7 +184,7 @@ class DocType: # Diff between file and system qty_diff = row[2] != '~' and flt(row[2]) - flt(sys_stock['actual_qty']) or 0 rate_diff = row[3] != '~' and flt(row[3]) - flt(sys_stock['val_rate']) or 0 - + # Make sl entry if qty_diff: self.make_sl_entry(is_submit, row, qty_diff, sys_stock) diff --git a/erpnext/stock/doctype/stock_uom_replace_utility/__init__.py b/erpnext/stock/doctype/stock_uom_replace_utility/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/stock_uom_replace_utility/__init__.py +++ b/erpnext/stock/doctype/stock_uom_replace_utility/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py b/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py index f7ff36b15c5..b12809411d0 100644 --- a/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py +++ b/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 @@ -116,4 +117,4 @@ class DocType: # update bin self.update_bin() - get_obj("Item", self.doc.item_code).on_update() \ No newline at end of file + get_obj("Item", self.doc.item_code).on_update() diff --git a/erpnext/stock/doctype/uom_conversion_detail/__init__.py b/erpnext/stock/doctype/uom_conversion_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/uom_conversion_detail/__init__.py +++ b/erpnext/stock/doctype/uom_conversion_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/valuation_control/__init__.py b/erpnext/stock/doctype/valuation_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/valuation_control/__init__.py +++ b/erpnext/stock/doctype/valuation_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/valuation_control/valuation_control.py b/erpnext/stock/doctype/valuation_control/valuation_control.py index f0cbed91971..1318db66e5e 100644 --- a/erpnext/stock/doctype/valuation_control/valuation_control.py +++ b/erpnext/stock/doctype/valuation_control/valuation_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals import webnotes, unittest from webnotes.utils import flt diff --git a/erpnext/stock/doctype/warehouse/__init__.py b/erpnext/stock/doctype/warehouse/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/doctype/warehouse/__init__.py +++ b/erpnext/stock/doctype/warehouse/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/warehouse/warehouse.js b/erpnext/stock/doctype/warehouse/warehouse.js index b218063b4a2..0017c75d596 100644 --- a/erpnext/stock/doctype/warehouse/warehouse.js +++ b/erpnext/stock/doctype/warehouse/warehouse.js @@ -14,16 +14,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -cur_frm.cscript.country = function(doc, cdt, cdn) { - var mydoc=doc; - $c('runserverobj', args={'method':'check_state', 'docs':compress_doclist(make_doclist(doc.doctype, doc.name))}, - function(r,rt){ - if(r.message) { - var doc = locals[mydoc.doctype][mydoc.name]; - doc.state = ''; - get_field(doc.doctype, 'state' , doc.name).options = r.message; - refresh_field('state'); - } - } - ); -} +cur_frm.cscript.refresh = function(doc) { + cur_frm.toggle_display('warehouse_name', doc.__islocal); +} \ No newline at end of file diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py index 887d5fe7d06..1766dadfe07 100644 --- a/erpnext/stock/doctype/warehouse/warehouse.py +++ b/erpnext/stock/doctype/warehouse/warehouse.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/stock/doctype/warehouse/warehouse.txt b/erpnext/stock/doctype/warehouse/warehouse.txt index 16bf59d9d54..844e3f326cb 100644 --- a/erpnext/stock/doctype/warehouse/warehouse.txt +++ b/erpnext/stock/doctype/warehouse/warehouse.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-05-15 12:15:13', + 'creation': '2012-07-03 13:30:45', 'docstatus': 0, - 'modified': '2012-05-21 18:02:46', + 'modified': '2012-07-11 10:18:07', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -17,6 +17,7 @@ 'autoname': u'field:warehouse_name', 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'A logical Warehouse against which stock entries are made.\n\nThere are two main Warehouse Types that are significant in ERPNext.\n\n1. **Stores:** These are where your incoming **Items** are kept before they are consumed or sold. You can have as many \u201cStores\u201d type **Warehouses** as you wish. Stores type warehouses are significant because if you set an Item for automatic re-order, ERPNext will check its quantities in all \u201cStores\u201d type **Warehouses** when deciding whether to re-order or not.\n\n2. **Asset**: **Items** marked as type \u201cFixed Asset\u201d are maintained in Asset Type **Warehouses**. This helps you separate them for the **Items** that are consumed as a part of your regular operations or \u201cCost of Goods Sold\u201d.\n', 'doctype': 'DocType', 'document_type': u'Master', 'module': u'Stock', @@ -170,17 +171,6 @@ 'write': 1 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'trash_reason', - 'fieldtype': u'Small Text', - 'label': u'Trash Reason', - 'oldfieldname': u'trash_reason', - 'oldfieldtype': u'Small Text', - 'permlevel': 1 - }, - # DocField { 'doctype': u'DocField', @@ -220,7 +210,6 @@ # DocField { 'colour': u'White:FFF', - 'description': u'The valuation of items in this warehouse will be considered for the company that is specified', 'doctype': u'DocField', 'fieldname': u'company', 'fieldtype': u'Link', @@ -233,6 +222,17 @@ 'search_index': 1 }, + # DocField + { + 'colour': u'White:FFF', + 'description': u'For Reference Only.', + 'doctype': u'DocField', + 'fieldname': u'warehouse_contact_info', + 'fieldtype': u'Section Break', + 'label': u'Warehouse Contact Info', + 'permlevel': 0 + }, + # DocField { 'doctype': u'DocField', @@ -246,24 +246,6 @@ 'print_hide': 0 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'auto_indent_mail', - 'fieldtype': u'Select', - 'hidden': 1, - 'label': u'Send Reorder Alert Mail ', - 'no_copy': 1, - 'oldfieldname': u'auto_indent_mail', - 'oldfieldtype': u'Select', - 'options': u'No\nYes', - 'permlevel': 0, - 'print_hide': 1, - 'report_hide': 1, - 'reqd': 0, - 'trigger': u'Client' - }, - # DocField { 'doctype': u'DocField', @@ -357,6 +339,8 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'For Admin use only. Please report errors to support@erpnext.com', 'doctype': u'DocField', 'fieldname': u'repost_stock', 'fieldtype': u'Section Break', diff --git a/erpnext/stock/page/__init__.py b/erpnext/stock/page/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/page/__init__.py +++ b/erpnext/stock/page/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/page/stock_home/__init__.py b/erpnext/stock/page/stock_home/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/page/stock_home/__init__.py +++ b/erpnext/stock/page/stock_home/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/page/stock_home/stock_home.html b/erpnext/stock/page/stock_home/stock_home.html index ef941ab66f1..0939a77681d 100644 --- a/erpnext/stock/page/stock_home/stock_home.html +++ b/erpnext/stock/page/stock_home/stock_home.html @@ -49,10 +49,15 @@ title = "Details packages against a delivery" href="#!List/Packing Slip">Packing Slip
    +
    Incoming Inspection + href="#!List/Quality Inspection">Quality Inspection
    . +from __future__ import unicode_literals col = [['In Store Period (in days)', 'Data', '']] for c in col: colnames.append(str(c[0])) diff --git a/erpnext/stock/search_criteria/stock_level/__init__.py b/erpnext/stock/search_criteria/stock_level/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/search_criteria/stock_level/__init__.py +++ b/erpnext/stock/search_criteria/stock_level/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/search_criteria/stock_level/stock_level.py b/erpnext/stock/search_criteria/stock_level/stock_level.py index 7782805888b..d53ab5f87ab 100644 --- a/erpnext/stock/search_criteria/stock_level/stock_level.py +++ b/erpnext/stock/search_criteria/stock_level/stock_level.py @@ -14,5 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals colwidths[col_idx['Reserved Quantity']]= "120px" colwidths[col_idx['Ordered Quantity']] = "120px" \ No newline at end of file diff --git a/erpnext/stock/search_criteria/stock_report/__init__.py b/erpnext/stock/search_criteria/stock_report/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/stock/search_criteria/stock_report/__init__.py +++ b/erpnext/stock/search_criteria/stock_report/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/search_criteria/stock_report/stock_report.py b/erpnext/stock/search_criteria/stock_report/stock_report.py index b87f684d24a..970141a06c0 100644 --- a/erpnext/stock/search_criteria/stock_report/stock_report.py +++ b/erpnext/stock/search_criteria/stock_report/stock_report.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals cols, columns = [], [] # Add columns # ------------ diff --git a/erpnext/stock/tests.py b/erpnext/stock/tests.py index acd0edcad28..92378dca06a 100644 --- a/erpnext/stock/tests.py +++ b/erpnext/stock/tests.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import unittest import sys diff --git a/erpnext/support/__init__.py b/erpnext/support/__init__.py index 71ef684bb19..b72925ea895 100644 --- a/erpnext/support/__init__.py +++ b/erpnext/support/__init__.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals install_docs = [ {'doctype':'Role', 'role_name':'Support Team', 'name':'Support Team'}, {'doctype':'Role', 'role_name':'Support Manager', 'name':'Support Manager'}, diff --git a/erpnext/support/doctype/__init__.py b/erpnext/support/doctype/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/doctype/__init__.py +++ b/erpnext/support/doctype/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/doctype/communication/__init__.py b/erpnext/support/doctype/communication/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/doctype/communication/__init__.py +++ b/erpnext/support/doctype/communication/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/doctype/communication/communication.py b/erpnext/support/doctype/communication/communication.py index 8382eb7bbe6..b046d2c6c71 100644 --- a/erpnext/support/doctype/communication/communication.py +++ b/erpnext/support/doctype/communication/communication.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.model.doc import make_autoname diff --git a/erpnext/support/doctype/customer_issue/__init__.py b/erpnext/support/doctype/customer_issue/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/doctype/customer_issue/__init__.py +++ b/erpnext/support/doctype/customer_issue/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/doctype/customer_issue/customer_issue.py b/erpnext/support/doctype/customer_issue/customer_issue.py index 0561ce0fb77..187616936a2 100644 --- a/erpnext/support/doctype/customer_issue/customer_issue.py +++ b/erpnext/support/doctype/customer_issue/customer_issue.py @@ -16,6 +16,7 @@ # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/support/doctype/maintenance_schedule/__init__.py b/erpnext/support/doctype/maintenance_schedule/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/doctype/maintenance_schedule/__init__.py +++ b/erpnext/support/doctype/maintenance_schedule/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py index 9ad9eb99652..75300e19ae9 100644 --- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py +++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/support/doctype/maintenance_schedule_detail/__init__.py b/erpnext/support/doctype/maintenance_schedule_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/doctype/maintenance_schedule_detail/__init__.py +++ b/erpnext/support/doctype/maintenance_schedule_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/doctype/maintenance_schedule_item/__init__.py b/erpnext/support/doctype/maintenance_schedule_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/doctype/maintenance_schedule_item/__init__.py +++ b/erpnext/support/doctype/maintenance_schedule_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/doctype/maintenance_visit/__init__.py b/erpnext/support/doctype/maintenance_visit/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/doctype/maintenance_visit/__init__.py +++ b/erpnext/support/doctype/maintenance_visit/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.py b/erpnext/support/doctype/maintenance_visit/maintenance_visit.py index 1954def8a99..5175ca90a69 100644 --- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.py +++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/support/doctype/maintenance_visit_purpose/__init__.py b/erpnext/support/doctype/maintenance_visit_purpose/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/doctype/maintenance_visit_purpose/__init__.py +++ b/erpnext/support/doctype/maintenance_visit_purpose/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/doctype/newsletter/__init__.py b/erpnext/support/doctype/newsletter/__init__.py new file mode 100644 index 00000000000..baffc488252 --- /dev/null +++ b/erpnext/support/doctype/newsletter/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/doctype/newsletter/newsletter.js b/erpnext/support/doctype/newsletter/newsletter.js new file mode 100644 index 00000000000..1f75edc9a19 --- /dev/null +++ b/erpnext/support/doctype/newsletter/newsletter.js @@ -0,0 +1,26 @@ +// 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 . + +cur_frm.cscript.refresh = function(doc) { + erpnext.hide_naming_series(); + if(!doc.__islocal && !cint(doc.email_sent) && !doc.__unsaved) { + cur_frm.add_custom_button('Send', function() { + $c_obj(make_doclist(doc.doctype, doc.name), 'send_emails', '', function(r) { + cur_frm.refresh(); + }); + }) + } +} \ No newline at end of file diff --git a/erpnext/support/doctype/newsletter/newsletter.py b/erpnext/support/doctype/newsletter/newsletter.py new file mode 100644 index 00000000000..fdbb323f503 --- /dev/null +++ b/erpnext/support/doctype/newsletter/newsletter.py @@ -0,0 +1,112 @@ +# ERPNext - web based ERP (http://erpnext.com) +# Copyright (C) 2012 Web Notes Technologies Pvt Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from __future__ import unicode_literals + +import webnotes +import webnotes.utils + +class DocType(): + def __init__(self, d, dl): + self.doc, self.doclist = d, dl + self.dt_map = { + "Contact": { + "email_field": "email_id", + "first_name_field": "first_name", + }, + "Lead": { + "email_field": "email_id", + "first_name_field": "lead_name" + } + } + self.query_map = { + "contacts": """select distinct email_id from `tabContact` + where ifnull(email_id, '') != '' """, + "customer_contacts": """select distinct email_id from `tabContact` + where ifnull(customer, '') != '' and ifnull(email_id, '') != '' """, + "leads": """select distinct email_id from `tabLead` + where ifnull(email_id, '') != '' """, + "active_leads": """select distinct email_id from `tabLead` + where status = "Open" and ifnull(email_id, '') != '' """, + "blog_subscribers": """select distinct email_id from `tabLead` + where ifnull(blog_subscriber,0) = 1 and ifnull(email_id, '') != '' """ + } + + def autoname(self): + from webnotes.model.doc import make_autoname + self.doc.name = make_autoname(self.doc.naming_series+ '.#####') + + def send_emails(self): + """send emails to leads and customers""" + # TODO: create unsubscribed check in customer + if self.doc.email_sent: + webnotes.msgprint("""Newsletter has already been sent""", raise_exception=1) + + self.all_recipients = [] + self.send_count = {} + + if self.doc.contacts: + self.send("contacts", "Contact") + elif self.doc.customer_contacts: + self.send("customer_contacts", "Contact") + + if self.doc.leads: + self.send("leads", "Lead") + else: + if self.doc.active_leads: + self.send("active_leads", "Lead") + + if self.doc.blog_subscribers: + self.send("blog_subscribers", "Lead") + + webnotes.conn.set(self.doc, "email_sent", 1) + webnotes.msgprint("""Scheduled to send to %s""" % \ + ", ".join(["%d %s(s)" % (self.send_count[s], s) for s in self.send_count])) + + def test_send(self, doctype="Lead"): + args = self.dt_map[doctype] + sender = webnotes.utils.get_email_id(self.doc.owner) + recipients = self.doc.test_email_id.split(",") + from webnotes.utils.email_lib.bulk import send + send(recipients = recipients, sender = sender, + subject = self.doc.subject, message = self.get_message(), + doctype = doctype, email_field = args["email_field"], + first_name_field = args["first_name_field"], last_name_field = "") + webnotes.msgprint("""Scheduled to send to %s""" % self.doc.test_email_id) + + def get_recipients(self, key): + recipients = webnotes.conn.sql(self.query_map[key]) + recipients = [r[0] for r in recipients if r not in self.all_recipients] + self.all_recipients += recipients + return recipients + + def get_message(self): + if not hasattr(self, "message"): + import markdown2 + self.message = markdown2.markdown(self.doc.message) + return self.message + + def send(self, query_key, doctype): + recipients = self.get_recipients(query_key) + sender = webnotes.utils.get_email_id(self.doc.owner) + args = self.dt_map[doctype] + self.send_count[doctype] = self.send_count.setdefault(doctype, 0) + len(recipients) + + from webnotes.utils.email_lib.bulk import send + send(recipients = recipients, sender = sender, + subject = self.doc.subject, message = self.get_message(), + doctype = doctype, email_field = args["email_field"], + first_name_field = args["first_name_field"], last_name_field = "") \ No newline at end of file diff --git a/erpnext/support/doctype/newsletter/newsletter.txt b/erpnext/support/doctype/newsletter/newsletter.txt new file mode 100644 index 00000000000..ef3033d47ca --- /dev/null +++ b/erpnext/support/doctype/newsletter/newsletter.txt @@ -0,0 +1,233 @@ +# DocType, Newsletter +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-23 18:49:12', + u'docstatus': 0, + u'modified': '2012-08-24 14:45:00', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all DocType + { + 'description': u'Create and Send Newsletters', + u'doctype': u'DocType', + 'document_type': u'Other', + 'module': u'Support', + u'name': u'__common__', + 'version': 1 + }, + + # These values are common for all DocField + { + u'doctype': u'DocField', + u'name': u'__common__', + 'parent': u'Newsletter', + 'parentfield': u'fields', + 'parenttype': u'DocType' + }, + + # These values are common for all DocPerm + { + u'doctype': u'DocPerm', + u'name': u'__common__', + 'parent': u'Newsletter', + 'parentfield': u'permissions', + 'parenttype': u'DocType', + 'read': 1 + }, + + # DocType, Newsletter + { + u'doctype': u'DocType', + u'name': u'Newsletter' + }, + + # DocField + { + u'doctype': u'DocField', + 'fieldname': u'basic_info', + 'fieldtype': u'Section Break', + 'label': u'Basic Info', + 'permlevel': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + 'default': u'NL-', + u'doctype': u'DocField', + 'fieldname': u'naming_series', + 'fieldtype': u'Select', + 'label': u'Naming Series', + 'options': u'NL-', + 'permlevel': 0, + 'reqd': 1 + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'A Lead with this email id should exist', + u'doctype': u'DocField', + 'fieldname': u'test_email_id', + 'fieldtype': u'Data', + 'label': u'Test Email Id', + 'permlevel': 0 + }, + + # DocField + { + u'doctype': u'DocField', + 'fieldname': u'test_send', + 'fieldtype': u'Button', + 'label': u'Test', + 'options': u'test_send', + 'permlevel': 0 + }, + + # DocField + { + u'doctype': u'DocField', + 'fieldname': u'column_break1', + 'fieldtype': u'Column Break', + 'label': u'Send To', + 'permlevel': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + u'doctype': u'DocField', + 'fieldname': u'contacts', + 'fieldtype': u'Check', + 'label': u'All Contacts', + 'permlevel': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + u'doctype': u'DocField', + 'fieldname': u'customer_contacts', + 'fieldtype': u'Check', + 'label': u'All Customer Contacts', + 'permlevel': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + u'doctype': u'DocField', + 'fieldname': u'leads', + 'fieldtype': u'Check', + 'label': u'All Leads', + 'permlevel': 0 + }, + + # DocField + { + u'doctype': u'DocField', + 'fieldname': u'active_leads', + 'fieldtype': u'Check', + 'label': u'All Active Leads', + 'permlevel': 0 + }, + + # DocField + { + u'doctype': u'DocField', + 'fieldname': u'blog_subscribers', + 'fieldtype': u'Check', + 'label': u'All Blog Subscribers', + 'permlevel': 0 + }, + + # DocField + { + u'doctype': u'DocField', + 'fieldname': u'newsletter_content', + 'fieldtype': u'Section Break', + 'label': u'Newsletter Content', + 'permlevel': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + u'doctype': u'DocField', + 'fieldname': u'subject', + 'fieldtype': u'Small Text', + 'label': u'Subject', + 'permlevel': 0, + 'reqd': 1 + }, + + # DocField + { + 'colour': u'White:FFF', + u'doctype': u'DocField', + 'fieldname': u'message', + 'fieldtype': u'Code', + 'label': u'Message', + 'options': u'Markdown', + 'permlevel': 0, + 'reqd': 0 + }, + + # DocField + { + u'doctype': u'DocField', + 'fieldname': u'newsletter_status', + 'fieldtype': u'Section Break', + 'label': u'Newsletter Status', + 'permlevel': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + u'doctype': u'DocField', + 'fieldname': u'email_sent', + 'fieldtype': u'Check', + 'label': u'Email Sent?', + 'no_copy': 1, + 'permlevel': 1 + }, + + # DocPerm + { + 'cancel': 1, + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales Manager', + 'write': 1 + }, + + # DocPerm + { + 'cancel': 1, + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Support Manager', + 'write': 1 + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales Manager' + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Support Manager' + } +] \ No newline at end of file diff --git a/erpnext/support/doctype/newsletter/newsletter_list.js b/erpnext/support/doctype/newsletter/newsletter_list.js new file mode 100644 index 00000000000..485fb833955 --- /dev/null +++ b/erpnext/support/doctype/newsletter/newsletter_list.js @@ -0,0 +1,34 @@ +// 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 . + +wn.doclistviews['Newsletter'] = wn.views.ListView.extend({ + init: function(doclistview) { + this._super(doclistview); + this.fields = this.fields.concat([ + "`tabNewsletter`.subject", + "`tabNewsletter`.email_sent", + ]); + }, + + columns: [ + {width: '3%', content: 'check'}, + {width: '5%', content: 'avatar'}, + {width: '15%', content: 'name'}, + {width: '55%', content: 'subject+tags'}, + {width: '22%', content:'modified', + css: {'text-align': 'right', 'color':'#777'}} + ], +}); \ No newline at end of file diff --git a/erpnext/support/doctype/support_ticket/__init__.py b/erpnext/support/doctype/support_ticket/__init__.py index 03511c39f05..f0502f6e2d8 100644 --- a/erpnext/support/doctype/support_ticket/__init__.py +++ b/erpnext/support/doctype/support_ticket/__init__.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.utils import cstr, cint @@ -66,7 +67,10 @@ class SupportMailbox(POP3Mailbox): import re re_result = re.findall('(?<=\<)(\S+)(?=\>)', mail.mail['From']) if re_result and re_result[0]: email_id = re_result[0] - + + from webnotes.utils import decode_email_header + + full_email_id = decode_email_header(mail.mail['From']) for thread_id in thread_list: exists = webnotes.conn.sql("""\ @@ -78,7 +82,7 @@ class SupportMailbox(POP3Mailbox): from webnotes.model.code import get_obj st = get_obj('Support Ticket', thread_id) - st.make_response_record(content, mail.mail['From'], content_type) + st.make_response_record(content, full_email_id, content_type) # to update modified date #webnotes.conn.set(st.doc, 'status', 'Open') @@ -98,8 +102,10 @@ class SupportMailbox(POP3Mailbox): from webnotes.model.doc import Document d = Document('Support Ticket') d.description = content - d.subject = mail.mail['Subject'] - d.raised_by = mail.mail['From'] + + d.subject = decode_email_header(mail.mail['Subject']) + + d.raised_by = full_email_id d.content_type = content_type d.status = 'Open' d.naming_series = opts and opts.split("\n")[0] or 'SUP' diff --git a/erpnext/support/doctype/support_ticket/support_ticket.py b/erpnext/support/doctype/support_ticket/support_ticket.py index 384d26f145d..d04f4730f1d 100644 --- a/erpnext/support/doctype/support_ticket/support_ticket.py +++ b/erpnext/support/doctype/support_ticket/support_ticket.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.model.doc import make_autoname diff --git a/erpnext/support/doctype/support_ticket_response/__init__.py b/erpnext/support/doctype/support_ticket_response/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/doctype/support_ticket_response/__init__.py +++ b/erpnext/support/doctype/support_ticket_response/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/page/__init__.py b/erpnext/support/page/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/page/__init__.py +++ b/erpnext/support/page/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/page/support_home/__init__.py b/erpnext/support/page/support_home/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/page/support_home/__init__.py +++ b/erpnext/support/page/support_home/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/page/support_home/support_home.html b/erpnext/support/page/support_home/support_home.html index ebc6f7173a0..d7036626d7c 100644 --- a/erpnext/support/page/support_home/support_home.html +++ b/erpnext/support/page/support_home/support_home.html @@ -14,6 +14,9 @@

    Maintenance Visit

    Visit report for maintenance visit


    +

    Newsletter

    +

    Send Newsletters to your contacts

    +

    Communication

    Communication Log

    diff --git a/erpnext/support/search_criteria/__init__.py b/erpnext/support/search_criteria/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/search_criteria/__init__.py +++ b/erpnext/support/search_criteria/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/search_criteria/amc_summary/__init__.py b/erpnext/support/search_criteria/amc_summary/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/search_criteria/amc_summary/__init__.py +++ b/erpnext/support/search_criteria/amc_summary/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/search_criteria/amc_summary/amc_summary.py b/erpnext/support/search_criteria/amc_summary/amc_summary.py index f0b76311c86..926da017a35 100644 --- a/erpnext/support/search_criteria/amc_summary/amc_summary.py +++ b/erpnext/support/search_criteria/amc_summary/amc_summary.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # ADD NEW COLUMNS +from __future__ import unicode_literals row_list = [['Item Group','Data','150px',''], ['Out of AMC','Int','150px',''], ['Under AMC','Int','150px',''], diff --git a/erpnext/support/search_criteria/customer_issues/__init__.py b/erpnext/support/search_criteria/customer_issues/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/search_criteria/customer_issues/__init__.py +++ b/erpnext/support/search_criteria/customer_issues/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/__init__.py b/erpnext/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/__init__.py +++ b/erpnext/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/search_criteria/maintenance_schedule_details/__init__.py b/erpnext/support/search_criteria/maintenance_schedule_details/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/search_criteria/maintenance_schedule_details/__init__.py +++ b/erpnext/support/search_criteria/maintenance_schedule_details/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/search_criteria/warranty_amc_expiry_details/__init__.py b/erpnext/support/search_criteria/warranty_amc_expiry_details/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/search_criteria/warranty_amc_expiry_details/__init__.py +++ b/erpnext/support/search_criteria/warranty_amc_expiry_details/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/search_criteria/warranty_amc_summary/__init__.py b/erpnext/support/search_criteria/warranty_amc_summary/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/support/search_criteria/warranty_amc_summary/__init__.py +++ b/erpnext/support/search_criteria/warranty_amc_summary/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/support/search_criteria/warranty_amc_summary/warranty_amc_summary.py b/erpnext/support/search_criteria/warranty_amc_summary/warranty_amc_summary.py index 17f36c0db48..8c102c38312 100644 --- a/erpnext/support/search_criteria/warranty_amc_summary/warranty_amc_summary.py +++ b/erpnext/support/search_criteria/warranty_amc_summary/warranty_amc_summary.py @@ -15,6 +15,7 @@ # along with this program. If not, see . +from __future__ import unicode_literals opt = filter_values.get('based_on') opt_dict = {'Territory':'territory', 'Item Group':'item_group'} diff --git a/erpnext/utilities/__init__.py b/erpnext/utilities/__init__.py index f6f38596ff7..a6e4625b35c 100644 --- a/erpnext/utilities/__init__.py +++ b/erpnext/utilities/__init__.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes @webnotes.whitelist() diff --git a/erpnext/utilities/cleanup_data.py b/erpnext/utilities/cleanup_data.py index 60b54eca42b..f4337909922 100644 --- a/erpnext/utilities/cleanup_data.py +++ b/erpnext/utilities/cleanup_data.py @@ -7,6 +7,7 @@ # This script can be executed from lib/wnf.py using # lib/wnf.py --cleanup-data +from __future__ import unicode_literals import sys sys.path.append("lib/py") sys.path.append(".") diff --git a/erpnext/utilities/doctype/__init__.py b/erpnext/utilities/doctype/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/doctype/__init__.py +++ b/erpnext/utilities/doctype/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/doctype/address/__init__.py b/erpnext/utilities/doctype/address/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/doctype/address/__init__.py +++ b/erpnext/utilities/doctype/address/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/doctype/address/address.py b/erpnext/utilities/doctype/address/address.py index cd6a188ca9a..f9e53e7d31a 100644 --- a/erpnext/utilities/doctype/address/address.py +++ b/erpnext/utilities/doctype/address/address.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals import webnotes from webnotes.model.doc import Document diff --git a/erpnext/utilities/doctype/answer/__init__.py b/erpnext/utilities/doctype/answer/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/doctype/answer/__init__.py +++ b/erpnext/utilities/doctype/answer/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/doctype/bulk_rename_tool/__init__.py b/erpnext/utilities/doctype/bulk_rename_tool/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/erpnext/utilities/doctype/bulk_rename_tool/bulk_rename_tool.py b/erpnext/utilities/doctype/bulk_rename_tool/bulk_rename_tool.py deleted file mode 100644 index c1a6d3fb945..00000000000 --- a/erpnext/utilities/doctype/bulk_rename_tool/bulk_rename_tool.py +++ /dev/null @@ -1,99 +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 . - -# 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, getchildren, make_autoname -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 - -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): - self.doc, self.doclist = d, dl - - # bulk rename - def do_rename(self): - import csv - data = csv.reader(self.get_csv_data().splitlines()) - - updated = 0 - - msgprint(self.doc.rename_doctype) - - if self.doc.rename_doctype == 'Account': - for line in data: - if len(line)==2: - rec = sql("select tc.abbr, ta.name from `tabAccount` ta, `tabCompany` tc where ta.company = tc.name and ta.account_name = %s", line[0], as_dict=1) - if rec: - new_name = line[1] + ' - ' + rec[0]['abbr'] - - webnotes.conn.begin() - webnotes.model.rename(self.doc.rename_doctype, rec[0]['name'], new_name) - sql("update `tabAccount` set account_name = '%s' where name = '%s'" %(line[1],new_name)) - webnotes.conn.commit() - - updated += 1 - else: - msgprint("[Ignored] Incorrect format: %s" % str(line)) - else: - for line in data: - if len(line)==2: - - webnotes.conn.begin() - - obj = get_obj(self.doc.rename_doctype, line[0]) - if hasattr(obj, 'on_rename'): - obj.on_rename(line[1],line[0]) - - webnotes.model.rename(self.doc.rename_doctype, line[0], line[1]) - - webnotes.conn.commit() - - updated += 1 - else: - msgprint("[Ignored] Incorrect format: %s" % str(line)) - - - msgprint("%s items updated" % updated) - - # Update CSV data - def get_csv_data(self): - if not self.doc.file_list: - msgprint("File not attached!") - raise Exception - - fid = self.doc.file_list.split(',')[1] - - from webnotes.utils import file_manager - fn, content = file_manager.get_file(fid) - - # NOTE: Don't know why this condition exists - if not isinstance(content, basestring) and hasattr(content, 'tostring'): - content = content.tostring() - - return content diff --git a/erpnext/utilities/doctype/bulk_rename_tool/bulk_rename_tool.txt b/erpnext/utilities/doctype/bulk_rename_tool/bulk_rename_tool.txt deleted file mode 100644 index d8f9c00fae9..00000000000 --- a/erpnext/utilities/doctype/bulk_rename_tool/bulk_rename_tool.txt +++ /dev/null @@ -1,126 +0,0 @@ -# DocType, Bulk Rename Tool -[ - - # These values are common in all dictionaries - { - 'creation': '2012-03-27 14:36:46', - 'docstatus': 0, - 'modified': '2012-03-27 14:45:46', - 'modified_by': u'Administrator', - 'owner': u'Administrator' - }, - - # These values are common for all DocType - { - '_last_update': u'1322549701', - 'allow_attach': 1, - 'autoname': u'field:rename_doctype', - 'colour': u'White:FFF', - 'default_print_format': u'Standard', - 'doctype': 'DocType', - 'is_submittable': 1, - 'module': u'Utilities', - 'name': '__common__', - 'section_style': u'Simple', - 'show_in_menu': 0, - 'version': 8 - }, - - # These values are common for all DocField - { - 'doctype': u'DocField', - 'name': '__common__', - 'parent': u'Bulk Rename Tool', - 'parentfield': u'fields', - 'parenttype': u'DocType' - }, - - # These values are common for all DocPerm - { - 'doctype': u'DocPerm', - 'name': '__common__', - 'parent': u'Bulk Rename Tool', - 'parentfield': u'permissions', - 'parenttype': u'DocType', - 'read': 1, - 'role': u'System Manager' - }, - - # DocType, Bulk Rename Tool - { - 'doctype': 'DocType', - 'name': u'Bulk Rename Tool' - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'rename_doctype', - 'fieldtype': u'Data', - 'label': u'Rename DocType', - 'options': u'Suggest', - 'permlevel': 0, - 'reqd': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'file_list', - 'fieldtype': u'Text', - 'hidden': 1, - 'label': u'File List', - 'no_copy': 1, - 'permlevel': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'rename', - 'fieldtype': u'Button', - 'label': u'Rename', - 'options': u'do_rename', - 'permlevel': 0 - }, - - # DocField - { - 'depends_on': u'eval:doc.amended_from', - 'description': u'The date at which current entry is corrected in the system.', - 'doctype': u'DocField', - 'fieldname': u'amendment_date', - 'fieldtype': u'Date', - 'label': u'Amendment Date', - 'no_copy': 1, - 'permlevel': 0, - 'print_hide': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'amended_from', - 'fieldtype': u'Link', - 'label': u'Amended From', - 'no_copy': 1, - 'options': u'Sales Invoice', - 'permlevel': 1, - 'print_hide': 1 - } -] \ No newline at end of file diff --git a/erpnext/utilities/doctype/contact/__init__.py b/erpnext/utilities/doctype/contact/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/doctype/contact/__init__.py +++ b/erpnext/utilities/doctype/contact/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/doctype/contact/contact.py b/erpnext/utilities/doctype/contact/contact.py index 3b5131f6cb4..f384ebb787f 100644 --- a/erpnext/utilities/doctype/contact/contact.py +++ b/erpnext/utilities/doctype/contact/contact.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals import webnotes from webnotes.model.doc import Document diff --git a/erpnext/utilities/doctype/gl_mapper/__init__.py b/erpnext/utilities/doctype/gl_mapper/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/doctype/gl_mapper/__init__.py +++ b/erpnext/utilities/doctype/gl_mapper/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/doctype/gl_mapper_detail/__init__.py b/erpnext/utilities/doctype/gl_mapper_detail/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/doctype/gl_mapper_detail/__init__.py +++ b/erpnext/utilities/doctype/gl_mapper_detail/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/doctype/profile_control/__init__.py b/erpnext/utilities/doctype/profile_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/doctype/profile_control/__init__.py +++ b/erpnext/utilities/doctype/profile_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/doctype/profile_control/profile_control.py b/erpnext/utilities/doctype/profile_control/profile_control.py index ef1a6b07c47..570be06860c 100644 --- a/erpnext/utilities/doctype/profile_control/profile_control.py +++ b/erpnext/utilities/doctype/profile_control/profile_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/utilities/doctype/question/__init__.py b/erpnext/utilities/doctype/question/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/doctype/question/__init__.py +++ b/erpnext/utilities/doctype/question/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/doctype/question/question.py b/erpnext/utilities/doctype/question/question.py index c104cfa28ab..6a6fd5ba3c7 100644 --- a/erpnext/utilities/doctype/question/question.py +++ b/erpnext/utilities/doctype/question/question.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals class DocType: def __init__(self, d, dl): self.doc, self.doclist = d, dl diff --git a/erpnext/utilities/doctype/rename_tool/__init__.py b/erpnext/utilities/doctype/rename_tool/__init__.py index e69de29bb2d..baffc488252 100755 --- a/erpnext/utilities/doctype/rename_tool/__init__.py +++ b/erpnext/utilities/doctype/rename_tool/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/doctype/rename_tool/rename_tool.py b/erpnext/utilities/doctype/rename_tool/rename_tool.py index 6c4b058f466..2a2ad92edb0 100644 --- a/erpnext/utilities/doctype/rename_tool/rename_tool.py +++ b/erpnext/utilities/doctype/rename_tool/rename_tool.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals class DocType: def __init__(self, d, dl=[]): self.doc, self.doclist = d, dl diff --git a/erpnext/utilities/doctype/reposting_tool/__init__.py b/erpnext/utilities/doctype/reposting_tool/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/doctype/reposting_tool/__init__.py +++ b/erpnext/utilities/doctype/reposting_tool/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/doctype/reposting_tool/reposting_tool.py b/erpnext/utilities/doctype/reposting_tool/reposting_tool.py index 646e09b1a02..feb1ea0d86d 100644 --- a/erpnext/utilities/doctype/reposting_tool/reposting_tool.py +++ b/erpnext/utilities/doctype/reposting_tool/reposting_tool.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/utilities/doctype/sms_control/__init__.py b/erpnext/utilities/doctype/sms_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/doctype/sms_control/__init__.py +++ b/erpnext/utilities/doctype/sms_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/doctype/sms_control/sms_control.py b/erpnext/utilities/doctype/sms_control/sms_control.py index 42a38fd1d27..9f74e357350 100644 --- a/erpnext/utilities/doctype/sms_control/sms_control.py +++ b/erpnext/utilities/doctype/sms_control/sms_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals import webnotes from webnotes.utils import cint, flt, load_json, nowdate, cstr diff --git a/erpnext/utilities/doctype/sms_log/__init__.py b/erpnext/utilities/doctype/sms_log/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/doctype/sms_log/__init__.py +++ b/erpnext/utilities/doctype/sms_log/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/doctype/sms_receiver/__init__.py b/erpnext/utilities/doctype/sms_receiver/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/doctype/sms_receiver/__init__.py +++ b/erpnext/utilities/doctype/sms_receiver/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/doctype/trash_control/__init__.py b/erpnext/utilities/doctype/trash_control/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/doctype/trash_control/__init__.py +++ b/erpnext/utilities/doctype/trash_control/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/doctype/trash_control/trash_control.py b/erpnext/utilities/doctype/trash_control/trash_control.py index c9643b1dbfc..1b4ec8adba0 100644 --- a/erpnext/utilities/doctype/trash_control/trash_control.py +++ b/erpnext/utilities/doctype/trash_control/trash_control.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # Please edit this list and import only required elements +from __future__ import unicode_literals 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 diff --git a/erpnext/utilities/page/__init__.py b/erpnext/utilities/page/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/page/__init__.py +++ b/erpnext/utilities/page/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/page/calendar/__init__.py b/erpnext/utilities/page/calendar/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/page/calendar/__init__.py +++ b/erpnext/utilities/page/calendar/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/page/calendar/calendar.py b/erpnext/utilities/page/calendar/calendar.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/page/calendar/calendar.py +++ b/erpnext/utilities/page/calendar/calendar.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/page/markdown_reference/__init__.py b/erpnext/utilities/page/markdown_reference/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/page/markdown_reference/__init__.py +++ b/erpnext/utilities/page/markdown_reference/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/page/markdown_reference/markdown_reference.py b/erpnext/utilities/page/markdown_reference/markdown_reference.py index f807eb0a4d4..fbba0997d8f 100644 --- a/erpnext/utilities/page/markdown_reference/markdown_reference.py +++ b/erpnext/utilities/page/markdown_reference/markdown_reference.py @@ -1 +1,2 @@ +from __future__ import unicode_literals import webnotes \ No newline at end of file diff --git a/erpnext/utilities/page/messages/__init__.py b/erpnext/utilities/page/messages/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/page/messages/__init__.py +++ b/erpnext/utilities/page/messages/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/page/messages/messages.py b/erpnext/utilities/page/messages/messages.py index db27805e7e8..9627d99e215 100644 --- a/erpnext/utilities/page/messages/messages.py +++ b/erpnext/utilities/page/messages/messages.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes @webnotes.whitelist() diff --git a/erpnext/utilities/page/question_view/__init__.py b/erpnext/utilities/page/question_view/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/page/question_view/__init__.py +++ b/erpnext/utilities/page/question_view/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/page/question_view/question_view.py b/erpnext/utilities/page/question_view/question_view.py index c7d927ea69a..78293854a6e 100644 --- a/erpnext/utilities/page/question_view/question_view.py +++ b/erpnext/utilities/page/question_view/question_view.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.utils import load_json, cstr, now diff --git a/erpnext/utilities/page/questions/__init__.py b/erpnext/utilities/page/questions/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/page/questions/__init__.py +++ b/erpnext/utilities/page/questions/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/page/questions/questions.js b/erpnext/utilities/page/questions/questions.js index 22a70d8f411..e2e7ed51daf 100644 --- a/erpnext/utilities/page/questions/questions.js +++ b/erpnext/utilities/page/questions/questions.js @@ -215,4 +215,4 @@ KBQuestion = function(parent, det, kb) { this.make() } -wn.require('js/kb_common.js'); +wn.require('js/app/kb_common.js'); diff --git a/erpnext/utilities/page/questions/questions.py b/erpnext/utilities/page/questions/questions.py index 7420d5f8c95..459a32fd8be 100644 --- a/erpnext/utilities/page/questions/questions.py +++ b/erpnext/utilities/page/questions/questions.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.utils import load_json, cint, cstr diff --git a/erpnext/utilities/page/todo/__init__.py b/erpnext/utilities/page/todo/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/page/todo/__init__.py +++ b/erpnext/utilities/page/todo/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/page/todo/todo.css b/erpnext/utilities/page/todo/todo.css index 499d8913b74..6c1ec367a75 100644 --- a/erpnext/utilities/page/todo/todo.css +++ b/erpnext/utilities/page/todo/todo.css @@ -23,10 +23,6 @@ float: right; } -.todoitem .ref_link { - line-height: 18px; -} - .todoitem .description { padding: 3px 0px; display: inline-block; diff --git a/erpnext/utilities/page/todo/todo.js b/erpnext/utilities/page/todo/todo.js index 89c1ed8024b..39c8c2de015 100644 --- a/erpnext/utilities/page/todo/todo.js +++ b/erpnext/utilities/page/todo/todo.js @@ -79,10 +79,10 @@ erpnext.todo.ToDoItem = Class.extend({ parent_list += " div.todo-content"; if(todo.reference_name && todo.reference_type) { - todo.link = repl('\ + todo.link = repl('
    \ %(reference_type)s: %(reference_name)s', todo); } else if(todo.reference_type) { - todo.link = repl('\ + todo.link = repl('
    \ %(reference_type)s', todo); } else { todo.link = ''; @@ -95,12 +95,10 @@ erpnext.todo.ToDoItem = Class.extend({
    \ %(priority)s\ \ - \ %(userdate)s\ %(fullname)s%(desc)s\ - \ -
    \ - %(link)s
    \ + [edit]\ + %(link)s\
    \ ×\
    \ diff --git a/erpnext/utilities/page/todo/todo.py b/erpnext/utilities/page/todo/todo.py index 6aadc9afc1c..f0de04ec9b1 100644 --- a/erpnext/utilities/page/todo/todo.py +++ b/erpnext/utilities/page/todo/todo.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.model.doc import Document diff --git a/erpnext/utilities/page/trash/__init__.py b/erpnext/utilities/page/trash/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/page/trash/__init__.py +++ b/erpnext/utilities/page/trash/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/page/users/__init__.py b/erpnext/utilities/page/users/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/page/users/__init__.py +++ b/erpnext/utilities/page/users/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/page/users/users.html b/erpnext/utilities/page/users/users.html index fe2f0004136..e69de29bb2d 100644 --- a/erpnext/utilities/page/users/users.html +++ b/erpnext/utilities/page/users/users.html @@ -1,13 +0,0 @@ -
    - × -

    Users

    -
    -
    Add, disable, delete users and change their roles, passwords and security settings
    -
    - -
    -
    -
    -
    -
    \ No newline at end of file diff --git a/erpnext/utilities/page/users/users.js b/erpnext/utilities/page/users/users.js index 517c3cf0cec..ee05001edf9 100644 --- a/erpnext/utilities/page/users/users.js +++ b/erpnext/utilities/page/users/users.js @@ -16,26 +16,37 @@ $.extend(wn.pages.users, { onload: function(wrapper) { - wn.pages.users.profiles = {}; - wn.pages.users.refresh(); - wn.pages.users.setup(); - wn.pages.users.role_editor = new erpnext.RoleEditor(); + var w = wn.pages.users; + wn.ui.make_app_page({ + parent: w, + title: "Users", + single_column: true + }); + w.profiles = {}; + w.refresh(); + w.setup(); + w.role_editor = new erpnext.RoleEditor(); }, setup: function() { + wn.pages.users.appframe.add_button('+ Add User', function() { + wn.pages.users.add_user(); + }); + // set roles - $('.users-area').on('click', '.btn.user-roles', function() { + var w = wn.pages.users; + $(w).on('click', '.btn.user-roles', function() { var uid = $(this).parent().parent().attr('data-name'); wn.pages.users.role_editor.show(uid); }); // settings - $('.users-area').on('click', '.btn.user-settings', function() { + $(w).on('click', '.btn.user-settings', function() { var uid = $(this).parent().parent().attr('data-name'); wn.pages.users.show_settings(uid); }); // delete - $('.users-area').on('click', 'a.close', function() { + $(w).on('click', 'a.close', function() { $card = $(this).parent(); var uid = $card.attr('data-name'); $card.css('opacity', 0.6); @@ -55,7 +66,7 @@ $.extend(wn.pages.users, { wn.call({ method:'utilities.page.users.users.get', callback: function(r, rt) { - $('.users-area').empty(); + $(wn.pages.users).find('.layout-main').empty(); for(var i in r.message) { var p = r.message[i]; wn.pages.users.profiles[p.name] = p; @@ -91,7 +102,7 @@ $.extend(wn.pages.users, { if(!data.enabled) data.delete_html = '×'; - $('.users-area').append(repl('
    \ + $(wn.pages.users).find('.layout-main').append(repl('
    \ %(delete_html)s\ \ ', data)); if(!data.enabled) { - $('.users-area .user-card:last') + $(wn.pages.users).find('.layout-main .user-card:last') .addClass('disabled') .find('.user-fullname').html('Disabled'); } @@ -225,8 +236,7 @@ $.extend(wn.pages.users, { 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, \ + msgprint(repl("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
    \ diff --git a/erpnext/utilities/page/users/users.py b/erpnext/utilities/page/users/users.py index 07504a80779..9878d3ca7c1 100644 --- a/erpnext/utilities/page/users/users.py +++ b/erpnext/utilities/page/users/users.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes import json @@ -30,9 +31,13 @@ def get(arg=None): @webnotes.whitelist() def get_roles(arg=None): - """return all roles""" + """return all roles except standard""" + return _get_roles(webnotes.form_dict['uid']) + +def _get_roles(user): + """return all roles except standard""" return [r[0] for r in webnotes.conn.sql("""select name from tabRole - where name not in ('Administrator', 'Guest', 'All') order by name""")] + where name not in ('Administrator', 'Guest', 'All') order by name""", user)] @webnotes.whitelist() def get_user_roles(arg=None): diff --git a/erpnext/utilities/page/wip_monitor/__init__.py b/erpnext/utilities/page/wip_monitor/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/utilities/page/wip_monitor/__init__.py +++ b/erpnext/utilities/page/wip_monitor/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py index 3bc78217008..0e10eeacb07 100644 --- a/erpnext/utilities/transaction_base.py +++ b/erpnext/utilities/transaction_base.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.utils import load_json, cint, cstr, flt, get_defaults from webnotes.model.doc import Document, addchild, getchildren diff --git a/erpnext/website/__init__.py b/erpnext/website/__init__.py index eb3a05555bc..dbf65dd04dd 100644 --- a/erpnext/website/__init__.py +++ b/erpnext/website/__init__.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals install_docs = [ {"doctype":"Role", "role_name":"Blogger", "name":"Blogger"}, {"doctype":"Role", "role_name":"Website Manager", "name":"Website Manager"}, diff --git a/erpnext/website/blog.py b/erpnext/website/blog.py index 482800ec4ee..0e131074c15 100644 --- a/erpnext/website/blog.py +++ b/erpnext/website/blog.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import webnotes @webnotes.whitelist(allow_guest=True) @@ -16,7 +17,8 @@ def get_blog_list(args=None): select cache.name as name, cache.html as content, blog.owner as owner, blog.creation as published, - blog.title as title + blog.title as title, (select count(name) from `tabComment` where + comment_doctype='Blog' and comment_docname=blog.name) as comments from `tabWeb Cache` cache, `tabBlog` blog where cache.doc_type = 'Blog' and blog.page_name = cache.name order by published desc, name asc""" @@ -85,25 +87,43 @@ def add_comment(args=None): } """ import webnotes + import webnotes.utils, markdown2 + import webnotes.widgets.form.comments + import website.web_cache if not args: args = webnotes.form_dict + args['comment'] = unicode(markdown2.markdown(args.get('comment') or '')) - import webnotes.widgets.form.comments comment = webnotes.widgets.form.comments.add_comment(args) # since comments are embedded in the page, clear the web cache - import website.web_cache website.web_cache.clear_cache(args.get('page_name'), args.get('comment_doctype'), args.get('comment_docname')) - import webnotes.utils comment['comment_date'] = webnotes.utils.global_date_format(comment['creation']) template_args = { 'comment_list': [comment], 'template': 'html/comment.html' } # get html of comment row comment_html = website.web_cache.build_html(template_args) - + + # notify commentors + commentors = [d[0] for d in webnotes.conn.sql("""select comment_by from tabComment where + comment_doctype='Blog' and comment_docname=%s and + ifnull(unsubscribed, 0)=0""", args.get('comment_docname'))] + + blog = webnotes.conn.sql("""select * from tabBlog where name=%s""", + args.get('comment_docname'), as_dict=1)[0] + + from webnotes.utils.email_lib.bulk import send + send(recipients=list(set(commentors + [blog['owner']])), + doctype='Comment', + email_field='comment_by', + first_name_field="comment_by_fullname", + last_name_field="NA", + subject='New Comment on Blog: ' + blog['title'], + message='%(comment)s

    By %(comment_by_fullname)s

    ' % args) + return comment_html @webnotes.whitelist(allow_guest=True) @@ -118,7 +138,8 @@ def add_subscriber(): lead = Document('Lead', name[0][0]) else: lead = Document('Lead') - + + if not lead.source: lead.source = 'Blog' lead.unsubscribed = 0 lead.blog_subscriber = 1 lead.lead_name = full_name diff --git a/erpnext/website/doctype/__init__.py b/erpnext/website/doctype/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/website/doctype/__init__.py +++ b/erpnext/website/doctype/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/website/doctype/blog/__init__.py b/erpnext/website/doctype/blog/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/website/doctype/blog/__init__.py +++ b/erpnext/website/doctype/blog/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py index fc389d09d7d..56f6c8683a2 100644 --- a/erpnext/website/doctype/blog/blog.py +++ b/erpnext/website/doctype/blog/blog.py @@ -14,11 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -""" -record of files - -naming for same name files: file.gif, file-1.gif, file-2.gif etc -""" +from __future__ import unicode_literals import webnotes import website.utils @@ -83,4 +79,4 @@ class DocType(website.web_page.Page): self.doc.comment_list = comment_list or [] for comment in self.doc.comment_list: - comment['comment_date'] = webnotes.utils.global_date_format(comment['creation']) \ No newline at end of file + comment['comment_date'] = webnotes.utils.global_date_format(comment['creation']) diff --git a/erpnext/website/doctype/related_page/__init__.py b/erpnext/website/doctype/related_page/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/website/doctype/related_page/__init__.py +++ b/erpnext/website/doctype/related_page/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/website/doctype/style_settings/__init__.py b/erpnext/website/doctype/style_settings/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/website/doctype/style_settings/__init__.py +++ b/erpnext/website/doctype/style_settings/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/website/doctype/style_settings/style_settings.py b/erpnext/website/doctype/style_settings/style_settings.py index 233ae1d1c43..face729736c 100644 --- a/erpnext/website/doctype/style_settings/style_settings.py +++ b/erpnext/website/doctype/style_settings/style_settings.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals class DocType: def __init__(self, d, dl): self.doc, self.doclist = d, dl diff --git a/erpnext/website/doctype/top_bar_item/__init__.py b/erpnext/website/doctype/top_bar_item/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/website/doctype/top_bar_item/__init__.py +++ b/erpnext/website/doctype/top_bar_item/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/website/doctype/web_cache/__init__.py b/erpnext/website/doctype/web_cache/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/website/doctype/web_cache/__init__.py +++ b/erpnext/website/doctype/web_cache/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/website/doctype/web_cache/web_cache.txt b/erpnext/website/doctype/web_cache/web_cache.txt index 98a48918a7f..3514f664a9c 100644 --- a/erpnext/website/doctype/web_cache/web_cache.txt +++ b/erpnext/website/doctype/web_cache/web_cache.txt @@ -3,26 +3,26 @@ # These values are common in all dictionaries { - 'creation': '2012-06-21 12:01:17', - 'docstatus': 0, - 'modified': '2012-06-21 17:25:52', - 'modified_by': u'Administrator', - 'owner': u'Administrator' + u'creation': '2012-07-12 22:19:44', + u'docstatus': 0, + u'modified': '2012-09-17 10:48:17', + u'modified_by': u'Administrator', + u'owner': u'Administrator' }, # These values are common for all DocType { - 'doctype': 'DocType', + u'doctype': u'DocType', 'document_type': u'System', 'module': u'Website', - 'name': '__common__', + u'name': u'__common__', 'version': 1 }, # These values are common for all DocField { - 'doctype': u'DocField', - 'name': '__common__', + u'doctype': u'DocField', + u'name': u'__common__', 'parent': u'Web Cache', 'parentfield': u'fields', 'parenttype': u'DocType', @@ -31,8 +31,8 @@ # These values are common for all DocPerm { - 'doctype': u'DocPerm', - 'name': '__common__', + u'doctype': u'DocPerm', + u'name': u'__common__', 'parent': u'Web Cache', 'parentfield': u'permissions', 'parenttype': u'DocType', @@ -43,34 +43,13 @@ # DocType, Web Cache { - 'doctype': 'DocType', - 'name': u'Web Cache' - }, - - # DocPerm - { - 'create': 0, - 'doctype': u'DocPerm', - 'role': u'All' - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'role': u'Website Manager' - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'role': u'Blogger' + u'doctype': u'DocType', + u'name': u'Web Cache' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'doc_type', 'fieldtype': u'Link', 'in_filter': 1, @@ -81,7 +60,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'doc_name', 'fieldtype': u'Data', 'in_filter': 0, @@ -91,9 +70,30 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'html', 'fieldtype': u'Long Text', 'label': u'HTML' + }, + + # DocPerm + { + 'create': 0, + u'doctype': u'DocPerm', + 'role': u'Guest' + }, + + # DocPerm + { + 'create': 1, + u'doctype': u'DocPerm', + 'role': u'Website Manager' + }, + + # DocPerm + { + 'create': 1, + u'doctype': u'DocPerm', + 'role': u'Blogger' } ] \ No newline at end of file diff --git a/erpnext/website/doctype/web_page/__init__.py b/erpnext/website/doctype/web_page/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/website/doctype/web_page/__init__.py +++ b/erpnext/website/doctype/web_page/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/website/doctype/web_page/web_page.py b/erpnext/website/doctype/web_page/web_page.py index 2a3e84ab179..3cfa4257f76 100644 --- a/erpnext/website/doctype/web_page/web_page.py +++ b/erpnext/website/doctype/web_page/web_page.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes import website.utils import website.web_page diff --git a/erpnext/website/doctype/website_settings/__init__.py b/erpnext/website/doctype/website_settings/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/website/doctype/website_settings/__init__.py +++ b/erpnext/website/doctype/website_settings/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/website/doctype/website_settings/website_settings.py b/erpnext/website/doctype/website_settings/website_settings.py index 4ceef6efb2b..47a12454b13 100644 --- a/erpnext/website/doctype/website_settings/website_settings.py +++ b/erpnext/website/doctype/website_settings/website_settings.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals class DocType: def __init__(self, d, dl): self.doc, self.doclist = d, dl diff --git a/erpnext/website/page/__init__.py b/erpnext/website/page/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/website/page/__init__.py +++ b/erpnext/website/page/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/website/page/unsubscribe/unsubscribe.py b/erpnext/website/page/unsubscribe/unsubscribe.py new file mode 100644 index 00000000000..9e32fc72da1 --- /dev/null +++ b/erpnext/website/page/unsubscribe/unsubscribe.py @@ -0,0 +1,27 @@ +# ERPNext - web based ERP (http://erpnext.com) +# Copyright (C) 2012 Web Notes Technologies Pvt Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from __future__ import unicode_literals +import webnotes + +@webnotes.whitelist() +def unsubscribe(arg): + """unsubscribe from lists""" + lists = [['Blog Subscriber', 'name']] + for l in lists: + webnotes.conn.sql("""delete from `tab%s` where %s=%s""" % (l[0], l[1], '%s'), arg) + + webnotes.msgprint('Unsubscribed!') \ No newline at end of file diff --git a/erpnext/website/page/website_home/__init__.py b/erpnext/website/page/website_home/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/website/page/website_home/__init__.py +++ b/erpnext/website/page/website_home/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/website/product.py b/erpnext/website/product.py index aff15d95f3f..1c0d6d9995c 100644 --- a/erpnext/website/product.py +++ b/erpnext/website/product.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import webnotes @webnotes.whitelist(allow_guest=True) diff --git a/erpnext/website/templates/__init__.py b/erpnext/website/templates/__init__.py index e69de29bb2d..baffc488252 100644 --- a/erpnext/website/templates/__init__.py +++ b/erpnext/website/templates/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/website/templates/html/outer.html b/erpnext/website/templates/html/outer.html index 47184fa28c9..a671d985d16 100644 --- a/erpnext/website/templates/html/outer.html +++ b/erpnext/website/templates/html/outer.html @@ -14,18 +14,34 @@ @@ -35,7 +51,8 @@
    -
    +
    +
    diff --git a/erpnext/website/templates/js/blog.js b/erpnext/website/templates/js/blog.js index 78dd3b774fd..8c9b9d7252b 100644 --- a/erpnext/website/templates/js/blog.js +++ b/erpnext/website/templates/js/blog.js @@ -22,10 +22,19 @@ wn.pages['{{ name }}'].onload = function(wrapper) { hide_refresh: true, no_toolbar: true, render_row: function(parent, data) { + if(!data.comments) { + data.comment_text = 'No comments yet.' + } else if (data.comments===1) { + data.comment_text = '1 comment.' + } else { + data.comment_text = data.comments + ' comments.' + } + if(data.content && data.content.length==1000) { data.content += repl('... (read on)', data); } parent.innerHTML = repl('

    %(title)s

    \ +
    %(comment_text)s
    \ %(content)s

    ', data); }, page_length: 10 diff --git a/erpnext/website/templates/js/login.js b/erpnext/website/templates/js/login.js index 29e49226fcc..4ca18c94527 100644 --- a/erpnext/website/templates/js/login.js +++ b/erpnext/website/templates/js/login.js @@ -59,6 +59,7 @@ erpnext.login.doLogin = function(){ args['remember_me'] = 1; $('#login_btn').set_working(); + $('#login_message').empty(); $c("login", args, erpnext.login.onLoginReply); diff --git a/erpnext/website/utils.py b/erpnext/website/utils.py index 470dbd71923..5393a3d157c 100644 --- a/erpnext/website/utils.py +++ b/erpnext/website/utils.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes from webnotes.model.doc import Document @@ -53,9 +54,9 @@ def render(page_name): except Exception, e: html = get_html('404') - print "Content-Type: text/html" - print - print html.encode('utf-8') + from webnotes.handler import eprint, print_zip + eprint("Content-Type: text/html") + print_zip(html) def get_html(page_name): """get page html""" diff --git a/erpnext/website/web_cache.py b/erpnext/website/web_cache.py index e08499baf1a..9892dac78c1 100644 --- a/erpnext/website/web_cache.py +++ b/erpnext/website/web_cache.py @@ -16,6 +16,7 @@ # html generation functions +from __future__ import unicode_literals template_map = { 'Web Page': 'html/web_page.html', 'Blog': 'html/blog_page.html', @@ -138,11 +139,26 @@ def get_outer_env(): env dict for outer template """ import webnotes + + all_top_items = webnotes.conn.sql("""\ + select * from `tabTop Bar Item` + where parent='Website Settings' and parentfield='top_bar_items' + order by idx asc""", as_dict=1) + + top_items = [d for d in all_top_items if not d['parent_label']] + + # attach child items to top bar + for d in all_top_items: + if d['parent_label']: + for t in top_items: + if t['label']==d['parent_label']: + if not 'child_items' in t: + t['child_items'] = [] + t['child_items'].append(d) + break + return { - 'top_bar_items': webnotes.conn.sql("""\ - select * from `tabTop Bar Item` - where parent='Website Settings' and parentfield='top_bar_items' - order by idx asc""", as_dict=1), + 'top_bar_items': top_items, 'footer_items': webnotes.conn.sql("""\ select * from `tabTop Bar Item` diff --git a/erpnext/website/web_page.py b/erpnext/website/web_page.py index 1058d7fa028..2e049829388 100644 --- a/erpnext/website/web_page.py +++ b/erpnext/website/web_page.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import unicode_literals import webnotes import website.utils import website.web_cache diff --git a/install_erpnext.py b/install_erpnext.py index 75a44aee115..240eca676bf 100644 --- a/install_erpnext.py +++ b/install_erpnext.py @@ -1,4 +1,5 @@ #!/usr/bin/python +from __future__ import unicode_literals import os, commands # ask for root mysql password diff --git a/public/css/all-app.css b/public/css/all-app.css index adf8ad267b7..3d9ba3c0b8a 100644 --- a/public/css/all-app.css +++ b/public/css/all-app.css @@ -2288,7 +2288,7 @@ div.fix_ff_cursor { overflow: auto; } div.comment { color: #444; } .small { - font-size: 11px; + font-size: 12px; } .help { @@ -2473,11 +2473,27 @@ div.std-footer-item { position: fixed; bottom: 5px; left: 5px; - height: 40px; - width: 40px; + height: 30px; + width: 30px; background: url('../images/erpnext-fade.png') no-repeat top left; } +.markdown p { + font-size: 13px; +} + +.markdown h1 { + margin-bottom: 9px; +} + +.markdown h2 { + margin-bottom: 7px; +} + +.markdown h3, .markdown h4 { + margin-bottom: 5px; +} + /* * lib/css/legacy/messages.css */ @@ -2488,6 +2504,14 @@ div.std-footer-item { div.fetching { color: #888; text-align:right; } +.msgprint { + min-height: 60px; + max-height: 500px; + padding: 9px; + color: #333; + overflow: auto; +} + div.notice { postion: absolute; background-color: #000; @@ -2513,24 +2537,17 @@ div.notice { } .help_box, .help-box { - background-color:#FFC; - font-size: 13px; - color: #864; - padding: 7px; + background-color: #ffe; + padding: 9px 9px 9px 9px; + border: 1px dashed #fc7; margin: 11px 0px; - border: 1px solid #EEB; } -.help_box_big { - background-color:#FFC; - color: #864; - padding: 7px; - margin: 7px 0px; - border: 1px solid #EEB; - text-align: center; - font-size: 14px; +.help-box, .help-box p, .help-box h1, .help-box h2, .help-box h3, .help-box h4 { + color: #643; } + /* * lib/css/legacy/forms.css */ @@ -2548,6 +2565,11 @@ div.form-title { margin-right: 7px; } +div.form-intro-area { + padding: 9px 9px 0px 9px; + margin: 0px 0px 15px 0px; +} + div.form-section-head { margin: 11px -15px 3px -15px; border-top: 1px solid #ccc; @@ -2557,7 +2579,7 @@ div.form-section-head { div.form-layout-row:first-child .form-section-head { border-top: 0px solid #ccc !important; margin-top: 0px; - padding-top: 15px; + padding-top: 0px; } div.form-section-head h3 { @@ -2584,18 +2606,6 @@ div.page_break { border-top: 1px dashed #888; } -div.grid_tbarlinks { - border-bottom: 0px; - background-color: #CCC; - padding: 4px 4px 2px 4px; - width: 190px; - float: right; - - -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px; - -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px; -} - - div.dialog_frm { position: relative; margin: 10px; @@ -2726,6 +2736,10 @@ div.sidebar-comment-info { .input_area input, select, textarea { font-size: 14px; padding: 2px; + + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; } .input_area input { @@ -2743,9 +2757,16 @@ div.sidebar-comment-info { width: 80%; padding: 2px 0px; font-size: 12px; + background-color: #eee; + padding: 2px; + border: 1px solid #ddd; + + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; } .disp_area_no_val { - height: 14px; + min-height: 14px; } .no_img { @@ -2766,52 +2787,46 @@ div.sidebar-comment-info { background-color:#FEE; } +.field-has-error { + border: 2px solid #C00; +} + /* * lib/css/legacy/grid.css */ - -/* Grid */ - - -/* --- Simple --- */ -.grid_wrapper_simple { - width: 100%; - margin-bottom: 8px; - border: 1px solid #AA9; -} - -.grid_head_wrapper_simple { - padding: 0px; - border-bottom: 2px solid #AAA; -} - -.grid_head_wrapper_simple td { - border-right: 1px solid #AA9; -} - -.grid_head_wrapper_simple td div { - padding: 2px; -} - -.grid_tab_wrapper_simple { -} - -.grid_cell_simple { - padding: 2px; - background-color: #fff; - border-right: 1px solid #AA9; -} - - -/* --- Normal --- */ .grid_wrapper { position: relative; overflow: auto; border: 1px solid #AAA; width: 100%; margin-bottom: 8px; - background-color: #fff; + background-color: #f8f8f8; +} + +div.grid_tbarlinks { + border-bottom: 0px; + padding: 4px 4px 2px 4px; + width: 190px; + float: right; + margin-right: 12px; + + -webkit-border-top-left-radius: 5px; + -webkit-border-top-right-radius: 5px; + -moz-border-radius-topleft: 5px; + -moz-border-radius-topright: 5px; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + + background: #dddddd; /* Old browsers */ + background: -moz-linear-gradient(top, #dddddd 0%, #bbbbbb 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#dddddd), color-stop(100%,#bbbbbb)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #dddddd 0%,#bbbbbb 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #dddddd 0%,#bbbbbb 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #dddddd 0%,#bbbbbb 100%); /* IE10+ */ + background: linear-gradient(to bottom, #dddddd 0%,#bbbbbb 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dddddd', endColorstr='#bbbbbb',GradientType=0 ); /* IE6-9 */ + } .grid_tab_wrapper { @@ -2842,11 +2857,19 @@ div.sidebar-comment-info { } .grid_head_table td { - background-color: #EEE; border-right: 1px solid #AAA; border-bottom: 1px solid #AAA; height: 40px; padding: 0px; + + background: #eeeeee; /* Old browsers */ + background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* IE10+ */ + background: linear-gradient(to bottom, #eeeeee 0%,#cccccc 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */ } .grid_head_table td div { @@ -3513,6 +3536,20 @@ div.appframe-toolbar { border-bottom: 1px solid #ccc; } +div.appframe-toolbar .label { + margin: 2px 2px; +} + +div.appframe-toolbar input, div.appframe-toolbar select { + font-size: 80%; + margin: 2px 2px; +} +div.appframe-toolbar button { + padding: 3px 7px !important; +} + + + /* * lib/css/ui/fonts.css */ diff --git a/public/css/all-web.css b/public/css/all-web.css index 6a77fac6f94..e38859e62ac 100644 --- a/public/css/all-web.css +++ b/public/css/all-web.css @@ -1938,7 +1938,7 @@ div.fix_ff_cursor { overflow: auto; } div.comment { color: #444; } .small { - font-size: 11px; + font-size: 12px; } .help { @@ -2123,11 +2123,27 @@ div.std-footer-item { position: fixed; bottom: 5px; left: 5px; - height: 40px; - width: 40px; + height: 30px; + width: 30px; background: url('../images/erpnext-fade.png') no-repeat top left; } +.markdown p { + font-size: 13px; +} + +.markdown h1 { + margin-bottom: 9px; +} + +.markdown h2 { + margin-bottom: 7px; +} + +.markdown h3, .markdown h4 { + margin-bottom: 5px; +} + /* * lib/css/legacy/messages.css */ @@ -2138,6 +2154,14 @@ div.std-footer-item { div.fetching { color: #888; text-align:right; } +.msgprint { + min-height: 60px; + max-height: 500px; + padding: 9px; + color: #333; + overflow: auto; +} + div.notice { postion: absolute; background-color: #000; @@ -2163,24 +2187,17 @@ div.notice { } .help_box, .help-box { - background-color:#FFC; - font-size: 13px; - color: #864; - padding: 7px; + background-color: #ffe; + padding: 9px 9px 9px 9px; + border: 1px dashed #fc7; margin: 11px 0px; - border: 1px solid #EEB; } -.help_box_big { - background-color:#FFC; - color: #864; - padding: 7px; - margin: 7px 0px; - border: 1px solid #EEB; - text-align: center; - font-size: 14px; +.help-box, .help-box p, .help-box h1, .help-box h2, .help-box h3, .help-box h4 { + color: #643; } + /* * lib/css/legacy/dialog.css */ @@ -2553,6 +2570,20 @@ div.appframe-toolbar { border-bottom: 1px solid #ccc; } +div.appframe-toolbar .label { + margin: 2px 2px; +} + +div.appframe-toolbar input, div.appframe-toolbar select { + font-size: 80%; + margin: 2px 2px; +} +div.appframe-toolbar button { + padding: 3px 7px !important; +} + + + /* * erpnext/startup/startup.css */ diff --git a/public/css/fields.css b/public/css/fields.css index 3f8aaf3f633..db9f6344724 100644 --- a/public/css/fields.css +++ b/public/css/fields.css @@ -28,6 +28,10 @@ .input_area input, select, textarea { font-size: 14px; padding: 2px; + + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; } .input_area input { @@ -45,9 +49,16 @@ width: 80%; padding: 2px 0px; font-size: 12px; + background-color: #eee; + padding: 2px; + border: 1px solid #ddd; + + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; } .disp_area_no_val { - height: 14px; + min-height: 14px; } .no_img { @@ -67,3 +78,7 @@ .field-to-update { background-color:#FEE; } + +.field-has-error { + border: 2px solid #C00; +} diff --git a/public/js/all-app.js b/public/js/all-app.js index fff60312ac9..5b25f348da4 100644 --- a/public/js/all-app.js +++ b/public/js/all-app.js @@ -139,7 +139,7 @@ wn.provide('wn.settings');wn.provide('wn.ui'); */ wn.require=function(items){if(typeof items==="string"){items=[items];} var l=items.length;for(var i=0;i').insertAfter(ele);}} -$.fn.done_working=function(){var ele=this.get(0);$(ele).attr('disabled',null);if(ele.loading_img){$(ele.loading_img).toggle(false);};}})(jQuery); +$.fn.done_working=function(){var ele=this.get(0);$(ele).attr('disabled',null);if(ele.loading_img){$(ele.loading_img).toggle(false);};}})(jQuery);wn.to_csv=function(data){var res=[];$.each(data,function(i,row){row=$.map(row,function(col){return typeof(col)==="string"?('"'+col.replace(/"/g,'\"')+'"'):col;});res.push(row.join(","));});return res.join("\n");} /* * lib/js/wn/model.js */ -wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],new_names:{},with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name,r);}});}},can_delete:function(doctype){if(!doctype)return false;return wn.boot.profile.can_cancel.indexOf(doctype)!=-1;}} +wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],new_names:{},with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name,r);}});}},can_delete:function(doctype){if(!doctype)return false;return wn.boot.profile.can_cancel.indexOf(doctype)!=-1;},has_value:function(dt,dn,fn){var val=locals[dt]&&locals[dt][dn]&&locals[dt][dn][fn];var df=wn.meta.get_docfield(dt,fn,dn);if(df.fieldtype=='Table'){var ret=false;$.each(locals[df.options]||{},function(k,d){if(d.parent==dn&&d.parenttype==dt&&d.parentfield==df.fieldname){ret=true;}});}else{var ret=!is_null(val);} +return ret?true:false;}} /* * lib/js/wn/meta.js */ wn.provide('wn.meta.docfield_map');wn.provide('wn.meta.docfield_list');wn.provide('wn.meta.doctypes');$.extend(wn.meta,{add_field:function(df){wn.provide('wn.meta.docfield_map.'+df.parent);wn.meta.docfield_map[df.parent][df.fieldname||df.label]=df;if(!wn.meta.docfield_list[df.parent]) wn.meta.docfield_list[df.parent]=[];for(var i in wn.meta.docfield_list[df.parent]){var d=wn.meta.docfield_list[df.parent][i];if(df.fieldname==d.fieldname) return;} -wn.meta.docfield_list[df.parent].push(df);}}); +wn.meta.docfield_list[df.parent].push(df);},get_docfield:function(dt,fn,dn){if(dn&&local_dt[dt]&&local_dt[dt][dn]){return local_dt[dt][dn][fn];}else{return wn.meta.docfield_map[dt][fn];}}}); /* * lib/js/wn/misc/tools.js */ wn.markdown=function(txt){if(!wn.md2html){wn.require('js/lib/showdown.js');wn.md2html=new Showdown.converter();} -return wn.md2html.makeHtml(txt);} +return'
    '+wn.md2html.makeHtml(txt)+'
    ';} /* * lib/js/wn/misc/user.js */ @@ -355,8 +356,9 @@ $(page).bind('show',onshow);if(onshow) $(page).bind('hide',onhide);page.label=label;wn.pages[label]=page;return page;},change_to:function(label){if(this.page&&this.page.label==label){return;} var me=this;if(label.tagName){var page=label;}else{var page=wn.pages[label];} if(!page){console.log('Page not found '+label);return;} -if(this.page){$(this.page).toggle(false);$(this.page).trigger('hide');} -this.page=page;$(this.page).fadeIn();$(this.page).trigger('show');this.page._route=window.location.hash;document.title=this.page.label;scroll(0,0);return this.page;}});wn.views.add_module_btn=function(parent,module){$(parent).append(repl('\ %(module)s Home\ ',{module:module,module_small:module.toLowerCase()}));} @@ -387,13 +389,13 @@ wn.provide('wn.request');wn.request.url='server.py';wn.request.prepare=function( throw"Incomplete Request";}} wn.request.cleanup=function(opts,r){if(opts.btn)$(opts.btn).done_working();if(opts.show_spinner)hide_loading();if(opts.freeze)unfreeze();if(wn.boot&&wn.boot.sid&&wn.get_cookie('sid')!=wn.boot.sid){if(!wn.app.logged_out){msgprint('Session Expired. Logging you out');wn.app.logout();} return;} -if(r.server_messages)msgprint(r.server_messages) -if(r.exc){console.log(r.exc);};if(r['403']){wn.container.change_to('403');} +if(r.server_messages){r.server_messages=JSON.parse(r.server_messages) +msgprint(r.server_messages);} +if(r.exc){r.exc=JSON.parse(r.exc);if(r.exc instanceof Array){$.each(r.exc,function(i,v){if(v)console.log(v);})}else{console.log(r.exc);}};if(r['403']){wn.container.change_to('403');} if(r.docs){LocalDB.sync(r.docs);}} -wn.request.call=function(opts){wn.request.prepare(opts);var ajax_args={url:opts.url||wn.request.url,data:opts.args,type:opts.type||'POST',dataType:opts.dataType||'json',success:function(r,xhr){wn.request.cleanup(opts,r);opts.success(r,xhr.responseText);},error:function(xhr,textStatus){wn.request.cleanup(opts,{});show_alert('Unable to complete request: '+textStatus) -if(opts.error)opts.error(xhr)}};if(opts.progress_bar){var interval=null;$.extend(ajax_args,{xhr:function(){var xhr=jQuery.ajaxSettings.xhr();interval=setInterval(function(){if(xhr.readyState>2){var total=parseInt(xhr.getResponseHeader('Content-length'));var completed=parseInt(xhr.responseText.length);var percent=(100.0/total*completed).toFixed(2) -opts.progress_bar.css('width',(percent<10?10:percent)+'%');console.log(percent);}},50);return xhr;},complete:function(){clearInterval(interval);}})} -console.log(ajax_args);$.ajax(ajax_args);} +wn.request.call=function(opts){wn.request.prepare(opts);var ajax_args={url:opts.url||wn.request.url,data:opts.args,type:opts.type||'POST',dataType:opts.dataType||'json',success:function(r,xhr){wn.request.cleanup(opts,r);opts.success&&opts.success(r,xhr.responseText);},error:function(xhr,textStatus){wn.request.cleanup(opts,{});show_alert('Unable to complete request: '+textStatus) +opts.error&&opts.error(xhr)}};if(opts.progress_bar){var interval=null;$.extend(ajax_args,{xhr:function(){var xhr=jQuery.ajaxSettings.xhr();interval=setInterval(function(){if(xhr.readyState>2){var total=parseInt(xhr.getResponseHeader('Original-Length')||0)||parseInt(xhr.getResponseHeader('Content-Length'));var completed=parseInt(xhr.responseText.length);var percent=(100.0/total*completed).toFixed(2);opts.progress_bar.css('width',(percent<10?10:percent)+'%');}},50);wn.last_xhr=xhr;return xhr;},complete:function(){opts.progress_bar.css('width','100%');clearInterval(interval);}})} +$.ajax(ajax_args);} wn.call=function(opts){var args=$.extend({},opts.args) if(opts.module&&opts.page){args.cmd=opts.module+'.page.'+opts.page+'.'+opts.page+'.'+opts.method}else if(opts.method){args.cmd=opts.method;} for(key in args){if(args[key]&&typeof args[key]!='string'){args[key]=JSON.stringify(args[key]);}} @@ -600,16 +602,14 @@ document.body.appendChild(temp);temp.submit();return temp;} /* * lib/js/legacy/utils/msgprint.js */ -var msg_dialog;function msgprint(msg,issmall,callback){if(!msg)return;if(typeof(msg)!='string') -msg=JSON.stringify(msg);if(issmall){show_alert(msg);return;} -if(msg.substr(0,8)=='__small:'){show_alert(msg.substr(8));return;} -if(!msg_dialog){msg_dialog=new Dialog(500,200,"Message");msg_dialog.make_body([['HTML','Msg']]) -msg_dialog.onhide=function(){msg_dialog.msg_area.innerHTML='';$dh(msg_dialog.msg_icon);if(msg_dialog.custom_onhide)msg_dialog.custom_onhide();} -$y(msg_dialog.rows['Msg'],{fontSize:'14px',lineHeight:'1.5em',padding:'16px'}) -var t=make_table(msg_dialog.rows['Msg'],1,2,'100%',['20px','250px'],{padding:'2px',verticalAlign:'Top'});msg_dialog.msg_area=$td(t,0,1);msg_dialog.msg_icon=$a($td(t,0,0),'img');} -if(!msg_dialog.display)msg_dialog.show();var has_msg=msg_dialog.msg_area.innerHTML?1:0;var m=$a(msg_dialog.msg_area,'div','');if(has_msg)$y(m,{marginTop:'4px'});$dh(msg_dialog.msg_icon);if(msg.substr(0,6).toLowerCase()=='error:'){msg_dialog.msg_icon.src='images/lib/icons/error.gif';$di(msg_dialog.msg_icon);msg=msg.substr(6);}else if(msg.substr(0,8).toLowerCase()=='message:'){msg_dialog.msg_icon.src='images/lib/icons/application.gif';$di(msg_dialog.msg_icon);msg=msg.substr(8);}else if(msg.substr(0,3).toLowerCase()=='ok:'){msg_dialog.msg_icon.src='images/lib/icons/accept.gif';$di(msg_dialog.msg_icon);msg=msg.substr(3);} -m.innerHTML=replace_newlines(msg);if(m.offsetHeight>200){$y(m,{height:'200px',width:'400px',overflow:'auto'})} -msg_dialog.custom_onhide=callback;} +var msg_dialog;function msgprint(msg,title){if(!msg)return;if(msg instanceof Array){$.each(msg,function(i,v){if(v)msgprint(v);}) +return;} +if(typeof(msg)!='string') +msg=JSON.stringify(msg);if(msg.substr(0,8)=='__small:'){show_alert(msg.substr(8));return;} +if(!msg_dialog){msg_dialog=new wn.ui.Dialog({title:"Message",onhide:function(){msg_dialog.msg_area.empty();}});msg_dialog.msg_area=$('
    ').appendTo(msg_dialog.body);} +if(msg.search(/
    |

    |

  • /)==-1) +msg=replace_newlines(msg);msg_dialog.set_title(title||'Message') +msg_dialog.msg_area.append(msg);msg_dialog.show();return msg_dialog;} var growl_area;function show_alert(txt,id){if(!growl_area){if(!$('#dialog-container').length){$('
    ').appendTo('body');} growl_area=$a($i('dialog-container'),'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});} var wrapper=$a(growl_area,'div','',{position:'relative'});var body=$a(wrapper,'div','notice');var c=$a(body,'i','icon-remove-sign',{cssFloat:'right',cursor:'pointer'});$(c).click(function(){$dh(this.wrapper)});c.wrapper=wrapper;var t=$a(body,'div','',{color:'#FFF'});$(t).html(txt);if(id){$(t).attr('id',id);} @@ -637,9 +637,9 @@ html.push('');html.push('').toggle(false).appendTo(this.label_area).css('float','left').css('margin-left','7px').attr("title","This field is mandatory.");this.suggest_icon=$('').toggle(false).appendTo(this.label_area).css('float','left').css('margin-left','7px').attr("title","will show suggestions as you type.");}else{this.label_span=$a(this.label_area,'span','',{marginRight:'4px'}) $dh(this.label_area);} if(!this.input_area){this.input_area=$a(this.wrapper,(this.with_label?'div':'span'));this.disp_area=$a(this.wrapper,(this.with_label?'div':'span'));} if(this.in_grid){if(this.label_area)$dh(this.label_area);}else{this.input_area.className='input_area';$y(this.wrapper,{marginBottom:'9px'});this.set_description();} @@ -650,8 +650,9 @@ Field.prototype.set_label=function(){if(this.with_label&&this.label_area&&this.l Field.prototype.set_description=function(){if(this.df.description){var p=in_list(['Text Editor','Code','Check'],this.df.fieldtype)?this.label_area:this.wrapper;this.desc_area=$a(p,'div','help small','',this.df.description) if(in_list(['Text Editor','Code'],this.df.fieldtype)) $(this.desc_area).addClass('help small');}} -Field.prototype.get_status=function(){if(this.in_filter)this.not_in_form=this.in_filter;if(this.not_in_form){return'Write';} -if(!this.df.permlevel)this.df.permlevel=0;var p=this.perm[this.df.permlevel];var ret;if(cur_frm.editable&&p&&p[WRITE])ret='Write';else if(p&&p[READ])ret='Read';else ret='None';if(this.df.fieldtype=='Binary') +Field.prototype.get_status=function(){if(this.in_filter) +this.not_in_form=this.in_filter;if(this.not_in_form){return'Write';} +if(!this.df.permlevel)this.df.permlevel=0;var p=this.perm[this.df.permlevel];var ret;if(cur_frm.editable&&p&&p[WRITE]&&!this.df.disabled)ret='Write';else if(p&&p[READ])ret='Read';else ret='None';if(this.df.fieldtype=='Binary') ret='None';if(cint(this.df.hidden)) ret='None';if(ret=='Write'&&cint(cur_frm.doc.docstatus)>0)ret='Read';var a_o_s=cint(this.df.allow_on_submit);if(a_o_s&&(this.in_grid||(this.frm&&this.frm.not_in_container))){a_o_s=null;if(this.in_grid)a_o_s=this.grid.field.df.allow_on_submit;if(this.frm&&this.frm.not_in_container){a_o_s=cur_grid.field.df.allow_on_submit;}} if(cur_frm.editable&&a_o_s&&cint(cur_frm.doc.docstatus)>0&&!this.df.hidden){tmp_perm=get_perm(cur_frm.doctype,cur_frm.docname,1);if(tmp_perm[this.df.permlevel]&&tmp_perm[this.df.permlevel][WRITE])ret='Write';} @@ -674,19 +675,19 @@ this.onrefresh();if(this.input){if(this.input.refresh)this.input.refresh(this.df if(this.wrapper){this.wrapper.fieldobj=this;$(this.wrapper).trigger('refresh');} if(!this.not_in_form) this.set_input(_f.get_value(this.doctype,this.docname,this.df.fieldname));this.refresh_mandatory();this.set_max_width();} -Field.prototype.refresh_label_icon=function(){if(this.df.reqd){if(this.get_value&&is_null(this.get_value())){if(this.label_icon)$ds(this.label_icon);$(this.txt?this.txt:this.input).addClass('field-to-update')}else{if(this.label_icon)$dh(this.label_icon);$(this.txt?this.txt:this.input).removeClass('field-to-update')}}} +Field.prototype.refresh_label_icon=function(){var to_update=false;if(this.df.reqd&&this.get_value&&is_null(this.get_value())) +to_update=true;if(!to_update&&this.df.has_error)this.df.has_error=false;if(this.label_icon)this.label_icon.toggle(to_update);$(this.txt?this.txt:this.input).toggleClass('field-to-update',to_update);$(this.txt?this.txt:this.input).toggleClass('field-has-error',this.df.has_error?true:false);} Field.prototype.set=function(val){if(this.not_in_form) return;if((!this.docname)&&this.grid){this.docname=this.grid.add_newrow();} -var set_val=val;if(this.validate)set_val=this.validate(val);_f.set_value(this.doctype,this.docname,this.df.fieldname,set_val);this.value=val;} +if(this.validate) +val=this.validate(val);cur_frm.set_value_in_locals(this.doctype,this.docname,this.df.fieldname,val);this.value=val;} Field.prototype.set_input=function(val){this.value=val;if(this.input&&this.input.set_input){if(val==null)this.input.set_input('');else this.input.set_input(val);} var disp_val=val;if(val==null)disp_val='';this.set_disp(disp_val);} -Field.prototype.run_trigger=function(){this.refresh_label_icon();if(this.df.reqd&&this.get_value&&!is_null(this.get_value())&&this.set_as_error) -this.set_as_error(0);if(this.not_in_form){return;} +Field.prototype.run_trigger=function(){this.refresh_label_icon();if(this.not_in_form){return;} if(cur_frm.cscript[this.df.fieldname]) cur_frm.runclientscript(this.df.fieldname,this.doctype,this.docname);cur_frm.refresh_dependency();} Field.prototype.set_disp_html=function(t){if(this.disp_area){$(this.disp_area).addClass('disp_area');this.disp_area.innerHTML=(t==null?'':t);if(!t)$(this.disp_area).addClass('disp_area_no_val');}} Field.prototype.set_disp=function(val){this.set_disp_html(val);} -Field.prototype.set_as_error=function(set){if(this.in_grid||this.in_filter)return;var w=this.txt?this.txt:this.input;if(set){$y(w,{border:'2px solid RED'});}else{$y(w,{border:'1px solid #888'});}} Field.prototype.activate=function(docname){this.docname=docname;this.refresh();if(this.input){var v=_f.get_value(this.doctype,this.docname,this.df.fieldname);this.last_value=v;if(this.input.onchange&&this.input.get_value&&this.input.get_value()!=v){if(this.validate) this.input.set_value(this.validate(v));else this.input.set_value((v==null)?'':v);if(this.format_input) @@ -701,7 +702,7 @@ me.set(val);if(me.format_input) me.format_input();if(in_list(['Currency','Float','Int'],me.df.fieldtype)){if(flt(me.last_value)==flt(val)){me.last_value=val;return;}} me.last_value=val;me.run_trigger();} this.input.set_input=function(val){if(val==null)val='';me.input.value=val;if(me.format_input)me.format_input();} -if(this.df.options=='Suggest'){if(this.suggest_icon)$di(this.suggest_icon);$(me.input).autocomplete({source:function(request,response){wn.call({method:'webnotes.widgets.search.search_link',args:{'txt':request.term,'dt':me.df.options,'query':repl('SELECT DISTINCT `%(fieldname)s` FROM \ +if(this.df.options=='Suggest'){if(this.suggest_icon)this.suggest_icon.toggle(true);$(me.input).autocomplete({source:function(request,response){wn.call({method:'webnotes.widgets.search.search_link',args:{'txt':request.term,'dt':me.df.options,'query':repl('SELECT DISTINCT `%(fieldname)s` FROM \ `tab%(dt)s` WHERE `%(fieldname)s` LIKE "%s" LIMIT 50',{fieldname:me.df.fieldname,dt:me.df.parent})},callback:function(r){response(r.results);}});},select:function(event,ui){me.set(ui.item.value);}});}} DataField.prototype.validate=function(v){if(this.df.options=='Phone'){if(v+''=='')return'';v1='' v=v.replace(/ /g,'').replace(/-/g,'').replace(/\(/g,'').replace(/\)/g,'');if(v&&v.substr(0,1)=='+'){v1='+';v=v.substr(1);} @@ -709,12 +710,11 @@ if(v&&v.substr(0,2)=='00'){v1+='00';v=v.substr(2);} if(v&&v.substr(0,1)=='0'){v1+='0';v=v.substr(1);} v1+=cint(v)+'';return v1;}else if(this.df.options=='Email'){if(v+''=='')return'';if(!validate_email(v)){msgprint(this.df.label+': '+v+' is not a valid email id');return'';}else return v;}else{return v;}} -DataField.prototype.onrefresh=function(){if(this.input&&this.df.colour){var col='#'+this.df.colour.split(':')[1];$bg(this.input,col);}} function ReadOnlyField(){} ReadOnlyField.prototype=new Field();function HTMLField(){} -HTMLField.prototype=new Field();HTMLField.prototype.with_label=0;HTMLField.prototype.set_disp=function(val){this.disp_area.innerHTML=val;} +HTMLField.prototype=new Field();HTMLField.prototype.with_label=0;HTMLField.prototype.set_disp=function(val){if(this.disp_area)this.disp_area.innerHTML=val;} HTMLField.prototype.set_input=function(val){if(val)this.set_disp(val);} -HTMLField.prototype.onrefresh=function(){this.set_disp(this.df.options?this.df.options:'');} +HTMLField.prototype.onrefresh=function(){if(this.df.options)this.set_disp(this.df.options);} var datepicker_active=0;function DateField(){}DateField.prototype=new Field();DateField.prototype.make_input=function(){var me=this;this.user_fmt=sys_defaults.date_format;if(!this.user_fmt)this.user_fmt='dd-mm-yy';this.input=$a(this.input_area,'input');$(this.input).datepicker({dateFormat:me.user_fmt.replace('yyyy','yy'),altFormat:'yy-mm-dd',changeYear:true,beforeShow:function(input,inst){datepicker_active=1},onClose:function(dateText,inst){datepicker_active=0;if(_f.cur_grid_cell) _f.cur_grid_cell.grid.cell_deselect();}});var me=this;me.input.onchange=function(){if(this.value==null)this.value='';if(!this.not_in_form) me.set(dateutil.user_to_str(me.input.value));me.run_trigger();} @@ -809,7 +809,6 @@ this.refresh();} function TimeField(){}TimeField.prototype=new Field();TimeField.prototype.get_time=function(){return time_to_hhmm(sel_val(this.input_hr),sel_val(this.input_mn),sel_val(this.input_am));} TimeField.prototype.set_time=function(v){ret=time_to_ampm(v);this.input_hr.inp.value=ret[0];this.input_mn.inp.value=ret[1];this.input_am.inp.value=ret[2];} TimeField.prototype.set_style_mandatory=function(){} -TimeField.prototype.set_as_error=function(){} TimeField.prototype.make_input=function(){var me=this;this.input=$a(this.input_area,'div','time_field');var t=make_table(this.input,1,3,'200px');var opt_hr=['1','2','3','4','5','6','7','8','9','10','11','12'];var opt_mn=['00','05','10','15','20','25','30','35','40','45','50','55'];var opt_am=['AM','PM'];this.input_hr=new SelectWidget($td(t,0,0),opt_hr,'50px');this.input_mn=new SelectWidget($td(t,0,1),opt_mn,'50px');this.input_am=new SelectWidget($td(t,0,2),opt_am,'50px');var onchange_fn=function(){me.set(me.get_time());me.run_trigger();} this.input_hr.inp.onchange=onchange_fn;this.input_mn.inp.onchange=onchange_fn;this.input_am.inp.onchange=onchange_fn;this.onrefresh=function(){var v=_f.get_value?_f.get_value(me.doctype,me.docname,me.df.fieldname):null;me.set_time(v);if(!v) me.set(me.get_time());} @@ -826,8 +825,7 @@ me.btn.setAttribute('title','Select Date');if(iconsrc1){var c2=tab.rows[0].inser me.btn1.setAttribute('title','Open Link');} if(iconsrc2){var c3=tab.rows[0].insertCell(3);$y(c3,{width:'20px'});me.btn2=$a(c3,'i',iconsrc2,icon_style) me.btn2.setAttribute('title','Create New');$dh(me.btn2);} -if(me.df.colour) -me.txt.style.background='#'+me.df.colour.split(':')[1];me.txt.name=me.df.fieldname;me.setdisabled=function(tf){me.txt.disabled=tf;}} +me.txt.name=me.df.fieldname;me.setdisabled=function(tf){me.txt.disabled=tf;}} var tmpid=0;_f.ButtonField=function(){};_f.ButtonField.prototype=new Field();_f.ButtonField.prototype.with_label=0;_f.ButtonField.prototype.init=function(){this.prev_button=null;if(!this.frm)return;if(cur_frm&&cur_frm.fields[cur_frm.fields.length-1]&&cur_frm.fields[cur_frm.fields.length-1].df.fieldtype=='Button'){this.make_body=function(){this.prev_button=cur_frm.fields[cur_frm.fields.length-1];if(!this.prev_button.prev_button){this.prev_button.button_area=$a(this.prev_button.input_area,'span');} this.wrapper=this.prev_button.wrapper;this.input_area=this.prev_button.input_area;this.disp_area=this.prev_button.disp_area;this.button_area=$a(this.prev_button.input_area,'span');}}} _f.ButtonField.prototype.make_input=function(){var me=this;if(!this.prev_button){$y(this.input_area,{marginTop:'4px',marginBottom:'4px'});} @@ -849,10 +847,14 @@ wn.ui.AppFrame=Class.extend({init:function(parent,title){this.buttons={};this.$w \ ×\
    ').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();}) -if(title)this.title(title);},title:function(txt){this.$titlebar.find('.appframe-title').html(txt);},add_button:function(label,click,icon){this.add_toolbar();args={label:label,icon:''};if(icon){args.icon='';} +if(title)this.title(title);},title:function(txt){this.clear_breadcrumbs();this.add_breadcrumb(txt);},add_button:function(label,click,icon){this.add_toolbar();args={label:label,icon:''};if(icon){args.icon='';} this.buttons[label]=$(repl('',args)).click(click).appendTo(this.toolbar);return this.buttons[label];},clear_buttons:function(){this.toolbar&&this.toolbar.empty();},add_toolbar:function(){if(!this.toolbar) -this.$w.append('
    ');this.toolbar=this.$w.find('.appframe-toolbar');},add_label:function(label){return $(""+label+" ").appendTo(this.toolbar);},add_select:function(label,options){this.add_toolbar();return $("").datepicker({dateFormat:sys_defaults.date_format.replace("yyyy","yy"),changeYear:true,}).val(dateutil.str_to_user(date)||"").appendTo(this.toolbar);},});wn.ui.make_app_page=function(opts){if(opts.single_column){$(opts.parent).html('
    \ + %(icon)s %(label)s',args)).click(click).appendTo(this.toolbar);return this.buttons[label];},add_help_button:function(txt){this.add_toolbar();$('').data('help-text',txt).click(function(){msgprint($(this).data('help-text'),'Help');}).appendTo(this.toolbar);},clear_buttons:function(){this.toolbar&&this.toolbar.empty();},add_breadcrumb:function(html){if(!this.$breadcrumbs) +this.$breadcrumbs=$('\ + ').appendTo(this.$titlebar);var crumb=$('').html(html);if(!this.$breadcrumbs.find('span').length){crumb.addClass('appframe-title');} +crumb.appendTo(this.$breadcrumbs);},clear_breadcrumbs:function(){this.$breadcrumbs&&this.$breadcrumbs.empty();},add_toolbar:function(){if(!this.toolbar) +this.$w.append('
    ');this.toolbar=this.$w.find('.appframe-toolbar');},add_label:function(label){return $(""+label+" ").appendTo(this.toolbar);},add_select:function(label,options){this.add_toolbar();return $("").appendTo(this.toolbar);},add_date:function(label,date){this.add_toolbar();return $("").datepicker({dateFormat:sys_defaults.date_format.replace("yyyy","yy"),changeYear:true,}).val(dateutil.str_to_user(date)||"").appendTo(this.toolbar);},});wn.ui.make_app_page=function(opts){if(opts.single_column){$(opts.parent).html('
    \
    \
    \
    ');}else{$(opts.parent).html('
    \ @@ -870,6 +872,7 @@ $y(this.body,{padding:'11px'});this.fields_dict={};for(var i=0;iPlease check the following Errors\n'+errors.join('\n'));return null;} @@ -877,19 +880,18 @@ return ret;} this.set_value=function(key,val){var f=this.fields_dict[key];if(f){f.set_input(val);f.refresh_mandatory();}} this.set_values=function(dict){for(var key in dict){if(this.fields_dict[key]){this.set_value(key,dict[key]);}}} this.clear=function(){for(key in this.fields_dict){var f=this.fields_dict[key];if(f){f.set_input(f.df['default']||'');}}}} -wn.widgets.Dialog=function(opts){this.opts=opts;this.display=false;this.make=function(opts){if(opts) -this.opts=opts;if(!this.opts.width)this.opts.width=480;if(!$('#dialog-container').length){$('
    ').appendTo('body');} +wn.widgets.Dialog=function(opts){this.display=false;this.make=function(opts){if(opts){this.opts=opts;$.extend(this,opts);} +if(!this.opts.width)this.opts.width=480;if(!$('#dialog-container').length){$('
    ').appendTo('body');} this.wrapper=$('
    ').appendTo('#dialog-container').get(0);if(this.opts.width) -this.wrapper.style.width=this.opts.width+'px';this.make_head();this.body=$a(this.wrapper,'div','dialog_body');if(this.opts.fields) -this.make_fields(this.body,this.opts.fields);} +this.wrapper.style.width=this.opts.width+'px';this.make_head();this.body=$a(this.wrapper,'div','dialog_body');if(this.opts.fields){this.make_fields(this.body,this.opts.fields);this.catch_enter_as_submit();}} this.make_head=function(){var me=this;this.appframe=new wn.ui.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);} this.set_title=function(t){this.appframe.$titlebar.find('.appframe-title').html(t||'');} this.set_postion=function(){this.wrapper.style.left=(($(window).width()-cint(this.wrapper.style.width))/2)+'px';this.wrapper.style.top=($(window).scrollTop()+60)+'px';top_index++;$y(this.wrapper,{zIndex:top_index});} this.show=function(){if(this.display)return;this.set_postion() -$ds(this.wrapper);freeze();this.display=true;cur_dialog=this;if(this.onshow)this.onshow();} +$ds(this.wrapper);freeze();this.display=true;cur_dialog=this;if(this.onshow)this.onshow();$(this.wrapper).find(':input:first').focus();} this.hide=function(){if(this.onhide)this.onhide();unfreeze();$dh(this.wrapper);this.display=false;cur_dialog=null;} this.no_cancel=function(){this.appframe.$titlebar.find('.close').toggle(false);} -if(opts)this.make();} +if(opts)this.make(opts);} wn.widgets.Dialog.prototype=new wn.widgets.FieldGroup();wn.provide('wn.ui');wn.ui.Dialog=wn.widgets.Dialog $(document).bind('keydown',function(e){if(cur_dialog&&!cur_dialog.no_cancel_flag&&e.which==27){cur_dialog.hide();}}); /* @@ -962,15 +964,16 @@ wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype){this.doctype=d
    \
    \
    \ -
    ');this.appframe=new wn.ui.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('').appendTo(this.appframe.$titlebar),locals.DocType[this.doctype].module,this.doctype);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.make_report_button();me.add_delete_option();},make_report_button:function(){var me=this;if(wn.boot.profile.can_get_report.indexOf(this.doctype)!=-1){this.appframe.add_button('Build Report',function(){wn.set_route('Report2',me.doctype);},'icon-th')}},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1 +
    ');this.appframe=new wn.ui.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs(this.appframe,locals.DocType[this.doctype].module,this.doctype);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.make_report_button();me.add_delete_option();me.make_help();},make_report_button:function(){var me=this;if(wn.boot.profile.can_get_report.indexOf(this.doctype)!=-1){this.appframe.add_button('Build Report',function(){wn.set_route('Report2',me.doctype);},'icon-th')}},make_help:function(){if(this.meta.description){this.appframe.add_help_button(wn.markdown('## '+this.meta.name+'\n\n' ++this.meta.description));}},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1 else return null;}).length;if(this.can_submit){this.$page.find('.show-docstatus').removeClass('hide');this.$page.find('.show-docstatus input').click(function(){me.run();})}},setup_listview:function(){if(this.meta.__listjs){eval(this.meta.__listjs);this.listview=new wn.doclistviews[this.doctype](this);}else{this.listview=new wn.views.ListView(this);} this.listview.parent=this;this.wrapper=this.$page.find('.wnlist-area');this.page_length=20;this.allow_delete=true;},init_list:function(auto_run){var me=this;this.make({method:'webnotes.widgets.doclistview.get',get_args:this.get_args,parent:this.wrapper,start:0,page_length:this.page_length,show_filters:true,show_grid:true,new_doctype:this.doctype,allow_delete:this.allow_delete,no_result_message:this.make_no_result(),columns:this.listview.fields,custom_new_doc:me.listview.make_new_doc||undefined,});$(this.wrapper).find('button[list_view_doc="'+me.doctype+'"]').click(function(){(me.listview.make_new_doc||me.make_new_doc)(me.doctype);});if((auto_run!==false)&&(auto_run!==0))this.run();},make_no_result:function(){var no_result_message=repl('
    \

    No %(doctype_label)s found

    \ - %(description)s\
    \

    \ -

    ',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||''),});return no_result_message;},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[],order_by:this.listview.order_by||undefined,group_by:this.listview.group_by||undefined,}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('Delete',function(){me.delete_items();},'icon-remove')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length) +

    ',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype});return no_result_message;},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[],order_by:this.listview.order_by||undefined,group_by:this.listview.group_by||undefined,}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('Delete',function(){me.delete_items();},'icon-remove');$('
    \ + Select all
    ').insertBefore(this.$page.find('.result-list'));this.$page.find('[name="select-all"]').click(function(){me.$page.find('.list-delete').attr('checked',$(this).attr('checked')||false);})}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length) return;if(!confirm('This is PERMANENT action and you cannot undo. Continue?')){return;} me.set_working(true);wn.call({method:'webnotes.widgets.doclistview.delete_items',args:{items:dl,doctype:me.doctype},callback:function(){me.set_working(false);me.refresh();}})},init_stats:function(){var me=this wn.call({method:'webnotes.widgets.doclistview.get_stats',args:{stats:me.listview.stats,doctype:me.doctype},callback:function(r){$.each(me.listview.stats,function(i,v){me.render_stat(v,r.message[v]);});if(me.listview.stats.length){$('').click(function(){me.reload_stats();}).appendTo($('
    ').appendTo(me.$page.find('.layout-side-section')))}}});},render_stat:function(field,stat){var me=this;if(!stat||!stat.length){if(field=='_user_tags'){this.$page.find('.layout-side-section').append('

    Tags

    \ @@ -1033,7 +1036,7 @@ _r.rb_con.set_dt(dt,function(rb){if(rep_name){var route_changed=(rb.current_rout rb.load_criteria(rep_name);if(rb.dt&&route_changed){rb.dt.run();}} if(!rb.forbidden){wn.container.change_to('Report Builder');}});}} wn.views.reportview2={show:function(dt){var page_name=wn.get_route_str();if(wn.pages[page_name]){wn.container.change_to(wn.pages[page_name]);}else{var route=wn.get_route();if(route[1]){new wn.views.ReportViewPage(route[1],route[2]);}else{wn.set_route('404');}}}} -wn.views.ReportViewPage=Class.extend({init:function(doctype,docname){this.doctype=doctype;this.docname=docname;this.page_name=wn.get_route_str();this.make_page();var me=this;wn.model.with_doctype(doctype,function(){me.make_report_view();if(docname){wn.model.with_doc('Report',docname,function(r){me.reportview.set_columns_and_filters(JSON.parse(locals['Report'][docname].json));me.reportview.run();});}else{me.reportview.run();}});},make_page:function(){this.page=wn.container.add_page(this.page_name);wn.ui.make_app_page({parent:this.page,single_column:true});wn.container.change_to(this.page_name);},make_report_view:function(){wn.views.breadcrumbs($('').appendTo(this.page.appframe.$titlebar),locals.DocType[this.doctype].module);this.reportview=new wn.views.ReportView(this.doctype,this.docname,this.page)}}) +wn.views.ReportViewPage=Class.extend({init:function(doctype,docname){this.doctype=doctype;this.docname=docname;this.page_name=wn.get_route_str();this.make_page();var me=this;wn.model.with_doctype(doctype,function(){me.make_report_view();if(docname){wn.model.with_doc('Report',docname,function(r){me.reportview.set_columns_and_filters(JSON.parse(locals['Report'][docname].json));me.reportview.run();});}else{me.reportview.run();}});},make_page:function(){this.page=wn.container.add_page(this.page_name);wn.ui.make_app_page({parent:this.page,single_column:true});wn.container.change_to(this.page_name);},make_report_view:function(){this.page.appframe.add_breadcrumb(locals.DocType[this.doctype].module);this.reportview=new wn.views.ReportView(this.doctype,this.docname,this.page)}}) wn.views.ReportView=wn.ui.Listing.extend({init:function(doctype,docname,page){var me=this;$(page).find('.layout-main').html('Loading Report...');this.import_slickgrid();$(page).find('.layout-main').empty();this.doctype=doctype;this.docname=docname;this.page=page;this.tab_name='`tab'+doctype+'`';this.setup();},import_slickgrid:function(){wn.require('js/lib/slickgrid/slick.grid.css');wn.require('js/lib/slickgrid/slick-default-theme.css');wn.require('js/lib/slickgrid/jquery.event.drag.min.js');wn.require('js/lib/slickgrid/slick.core.js');wn.require('js/lib/slickgrid/slick.grid.js');wn.dom.set_style('.slick-cell { font-size: 12px; }');},set_init_columns:function(){var columns=[['name'],['owner']];$.each(wn.meta.docfield_list[this.doctype],function(i,df){if(df.in_filter&&df.fieldname!='naming_series'&&df.fieldtype!='Table'){columns.push([df.fieldname]);}});this.columns=columns;},setup:function(){var me=this;this.make({title:'Report: '+(this.docname?(this.doctype+' - '+this.docname):this.doctype),appframe:this.page.appframe,method:'webnotes.widgets.doclistview.get',get_args:this.get_args,parent:$(this.page).find('.layout-main'),start:0,page_length:20,show_filters:true,new_doctype:this.doctype,allow_delete:true,});this.make_column_picker();this.make_sorter();this.make_export();this.set_init_columns();this.make_save();},set_columns_and_filters:function(opts){var me=this;if(opts.columns)this.columns=opts.columns;if(opts.filters)$.each(opts.filters,function(i,f){me.filter_list.add_filter(f[0],f[1],f[2],f[3]);});if(opts.sort_by)this.sort_by_select.val(opts.sort_by);if(opts.sort_order)this.sort_order_select.val(opts.sort_order);if(opts.sort_by_next)this.sort_by_next_select.val(opts.sort_by_next);if(opts.sort_order_next)this.sort_order_next_select.val(opts.sort_order_next);},get_args:function(){var me=this;return{doctype:this.doctype,fields:$.map(this.columns,function(v){return me.get_full_column_name(v)}),order_by:this.get_order_by(),filters:this.filter_list.get_filters(),docstatus:['0','1','2']}},get_order_by:function(){var order_by=this.get_selected_table_and_column(this.sort_by_select) +' '+this.sort_order_select.val();if(this.sort_by_next_select.val()){order_by+=', '+this.get_selected_table_and_column(this.sort_by_next_select) +' '+this.sort_order_next_select.val();} @@ -1069,12 +1072,36 @@ me.list.run();});this.dialog.show();},add_column:function(c){var w=$('
    ').appendTo(this.parent);if(this.filters){this.make_filters();} -this.make_waiting();this.import_slickgrid();var me=this;this.get_data();wn.cur_grid_report=this;},get_data:function(){var me=this;wn.report_dump.with_data(this.doctypes,function(){$.each(me.filter_inputs,function(i,v){var opts=v.get(0).opts;if(opts.fieldtype=="Select"&&inList(me.doctypes,opts.options)){$(v).add_options($.map(wn.report_dump.data[opts.options],function(d){return d.name;}));}});me.setup();me.refresh();},this.wrapper.find(".progress .bar"));},make_waiting:function(){this.waiting=$('
    \ +if(missing.length){wn.call({method:"webnotes.widgets.report_dump.get_data",args:{doctypes:missing},callback:function(r){$.each(r.message,function(doctype,doctype_data){var data=[];$.each(doctype_data.data,function(i,d){var row={};$.each(doctype_data.columns,function(idx,col){row[col]=d[idx];});row.id=doctype+"-"+i;data.push(row);});wn.report_dump.data[doctype]=data;});callback();},progress_bar:progress_bar})}else{callback();}}});wn.provide("wn.views");wn.views.GridReport=Class.extend({init:function(opts){this.filter_inputs={};this.preset_checks=[];$.extend(this,opts);this.wrapper=$('
    ').appendTo(this.parent);if(this.filters){this.make_filters();} +this.make_waiting();this.import_slickgrid();var me=this;this.get_data();},get_data:function(){var me=this;wn.report_dump.with_data(this.doctypes,function(){me.setup_filters();me.init_filter_values();me.refresh();},this.wrapper.find(".progress .bar"));},setup_filters:function(){var me=this;$.each(me.filter_inputs,function(i,v){var opts=v.get(0).opts;if(opts.fieldtype=="Select"&&inList(me.doctypes,opts.link)){$(v).add_options($.map(wn.report_dump.data[opts.link],function(d){return d.name;}));}});this.filter_inputs.refresh&&this.filter_inputs.refresh.click(function(){me.set_route();});this.filter_inputs.reset_filters&&this.filter_inputs.reset_filters.click(function(){me.init_filter_values();me.set_route();});},make_waiting:function(){this.waiting=$('
    \

    Loading Report...

    \
    \ -
    ').appendTo(this.wrapper);},load_filters:function(callback){callback();},make_filters:function(){var me=this;$.each(this.filters,function(i,v){v.fieldname=v.fieldname||v.label.replace(/ /g,'_').toLowerCase();var input=null;if(v.fieldtype=='Select'){input=me.appframe.add_select(v.label,["Select "+v.options]);}else if(v.fieldtype=='Button'){input=me.appframe.add_button(v.label);}else if(v.fieldtype=='Date'){input=me.appframe.add_date(v.label);}else if(v.fieldtype=='Label'){input=me.appframe.add_label(v.label);} -input&&(input.get(0).opts=v);me.filter_inputs[v.fieldname]=input;});},import_slickgrid:function(){wn.require('js/lib/slickgrid/slick.grid.css');wn.require('js/lib/slickgrid/slick-default-theme.css');wn.require('js/lib/slickgrid/jquery.event.drag.min.js');wn.require('js/lib/slickgrid/slick.core.js');wn.require('js/lib/slickgrid/slick.grid.js');wn.require('js/lib/slickgrid/slick.dataview.js');wn.dom.set_style('.slick-cell { font-size: 12px; }');},refresh:function(){this.prepare_data();this.render();},render:function(){this.waiting.toggle(false);this.grid_wrapper=$("
    ").appendTo(this.wrapper);this.id=wn.dom.set_unique_id(this.grid_wrapper.get(0));this.grid=new Slick.Grid("#"+this.id,this.dataView,this.columns,this.options);this.dataView.onRowsChanged.subscribe(function(e,args){grid.invalidateRows(args.rows);grid.render();});this.dataView.onRowCountChanged.subscribe(function(e,args){grid.updateRowCount();grid.render();});},prepare_data_view:function(items){this.dataView=new Slick.Data.DataView({inlineFilters:true});this.dataView.beginUpdate();this.dataView.setItems(items);this.dataView.setFilter(this.dataview_filter);this.dataView.endUpdate();},options:{editable:false,enableColumnReorder:false},dataview_filter:function(item){return true;},date_formatter:function(row,cell,value,columnDef,dataContext){return dateutil.str_to_user(value);},currency_formatter:function(row,cell,value,columnDef,dataContext){return"
    "+fmt_money(value)+"
    ";}}) +
    ').appendTo(this.wrapper);},make_grid_wrapper:function(){$('').appendTo(this.wrapper);$('
    \ + Print \ + | \ + Export \ +
    ').appendTo(this.wrapper);this.wrapper.find(".grid-report-export").click(function(){return me.export();});this.grid_wrapper=$("
    ").appendTo(this.wrapper);this.id=wn.dom.set_unique_id(this.grid_wrapper.get(0));var me=this;$(this.page).bind('show',function(){wn.cur_grid_report=me;me.apply_filters_from_route();me.refresh();});wn.cur_grid_report=this;this.apply_filters_from_route();},load_filters:function(callback){callback();},make_filters:function(){var me=this;$.each(this.filters,function(i,v){v.fieldname=v.fieldname||v.label.replace(/ /g,'_').toLowerCase();var input=null;if(v.fieldtype=='Select'){input=me.appframe.add_select(v.label,v.options||[v.default_value]);}else if(v.fieldtype=='Button'){input=me.appframe.add_button(v.label);if(v.icon){$('').prependTo(input);}}else if(v.fieldtype=='Date'){input=me.appframe.add_date(v.label);}else if(v.fieldtype=='Label'){input=me.appframe.add_label(v.label);}else if(v.fieldtype=='Data'){input=me.appframe.add_data(v.label);} +if(input){input&&(input.get(0).opts=v);if(v.cssClass){input.addClass(v.cssClass);} +input.keypress(function(e){if(e.which==13){me.refresh();}})} +me.filter_inputs[v.fieldname]=input;});},import_slickgrid:function(){wn.require('js/lib/slickgrid/slick.grid.css');wn.require('js/lib/slickgrid/slick-default-theme.css');wn.require('js/lib/slickgrid/jquery.event.drag.min.js');wn.require('js/lib/slickgrid/slick.core.js');wn.require('js/lib/slickgrid/slick.grid.js');wn.require('js/lib/slickgrid/slick.dataview.js');wn.dom.set_style('.slick-cell { font-size: 12px; }');},refresh:function(){this.init_refresh&&this.init_refresh();this.waiting.toggle(false);if(!this.grid_wrapper) +this.make_grid_wrapper();this.setup_columns();this.apply_link_formatters();this.prepare_data();this.init_plot&&this.init_plot();this.render();this.render_plot();},apply_filters_from_route:function(){var hash=window.location.hash;var me=this;if(hash.indexOf('/')!=-1){$.each(hash.split('/').splice(1).join('/').split('&'),function(i,f){var f=f.split("=");if(me.filter_inputs[f[0]]){me.filter_inputs[f[0]].val(decodeURIComponent(f[1]));}else{console.log("Invalid filter: "+f[0]);}});}},set_route:function(){wn.set_route(wn.container.page.page_name,$.map(this.filter_inputs,function(v){var val=v.val();var opts=v.get(0).opts;if(val&&val!=opts.default_value) +return encodeURIComponent(opts.fieldname) ++'='+encodeURIComponent(val);}).join('&'))},render:function(){this.grid=new Slick.Grid("#"+this.id,this.dataView,this.columns,this.options);var me=this;this.dataView.onRowsChanged.subscribe(function(e,args){me.grid.invalidateRows(args.rows);me.grid.render();});this.dataView.onRowCountChanged.subscribe(function(e,args){me.grid.updateRowCount();me.grid.render();});this.add_grid_events&&this.add_grid_events();},prepare_data_view:function(items){this.dataView=new Slick.Data.DataView({inlineFilters:true});this.dataView.beginUpdate();this.dataView.setItems(items);this.dataView.setFilter(this.dataview_filter);this.dataView.endUpdate();},export:function(){var me=this;var res=[$.map(this.columns,function(v){return v.name;})].concat(this.get_view_data());wn.require("js/lib/downloadify/downloadify.min.js");wn.require("js/lib/downloadify/swfobject.js");var id=wn.dom.set_unique_id();var msgobj=msgprint('

    You must have Flash 10 installed to download this file.

    ');Downloadify.create(id,{filename:function(){return me.title+'.csv';},data:function(){return wn.to_csv(res);},swf:'js/lib/downloadify/downloadify.swf',downloadImage:'js/lib/downloadify/download.png',onComplete:function(){msgobj.hide();},onCancel:function(){msgobj.hide();},onError:function(){msgobj.hide();},width:100,height:30,transparent:true,append:false});return false;},render_plot:function(){if(!this.get_plot_data)return;wn.require('js/lib/flot/jquery.flot.js');$.plot(this.wrapper.find('.plot').toggle(true),this.get_plot_data());},get_view_data:function(){var res=[];var col_map=$.map(this.columns,function(v){return v.field;});for(var i=0,len=this.dataView.getLength();i%(value)s
    ',{_style:dataContext._style||"",value:fmt_money(value)});},text_formatter:function(row,cell,value,columnDef,dataContext){return repl('%(value)s',{_style:dataContext._style||"",esc_value:cstr(value).replace(/"/g,'\"'),value:cstr(value)});},apply_link_formatters:function(){var me=this;$.each(this.columns,function(i,col){if(col.link_formatter){col.formatter=function(row,cell,value,columnDef,dataContext){if(!value)return"";if(dataContext._show){return repl('%(value)s',{_style:dataContext._style||"",value:value});} +var link_formatter=wn.cur_grid_report.columns[cell].link_formatter;var html=repl('\ + %(value)s',{value:value,col_name:link_formatter.filter_input,page_name:wn.container.page.page_name}) +if(link_formatter.open_btn){html+=repl(' \ + ',{value:value,doctype:eval(link_formatter.doctype)});} +return html;}}})}}) /* * lib/js/legacy/widgets/dialog.js */ @@ -1110,7 +1137,7 @@ Layout.prototype.show=function(){$ds(this.wrapper);} Layout.prototype.hide=function(){$dh(this.wrapper);} Layout.prototype.close_borders=function(){if(this.with_border){this.myrows[this.myrows.length-1].wrapper.style.borderBottom='1px solid #000';}} function LayoutRow(layout,parent){this.layout=layout;this.wrapper=$a(parent,'div','form-layout-row');this.main_head=$a(this.wrapper,'div');this.main_body=$a(this.wrapper,'div');if(layout.with_border){this.wrapper.style.border='1px solid #000';this.wrapper.style.borderBottom='0px';} -this.header=$a(this.main_body,'div','',{padding:(layout.with_border?'0px 8px':'0px')});this.body=$a(this.main_body,'div');this.table=$a(this.body,'table','',{width:'100%',borderCollapse:'collapse'});this.row=this.table.insertRow(0);this.mycells=[];} +this.header=$a(this.main_body,'div','',{padding:(layout.with_border?'0px 8px':'0px')});this.body=$a(this.main_body,'div');this.table=$a(this.body,'table','',{width:'100%',borderCollapse:'collapse',tableLayout:'fixed'});this.row=this.table.insertRow(0);this.mycells=[];} LayoutRow.prototype.hide=function(){$dh(this.wrapper);} LayoutRow.prototype.show=function(){$ds(this.wrapper);} LayoutRow.prototype.addCell=function(wid){var lc=new LayoutCell(this.layout,this,wid);this.mycells[this.mycells.length]=lc;return lc;} @@ -1226,14 +1253,14 @@ args.colnames=colnames.join(',');args.report_name=report_name?report_name:'';ope * lib/js/legacy/webpage/search.js */ search_fields={};function setlinkvalue(name){selector.input.set_input_value(name);selector.hide();} -function makeselector(){var d=new Dialog(540,440,'Search');d.make_body([['Data','Beginning With','Tip: You can use wildcard "%"'],['Select','Search By'],['Button','Search'],['HTML','Help'],['HTML','Result']]);var inp=d.widgets['Beginning With'];var field_sel=d.widgets['Search By'];var btn=d.widgets['Search'];d.sel_type='';d.values_len=0;d.set=function(input,type,label){d.sel_type=type;d.input=input;if(d.style!='Link'){d.rows['Result'].innerHTML='';d.values_len=0;} +function makeselector(){var d=new Dialog(540,440,'Search');d.make_body([['HTML','Help'],['Data','Beginning With','Tip: You can use wildcard "%"'],['Select','Search By'],['Button','Search'],['HTML','Result']]);var inp=d.widgets['Beginning With'];var field_sel=d.widgets['Search By'];var btn=d.widgets['Search'];d.sel_type='';d.values_len=0;d.set=function(input,type,label){d.sel_type=type;d.input=input;if(d.style!='Link'){d.rows['Result'].innerHTML='';d.values_len=0;} d.style='Link';d.set_query_description() -if(!d.sel_type)d.sel_type='Value';d.set_title('Select a "'+d.sel_type+'" for field "'+label+'"');} +if(!d.sel_type)d.sel_type='Value';d.set_title("Select");d.set_query_description('Select a "'+d.sel_type+'" for field "'+label+'"');} d.set_search=function(dt){if(d.style!='Search'){d.rows['Result'].innerHTML='';d.values_len=0;} d.style='Search';if(d.input){d.input=null;sel_type=null;} d.sel_type=get_label_doctype(dt);d.set_title('Quick Search for '+dt);} $(inp).keydown(function(e){if(e.which==13){if(!btn.disabled)btn.onclick();}}) -d.set_query_description=function(){if(d.input&&d.input.query_description){d.rows['Help'].innerHTML='
    '+d.input.query_description+'
    ';}else{d.rows['Help'].innerHTML=''}} +d.set_query_description=function(txt){txt=d.input&&d.input.query_description||txt;if(txt){d.rows['Help'].innerHTML='
    '+txt+'
    ';}else{d.rows['Help'].innerHTML=''}} d.onshow=function(){if(d.set_doctype!=d.sel_type){d.rows['Result'].innerHTML='';d.values_len=0;} inp.value='';if(d.input&&d.input.txt.value){inp.value=d.input.txt.value;} try{inp.focus();}catch(e){} @@ -1321,7 +1348,9 @@ delete locals[dt][dn];} function get_local(dt,dn){return locals[dt]?locals[dt][dn]:null;} LocalDB.sync=function(list){if(list._kl)list=expand_doclist(list);if(list){LocalDB.clear_locals(list[0].doctype,list[0].name);} for(var i=0;i1)return true;var fl=wn.meta.docfield_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;i1)return true;var fl=wn.meta.docfield_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;i
  • /)==-1) +msg=replace_newlines(msg);msg_dialog.set_title(title||'Message') +msg_dialog.msg_area.append(msg);msg_dialog.show();return msg_dialog;} var growl_area;function show_alert(txt,id){if(!growl_area){if(!$('#dialog-container').length){$('
    ').appendTo('body');} growl_area=$a($i('dialog-container'),'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});} var wrapper=$a(growl_area,'div','',{position:'relative'});var body=$a(wrapper,'div','notice');var c=$a(body,'i','icon-remove-sign',{cssFloat:'right',cursor:'pointer'});$(c).click(function(){$dh(this.wrapper)});c.wrapper=wrapper;var t=$a(body,'div','',{color:'#FFF'});$(t).html(txt);if(id){$(t).attr('id',id);} @@ -508,10 +508,14 @@ wn.ui.AppFrame=Class.extend({init:function(parent,title){this.buttons={};this.$w \ ×\
    ').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();}) -if(title)this.title(title);},title:function(txt){this.$titlebar.find('.appframe-title').html(txt);},add_button:function(label,click,icon){this.add_toolbar();args={label:label,icon:''};if(icon){args.icon='';} +if(title)this.title(title);},title:function(txt){this.clear_breadcrumbs();this.add_breadcrumb(txt);},add_button:function(label,click,icon){this.add_toolbar();args={label:label,icon:''};if(icon){args.icon='';} this.buttons[label]=$(repl('',args)).click(click).appendTo(this.toolbar);return this.buttons[label];},clear_buttons:function(){this.toolbar&&this.toolbar.empty();},add_toolbar:function(){if(!this.toolbar) -this.$w.append('
    ');this.toolbar=this.$w.find('.appframe-toolbar');},add_label:function(label){return $(""+label+" ").appendTo(this.toolbar);},add_select:function(label,options){this.add_toolbar();return $("").datepicker({dateFormat:sys_defaults.date_format.replace("yyyy","yy"),changeYear:true,}).val(dateutil.str_to_user(date)||"").appendTo(this.toolbar);},});wn.ui.make_app_page=function(opts){if(opts.single_column){$(opts.parent).html('
    \ + %(icon)s %(label)s',args)).click(click).appendTo(this.toolbar);return this.buttons[label];},add_help_button:function(txt){this.add_toolbar();$('').data('help-text',txt).click(function(){msgprint($(this).data('help-text'),'Help');}).appendTo(this.toolbar);},clear_buttons:function(){this.toolbar&&this.toolbar.empty();},add_breadcrumb:function(html){if(!this.$breadcrumbs) +this.$breadcrumbs=$('\ + ').appendTo(this.$titlebar);var crumb=$('').html(html);if(!this.$breadcrumbs.find('span').length){crumb.addClass('appframe-title');} +crumb.appendTo(this.$breadcrumbs);},clear_breadcrumbs:function(){this.$breadcrumbs&&this.$breadcrumbs.empty();},add_toolbar:function(){if(!this.toolbar) +this.$w.append('
    ');this.toolbar=this.$w.find('.appframe-toolbar');},add_label:function(label){return $(""+label+" ").appendTo(this.toolbar);},add_select:function(label,options){this.add_toolbar();return $("").appendTo(this.toolbar);},add_date:function(label,date){this.add_toolbar();return $("").datepicker({dateFormat:sys_defaults.date_format.replace("yyyy","yy"),changeYear:true,}).val(dateutil.str_to_user(date)||"").appendTo(this.toolbar);},});wn.ui.make_app_page=function(opts){if(opts.single_column){$(opts.parent).html('
    \
    \
    \
    ');}else{$(opts.parent).html('
    \ @@ -529,6 +533,7 @@ $y(this.body,{padding:'11px'});this.fields_dict={};for(var i=0;iPlease check the following Errors\n'+errors.join('\n'));return null;} @@ -536,19 +541,18 @@ return ret;} this.set_value=function(key,val){var f=this.fields_dict[key];if(f){f.set_input(val);f.refresh_mandatory();}} this.set_values=function(dict){for(var key in dict){if(this.fields_dict[key]){this.set_value(key,dict[key]);}}} this.clear=function(){for(key in this.fields_dict){var f=this.fields_dict[key];if(f){f.set_input(f.df['default']||'');}}}} -wn.widgets.Dialog=function(opts){this.opts=opts;this.display=false;this.make=function(opts){if(opts) -this.opts=opts;if(!this.opts.width)this.opts.width=480;if(!$('#dialog-container').length){$('
    ').appendTo('body');} +wn.widgets.Dialog=function(opts){this.display=false;this.make=function(opts){if(opts){this.opts=opts;$.extend(this,opts);} +if(!this.opts.width)this.opts.width=480;if(!$('#dialog-container').length){$('
    ').appendTo('body');} this.wrapper=$('
    ').appendTo('#dialog-container').get(0);if(this.opts.width) -this.wrapper.style.width=this.opts.width+'px';this.make_head();this.body=$a(this.wrapper,'div','dialog_body');if(this.opts.fields) -this.make_fields(this.body,this.opts.fields);} +this.wrapper.style.width=this.opts.width+'px';this.make_head();this.body=$a(this.wrapper,'div','dialog_body');if(this.opts.fields){this.make_fields(this.body,this.opts.fields);this.catch_enter_as_submit();}} this.make_head=function(){var me=this;this.appframe=new wn.ui.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);} this.set_title=function(t){this.appframe.$titlebar.find('.appframe-title').html(t||'');} this.set_postion=function(){this.wrapper.style.left=(($(window).width()-cint(this.wrapper.style.width))/2)+'px';this.wrapper.style.top=($(window).scrollTop()+60)+'px';top_index++;$y(this.wrapper,{zIndex:top_index});} this.show=function(){if(this.display)return;this.set_postion() -$ds(this.wrapper);freeze();this.display=true;cur_dialog=this;if(this.onshow)this.onshow();} +$ds(this.wrapper);freeze();this.display=true;cur_dialog=this;if(this.onshow)this.onshow();$(this.wrapper).find(':input:first').focus();} this.hide=function(){if(this.onhide)this.onhide();unfreeze();$dh(this.wrapper);this.display=false;cur_dialog=null;} this.no_cancel=function(){this.appframe.$titlebar.find('.close').toggle(false);} -if(opts)this.make();} +if(opts)this.make(opts);} wn.widgets.Dialog.prototype=new wn.widgets.FieldGroup();wn.provide('wn.ui');wn.ui.Dialog=wn.widgets.Dialog $(document).bind('keydown',function(e){if(cur_dialog&&!cur_dialog.no_cancel_flag&&e.which==27){cur_dialog.hide();}}); /* @@ -624,7 +628,9 @@ delete locals[dt][dn];} function get_local(dt,dn){return locals[dt]?locals[dt][dn]:null;} LocalDB.sync=function(list){if(list._kl)list=expand_doclist(list);if(list){LocalDB.clear_locals(list[0].doctype,list[0].name);} for(var i=0;i1)return true;var fl=wn.meta.docfield_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;i1)return true;var fl=wn.meta.docfield_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;i
    ');if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("js/app/complete_setup.js");erpnext.complete_setup.show();} if(wn.boot.expires_on&&in_list(user_roles,'System Manager')){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('
    \ Your ERPNext subscription will expire %(expiry_string)s. \ Please renew your subscription to continue using ERPNext \ @@ -717,9 +721,7 @@ if(wn.boot.expires_on&&in_list(user_roles,'System Manager')){var today=dateutil. This ERPNext subscription has expired. \
    ',{expiry_string:expiry_string}));}} erpnext.set_about();if(wn.control_panel.custom_startup_code) -eval(wn.control_panel.custom_startup_code);} -$('body').append('')} +eval(wn.control_panel.custom_startup_code);}} erpnext.update_messages=function(reset){if(inList(['Guest'],user)||!wn.session_alive){return;} if(!reset){var set_messages=function(r){if(!r.exc){erpnext.toolbar.set_new_comments(r.message.unread_messages);var show_in_circle=function(parent_id,msg){var parent=$('#'+parent_id);if(parent){if(msg){parent.find('span:first').text(msg);parent.toggle(true);}else{parent.toggle(false);}}} show_in_circle('unread_messages',r.message.unread_messages.length);show_in_circle('open_support_tickets',r.message.open_support_tickets);show_in_circle('things_todo',r.message.things_todo);show_in_circle('todays_events',r.message.todays_events);show_in_circle('open_tasks',r.message.open_tasks);show_in_circle('unanswered_questions',r.message.unanswered_questions);}else{clearInterval(wn.updates.id);}} diff --git a/erpnext/accounts/page/chart_of_accounts/chart_of_accounts.css b/public/js/app/account_tree_grid.css similarity index 100% rename from erpnext/accounts/page/chart_of_accounts/chart_of_accounts.css rename to public/js/app/account_tree_grid.css diff --git a/public/js/app/account_tree_grid.js b/public/js/app/account_tree_grid.js new file mode 100644 index 00000000000..c8dd8a5fa30 --- /dev/null +++ b/public/js/app/account_tree_grid.js @@ -0,0 +1,259 @@ +// 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 . + +erpnext.AccountTreeGrid = wn.views.GridReport.extend({ + init: function(wrapper, title) { + this._super({ + title: title, + page: wrapper, + parent: $(wrapper).find('.layout-main'), + appframe: wrapper.appframe, + doctypes: ["Company", "Fiscal Year", "Account", "GL Entry"] + }); + }, + setup_columns: function() { + this.columns = [ + {id: "name", name: "Account", field: "name", width: 300, cssClass: "cell-title", + formatter: this.account_formatter}, + {id: "opening_debit", name: "Opening (Dr)", field: "opening_debit", width: 100, + formatter: this.currency_formatter}, + {id: "opening_credit", name: "Opening (Cr)", field: "opening_credit", width: 100, + formatter: this.currency_formatter}, + {id: "debit", name: "Debit", field: "debit", width: 100, + formatter: this.currency_formatter}, + {id: "credit", name: "Credit", field: "credit", width: 100, + formatter: this.currency_formatter}, + {id: "closing_debit", name: "Closing (Dr)", field: "closing_debit", width: 100, + formatter: this.currency_formatter}, + {id: "closing_credit", name: "Closing (Cr)", field: "closing_credit", width: 100, + formatter: this.currency_formatter} + ]; + + }, + filters: [ + {fieldtype:"Select", label: "Company", link:"Company", default_value: "Select Company...", + filter: function(val, item, opts) { + return item.company == val || val == opts.default_value || item._show; + }}, + {fieldtype:"Select", label: "Fiscal Year", link:"Fiscal Year", + default_value: "Select Fiscal Year..."}, + {fieldtype:"Date", label: "From Date"}, + {fieldtype:"Label", label: "To"}, + {fieldtype:"Date", label: "To Date"}, + {fieldtype:"Button", label: "Refresh", icon:"icon-refresh icon-white", cssClass:"btn-info"}, + {fieldtype:"Button", label: "Reset Filters"} + ], + setup_filters: function() { + this._super(); + var me = this; + // default filters + this.filter_inputs.fiscal_year.change(function() { + var fy = $(this).val(); + $.each(wn.report_dump.data["Fiscal Year"], function(i, v) { + if (v.name==fy) { + me.filter_inputs.from_date.val(dateutil.str_to_user(v.year_start_date)); + me.filter_inputs.to_date.val(dateutil.str_to_user(v.year_end_date)); + } + }); + me.set_route(); + }); + }, + init_filter_values: function() { + this.filter_inputs.company.val(sys_defaults.company); + this.filter_inputs.fiscal_year.val(sys_defaults.fiscal_year); + this.filter_inputs.from_date.val(dateutil.str_to_user(sys_defaults.year_start_date)); + this.filter_inputs.to_date.val(dateutil.str_to_user(sys_defaults.year_end_date)); + }, + prepare_data: function() { + var me = this; + var data = []; + var parent_map = {}; + var data_by_name = {}; + $.each(wn.report_dump.data["Account"], function(i, v) { + var d = copy_dict(v); + me.init_account(d); + + data.push(d); + data_by_name[d.name] = d; + if(d.parent_account) { + parent_map[d.name] = d.parent_account; + } + }); + this.set_indent(data, parent_map); + this.accounts = data; + this.parent_map = parent_map; + this.accounts_by_name = data_by_name; + this.prepare_balances(); + this.prepare_data_view(this.accounts); + }, + init_account: function(d) { + $.extend(d, { + "opening_debit": 0, + "opening_credit": 0, + "debit": 0, + "credit": 0, + "closing_debit": 0, + "closing_credit": 0 + }); + }, + prepare_balances: function() { + var gl = wn.report_dump.data['GL Entry']; + var me = this; + + this.opening_date = dateutil.user_to_obj(this.filter_inputs.from_date.val()); + this.closing_date = dateutil.user_to_obj(this.filter_inputs.to_date.val()); + this.set_fiscal_year(); + if (!this.fiscal_year) return; + + $.each(this.accounts, function(i, v) { + v.opening_debit = v.opening_credit = v.debit + = v.credit = v.closing_debit = v.closing_credit = 0; + }); + + $.each(gl, function(i, v) { + var posting_date = dateutil.str_to_obj(v.posting_date); + var account = me.accounts_by_name[v.account]; + me.update_balances(account, posting_date, v) + }); + + this.update_groups(); + }, + update_balances: function(account, posting_date, v) { + // opening + if (posting_date < this.opening_date || v.is_opening === "Yes") { + if (account.is_pl_account === "Yes" && + posting_date <= dateutil.str_to_obj(this.fiscal_year[1])) { + // balance of previous fiscal_year should + // not be part of opening of pl account balance + } else { + if(account.debit_or_credit=='Debit') { + account.opening_debit += (v.debit - v.credit); + } else { + account.opening_credit += (v.credit - v.debit); + } + } + } else if (this.opening_date <= posting_date && posting_date <= this.closing_date) { + // in between + account.debit += v.debit; + account.credit += v.credit; + } + // closing + if(account.debit_or_credit=='Debit') { + account.closing_debit = account.opening_debit + account.debit - account.credit; + } else { + account.closing_credit = account.opening_credit - account.debit + account.credit; + } + }, + update_groups: function() { + // update groups + var me= this; + $.each(this.accounts, function(i, account) { + // update groups + var parent = me.parent_map[account.name]; + while(parent) { + parent_account = me.accounts_by_name[parent]; + $.each(me.columns, function(c, col) { + if (col.formatter == me.currency_formatter) { + parent_account[col.field] += account[col.field]; + } + }); + parent = me.parent_map[parent]; + } + }); + }, + + set_fiscal_year: function() { + if (this.opening_date > this.closing_date) { + msgprint("Opening Date should be before Closing Date"); + return; + } + + this.fiscal_year = null; + var me = this; + $.each(wn.report_dump.data["Fiscal Year"], function(i, v) { + if (me.opening_date >= dateutil.str_to_obj(v.year_start_date) && + me.closing_date <= dateutil.str_to_obj(v.year_end_date)) { + me.fiscal_year = v; + } + }); + + if (!this.fiscal_year) { + msgprint("Opening Date and Closing Date should be within same Fiscal Year"); + return; + } + }, + set_indent: function(data, parent_map) { + $.each(data, function(i, d) { + var indent = 0; + var parent = parent_map[d.name]; + if(parent) { + while(parent) { + indent++; + parent = parent_map[parent]; + } + } + d.indent = indent; + }); + }, + account_formatter: function (row, cell, value, columnDef, dataContext) { + value = value.replace(/&/g,"&").replace(//g,">"); + var data = wn.cur_grid_report.accounts; + var spacer = ""; + var idx = wn.cur_grid_report.dataView.getIdxById(dataContext.id); + var account_link = repl('%(value)s', { + value: value, + enc_value: encodeURIComponent(value) + }); + + if (data[idx + 1] && data[idx + 1].indent > data[idx].indent) { + if (dataContext._collapsed) { + return spacer + "  " + account_link; + } else { + return spacer + "  " + account_link; + } + } else { + return spacer + "  " + account_link; + } + }, + add_grid_events: function() { + var me = this; + this.grid.onClick.subscribe(function (e, args) { + if ($(e.target).hasClass("toggle")) { + var item = me.dataView.getItem(args.row); + if (item) { + if (!item._collapsed) { + item._collapsed = true; + } else { + item._collapsed = false; + } + + me.dataView.updateItem(item.id, item); + } + e.stopImmediatePropagation(); + } + }); + }, + custom_dataview_filter: function(item) { + if (item.parent_account) { + var parent = item.parent_account; + while (parent) { + if (wn.cur_grid_report.accounts_by_name[parent]._collapsed) { + return false; + } + parent = wn.cur_grid_report.parent_map[parent]; + } + } + return true; + } +}); \ No newline at end of file diff --git a/erpnext/startup/js/complete_setup.js b/public/js/app/complete_setup.js similarity index 100% rename from erpnext/startup/js/complete_setup.js rename to public/js/app/complete_setup.js diff --git a/public/js/app/gantt_task.js b/public/js/app/gantt_task.js new file mode 100644 index 00000000000..aa3adbb85fd --- /dev/null +++ b/public/js/app/gantt_task.js @@ -0,0 +1,88 @@ +// 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 . + +// gantt chart for project tasks + +wn.require('js/lib/jQuery.Gantt/css/style.css'); +wn.require('js/lib/jQuery.Gantt/js/jquery.fn.gantt.min.js'); + +erpnext.show_task_gantt = function(parent, project) { + + $(parent).css('min-height', '300px').html('
    Loading...
    ') + + var get_source = function(r) { + var source = []; + // projects + $.each(r.message, function(i,v) { + source.push({ + name: v.project, + desc: v.subject, + values: [{ + label: v.subject, + desc: v.description || v.subject, + from: '/Date("'+v.exp_start_date+'")/', + to: '/Date("'+v.exp_end_date+'")/', + customClass: { + 'Open':'ganttRed', + 'Pending Review':'ganttOrange', + 'Working':'', + 'Completed':'ganttGreen', + 'Cancelled':'ganttGray' + }[v.status], + dataObj: v + }] + }) + }); + return source + } + wn.call({ + method: 'projects.page.projects.projects.get_tasks', + args: { + project: project || '' + }, + callback: function(r) { + $(parent).empty(); + if(!r.message.length) { + $(parent).html('
    No Tasks Yet.
    '); + } else { + var gantt_area = $('
    ').appendTo(parent); + gantt_area.gantt({ + source: get_source(r), + navigate: project ? "button" : "scroll", + scale: "weeks", + minScale: "weeks", + maxScale: "months", + onItemClick: function(data) { + wn.set_route('Form', 'Task', data.name); + }, + onAddClick: function(dt, rowId) { + newdoc('Task'); + } + }); + } + + $('').click(function() { + wn.model.with_doctype('Task', function() { + var new_name = LocalDB.create('Task'); + if(project) + locals.Task[new_name].project = project; + wn.set_route('Form', 'Task', new_name); + }); + }).appendTo(parent); + } + }) +} diff --git a/erpnext/utilities/page/kb_common/kb_common.js b/public/js/app/kb_common.js similarity index 100% rename from erpnext/utilities/page/kb_common/kb_common.js rename to public/js/app/kb_common.js diff --git a/public/js/complete_setup.js b/public/js/complete_setup.js deleted file mode 100644 index ad0f37f9aad..00000000000 --- a/public/js/complete_setup.js +++ /dev/null @@ -1,10 +0,0 @@ - -/* - * erpnext/startup/js/complete_setup.js - */ -wn.provide('erpnext.complete_setup');$.extend(erpnext.complete_setup,{show:function(){d=erpnext.complete_setup.prepare_dialog();d.show();},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);$('header').toggle(false);} -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);}};if(wn.control_panel.company_name){var inp=d.fields_dict.company_name.input;inp.value=wn.control_panel.company_name;inp.disabled=true;} -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;},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','Hong Kong','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',"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'],'China':['Asia/Shanghai','Asia/Harbin','Asia/Chongqing','Asia/Urumqi','Asia/Kashgar'],'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'],'Hong Kong':['Asia/Hong_Kong'],'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'],'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/public/js/fields.js b/public/js/fields.js index 548a4b8c963..8fee1068b21 100644 --- a/public/js/fields.js +++ b/public/js/fields.js @@ -5,9 +5,9 @@ var no_value_fields=['Section Break','Column Break','HTML','Table','FlexTable','Button','Image'];var codeid=0;var code_editors={};function Field(){this.with_label=1;} Field.prototype.make_body=function(){var ischk=(this.df.fieldtype=='Check'?1:0);if(this.parent) this.wrapper=$a(this.parent,(this.with_label?'div':'span'));else -this.wrapper=document.createElement((this.with_label?'div':'span'));this.label_area=$a(this.wrapper,'div','',{margin:'0px 0px 2px 0px'});if(ischk&&!this.in_grid){this.input_area=$a(this.label_area,'span','',{marginRight:'4px'});this.disp_area=$a(this.label_area,'span','',{marginRight:'4px'});} -if(this.with_label){this.label_span=$a(this.label_area,'span','small') -this.label_icon=$a(this.label_area,'img','',{margin:'-3px 4px -3px 4px'});$dh(this.label_icon);this.label_icon.src='images/lib/icons/error.gif';this.label_icon.title='Mandatory value needs to be entered';this.suggest_icon=$a(this.label_area,'img','',{margin:'-3px 4px -3px 0px'});$dh(this.suggest_icon);this.suggest_icon.src='images/lib/icons/bullet_arrow_down.png';this.suggest_icon.title='With suggestions';}else{this.label_span=$a(this.label_area,'span','',{marginRight:'4px'}) +this.wrapper=document.createElement((this.with_label?'div':'span'));this.label_area=$a(this.wrapper,'div','',{margin:'0px 0px 2px 0px',minHeight:'1em'});if(ischk&&!this.in_grid){this.input_area=$a(this.label_area,'span','',{marginRight:'4px'});this.disp_area=$a(this.label_area,'span','',{marginRight:'4px'});} +if(this.with_label){this.label_span=$a(this.label_area,'span','small',{cssFloat:'left'}) +this.label_icon=$('').toggle(false).appendTo(this.label_area).css('float','left').css('margin-left','7px').attr("title","This field is mandatory.");this.suggest_icon=$('').toggle(false).appendTo(this.label_area).css('float','left').css('margin-left','7px').attr("title","will show suggestions as you type.");}else{this.label_span=$a(this.label_area,'span','',{marginRight:'4px'}) $dh(this.label_area);} if(!this.input_area){this.input_area=$a(this.wrapper,(this.with_label?'div':'span'));this.disp_area=$a(this.wrapper,(this.with_label?'div':'span'));} if(this.in_grid){if(this.label_area)$dh(this.label_area);}else{this.input_area.className='input_area';$y(this.wrapper,{marginBottom:'9px'});this.set_description();} @@ -18,8 +18,9 @@ Field.prototype.set_label=function(){if(this.with_label&&this.label_area&&this.l Field.prototype.set_description=function(){if(this.df.description){var p=in_list(['Text Editor','Code','Check'],this.df.fieldtype)?this.label_area:this.wrapper;this.desc_area=$a(p,'div','help small','',this.df.description) if(in_list(['Text Editor','Code'],this.df.fieldtype)) $(this.desc_area).addClass('help small');}} -Field.prototype.get_status=function(){if(this.in_filter)this.not_in_form=this.in_filter;if(this.not_in_form){return'Write';} -if(!this.df.permlevel)this.df.permlevel=0;var p=this.perm[this.df.permlevel];var ret;if(cur_frm.editable&&p&&p[WRITE])ret='Write';else if(p&&p[READ])ret='Read';else ret='None';if(this.df.fieldtype=='Binary') +Field.prototype.get_status=function(){if(this.in_filter) +this.not_in_form=this.in_filter;if(this.not_in_form){return'Write';} +if(!this.df.permlevel)this.df.permlevel=0;var p=this.perm[this.df.permlevel];var ret;if(cur_frm.editable&&p&&p[WRITE]&&!this.df.disabled)ret='Write';else if(p&&p[READ])ret='Read';else ret='None';if(this.df.fieldtype=='Binary') ret='None';if(cint(this.df.hidden)) ret='None';if(ret=='Write'&&cint(cur_frm.doc.docstatus)>0)ret='Read';var a_o_s=cint(this.df.allow_on_submit);if(a_o_s&&(this.in_grid||(this.frm&&this.frm.not_in_container))){a_o_s=null;if(this.in_grid)a_o_s=this.grid.field.df.allow_on_submit;if(this.frm&&this.frm.not_in_container){a_o_s=cur_grid.field.df.allow_on_submit;}} if(cur_frm.editable&&a_o_s&&cint(cur_frm.doc.docstatus)>0&&!this.df.hidden){tmp_perm=get_perm(cur_frm.doctype,cur_frm.docname,1);if(tmp_perm[this.df.permlevel]&&tmp_perm[this.df.permlevel][WRITE])ret='Write';} @@ -42,19 +43,19 @@ this.onrefresh();if(this.input){if(this.input.refresh)this.input.refresh(this.df if(this.wrapper){this.wrapper.fieldobj=this;$(this.wrapper).trigger('refresh');} if(!this.not_in_form) this.set_input(_f.get_value(this.doctype,this.docname,this.df.fieldname));this.refresh_mandatory();this.set_max_width();} -Field.prototype.refresh_label_icon=function(){if(this.df.reqd){if(this.get_value&&is_null(this.get_value())){if(this.label_icon)$ds(this.label_icon);$(this.txt?this.txt:this.input).addClass('field-to-update')}else{if(this.label_icon)$dh(this.label_icon);$(this.txt?this.txt:this.input).removeClass('field-to-update')}}} +Field.prototype.refresh_label_icon=function(){var to_update=false;if(this.df.reqd&&this.get_value&&is_null(this.get_value())) +to_update=true;if(!to_update&&this.df.has_error)this.df.has_error=false;if(this.label_icon)this.label_icon.toggle(to_update);$(this.txt?this.txt:this.input).toggleClass('field-to-update',to_update);$(this.txt?this.txt:this.input).toggleClass('field-has-error',this.df.has_error?true:false);} Field.prototype.set=function(val){if(this.not_in_form) return;if((!this.docname)&&this.grid){this.docname=this.grid.add_newrow();} -var set_val=val;if(this.validate)set_val=this.validate(val);_f.set_value(this.doctype,this.docname,this.df.fieldname,set_val);this.value=val;} +if(this.validate) +val=this.validate(val);cur_frm.set_value_in_locals(this.doctype,this.docname,this.df.fieldname,val);this.value=val;} Field.prototype.set_input=function(val){this.value=val;if(this.input&&this.input.set_input){if(val==null)this.input.set_input('');else this.input.set_input(val);} var disp_val=val;if(val==null)disp_val='';this.set_disp(disp_val);} -Field.prototype.run_trigger=function(){this.refresh_label_icon();if(this.df.reqd&&this.get_value&&!is_null(this.get_value())&&this.set_as_error) -this.set_as_error(0);if(this.not_in_form){return;} +Field.prototype.run_trigger=function(){this.refresh_label_icon();if(this.not_in_form){return;} if(cur_frm.cscript[this.df.fieldname]) cur_frm.runclientscript(this.df.fieldname,this.doctype,this.docname);cur_frm.refresh_dependency();} Field.prototype.set_disp_html=function(t){if(this.disp_area){$(this.disp_area).addClass('disp_area');this.disp_area.innerHTML=(t==null?'':t);if(!t)$(this.disp_area).addClass('disp_area_no_val');}} Field.prototype.set_disp=function(val){this.set_disp_html(val);} -Field.prototype.set_as_error=function(set){if(this.in_grid||this.in_filter)return;var w=this.txt?this.txt:this.input;if(set){$y(w,{border:'2px solid RED'});}else{$y(w,{border:'1px solid #888'});}} Field.prototype.activate=function(docname){this.docname=docname;this.refresh();if(this.input){var v=_f.get_value(this.doctype,this.docname,this.df.fieldname);this.last_value=v;if(this.input.onchange&&this.input.get_value&&this.input.get_value()!=v){if(this.validate) this.input.set_value(this.validate(v));else this.input.set_value((v==null)?'':v);if(this.format_input) @@ -69,7 +70,7 @@ me.set(val);if(me.format_input) me.format_input();if(in_list(['Currency','Float','Int'],me.df.fieldtype)){if(flt(me.last_value)==flt(val)){me.last_value=val;return;}} me.last_value=val;me.run_trigger();} this.input.set_input=function(val){if(val==null)val='';me.input.value=val;if(me.format_input)me.format_input();} -if(this.df.options=='Suggest'){if(this.suggest_icon)$di(this.suggest_icon);$(me.input).autocomplete({source:function(request,response){wn.call({method:'webnotes.widgets.search.search_link',args:{'txt':request.term,'dt':me.df.options,'query':repl('SELECT DISTINCT `%(fieldname)s` FROM \ +if(this.df.options=='Suggest'){if(this.suggest_icon)this.suggest_icon.toggle(true);$(me.input).autocomplete({source:function(request,response){wn.call({method:'webnotes.widgets.search.search_link',args:{'txt':request.term,'dt':me.df.options,'query':repl('SELECT DISTINCT `%(fieldname)s` FROM \ `tab%(dt)s` WHERE `%(fieldname)s` LIKE "%s" LIMIT 50',{fieldname:me.df.fieldname,dt:me.df.parent})},callback:function(r){response(r.results);}});},select:function(event,ui){me.set(ui.item.value);}});}} DataField.prototype.validate=function(v){if(this.df.options=='Phone'){if(v+''=='')return'';v1='' v=v.replace(/ /g,'').replace(/-/g,'').replace(/\(/g,'').replace(/\)/g,'');if(v&&v.substr(0,1)=='+'){v1='+';v=v.substr(1);} @@ -77,12 +78,11 @@ if(v&&v.substr(0,2)=='00'){v1+='00';v=v.substr(2);} if(v&&v.substr(0,1)=='0'){v1+='0';v=v.substr(1);} v1+=cint(v)+'';return v1;}else if(this.df.options=='Email'){if(v+''=='')return'';if(!validate_email(v)){msgprint(this.df.label+': '+v+' is not a valid email id');return'';}else return v;}else{return v;}} -DataField.prototype.onrefresh=function(){if(this.input&&this.df.colour){var col='#'+this.df.colour.split(':')[1];$bg(this.input,col);}} function ReadOnlyField(){} ReadOnlyField.prototype=new Field();function HTMLField(){} -HTMLField.prototype=new Field();HTMLField.prototype.with_label=0;HTMLField.prototype.set_disp=function(val){this.disp_area.innerHTML=val;} +HTMLField.prototype=new Field();HTMLField.prototype.with_label=0;HTMLField.prototype.set_disp=function(val){if(this.disp_area)this.disp_area.innerHTML=val;} HTMLField.prototype.set_input=function(val){if(val)this.set_disp(val);} -HTMLField.prototype.onrefresh=function(){this.set_disp(this.df.options?this.df.options:'');} +HTMLField.prototype.onrefresh=function(){if(this.df.options)this.set_disp(this.df.options);} var datepicker_active=0;function DateField(){}DateField.prototype=new Field();DateField.prototype.make_input=function(){var me=this;this.user_fmt=sys_defaults.date_format;if(!this.user_fmt)this.user_fmt='dd-mm-yy';this.input=$a(this.input_area,'input');$(this.input).datepicker({dateFormat:me.user_fmt.replace('yyyy','yy'),altFormat:'yy-mm-dd',changeYear:true,beforeShow:function(input,inst){datepicker_active=1},onClose:function(dateText,inst){datepicker_active=0;if(_f.cur_grid_cell) _f.cur_grid_cell.grid.cell_deselect();}});var me=this;me.input.onchange=function(){if(this.value==null)this.value='';if(!this.not_in_form) me.set(dateutil.user_to_str(me.input.value));me.run_trigger();} @@ -177,7 +177,6 @@ this.refresh();} function TimeField(){}TimeField.prototype=new Field();TimeField.prototype.get_time=function(){return time_to_hhmm(sel_val(this.input_hr),sel_val(this.input_mn),sel_val(this.input_am));} TimeField.prototype.set_time=function(v){ret=time_to_ampm(v);this.input_hr.inp.value=ret[0];this.input_mn.inp.value=ret[1];this.input_am.inp.value=ret[2];} TimeField.prototype.set_style_mandatory=function(){} -TimeField.prototype.set_as_error=function(){} TimeField.prototype.make_input=function(){var me=this;this.input=$a(this.input_area,'div','time_field');var t=make_table(this.input,1,3,'200px');var opt_hr=['1','2','3','4','5','6','7','8','9','10','11','12'];var opt_mn=['00','05','10','15','20','25','30','35','40','45','50','55'];var opt_am=['AM','PM'];this.input_hr=new SelectWidget($td(t,0,0),opt_hr,'50px');this.input_mn=new SelectWidget($td(t,0,1),opt_mn,'50px');this.input_am=new SelectWidget($td(t,0,2),opt_am,'50px');var onchange_fn=function(){me.set(me.get_time());me.run_trigger();} this.input_hr.inp.onchange=onchange_fn;this.input_mn.inp.onchange=onchange_fn;this.input_am.inp.onchange=onchange_fn;this.onrefresh=function(){var v=_f.get_value?_f.get_value(me.doctype,me.docname,me.df.fieldname):null;me.set_time(v);if(!v) me.set(me.get_time());} @@ -194,8 +193,7 @@ me.btn.setAttribute('title','Select Date');if(iconsrc1){var c2=tab.rows[0].inser me.btn1.setAttribute('title','Open Link');} if(iconsrc2){var c3=tab.rows[0].insertCell(3);$y(c3,{width:'20px'});me.btn2=$a(c3,'i',iconsrc2,icon_style) me.btn2.setAttribute('title','Create New');$dh(me.btn2);} -if(me.df.colour) -me.txt.style.background='#'+me.df.colour.split(':')[1];me.txt.name=me.df.fieldname;me.setdisabled=function(tf){me.txt.disabled=tf;}} +me.txt.name=me.df.fieldname;me.setdisabled=function(tf){me.txt.disabled=tf;}} var tmpid=0;_f.ButtonField=function(){};_f.ButtonField.prototype=new Field();_f.ButtonField.prototype.with_label=0;_f.ButtonField.prototype.init=function(){this.prev_button=null;if(!this.frm)return;if(cur_frm&&cur_frm.fields[cur_frm.fields.length-1]&&cur_frm.fields[cur_frm.fields.length-1].df.fieldtype=='Button'){this.make_body=function(){this.prev_button=cur_frm.fields[cur_frm.fields.length-1];if(!this.prev_button.prev_button){this.prev_button.button_area=$a(this.prev_button.input_area,'span');} this.wrapper=this.prev_button.wrapper;this.input_area=this.prev_button.input_area;this.disp_area=this.prev_button.disp_area;this.button_area=$a(this.prev_button.input_area,'span');}}} _f.ButtonField.prototype.make_input=function(){var me=this;if(!this.prev_button){$y(this.input_area,{marginTop:'4px',marginBottom:'4px'});} diff --git a/public/js/kb_common.js b/public/js/kb_common.js deleted file mode 100644 index 97ad5deb8e5..00000000000 --- a/public/js/kb_common.js +++ /dev/null @@ -1,30 +0,0 @@ - -/* - * erpnext/utilities/page/kb_common/kb_common.js - */ -KBItemToolbar=function(args,kb){$.extend(this,args);var me=this;this.make=function(){this.wrapper=$a(this.parent,'div','',{});this.line1=$a(this.wrapper,'div','',{color:'#888',fontSize:'11px',margin:'7px 0px'});this.make_timestamp();this.make_answers();if(this.with_tags) -this.make_tags();this.setup_del();} -this.make_timestamp=function(){this.line1.innerHTML=repl('By %(name)s | %(when)s',{name:wn.utils.full_name(this.det.first_name,this.det.last_name),when:wn.datetime.comment_when(this.det.modified)});if(has_common(user_roles,['Administrator','System Manager'])){this.line1.innerHTML+=' | delete';}} -this.make_answers=function(){if(this.doctype=='Question'){if(this.det.answers==0){this.line1.innerHTML+=' | no answers';}else if(this.det.answers==1){this.line1.innerHTML+=' | 1 answer';}else{this.line1.innerHTML+=' | '+this.det.answers+' answers';}}} -this.make_tags=function(){this.line1.innerHTML+=' | ' -this.tags_area=$a(this.line1,'span','kb-tags') -this.tags=new TagList(this.tags_area,this.det._user_tags&&(this.det._user_tags.split(',')),this.doctype,this.det.name,0,kb.set_tag_filter)} -this.setup_del=function(){$(this.line1).find('.del-link').click(function(){console.log(1);this.innerHTML='deleting...';this.disabled=1;$c_page('utilities','questions','delete',{dt:me.doctype,dn:me.det.name},function(r,rt){kb.list.run()});});} -this.make();} -EditableText=function(args){$.extend(this,args);var me=this;me.$w=$(repl('
    \ -
    \ - [edit]\ - \ -

    Formatted as markdown
    \ - \ - Cancel\ -
    ',args)).appendTo(me.parent);this.set_display=function(txt){me.$w.find('.ed-text-display').html(wn.markdown(txt));me.text=txt;} -this.set_display(me.text);if(me.height)me.$w.find('.ed-text-input').css('height',me.height);me.$w.find('.ed-text-edit').click(function(){me.$w.find('.ed-text-input').val(me.text);me.show_as_input();}) -me.$w.find('.ed-text-save').click(function(){var v=me.$w.find('.ed-text-input').val();if(!v){msgprint('Please write something!');return;} -var btn=this;$(btn).set_working();$c_page('utilities','question_view','update_item',{dt:me.dt,dn:me.dn,fn:me.fieldname,text:v},function(r){$(btn).done_working();if(r.exc){msgprint(r.exc);return;} -me.set_display(v);me.show_as_text();});}) -me.$w.find('.ed-text-cancel').click(function(){me.show_as_text();}) -this.show_as_text=function(){me.$w.find('.ed-text-display, .ed-text-edit').toggle(true);me.$w.find('.ed-text-input, .ed-text-save, .ed-text-cancel, .help').toggle(false);} -this.show_as_input=function(){me.$w.find('.ed-text-display, .ed-text-edit').toggle(false);me.$w.find('.ed-text-input, .ed-text-save, .ed-text-cancel, .help').toggle(true);}} \ No newline at end of file diff --git a/public/js/listing.js b/public/js/listing.js index 5954286de5c..d40c72f332a 100644 --- a/public/js/listing.js +++ b/public/js/listing.js @@ -11,13 +11,9 @@ if(!this.opts.hide_refresh){make_btn('Refresh','ui-icon-refresh',function(btn){m if(this.opts.show_new){make_btn('New ','ui-icon-document',function(){new_doc(me.dt);},1);} if(this.opts.show_report){make_btn('Report Builder','ui-icon-clipboard',function(){loadreport(me.dt,null,null,null,1);},0);} if(!this.opts.hide_export){make_btn('Export','ui-icon-circle-arrow-e',function(){me.do_export();});} -if(!this.opts.hide_print){make_btn('Print','ui-icon-print',function(){me.do_print();});} if(this.opts.show_calc){make_btn('Calc','ui-icon-calculator',function(){me.do_calc();});$dh(me.buttons['Calc'])} this.loading_img=$a(this.btn_area,'img','',{display:'none',marginBottom:'-2px'});this.loading_img.src='images/lib/ui/button-load.gif';if(!keys(this.buttons).length) $dh(this.btn_area);} -Listing.prototype.do_print=function(){this.build_query();if(!this.query){alert('No Query!');return;} -args={query:this.query,title:this.head_text,colnames:this.colnames,colwidths:this.colwidths,coltypes:this.coltypes,has_index:(this.no_index?0:1),has_headings:1,check_limit:1,is_simple:1} -wn.require('js/print_query.js');_p.print_query=new _p.PrintQuery();_p.print_query.show_dialog(args);} Listing.prototype.do_calc=function(){show_calc(this.result_tab,this.colnames,this.coltypes,0)} Listing.prototype.add_filter=function(label,ftype,options,tname,fname,cond){if(!this.filter_area){alert('[Listing] make() must be called before add_filter');} var me=this;if(!this.filter_set){var h=$a(this.filter_area,'div','',{fontSize:'14px',fontWeight:'bold',marginBottom:'4px'});h.innerHTML='Filter your search';this.filter_area.div=$a(this.filter_area,'div');this.perm=[[1,1],] diff --git a/public/js/print_query.js b/public/js/print_query.js deleted file mode 100644 index c982924676f..00000000000 --- a/public/js/print_query.js +++ /dev/null @@ -1,41 +0,0 @@ - -/* - * lib/js/legacy/widgets/print_query.js - */ -_p.PrintQuery=function(){this.args={};} -_p.PrintQuery.prototype.show_dialog=function(args){this.args=args;var me=this;if(!this.dialog){var d=new Dialog(400,300,"Print");d.make_body([['Data','Max rows','Blank to print all rows'],['Data','Rows per page'],['Button','Go'],]);d.widgets['Go'].onclick=function(){d.hide();me.render(cint(d.widgets['Max rows'].value),cint(d.widgets['Rows per page'].value))} -d.onshow=function(){this.widgets['Rows per page'].value='35';this.widgets['Max rows'].value='500';} -this.dialog=d;} -this.dialog.show();} -_p.PrintQuery.prototype.render=function(max_rows,page_len){var me=this;var args=me.args;if(cint(max_rows)!=0)args.query+=' LIMIT 0,'+cint(max_rows);if(!args.query)return;var callback=function(r,rt){if(!r.values){return;} -if(!page_len)page_len=r.values.length;if(r.colnames&&r.colnames.length) -args.colnames=args.has_index?add_lists(['Sr'],r.colnames):r.colnames;if(r.colwidths&&r.colwidths.length) -args.colwidths=args.has_index?add_lists(['25px'],r.colwidths):r.colwidths;if(r.coltypes) -args.coltypes=args.has_index?add_lists(['Data'],r.coltypes):r.coltypes;if(args.coltypes){for(var i in args.coltypes) -if(args.coltypes[i]=='Link')args.coltypes[i]='Data';} -if(args.colwidths){var tw=0;for(var i=0;i' -+''+args.title+'' -+'' -+'' -+(r.header_html?r.header_html:'') -+tl.join('\n
    \n') -+(r.footer_html?r.footer_html:'') -+'';_p.preview(html);} -var out_args=copy_dict(args);if(args.is_simple){out_args.simple_query=args.query;delete out_args.query;} -if(args.filter_values) -out_args.filter_values=args.filter_values;$c('webnotes.widgets.query_builder.runquery',out_args,callback);} -_p.PrintQuery.prototype.build_table=function(r,start,page_len,has_heading,rb){var div=document.createElement('div');if(!r.page_template){var head=$a(div,'div',null,{fontSize:'20px',fontWeight:'bold',margin:'16px 0px',borderBottom:'1px solid #CCC',paddingBottom:'8px'});head.innerHTML=args.title;} -var m=start+page_len;if(m>r.values.length)m=r.values.length -var t=make_table(div,m+has_heading-start,r.values[0].length+args.has_index,'100%',null);t.className='simpletable';if(args.colwidths) -$y(t,{tableLayout:'fixed'});if(has_heading){for(var i=0;i' ++''+args.title+'' ++'' ++'' ++(r.header_html?r.header_html:'') ++tl.join('\n
    \n') ++(r.footer_html?r.footer_html:'') ++'';_p.preview(html);} +var out_args=copy_dict(args);if(args.is_simple){out_args.simple_query=args.query;delete out_args.query;} +if(args.filter_values) +out_args.filter_values=args.filter_values;$c('webnotes.widgets.query_builder.runquery',out_args,callback);} +_p.PrintQuery.prototype.build_table=function(r,start,page_len,has_heading,rb){var div=document.createElement('div');if(!r.page_template){var head=$a(div,'div',null,{fontSize:'20px',fontWeight:'bold',margin:'16px 0px',borderBottom:'1px solid #CCC',paddingBottom:'8px'});head.innerHTML=args.title;} +var m=start+page_len;if(m>r.values.length)m=r.values.length +var t=make_table(div,m+has_heading-start,r.values[0].length+args.has_index,'100%',null);t.className='simpletable';if(args.colwidths) +$y(t,{tableLayout:'fixed'});if(has_heading){for(var i=0;i. """ -return a dynamic page from website templates + return a dynamic page from website templates -all html pages except login-page.html get generated here + all html pages related to website are generated here """ - +from __future__ import unicode_literals import cgi, cgitb, os, sys cgitb.enable() @@ -32,10 +32,8 @@ sys.path.append('../lib/py') sys.path.append(conf.modules_path) def init(): - import webnotes - webnotes.form = cgi.FieldStorage(keep_blank_values=True) - for key in webnotes.form.keys(): - webnotes.form_dict[key] = webnotes.form.getvalue(key) + import webnotes.handler + webnotes.handler.get_cgi_fields() webnotes.connect() def respond():