Merge branch 'stable' into latest
diff --git a/.gitignore b/.gitignore
index 0818a02..28fcc88 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,10 @@
*.comp.js
.DS_Store
server_tools
+services
+user_files
patch.log
lib
versions-local.db
+user_files
*.sql*
diff --git a/erpnext/utilities/doctype/production_tips_common/__init__.py b/blank.html
similarity index 100%
copy from erpnext/utilities/doctype/production_tips_common/__init__.py
copy to blank.html
diff --git a/config/conf.py b/config/conf.py
deleted file mode 100644
index 1cf35e2..0000000
--- a/config/conf.py
+++ /dev/null
@@ -1,7 +0,0 @@
-index_path = '/'
-
-include_paths = [
- 'erpnext',
- 'lib/py',
- 'lib/py/legacy'
-]
\ No newline at end of file
diff --git a/erpnext/accounts/__init__.py b/erpnext/accounts/__init__.py
index e69de29..0f98d2b 100644
--- a/erpnext/accounts/__init__.py
+++ b/erpnext/accounts/__init__.py
@@ -0,0 +1,13 @@
+import webnotes
+
+def get_default_bank_account():
+ """
+ Get default bank account for a company
+ """
+ company = webnotes.form_dict.get('company')
+ if not company: return
+ res = webnotes.conn.sql("""\
+ SELECT default_bank_account FROM `tabCompany`
+ WHERE name=%s AND docstatus<2""", company)
+
+ if res: return res[0][0]
diff --git a/erpnext/accounts/doctype/account/account.js b/erpnext/accounts/doctype/account/account.js
index 51cacda..b07bb9c 100644
--- a/erpnext/accounts/doctype/account/account.js
+++ b/erpnext/accounts/doctype/account/account.js
@@ -15,7 +15,7 @@
cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.cscript.account_type(doc, cdt, cdn);
// hide India specific fields
- var cp = locals['Control Panel']['Control Panel'];
+ var cp = wn.control_panel;
if(cp.country == 'India')
unhide_field(['pan_number', 'tds_applicable', 'tds_details', 'TDS']);
else
diff --git a/erpnext/accounts/doctype/account/account.txt b/erpnext/accounts/doctype/account/account.txt
index bf48a24..0fdeaac 100644
--- a/erpnext/accounts/doctype/account/account.txt
+++ b/erpnext/accounts/doctype/account/account.txt
@@ -5,27 +5,28 @@
{
'creation': '2010-08-08 17:08:51',
'docstatus': 0,
- 'modified': '2011-06-23 17:11:38',
+ 'modified': '2012-02-02 15:34:41',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
- '_last_update': '1309508836',
+ '_last_update': '1325570645',
'allow_copy': 1,
'allow_trash': 1,
'colour': 'White:FFF',
+ 'default_print_format': 'Standard',
'doctype': 'DocType',
'document_type': 'Master',
'in_create': 1,
'module': 'Accounts',
'name': '__common__',
- 'search_fields': 'debit_or_credit, group_or_ledger',
+ 'search_fields': 'account_type, debit_or_credit, group_or_ledger',
'section_style': 'Tray',
'server_code_error': ' ',
'show_in_menu': 0,
- 'version': 133
+ 'version': 138
},
# These values are common for all DocField
@@ -56,7 +57,6 @@
# DocPerm
{
'doctype': 'DocPerm',
- 'idx': 1,
'permlevel': 0,
'role': 'Sales User'
},
@@ -64,7 +64,6 @@
# DocPerm
{
'doctype': 'DocPerm',
- 'idx': 2,
'permlevel': 0,
'role': 'Purchase User'
},
@@ -75,7 +74,6 @@
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
- 'idx': 3,
'permlevel': 0,
'role': 'Accounts User',
'submit': 0,
@@ -88,7 +86,6 @@
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
- 'idx': 4,
'permlevel': 0,
'role': 'Accounts Manager',
'submit': 0,
@@ -101,7 +98,6 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 5,
'permlevel': 1,
'role': 'Accounts User',
'submit': 0,
@@ -114,7 +110,6 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 6,
'permlevel': 1,
'role': 'Accounts Manager',
'submit': 0,
@@ -127,7 +122,6 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 7,
'permlevel': 2,
'role': 'Accounts Manager',
'submit': 0,
@@ -140,7 +134,6 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 8,
'permlevel': 2,
'role': 'Accounts User',
'submit': 0,
@@ -151,7 +144,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 1,
'label': 'Properties',
'oldfieldtype': 'Section Break',
'permlevel': 0
@@ -161,7 +153,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
- 'idx': 2,
'permlevel': 0,
'width': '50%'
},
@@ -171,7 +162,6 @@
'doctype': 'DocField',
'fieldname': 'account_name',
'fieldtype': 'Data',
- 'idx': 3,
'in_filter': 1,
'label': 'Account Name',
'no_copy': 1,
@@ -179,7 +169,7 @@
'oldfieldtype': 'Data',
'permlevel': 1,
'reqd': 1,
- 'search_index': 0
+ 'search_index': 1
},
# DocField
@@ -187,7 +177,6 @@
'doctype': 'DocField',
'fieldname': 'parent_account',
'fieldtype': 'Link',
- 'idx': 4,
'label': 'Parent Account',
'oldfieldname': 'parent_account',
'oldfieldtype': 'Link',
@@ -203,7 +192,6 @@
'fieldname': 'level',
'fieldtype': 'Int',
'hidden': 1,
- 'idx': 5,
'label': 'Level',
'oldfieldname': 'level',
'oldfieldtype': 'Int',
@@ -217,7 +205,6 @@
'doctype': 'DocField',
'fieldname': 'group_or_ledger',
'fieldtype': 'Select',
- 'idx': 6,
'in_filter': 1,
'label': 'Group or Ledger',
'oldfieldname': 'group_or_ledger',
@@ -225,14 +212,13 @@
'options': '\nLedger\nGroup',
'permlevel': 1,
'reqd': 1,
- 'search_index': 0
+ 'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Button',
- 'idx': 7,
'label': 'Convert to Group',
'permlevel': 0,
'trigger': 'Client'
@@ -242,7 +228,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Button',
- 'idx': 8,
'label': 'Convert to Ledger',
'permlevel': 0,
'trigger': 'Client'
@@ -253,13 +238,12 @@
'doctype': 'DocField',
'fieldname': 'debit_or_credit',
'fieldtype': 'Data',
- 'idx': 9,
'in_filter': 1,
'label': 'Debit or Credit',
'oldfieldname': 'debit_or_credit',
'oldfieldtype': 'Data',
'permlevel': 1,
- 'search_index': 0
+ 'search_index': 1
},
# DocField
@@ -267,14 +251,13 @@
'doctype': 'DocField',
'fieldname': 'is_pl_account',
'fieldtype': 'Select',
- 'idx': 10,
'in_filter': 1,
'label': 'Is PL Account',
'oldfieldname': 'is_pl_account',
'oldfieldtype': 'Select',
'options': 'Yes\nNo',
'permlevel': 1,
- 'search_index': 0
+ 'search_index': 1
},
# DocField
@@ -282,7 +265,6 @@
'doctype': 'DocField',
'fieldname': 'account_type',
'fieldtype': 'Select',
- 'idx': 11,
'in_filter': 1,
'label': 'Account Type',
'oldfieldname': 'account_type',
@@ -301,7 +283,6 @@
'fieldname': 'tax_rate',
'fieldtype': 'Currency',
'hidden': 0,
- 'idx': 12,
'label': 'Rate',
'oldfieldname': 'tax_rate',
'oldfieldtype': 'Currency',
@@ -313,7 +294,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
- 'idx': 13,
'permlevel': 0,
'width': '50%'
},
@@ -323,7 +303,6 @@
'doctype': 'DocField',
'fieldname': 'freeze_account',
'fieldtype': 'Select',
- 'idx': 14,
'label': 'Freeze Account',
'oldfieldname': 'freeze_account',
'oldfieldtype': 'Select',
@@ -336,7 +315,6 @@
'doctype': 'DocField',
'fieldname': 'company',
'fieldtype': 'Link',
- 'idx': 15,
'in_filter': 1,
'label': 'Company',
'oldfieldname': 'company',
@@ -344,7 +322,7 @@
'options': 'Company',
'permlevel': 1,
'reqd': 1,
- 'search_index': 0
+ 'search_index': 1
},
# DocField
@@ -352,8 +330,7 @@
'doctype': 'DocField',
'fieldname': 'credit_days',
'fieldtype': 'Int',
- 'hidden': 0,
- 'idx': 16,
+ 'hidden': 1,
'label': 'Credit Days',
'oldfieldname': 'credit_days',
'oldfieldtype': 'Int',
@@ -366,8 +343,7 @@
'doctype': 'DocField',
'fieldname': 'credit_limit',
'fieldtype': 'Currency',
- 'hidden': 0,
- 'idx': 17,
+ 'hidden': 1,
'label': 'Credit Limit',
'oldfieldname': 'credit_limit',
'oldfieldtype': 'Currency',
@@ -380,7 +356,6 @@
'doctype': 'DocField',
'fieldname': 'master_type',
'fieldtype': 'Select',
- 'idx': 18,
'label': 'Master Type',
'oldfieldname': 'master_type',
'oldfieldtype': 'Select',
@@ -393,7 +368,6 @@
'doctype': 'DocField',
'fieldname': 'master_name',
'fieldtype': 'Link',
- 'idx': 19,
'label': 'Master Name',
'oldfieldname': 'master_name',
'oldfieldtype': 'Link',
@@ -405,7 +379,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 20,
'label': 'TDS',
'oldfieldtype': 'Section Break',
'permlevel': 0
@@ -416,7 +389,6 @@
'doctype': 'DocField',
'fieldname': 'pan_number',
'fieldtype': 'Data',
- 'idx': 21,
'label': 'PAN Number',
'oldfieldname': 'pan_number',
'oldfieldtype': 'Data',
@@ -429,7 +401,6 @@
'doctype': 'DocField',
'fieldname': 'tds_applicable',
'fieldtype': 'Select',
- 'idx': 22,
'label': 'TDS Applicable',
'oldfieldname': 'tds_applicable',
'oldfieldtype': 'Select',
@@ -442,7 +413,6 @@
'doctype': 'DocField',
'fieldname': 'tds_details',
'fieldtype': 'Table',
- 'idx': 23,
'label': 'TDS Details',
'oldfieldname': 'tds_details',
'oldfieldtype': 'Table',
@@ -456,13 +426,12 @@
'doctype': 'DocField',
'fieldname': 'old_parent',
'fieldtype': 'Link',
- 'options': 'Account',
'hidden': 1,
- 'idx': 24,
'label': 'Old Parent',
'no_copy': 1,
'oldfieldname': 'old_parent',
'oldfieldtype': 'Data',
+ 'options': 'Account',
'permlevel': 0,
'report_hide': 1
},
@@ -475,7 +444,6 @@
'fieldname': 'lft',
'fieldtype': 'Int',
'hidden': 1,
- 'idx': 25,
'in_filter': 1,
'label': 'Lft',
'no_copy': 1,
@@ -495,7 +463,6 @@
'fieldname': 'rgt',
'fieldtype': 'Int',
'hidden': 1,
- 'idx': 26,
'in_filter': 1,
'label': 'Rgt',
'no_copy': 1,
@@ -512,10 +479,9 @@
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
- 'idx': 27,
'label': 'Trash Reason',
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'permlevel': 1
}
-]
+]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/gl_control/gl_control.py b/erpnext/accounts/doctype/gl_control/gl_control.py
index bab8626..001df84 100644
--- a/erpnext/accounts/doctype/gl_control/gl_control.py
+++ b/erpnext/accounts/doctype/gl_control/gl_control.py
@@ -8,8 +8,6 @@
from webnotes.model.code import get_obj
from webnotes import session, form, is_testing, msgprint, errprint
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
in_transaction = webnotes.conn.in_transaction
convert_to_lists = webnotes.conn.convert_to_lists
@@ -24,7 +22,7 @@
# Get Company List
# ----------------
def get_companies(self,arg=''):
- ret = sql("select name, abbr from tabCompany where docstatus != 2")
+ ret = webnotes.conn.sql("select name, abbr from tabCompany where docstatus != 2")
return {'cl':[r[0] for r in ret]}
def get_company_currency(self,arg=''):
@@ -35,7 +33,7 @@
# --------------------
def get_bal(self,arg):
ac, fy = arg.split('~~~')
- det = sql("select t1.balance, t2.debit_or_credit from `tabAccount Balance` t1, `tabAccount` t2 where t1.period = %s and t2.name=%s and t1.account = t2.name", (fy, ac))
+ det = webnotes.conn.sql("select t1.balance, t2.debit_or_credit from `tabAccount Balance` t1, `tabAccount` t2 where t1.period = %s and t2.name=%s and t1.account = t2.name", (fy, ac))
bal = det and flt(det[0][0]) or 0
dr_or_cr = det and flt(det[0][1]) or ''
return fmt_money(bal) + ' ' + dr_or_cr
@@ -44,10 +42,10 @@
acc, f, t = arg.split('~~~')
c, fy = '', get_defaults()['fiscal_year']
- det = sql("select debit_or_credit, lft, rgt, is_pl_account from tabAccount where name=%s", acc)
+ det = webnotes.conn.sql("select debit_or_credit, lft, rgt, is_pl_account from tabAccount where name=%s", acc)
if f: c += (' and t1.posting_date >= "%s"' % f)
if t: c += (' and t1.posting_date <= "%s"' % t)
- bal = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1 where t1.account='%s' and ifnull(is_opening, 'No') = 'No' %s" % (acc, c))
+ bal = webnotes.conn.sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1 where t1.account='%s' and ifnull(is_opening, 'No') = 'No' %s" % (acc, c))
bal = bal and flt(bal[0][0]) or 0
if det[0][0] != 'Debit':
@@ -55,7 +53,7 @@
# add opening for balance sheet accounts
if det[0][3] == 'No':
- opening = flt(sql("select opening from `tabAccount Balance` where account=%s and period=%s", (acc, fy))[0][0])
+ opening = flt(webnotes.conn.sql("select opening from `tabAccount Balance` where account=%s and period=%s", (acc, fy))[0][0])
bal = bal + opening
return flt(bal)
@@ -67,11 +65,11 @@
acc, f, t = arg.split('~~~')
c, fy = '', get_defaults()['fiscal_year']
- det = sql("select debit_or_credit, lft, rgt, is_pl_account from tabAccount where name=%s", acc)
+ det = webnotes.conn.sql("select debit_or_credit, lft, rgt, is_pl_account from tabAccount where name=%s", acc)
if f: c += (' and t1.posting_date >= "%s"' % f)
if t: c += (' and t1.posting_date <= "%s"' % t)
if cost_center: c += (' and t1.cost_center = "%s"' % cost_center)
- bal = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1 where t1.account='%s' %s" % (acc, c))
+ bal = webnotes.conn.sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1 where t1.account='%s' %s" % (acc, c))
bal = bal and flt(bal[0][0]) or 0
if det[0][0] != 'Debit':
@@ -91,9 +89,9 @@
if parent=='Root Node':
- cl = sql("select t1.name, t1.group_or_ledger, t1.debit_or_credit, t2.balance, t1.account_name from tabAccount t1, `tabAccount Balance` t2 where ifnull(t1.parent_account, '') = '' and t1.docstatus != 2 and t1.company=%s and t1.name = t2.account and t2.period = %s order by t1.name asc", (company, fy),as_dict=1)
+ cl = webnotes.conn.sql("select t1.name, t1.group_or_ledger, t1.debit_or_credit, t2.balance, t1.account_name from tabAccount t1, `tabAccount Balance` t2 where ifnull(t1.parent_account, '') = '' and t1.docstatus != 2 and t1.company=%s and t1.name = t2.account and t2.period = %s order by t1.name asc", (company, fy),as_dict=1)
else:
- cl = sql("select t1.name, t1.group_or_ledger, t1.debit_or_credit, t2.balance, t1.account_name from tabAccount t1, `tabAccount Balance` t2 where ifnull(t1.parent_account, '')=%s and t1.docstatus != 2 and t1.company=%s and t1.name = t2.account and t2.period = %s order by t1.name asc",(parent, company, fy) ,as_dict=1)
+ cl = webnotes.conn.sql("select t1.name, t1.group_or_ledger, t1.debit_or_credit, t2.balance, t1.account_name from tabAccount t1, `tabAccount Balance` t2 where ifnull(t1.parent_account, '')=%s and t1.docstatus != 2 and t1.company=%s and t1.name = t2.account and t2.period = %s order by t1.name asc",(parent, company, fy) ,as_dict=1)
# remove Decimals
for c in cl: c['balance'] = flt(c['balance'])
@@ -101,9 +99,9 @@
# get children cost center details
elif type=='Cost Center':
if parent=='Root Node':
- cl = sql("select name,group_or_ledger, cost_center_name from `tabCost Center` where ifnull(parent_cost_center, '')='' and docstatus != 2 and company_name=%s order by name asc",(company),as_dict=1)
+ cl = webnotes.conn.sql("select name,group_or_ledger, cost_center_name from `tabCost Center` where ifnull(parent_cost_center, '')='' and docstatus != 2 and company_name=%s order by name asc",(company),as_dict=1)
else:
- cl = sql("select name,group_or_ledger,cost_center_name from `tabCost Center` where ifnull(parent_cost_center, '')=%s and docstatus != 2 and company_name=%s order by name asc",(parent,company),as_dict=1)
+ cl = webnotes.conn.sql("select name,group_or_ledger,cost_center_name from `tabCost Center` where ifnull(parent_cost_center, '')=%s and docstatus != 2 and company_name=%s order by name asc",(parent,company),as_dict=1)
return {'parent':parent, 'parent_acc_name':parent_acc_name, 'cl':cl}
# Add a new account
@@ -130,7 +128,7 @@
for d in arg.keys():
cc.fields[d] = arg[d]
# map company abbr
- other_info = sql("select company_abbr from `tabCost Center` where name='%s'"%arg['parent_cost_center'])
+ other_info = webnotes.conn.sql("select company_abbr from `tabCost Center` where name='%s'"%arg['parent_cost_center'])
cc.company_abbr = other_info and other_info[0][0] or arg['company_abbr']
cc_obj = get_obj(doc=cc)
@@ -167,7 +165,7 @@
# Check budget before gl entry
#check budget only if account is expense account
- is_expense_acct = sql("select name from tabAccount where is_pl_account='Yes' and debit_or_credit='Debit' and name=%s",self.get_val(le_map['account'], d, parent))
+ is_expense_acct = webnotes.conn.sql("select name from tabAccount where is_pl_account='Yes' and debit_or_credit='Debit' and name=%s",self.get_val(le_map['account'], d, parent))
if is_expense_acct and self.get_val(le_map['cost_center'], d, parent):
get_obj('Budget Control').check_budget([self.get_val(le_map[k], d, parent) for k in flist if k in ['account','cost_center','debit','credit','posting_date','fiscal_year','company']],cancel)
@@ -214,7 +212,7 @@
def make_gl_entries(self, doc, doclist, cancel=0, adv_adj = 0, use_mapper='', merge_entries = 1, update_outstanding='Yes'):
self.entries = []
# get entries
- le_map_list = sql("select * from `tabGL Mapper Detail` where parent = %s", use_mapper or doc.doctype, as_dict=1)
+ le_map_list = webnotes.conn.sql("select * from `tabGL Mapper Detail` where parent = %s", use_mapper or doc.doctype, as_dict=1)
self.td, self.tc = 0.0, 0.0
for le_map in le_map_list:
if le_map['table_field']:
@@ -237,17 +235,17 @@
# set as cancelled
if cancel:
vt, vn = self.get_val(le_map['voucher_type'], doc, doc), self.get_val(le_map['voucher_no'], doc, doc)
- sql("update `tabGL Entry` set is_cancelled='Yes' where voucher_type=%s and voucher_no=%s", (vt, vn))
+ webnotes.conn.sql("update `tabGL Entry` set is_cancelled='Yes' where voucher_type=%s and voucher_no=%s", (vt, vn))
# Get account balance on any date
# -------------------------------
def get_as_on_balance(self, account_name, fiscal_year, as_on, credit_or_debit, lft, rgt):
# initialization
- det = sql("select start_date, opening from `tabAccount Balance` where period = %s and account = %s", (fiscal_year, account_name))
+ det = webnotes.conn.sql("select start_date, opening from `tabAccount Balance` where period = %s and account = %s", (fiscal_year, account_name))
from_date, opening, debit_bal, credit_bal, closing_bal = det and det[0][0] or getdate(nowdate()), det and flt(det[0][1]) or 0, 0, 0, det and flt(det[0][1]) or 0
# prev month closing
- prev_month_det = sql("select end_date, debit, credit, balance from `tabAccount Balance` where account = %s and end_date <= %s and fiscal_year = %s order by end_date desc limit 1", (account_name, as_on, fiscal_year))
+ prev_month_det = webnotes.conn.sql("select end_date, debit, credit, balance from `tabAccount Balance` where account = %s and end_date <= %s and fiscal_year = %s order by end_date desc limit 1", (account_name, as_on, fiscal_year))
if prev_month_det:
from_date = getdate(add_days(prev_month_det[0][0].strftime('%Y-%m-%d'), 1))
opening = 0
@@ -257,7 +255,7 @@
# curr month transaction
if getdate(as_on) >= from_date:
- curr_month_bal = 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 ifnull(t1.is_cancelled, 'No') = 'No'", (from_date, as_on, lft, rgt))
+ curr_month_bal = webnotes.conn.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 ifnull(t1.is_cancelled, 'No') = 'No'", (from_date, as_on, lft, rgt))
curr_debit_amt, curr_credit_amt = flt(curr_month_bal[0][0]), flt(curr_month_bal[0][1])
debit_bal = curr_month_bal and debit_bal + curr_debit_amt or debit_bal
credit_bal = curr_month_bal and credit_bal + curr_credit_amt or credit_bal
@@ -272,7 +270,7 @@
# ADVANCE ALLOCATION
#-------------------
def get_advances(self, obj, account_head, table_name,table_field_name, dr_or_cr):
- jv_detail = sql("select t1.name, t1.remark, t2.%s, t2.name, t1.ded_amount from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t1.name = t2.parent and (t2.against_voucher is null or t2.against_voucher = '') and (t2.against_invoice is null or t2.against_invoice = '') and (t2.against_jv is null or t2.against_jv = '') and t2.account = '%s' and t2.is_advance = 'Yes' and t1.docstatus = 1 order by t1.voucher_date " % (dr_or_cr,account_head))
+ jv_detail = webnotes.conn.sql("select t1.name, t1.remark, t2.%s, t2.name, t1.ded_amount from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t1.name = t2.parent and (t2.against_voucher is null or t2.against_voucher = '') and (t2.against_invoice is null or t2.against_invoice = '') and (t2.against_jv is null or t2.against_jv = '') and t2.account = '%s' and t2.is_advance = 'Yes' and t1.docstatus = 1 order by t1.voucher_date " % (dr_or_cr,account_head))
# clear advance table
obj.doc.clear_table(obj.doclist,table_field_name)
# Create advance table
@@ -291,7 +289,7 @@
def clear_advances(self, obj,table_name,table_field_name):
for d in getlist(obj.doclist,table_field_name):
if not flt(d.allocated_amount):
- sql("update `tab%s` set parent = '' where name = '%s' and parent = '%s'" % (table_name, d.name, d.parent))
+ webnotes.conn.sql("update `tab%s` set parent = '' where name = '%s' and parent = '%s'" % (table_name, d.name, d.parent))
d.parent = ''
# Update aginst document in journal voucher
@@ -305,7 +303,7 @@
get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel =1, adv_adj =1)
# update ref in JV Detail
- sql("update `tabJournal Voucher Detail` set %s = '%s' where name = '%s'" % (doctype=='Payable Voucher' and 'against_voucher' or 'against_invoice', cstr(against_document_no), d.jv_detail_no))
+ webnotes.conn.sql("update `tabJournal Voucher Detail` set %s = '%s' where name = '%s'" % (doctype=='Payable Voucher' and 'against_voucher' or 'against_invoice', cstr(against_document_no), d.jv_detail_no))
# re-submit JV
jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children =1)
@@ -332,12 +330,12 @@
def add_extra_entry(self,jv_obj,jv,jv_detail_no, allocate, account_head, doctype, dr_or_cr, against_document_no):
# get old entry details
- jvd = sql("select %s, cost_center, balance, against_account from `tabJournal Voucher Detail` where name = '%s'" % (dr_or_cr,jv_detail_no))
+ jvd = webnotes.conn.sql("select %s, cost_center, balance, against_account from `tabJournal Voucher Detail` where name = '%s'" % (dr_or_cr,jv_detail_no))
advance = jvd and flt(jvd[0][0]) or 0
balance = flt(advance) - flt(allocate)
# update old entry
- sql("update `tabJournal Voucher Detail` set %s = '%s', %s = '%s' where name = '%s'" % (dr_or_cr, flt(allocate), doctype == "Payable Voucher" and 'against_voucher' or 'against_invoice',cstr(against_document_no), jv_detail_no))
+ webnotes.conn.sql("update `tabJournal Voucher Detail` set %s = '%s', %s = '%s' where name = '%s'" % (dr_or_cr, flt(allocate), doctype == "Payable Voucher" and 'against_voucher' or 'against_invoice',cstr(against_document_no), jv_detail_no))
# new entry with balance amount
add = addchild(jv_obj.doc, 'entries', 'Journal Voucher Detail', 1, jv_obj.doclist)
@@ -356,7 +354,7 @@
# 2. check if amount is same
# 3. check if is_advance is 'Yes'
# 4. check if jv is submitted
- ret = sql("select t2.%s from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t1.name = t2.parent and ifnull(t2.against_voucher, '') = '' and ifnull(t2.against_invoice, '') = '' and t2.account = '%s' and t1.name = '%s' and t2.name = '%s' and t2.is_advance = 'Yes' and t1.docstatus=1 and t2.%s = %s" % (dr_or_cr, account_head, d.journal_voucher, d.jv_detail_no, dr_or_cr, d.advance_amount))
+ ret = webnotes.conn.sql("select t2.%s from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t1.name = t2.parent and ifnull(t2.against_voucher, '') = '' and ifnull(t2.against_invoice, '') = '' and t2.account = '%s' and t1.name = '%s' and t2.name = '%s' and t2.is_advance = 'Yes' and t1.docstatus=1 and t2.%s = %s" % (dr_or_cr, account_head, d.journal_voucher, d.jv_detail_no, dr_or_cr, d.advance_amount))
if (not ret):
msgprint("Please click on 'Get Advances Paid' button as the advance entries have been changed.")
raise Exception
@@ -399,13 +397,13 @@
Updates against document, if partial amount splits into rows
"""
- sql("""
+ webnotes.conn.sql("""
update `tabJournal Voucher Detail` t1, `tabJournal Voucher` t2
set t1.%(dr_or_cr)s = '%(allocated_amt)s', t1.%(against_fld)s = '%(against_voucher)s', t2.modified = now()
where t1.name = '%(voucher_detail_no)s' and t1.parent = t2.name""" % d)
if d['allocated_amt'] < d['unadjusted_amt']:
- jvd = sql("select cost_center, balance, against_account, is_advance from `tabJournal Voucher Detail` where name = '%s'" % d['voucher_detail_no'])
+ jvd = webnotes.conn.sql("select cost_center, balance, against_account, is_advance from `tabJournal Voucher Detail` where name = '%s'" % d['voucher_detail_no'])
# new entry with balance amount
ch = addchild(jv_obj.doc, 'entries', 'Journal Voucher Detail', 1)
ch.account = d['account']
@@ -425,7 +423,7 @@
check if amount is same
check if jv is submitted
"""
- ret = sql("""
+ ret = webnotes.conn.sql("""
select t2.%(dr_or_cr)s from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
where t1.name = t2.parent and t2.account = '%(account)s'
and ifnull(t2.against_voucher, '')='' and ifnull(t2.against_invoice, '')='' and ifnull(t2.against_jv, '')=''
@@ -446,7 +444,7 @@
msg = []
# Get Balance from GL Entries
- bal = sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s", (voucher_obj.doc.name , voucher_obj.doc.doctype))
+ bal = webnotes.conn.sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s", (voucher_obj.doc.name , voucher_obj.doc.doctype))
bal = bal and flt(bal[0][0]) or 0.0
if cstr(voucher_obj.doc.doctype) == 'Payable Voucher':
bal = -bal
@@ -457,7 +455,7 @@
msg.append('<div style="color: RED"> Difference found in Outstanding Amount of %s : %s (Before : %s; After : %s) </div>' % (voucher_obj.doc.doctype, voucher_obj.doc.name, voucher_obj.doc.outstanding_amount, bal))
# set voucher balance
- #sql("update `tab%s` set outstanding_amount=%s where name='%s'" % (voucher_obj.doc.doctype, bal, voucher_obj.doc.name))
+ #webnotes.conn.sql("update `tab%s` set outstanding_amount=%s where name='%s'" % (voucher_obj.doc.doctype, bal, voucher_obj.doc.name))
webnotes.conn.set(voucher_obj.doc, 'outstanding_amount', flt(bal))
# Send Mail
@@ -468,7 +466,7 @@
%s
-""" % (get_value('Control Panel', None,'account_id'), session['user'], voucher_obj.doc.doctype, voucher_obj.doc.name, '\n'.join(msg))
+""" % (webnotes.conn.get_value('Control Panel', None,'account_id'), session['user'], voucher_obj.doc.doctype, voucher_obj.doc.name, '\n'.join(msg))
sendmail(['support@iwebnotes.com'], subject='Repair Outstanding Amount', parts = [('text/plain', email_msg)])
# Acknowledge User
@@ -478,7 +476,7 @@
"""
Find vouchers that are not cancelled correctly and repost them
"""
- vl = sql("""
+ vl = webnotes.conn.sql("""
select voucher_type, voucher_no, account, sum(debit) as sum_debit, sum(credit) as sum_credit
from `tabGL Entry`
where is_cancelled='Yes' and creation > %s
@@ -490,7 +488,7 @@
if v['sum_debit'] != 0 or v['sum_credit'] != 0:
ac_list.append(v['account'])
- fy_list = sql("""select name from `tabFiscal Year`
+ fy_list = webnotes.conn.sql("""select name from `tabFiscal Year`
where (%s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day))
or year_start_date > %s
order by year_start_date ASC""", (after_date, after_date))
@@ -506,10 +504,10 @@
Create recurring invoices on specific date by copying the original one
and notify the concerned people
"""
- rv = sql("""select name, recurring_id from `tabReceivable Voucher` where ifnull(convert_into_recurring_invoice, 0) = 1
- and next_date = %s and next_date <= end_date order by next_date desc""", nowdate())
+ rv = webnotes.conn.sql("""select name, recurring_id from `tabReceivable Voucher` where ifnull(convert_into_recurring_invoice, 0) = 1
+ and next_date = %s and next_date <= end_date and docstatus=1 order by next_date desc""", nowdate())
for d in rv:
- if not sql("""select name from `tabReceivable Voucher` where posting_date = %s and recurring_id = %s""", (nowdate(), d[1])):
+ if not webnotes.conn.sql("""select name from `tabReceivable Voucher` where posting_date = %s and recurring_id = %s and docstatus=1""", (nowdate(), d[1])):
prev_rv = get_obj('Receivable Voucher', d[0], with_children=1)
new_rv = create_new_invoice(prev_rv)
@@ -526,6 +524,7 @@
new_rv.doc.posting_date = new_rv.doc.next_date
new_rv.doc.aging_date = new_rv.doc.next_date
new_rv.doc.due_date = add_days(new_rv.doc.next_date, cint(date_diff(prev_rv.doc.due_date, prev_rv.doc.posting_date)))
+ new_rv.doc.owner = prev_rv.doc.owner
new_rv.doc.save()
# submit and after submit
@@ -539,7 +538,7 @@
"""Notify concerned persons about recurring invoice generation"""
subject = "Invoice : " + new_rv.doc.name
- com = new_rv.doc.company # get_value('Control Panel', '', 'letter_head')
+ com = new_rv.doc.company # webnotes.conn.get_value('Control Panel', '', 'letter_head')
hd = '''<div><h2>%s</h2></div>
<div><h3>Invoice: %s</h3></div>
@@ -590,5 +589,5 @@
msg = hd + tbl + totals
from webnotes.utils.email_lib import sendmail
- sendmail(recipients = [new_rv.doc.email_notification_address], \
+ sendmail(recipients = new_rv.doc.notification_email_address.split(", "), \
sender=new_rv.doc.owner, subject=subject, parts=[['text/plain', msg]])
diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
index f65ee31..19b095b 100644
--- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
+++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
@@ -1,5 +1,5 @@
cur_frm.cscript.onload = function(doc, cdt, cdn) {
- var cp = locals['Control Panel']['Control Panel'];
+ var cp = wn.control_panel;
if (!doc.voucher_date) doc.voucher_date = dateutil.obj_to_str(new Date());
@@ -152,3 +152,19 @@
}
loadreport('GL Entry','General Ledger', callback);
}
+
+
+cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
+ if(doc.voucher_type == 'Bank Voucher' && cstr(doc.company)) {
+ var children = getchildren('Journal Voucher Detail', doc.name, 'entries');
+ if(!children || children.length==0) {
+ $c('accounts.get_default_bank_account', {company: doc.company }, function(r, rt) {
+ if(!r.exc) {
+ var jvd = LocalDB.add_child(doc, 'Journal Voucher Detail', 'entries');
+ jvd.account = cstr(r.message);
+ refresh_field('entries');
+ }
+ });
+ }
+ }
+}
diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.txt b/erpnext/accounts/doctype/journal_voucher/journal_voucher.txt
index 104d3d1..0d67374 100644
--- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.txt
+++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.txt
@@ -5,15 +5,25 @@
{
'creation': '2010-08-08 17:09:06',
'docstatus': 0,
- 'modified': '2011-07-28 15:28:12',
+ 'modified': '2012-01-19 14:15:53',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'Journal Voucher',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType'
+ },
+
# These values are common for all DocType
{
'_last_update': '1311251040',
'colour': 'White:FFF',
+ 'default_print_format': 'Standard',
'doctype': 'DocType',
'module': 'Accounts',
'name': '__common__',
@@ -23,15 +33,15 @@
'show_in_menu': 0,
'subject': ' ',
'tag_fields': 'voucher_type',
- 'version': 309
+ 'version': 311
},
- # These values are common for all DocField
+ # These values are common for all DocFormat
{
- 'doctype': 'DocField',
+ 'doctype': 'DocFormat',
'name': '__common__',
'parent': 'Journal Voucher',
- 'parentfield': 'fields',
+ 'parentfield': 'formats',
'parenttype': 'DocType'
},
@@ -57,7 +67,6 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 1,
'permlevel': 1,
'role': 'Accounts Manager',
'submit': 0,
@@ -70,7 +79,6 @@
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
- 'idx': 2,
'permlevel': 0,
'role': 'Accounts Manager',
'submit': 1,
@@ -83,7 +91,6 @@
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
- 'idx': 3,
'permlevel': 0,
'role': 'Accounts User',
'submit': 1,
@@ -96,18 +103,28 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 4,
'permlevel': 1,
'role': 'Accounts User',
'submit': 0,
'write': 0
},
+ # DocFormat
+ {
+ 'doctype': 'DocFormat',
+ 'format': 'Payment Receipt Voucher'
+ },
+
+ # DocFormat
+ {
+ 'doctype': 'DocFormat',
+ 'format': 'Cheque Printing Format'
+ },
+
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 1,
'label': 'Basic Info',
'oldfieldtype': 'Section Break',
'permlevel': 0
@@ -117,7 +134,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 2,
'label': '1. Select Series and Dates',
'oldfieldtype': 'Section Break',
'options': 'Simple',
@@ -128,7 +144,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
- 'idx': 3,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
@@ -139,12 +154,11 @@
'doctype': 'DocField',
'fieldname': 'voucher_type',
'fieldtype': 'Select',
- 'idx': 4,
'in_filter': 1,
'label': 'Voucher Type',
'oldfieldname': 'voucher_type',
'oldfieldtype': 'Select',
- 'options': '\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher\nLoan Receipt',
+ 'options': '\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher',
'permlevel': 0,
'print_hide': 0,
'search_index': 1
@@ -157,7 +171,6 @@
'doctype': 'DocField',
'fieldname': 'write_off_amount',
'fieldtype': 'Currency',
- 'idx': 5,
'label': 'Write Off Amount <=',
'permlevel': 0,
'print_hide': 1,
@@ -172,7 +185,6 @@
'doctype': 'DocField',
'fieldname': 'write_off_based_on',
'fieldtype': 'Select',
- 'idx': 6,
'label': 'Write Off Based On',
'options': 'Accounts Receivable\nAccounts Payable',
'permlevel': 0,
@@ -187,7 +199,6 @@
'doctype': 'DocField',
'fieldname': 'naming_series',
'fieldtype': 'Select',
- 'idx': 7,
'label': 'Series',
'no_copy': 1,
'oldfieldname': 'naming_series',
@@ -205,7 +216,6 @@
'doctype': 'DocField',
'fieldname': 'voucher_date',
'fieldtype': 'Date',
- 'idx': 8,
'in_filter': 1,
'label': 'Voucher Date',
'no_copy': 1,
@@ -223,7 +233,6 @@
'doctype': 'DocField',
'fieldname': 'posting_date',
'fieldtype': 'Date',
- 'idx': 9,
'in_filter': 1,
'label': 'Posting Date',
'no_copy': 1,
@@ -239,7 +248,6 @@
'doctype': 'DocField',
'fieldname': 'due_date',
'fieldtype': 'Date',
- 'idx': 10,
'label': 'Due Date',
'oldfieldname': 'due_date',
'oldfieldtype': 'Date',
@@ -253,7 +261,6 @@
'doctype': 'DocField',
'fieldname': 'amendment_date',
'fieldtype': 'Date',
- 'idx': 11,
'label': 'Amendment Date',
'no_copy': 1,
'oldfieldname': 'amendment_date',
@@ -267,7 +274,6 @@
'doctype': 'DocField',
'fieldname': 'amended_from',
'fieldtype': 'Link',
- 'idx': 12,
'label': 'Amended From',
'no_copy': 1,
'oldfieldname': 'amended_from',
@@ -283,7 +289,6 @@
'depends_on': "eval:doc.voucher_type == 'Write Off Voucher'",
'doctype': 'DocField',
'fieldtype': 'Button',
- 'idx': 13,
'label': 'Get Outstanding Invoices',
'options': 'get_outstanding_invoices',
'permlevel': 0,
@@ -295,7 +300,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
- 'idx': 14,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
@@ -306,7 +310,6 @@
'doctype': 'DocField',
'fieldname': 'cheque_no',
'fieldtype': 'Data',
- 'idx': 15,
'in_filter': 1,
'label': 'Cheque No',
'no_copy': 1,
@@ -321,7 +324,6 @@
'doctype': 'DocField',
'fieldname': 'cheque_date',
'fieldtype': 'Date',
- 'idx': 16,
'label': 'Cheque Date',
'no_copy': 1,
'oldfieldname': 'cheque_date',
@@ -334,7 +336,6 @@
'doctype': 'DocField',
'fieldname': 'clearance_date',
'fieldtype': 'Date',
- 'idx': 17,
'in_filter': 1,
'label': 'Clearance Date',
'no_copy': 1,
@@ -350,7 +351,6 @@
'doctype': 'DocField',
'fieldname': 'user_remark',
'fieldtype': 'Small Text',
- 'idx': 18,
'in_filter': 1,
'label': 'User Remark',
'no_copy': 1,
@@ -365,7 +365,6 @@
'doctype': 'DocField',
'fieldname': 'remark',
'fieldtype': 'Small Text',
- 'idx': 19,
'label': 'Remark',
'no_copy': 1,
'oldfieldname': 'remark',
@@ -378,7 +377,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 20,
'label': '2. Add / Edit GL Entries',
'oldfieldtype': 'Section Break',
'options': 'Simple',
@@ -387,10 +385,10 @@
# DocField
{
+ 'allow_on_submit': 1,
'doctype': 'DocField',
'fieldname': 'entries',
'fieldtype': 'Table',
- 'idx': 21,
'label': 'Entries',
'oldfieldname': 'entries',
'oldfieldtype': 'Table',
@@ -403,7 +401,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Button',
- 'idx': 22,
'label': 'Get Balance',
'oldfieldtype': 'Button',
'permlevel': 0,
@@ -415,7 +412,6 @@
'doctype': 'DocField',
'fieldname': 'total_debit',
'fieldtype': 'Currency',
- 'idx': 23,
'in_filter': 1,
'label': 'Total Debit',
'no_copy': 1,
@@ -429,7 +425,6 @@
'doctype': 'DocField',
'fieldname': 'total_credit',
'fieldtype': 'Currency',
- 'idx': 24,
'in_filter': 1,
'label': 'Total Credit',
'no_copy': 1,
@@ -443,7 +438,6 @@
'doctype': 'DocField',
'fieldname': 'difference',
'fieldtype': 'Currency',
- 'idx': 25,
'label': 'Difference',
'no_copy': 1,
'oldfieldname': 'difference',
@@ -456,7 +450,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 26,
'label': 'Addtional Info',
'oldfieldtype': 'Section Break',
'permlevel': 0
@@ -466,7 +459,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
- 'idx': 27,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
@@ -477,7 +469,6 @@
'doctype': 'DocField',
'fieldname': 'bill_no',
'fieldtype': 'Data',
- 'idx': 28,
'label': 'Bill No',
'oldfieldname': 'bill_no',
'oldfieldtype': 'Data',
@@ -490,7 +481,6 @@
'doctype': 'DocField',
'fieldname': 'bill_date',
'fieldtype': 'Date',
- 'idx': 29,
'label': 'Bill Date',
'oldfieldname': 'bill_date',
'oldfieldtype': 'Date',
@@ -505,7 +495,6 @@
'doctype': 'DocField',
'fieldname': 'is_opening',
'fieldtype': 'Select',
- 'idx': 30,
'in_filter': 1,
'label': 'Is Opening',
'oldfieldname': 'is_opening',
@@ -522,7 +511,6 @@
'doctype': 'DocField',
'fieldname': 'aging_date',
'fieldtype': 'Date',
- 'idx': 31,
'label': 'Aging Date',
'no_copy': 0,
'oldfieldname': 'aging_date',
@@ -536,7 +524,6 @@
'doctype': 'DocField',
'fieldname': 'cancel_reason',
'fieldtype': 'Data',
- 'idx': 32,
'label': 'Cancel Reason',
'no_copy': 1,
'oldfieldname': 'cancel_reason',
@@ -551,7 +538,6 @@
'fieldname': 'pay_to_recd_from',
'fieldtype': 'Data',
'hidden': 0,
- 'idx': 33,
'label': 'Pay To / Recd From',
'no_copy': 1,
'permlevel': 0,
@@ -565,7 +551,6 @@
'fieldname': 'total_amount',
'fieldtype': 'Data',
'hidden': 0,
- 'idx': 34,
'label': 'Total Amount',
'no_copy': 1,
'permlevel': 1,
@@ -579,7 +564,6 @@
'fieldname': 'total_amount_in_words',
'fieldtype': 'Data',
'hidden': 0,
- 'idx': 35,
'label': 'Total Amount in Words',
'no_copy': 1,
'permlevel': 1,
@@ -591,7 +575,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
- 'idx': 36,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
@@ -602,7 +585,6 @@
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
- 'idx': 37,
'in_filter': 1,
'label': 'Fiscal Year',
'oldfieldname': 'fiscal_year',
@@ -619,7 +601,6 @@
'doctype': 'DocField',
'fieldname': 'company',
'fieldtype': 'Link',
- 'idx': 38,
'in_filter': 1,
'label': 'Company',
'oldfieldname': 'company',
@@ -638,7 +619,6 @@
'doctype': 'DocField',
'fieldname': 'select_print_heading',
'fieldtype': 'Link',
- 'idx': 39,
'label': 'Select Print Heading',
'no_copy': 1,
'oldfieldname': 'select_print_heading',
@@ -654,7 +634,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 40,
'oldfieldtype': 'Section Break',
'options': 'Simple',
'permlevel': 0
@@ -665,7 +644,6 @@
'allow_on_submit': 1,
'doctype': 'DocField',
'fieldtype': 'Button',
- 'idx': 41,
'label': 'View Ledger Entry',
'oldfieldtype': 'Button',
'permlevel': 0,
@@ -677,7 +655,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 42,
'label': 'TDS',
'oldfieldtype': 'Section Break',
'permlevel': 0,
@@ -690,7 +667,6 @@
'doctype': 'DocField',
'fieldname': 'tds_applicable',
'fieldtype': 'Select',
- 'idx': 43,
'in_filter': 1,
'label': 'TDS Applicable',
'no_copy': 1,
@@ -709,7 +685,6 @@
'fieldname': 'tds_category',
'fieldtype': 'Select',
'hidden': 0,
- 'idx': 44,
'in_filter': 1,
'label': 'TDS Category',
'no_copy': 1,
@@ -729,7 +704,6 @@
'fieldname': 'supplier_account',
'fieldtype': 'Link',
'hidden': 0,
- 'idx': 45,
'label': 'Supplier Account',
'no_copy': 1,
'oldfieldname': 'supplier_account',
@@ -745,7 +719,6 @@
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Button',
- 'idx': 46,
'label': 'Get TDS',
'no_copy': 0,
'oldfieldtype': 'Button',
@@ -760,7 +733,6 @@
'doctype': 'DocField',
'fieldname': 'tax_code',
'fieldtype': 'Link',
- 'idx': 47,
'label': 'TDS Account Head',
'no_copy': 1,
'oldfieldname': 'tax_code',
@@ -775,7 +747,6 @@
'doctype': 'DocField',
'fieldname': 'rate',
'fieldtype': 'Currency',
- 'idx': 48,
'label': 'Rate',
'no_copy': 1,
'oldfieldname': 'rate',
@@ -790,7 +761,6 @@
'doctype': 'DocField',
'fieldname': 'ded_amount',
'fieldtype': 'Currency',
- 'idx': 49,
'label': 'Amount',
'no_copy': 1,
'oldfieldname': 'ded_amount',
diff --git a/erpnext/accounts/doctype/payable_voucher/payable_voucher.js b/erpnext/accounts/doctype/payable_voucher/payable_voucher.js
index ce26865..a684ff4 100644
--- a/erpnext/accounts/doctype/payable_voucher/payable_voucher.js
+++ b/erpnext/accounts/doctype/payable_voucher/payable_voucher.js
@@ -7,7 +7,7 @@
// On Load
// --------
cur_frm.cscript.onload = function(doc,dt,dn) {
- var cp = locals['Control Panel']['Control Panel'];
+ var cp = wn.control_panel;
if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()});
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
@@ -200,8 +200,12 @@
// Make Journal Voucher
// --------------------
-cur_frm.cscript['Make Bank Voucher'] = function(doc, dt, dn) {
- cur_frm.cscript.make_jv(cur_frm.doc);
+cur_frm.cscript['Make Bank Voucher'] = function() {
+ $c('accounts.get_default_bank_account', { company: cur_frm.doc.company }, function(r, rt) {
+ if(!r.exc) {
+ cur_frm.cscript.make_jv(cur_frm.doc, null, null, r.message);
+ }
+ });
}
@@ -324,7 +328,7 @@
// Make JV
// --------
-cur_frm.cscript.make_jv = function(doc, dt, dn, det) {
+cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
var jv = LocalDB.create('Journal Voucher');
jv = locals['Journal Voucher'][jv];
jv.voucher_type = 'Bank Voucher';
@@ -342,6 +346,7 @@
// credit to bank
var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
+ d1.account = bank_account;
d1.credit = doc.outstanding_amount;
loaddoc('Journal Voucher', jv.name);
diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
index edff465..f700cef 100644
--- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
+++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
@@ -71,7 +71,7 @@
}
// India related fields
- var cp = locals['Control Panel']['Control Panel'];
+ var cp = wn.control_panel;
if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);
else hide_field(['c_form_applicable', 'c_form_no']);
@@ -277,7 +277,11 @@
// Make Bank Voucher Button
// -------------------------
cur_frm.cscript['Make Bank Voucher'] = function(doc, dt, dn) {
- cur_frm.cscript.make_jv(cur_frm.doc);
+ $c('accounts.get_default_bank_account', { company: cur_frm.doc.company }, function(r, rt) {
+ if(!r.exc) {
+ cur_frm.cscript.make_jv(cur_frm.doc, null, null, r.message);
+ }
+ });
}
@@ -402,7 +406,7 @@
// Make Journal Voucher
// --------------------
-cur_frm.cscript.make_jv = function(doc, dt, dn) {
+cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
var jv = LocalDB.create('Journal Voucher');
jv = locals['Journal Voucher'][jv];
jv.voucher_type = 'Bank Voucher';
@@ -420,6 +424,7 @@
// credit to bank
var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
+ d1.account = bank_account;
d1.debit = doc.outstanding_amount;
loaddoc('Journal Voucher', jv.name);
@@ -439,7 +444,7 @@
cur_frm.cscript.convert_into_recurring_invoice = function(doc) {
if (doc.convert_into_recurring_invoice) {
doc.repeat_on_day_of_month = doc.posting_date.split('-')[2];
- doc.notification_email_address = doc.owner + ', ' + doc.contact_email;
+ doc.notification_email_address = [doc.owner, doc.contact_email].join(', ');
refresh_field(['repeat_on_day_of_month', 'notification_email_address']);
}
}
diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py
index 5921736..e0b93c8 100644
--- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py
+++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py
@@ -9,12 +9,10 @@
from webnotes import session, form, is_testing, msgprint, errprint
from webnotes.utils.scheduler import set_event, cancel_event, Scheduler
-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
-
+session = webnotes.session
+
# -----------------------------------------------------------------------------------------
from utilities.transaction_base import TransactionBase
@@ -39,25 +37,25 @@
#Set retail related fields from pos settings
#-------------------------------------------------------------------------
def set_pos_fields(self):
- pos = sql("select * from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)
+ 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 = sql("select * from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
+ pos = webnotes.conn.sql("select * from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
if pos:
- val = sql("select name from `tabAccount` where name = %s and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr()))
+ val = webnotes.conn.sql("select name from `tabAccount` where name = %s and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr()))
val = val and val[0][0] or ''
if not val: val = pos and pos[0]['customer_account'] or ''
if not self.doc.debit_to:
- set(self.doc,'debit_to',val)
+ webnotes.conn.set(self.doc,'debit_to',val)
lst = ['territory','naming_series','currency','charge','letter_head','tc_name','price_list_name','company','select_print_heading','cash_bank_account']
for i in lst:
val = pos and pos[0][i] or ''
- set(self.doc,i,val)
+ webnotes.conn.set(self.doc,i,val)
self.set_pos_item_values()
val = pos and flt(pos[0]['conversion_rate']) or 0
- set(self.doc,'conversion_rate',val)
+ webnotes.conn.set(self.doc,'conversion_rate',val)
#fetch terms
if self.doc.tc_name: self.get_tc_details()
@@ -70,9 +68,9 @@
# --------------------------------------------------------------------------
def set_pos_item_values(self):
if cint(self.doc.is_pos) ==1:
- dtl = 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)
+ 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:
- dtl = sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
+ dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
for d in getlist(self.doclist,'entries'):
if dtl and dtl[0]['income_account']: d.income_account = dtl[0]['income_account']
if dtl and dtl[0]['cost_center']: d.cost_center = dtl[0]['cost_center']
@@ -82,7 +80,7 @@
# Get Account Head to which amount needs to be Debited based on Customer
# ----------------------------------------------------------------------
def get_customer_account(self):
- acc_head = sql("select name from `tabAccount` where (name = %s or (master_name = %s and master_type = 'customer')) and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr(),self.doc.customer))
+ acc_head = webnotes.conn.sql("select name from `tabAccount` where (name = %s or (master_name = %s and master_type = 'customer')) and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr(),self.doc.customer))
if acc_head and acc_head[0][0]:
return acc_head[0][0]
else:
@@ -99,17 +97,17 @@
def get_cust_and_due_date(self):
credit_days = 0
if self.doc.debit_to:
- credit_days = sql("select credit_days from `tabAccount` where name='%s' and docstatus != 2" % self.doc.debit_to)
+ credit_days = webnotes.conn.sql("select credit_days from `tabAccount` where name='%s' and docstatus != 2" % self.doc.debit_to)
credit_days = credit_days and cint(credit_days[0][0]) or 0
if self.doc.company and not credit_days:
- credit_days = sql("select credit_days from `tabCompany` where name='%s'" % self.doc.company)
+ credit_days = webnotes.conn.sql("select credit_days from `tabCompany` where name='%s'" % self.doc.company)
credit_days = credit_days and cint(credit_days[0][0]) or 0
# Customer has higher priority than company
# i.e.if not entered in customer will take credit days from company
self.doc.due_date = add_days(cstr(self.doc.posting_date), credit_days)
if self.doc.debit_to:
- self.doc.customer = get_value('Account',self.doc.debit_to,'master_name')
+ self.doc.customer = webnotes.conn.get_value('Account',self.doc.debit_to,'master_name')
# get_obj('Sales Common').get_customer_details(self, inv_det_reqd = 0)
@@ -144,7 +142,7 @@
def get_income_account(self,doctype):
for d in getlist(self.doclist, doctype):
if d.item_code:
- item = sql("select default_income_account, default_sales_cost_center from tabItem where name = '%s'" %(d.item_code), as_dict=1)
+ item = webnotes.conn.sql("select default_income_account, default_sales_cost_center from tabItem where name = '%s'" %(d.item_code), as_dict=1)
d.income_account = item and item[0]['default_income_account'] or ''
d.cost_center = item and item[0]['default_sales_cost_center'] or ''
@@ -153,14 +151,14 @@
def get_item_details(self, item_code):
ret = get_obj('Sales Common').get_item_details(item_code, self)
if item_code and cint(self.doc.is_pos) == 1:
- dtl = sql("select income_account, warehouse, cost_center from `tabPOS Setting` where user = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)
+ dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where user = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)
if not dtl:
- dtl = sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
+ dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
if dtl and dtl[0]['income_account']: ret['income_account'] = dtl and dtl[0]['income_account']
if dtl and dtl[0]['cost_center']: ret['cost_center'] = dtl and dtl[0]['cost_center']
if dtl and dtl[0]['warehouse']: ret['warehouse'] = dtl and dtl[0]['warehouse']
if ret['warehouse']:
- actual_qty = sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (item_code, ret['warehouse']))
+ actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (item_code, ret['warehouse']))
ret['actual_qty']= actual_qty and flt(actual_qty[0][0]) or 0
return ret
@@ -205,7 +203,7 @@
#pull project customer
#-------------------------
def pull_project_customer(self):
- res = sql("select customer from `tabProject` where name = '%s'"%self.doc.project_name)
+ res = webnotes.conn.sql("select customer from `tabProject` where name = '%s'"%self.doc.project_name)
if res:
get_obj('DocType Mapper', 'Project-Receivable Voucher').dt_map('Project', 'Receivable Voucher', self.doc.project_name, self.doc, self.doclist, "[['Project', 'Receivable Voucher']]")
@@ -214,7 +212,7 @@
# Get Company Abbr.
# ------------------
def get_company_abbr(self):
- return sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
+ 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
@@ -267,7 +265,7 @@
dt = d.delivery_note and 'Delivery Note' or d.sales_order and 'Sales Order' or ''
if dt:
dt_no = d.delivery_note or d.sales_order
- cust = sql("select customer from `tab%s` where name = %s" % (dt, '%s'), dt_no)
+ cust = webnotes.conn.sql("select customer from `tab%s` where name = %s" % (dt, '%s'), dt_no)
if cust and cstr(cust[0][0]) != cstr(self.doc.customer):
msgprint("Customer %s does not match with customer of %s: %s." %(self.doc.customer, dt, dt_no), raise_exception=1)
@@ -276,7 +274,7 @@
# ------------------------------------------------
def validate_debit_to_acc(self):
if self.doc.customer and not cint(self.doc.is_pos):
- acc_head = sql("select name from `tabAccount` where name = %s and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr()))
+ acc_head = webnotes.conn.sql("select name from `tabAccount` where name = %s and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr()))
if acc_head and acc_head[0][0]:
if not cstr(acc_head[0][0]) == cstr(self.doc.debit_to):
msgprint("Debit To %s do not match with Customer %s for Company %s i.e. %s" %(self.doc.debit_to,self.doc.customer,self.doc.company,cstr(acc_head[0][0])))
@@ -292,7 +290,7 @@
# 3. Is a PL Account
# ---------------------------
def validate_debit_acc(self):
- acc = sql("select debit_or_credit, is_pl_account from tabAccount where name = '%s' and docstatus != 2" % self.doc.debit_to)
+ 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:
msgprint("Account: "+ self.doc.debit_to + " does not exist")
raise Exception
@@ -308,8 +306,8 @@
# -----------------------------------------------------------------------
def validate_fixed_asset_account(self):
for d in getlist(self.doclist,'entries'):
- item = 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 = sql("select account_type from `tabAccount` where name = '%s' and docstatus != 2" % d.income_account)
+ 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)
if not acc:
msgprint("Account: "+d.income_account+" does not exist in the system")
raise Exception
@@ -358,7 +356,7 @@
def so_dn_required(self):
dict = {'Sales Order':'so_required','Delivery Note':'dn_required'}
for i in dict:
- res = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = '%s'"%dict[i])
+ res = webnotes.conn.sql("select value from `tabSingles` where doctype = 'Manage Account' and field = '%s'"%dict[i])
if res and res[0][0] == 'Yes':
for d in getlist(self.doclist,'entries'):
if not d.fields[i.lower().replace(' ','_')]:
@@ -369,7 +367,7 @@
#-------------------------------------------------------------------------------------------------
def validate_proj_cust(self):
if self.doc.project_name and self.doc.customer:
- res = sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, 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:
msgprint("Customer - %s does not belong to project - %s. \n\nIf you want to use project for multiple customers then please make customer details blank in that project."%(self.doc.customer,self.doc.project_name))
raise Exception
@@ -386,7 +384,7 @@
# ********* UPDATE CURRENT STOCK *****************************
def update_current_stock(self):
for d in getlist(self.doclist, 'entries'):
- bin = sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
+ 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):
@@ -405,10 +403,10 @@
def validate_c_form(self):
""" Blank C-form no if C-form applicable marked as 'No'"""
if self.doc.amended_from and self.doc.c_form_applicable == 'No' and self.doc.c_form_no:
- sql("""delete from `tabC-Form Invoice Detail` where invoice_no = %s
+ webnotes.conn.sql("""delete from `tabC-Form Invoice Detail` where invoice_no = %s
and parent = %s""", (self.doc.amended_from, self.doc.c_form_no))
- set(self.doc, 'c_form_no', '')
+ webnotes.conn.set(self.doc, 'c_form_no', '')
# VALIDATE
# ====================================================================================
@@ -453,13 +451,13 @@
def check_prev_docstatus(self):
for d in getlist(self.doclist,'entries'):
if d.sales_order:
- submitted = sql("select name from `tabSales Order` where docstatus = 1 and name = '%s'" % d.sales_order)
+ submitted = webnotes.conn.sql("select name from `tabSales Order` where docstatus = 1 and name = '%s'" % d.sales_order)
if not submitted:
msgprint("Sales Order : "+ cstr(d.sales_order) +" is not submitted")
raise Exception , "Validation Error."
if d.delivery_note:
- submitted = sql("select name from `tabDelivery Note` where docstatus = 1 and name = '%s'" % d.delivery_note)
+ submitted = webnotes.conn.sql("select name from `tabDelivery Note` where docstatus = 1 and name = '%s'" % d.delivery_note)
if not submitted:
msgprint("Delivery Note : "+ cstr(d.delivery_note) +" is not submitted")
raise Exception , "Validation Error."
@@ -469,17 +467,17 @@
def set_actual_qty(self):
for d in getlist(self.doclist, 'delivery_note_details'):
if d.item_code and d.warehouse:
- actual_qty = sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, 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
# Check qty in stock depends on item code and warehouse
#-------------------------------------------------------
def check_qty_in_stock(self):
for d in getlist(self.doclist, 'entries'):
- is_stock_item = sql("select is_stock_item from `tabItem` where name = '%s'" % d.item_code)[0][0]
+ is_stock_item = webnotes.conn.sql("select is_stock_item from `tabItem` where name = '%s'" % d.item_code)[0][0]
actual_qty = 0
if d.item_code and d.warehouse:
- actual_qty = sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, d.warehouse))
+ actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, d.warehouse))
actual_qty = actual_qty and flt(actual_qty[0][0]) or 0
if is_stock_item == 'Yes' and flt(d.qty) > flt(actual_qty):
@@ -490,7 +488,7 @@
# ********************** Make Stock Entry ************************************
def make_sl_entry(self, d, wh, qty, in_value, update_stock):
- st_uom = 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,
'warehouse' : wh,
@@ -516,7 +514,7 @@
def update_stock_ledger(self, update_stock, clear = 0):
self.values = []
for d in getlist(self.doclist, 'entries'):
- stock_item = 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
+ 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
if stock_item[0]['is_stock_item'] == "Yes":
# Reduce actual qty from warehouse
self.make_sl_entry( d, d.warehouse, - flt(d.qty) , 0, update_stock)
@@ -531,7 +529,7 @@
# ********** Get Actual Qty of item in warehouse selected *************
def get_actual_qty(self,args):
args = eval(args)
- actual_qty = sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], args['warehouse']), as_dict=1)
+ 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)
ret = {
'actual_qty' : actual_qty and flt(actual_qty[0]['actual_qty']) or 0
}
@@ -574,7 +572,7 @@
def update_c_form(self):
"""Update amended id in C-form"""
if self.doc.c_form_no and self.doc.amended_from:
- sql("""update `tabC-Form Invoice Detail` set invoice_no = %s,
+ 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))
@@ -584,7 +582,7 @@
# Check Next Document's docstatus
# --------------------------------
def check_next_docstatus(self):
- submit_jv = 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))
+ 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."
@@ -607,10 +605,10 @@
# Get Warehouse
def get_warehouse(self):
- w = sql("select warehouse from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company))
+ 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 = sql("select name, warehouse from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % self.doc.company)
+ 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 Setup --> Accounts --> POS Setting and refresh the system.")
raise Exception
@@ -633,12 +631,12 @@
d.warehouse = cstr(w)
if flt(self.doc.paid_amount) == 0:
- set(self.doc,'paid_amount',(flt(self.doc.grand_total) - flt(self.doc.write_off_amount)))
+ webnotes.conn.set(self.doc,'paid_amount',(flt(self.doc.grand_total) - flt(self.doc.write_off_amount)))
else:
- set(self.doc,'paid_amount',0)
+ webnotes.conn.set(self.doc,'paid_amount',0)
- 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))
+ 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))
########################################################################
# Repair Outstanding
@@ -656,9 +654,9 @@
if self.doc.convert_into_recurring_invoice:
self.set_next_date()
if not self.doc.recurring_id:
- set(self.doc, 'recurring_id', make_autoname('RECINV/.#####'))
+ webnotes.conn.set(self.doc, 'recurring_id', make_autoname('RECINV/.#####'))
elif self.doc.recurring_id:
- sql("""update `tabReceivable Voucher` set convert_into_recurring_invoice = 0 where recurring_id = %s""", self.doc.recurring_id)
+ webnotes.conn.sql("""update `tabReceivable Voucher` set convert_into_recurring_invoice = 0 where recurring_id = %s""", self.doc.recurring_id)
self.manage_scheduler()
@@ -666,7 +664,7 @@
""" set/cancel event in scheduler """
event = 'accounts.doctype.gl_control.gl_control.manage_recurring_invoices'
- if sql("select name from `tabReceivable Voucher` where ifnull(convert_into_recurring_invoice, 0) = 1 and next_date <= end_date"):
+ if webnotes.conn.sql("select name from `tabReceivable Voucher` where ifnull(convert_into_recurring_invoice, 0) = 1 and next_date <= end_date"):
if not self.check_event_exists(event):
set_event(event, interval = 60*60, recurring = 1)
else:
@@ -703,4 +701,4 @@
next_date = datetime.date(y, m, last_day)
next_date = next_date.strftime("%Y-%m-%d")
- set(self.doc, 'next_date', next_date)
+ webnotes.conn.set(self.doc, 'next_date', next_date)
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js
index 61b36d2..e5fca9f 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.js
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js
@@ -1,4 +1,5 @@
pscript['onload_Accounts Browser'] = function(){
+ wn.require('lib/js/legacy/widgets/tree.js');
// if the user directly loads the page, ask to select the chart
var parent = $i('ab_body');
parent.innerHTML = 'Please select your chart: '
diff --git a/erpnext/accounts/page/financial_statements/financial_statements.html b/erpnext/accounts/page/financial_statements/financial_statements.html
index 6e69bc2..e6735fa 100644
--- a/erpnext/accounts/page/financial_statements/financial_statements.html
+++ b/erpnext/accounts/page/financial_statements/financial_statements.html
@@ -1,6 +1,5 @@
<div class="layout_wrapper">
<div id="fs_header"></div>
-</div>
<!-- table.statement td { vertical-align: middle; } table.statement td select { width: 100px; } table.stmt_table { table-layout: fixed; border-collapse: collapse; } table.stmt_table td { vertical-align: middle; padding: 2px; } td.stmt_level0 { font-weight: bold; font-size: 14px; border-bottom: 1px solid #AAA; } td.stmt_level1 { font-weight: bold; font-size: 12px; } td.stmt_level2 { font-size: 11px; } td.stmt_level3 { font-size: 11px; } td.stmt_level4 { font-size: 12px; font-weight: bold; border-bottom: 1px solid #000; } td.stmt_level5 { color: BLUE; font-size: 11px; } --> <!--
<div style="border: 1px solid #cccccc; padding: 4px; margin-top: 8px; background-color: #eeeeee; width: 98%;">
<table class="statement" border="0" cellspacing="2px">
@@ -25,7 +24,8 @@
<div style="margin:10px 0px 10px 0px" mce_style="margin:10px 0px 10px 0px"><button class="button" onclick="pscript.print_statement();">Print</button></div>
-->
<div id="print_html">
-<div id="stmt_title1" style="margin:16px 0px 4px 0px; font-size: 16px; font-weight: bold; color: #888;"></div>
-<div id="stmt_title2" style="margin:0px 0px 8px 0px; font-size: 16px; font-weight: bold;"></div>
-<div id="stmt_tree" style="margin: 0px 0px 16px; overflow: auto; display: none; width: 100%;"></div>
+ <div id="stmt_title1" style="margin:16px 0px 4px 0px; font-size: 16px; font-weight: bold; color: #888;"></div>
+ <div id="stmt_title2" style="margin:0px 0px 8px 0px; font-size: 16px; font-weight: bold;"></div>
+ <div id="stmt_tree" style="margin: 0px 0px 16px; overflow: auto; display: none; width: 100%;"></div>
+</div>
</div>
diff --git a/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.txt b/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.txt
index 5c55039..8be1359 100644
--- a/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.txt
+++ b/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.txt
@@ -5,16 +5,18 @@
{
'creation': '2010-08-08 17:09:15',
'docstatus': 0,
- 'modified': '2010-09-20 17:30:25',
+ 'modified': '2012-01-24 12:42:18',
'modified_by': 'Administrator',
'owner': 'wasim@webnotestech.com'
},
# These values are common for all DocType
{
+ '_last_update': '1325570646',
'allow_trash': 1,
'autoname': 'field:title',
'colour': 'White:FFF',
+ 'default_print_format': 'Standard',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'Buying',
@@ -22,7 +24,7 @@
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
- 'version': 16
+ 'version': 18
},
# These values are common for all DocField
@@ -54,7 +56,6 @@
# DocPerm
{
'doctype': 'DocPerm',
- 'idx': 1,
'permlevel': 1,
'role': 'All'
},
@@ -65,7 +66,6 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 2,
'permlevel': 0,
'role': 'Purchase Manager',
'submit': 0,
@@ -77,7 +77,6 @@
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
- 'idx': 3,
'permlevel': 0,
'role': 'System Manager',
'write': 1
@@ -88,7 +87,6 @@
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
- 'idx': 4,
'permlevel': 0,
'role': 'Purchase Master Manager',
'submit': 0,
@@ -100,7 +98,6 @@
'doctype': 'DocField',
'fieldname': 'title',
'fieldtype': 'Data',
- 'idx': 1,
'in_filter': 1,
'label': 'Title',
'oldfieldname': 'title',
@@ -112,9 +109,19 @@
# DocField
{
'doctype': 'DocField',
+ 'fieldname': 'company',
+ 'fieldtype': 'Link',
+ 'in_filter': 1,
+ 'label': 'Company',
+ 'options': 'Company',
+ 'reqd': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
'fieldname': 'purchase_tax_details',
'fieldtype': 'Table',
- 'idx': 2,
'label': 'Purchase Tax Details',
'oldfieldname': 'purchase_tax_details',
'oldfieldtype': 'Table',
diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py
index 55bf8b8..d43900b 100644
--- a/erpnext/buying/doctype/supplier/supplier.py
+++ b/erpnext/buying/doctype/supplier/supplier.py
@@ -158,8 +158,7 @@
('Payable Voucher', 'supplier'),
('Purchase Order', 'supplier'),
('Purchase Receipt', 'supplier'),
- ('Serial No', 'supplier'),
- ('Supplier Quotation', 'supplier')]
+ ('Serial No', 'supplier')]
for rec in update_fields:
sql("update `tab%s` set supplier_name = '%s' where %s = '%s'" %(rec[0],newdn,rec[1],olddn))
diff --git a/erpnext/erpnext_version.py b/erpnext/erpnext_version.py
deleted file mode 100644
index 48e45d5..0000000
--- a/erpnext/erpnext_version.py
+++ /dev/null
@@ -1,3 +0,0 @@
-# version info
-
-version='1.0.0'
diff --git a/erpnext/home/__init__.py b/erpnext/home/__init__.py
index 9e807df..5ebf7c0 100644
--- a/erpnext/home/__init__.py
+++ b/erpnext/home/__init__.py
@@ -16,6 +16,7 @@
# Stock
'Delivery Note': ['[%(status)s] To %(customer_name)s', '#4169E1'],
+ 'Purchase Receipt': ['[%(status)s] From %(supplier)s', '#4169E1'],
# Accounts
'Journal Voucher': ['[%(voucher_type)s] %(name)s', '#4169E1'],
@@ -33,69 +34,33 @@
'Support Ticket': ['[%(status)s] %(subject)s', '#000080']
}
-feed_dict_color = {
- # Project
- 'Project': '#000080',
-
- # Sales
- 'Lead': '#000080',
- 'Quotation': '#4169E1',
- 'Sales Order': '#4169E1',
-
- # Purchase
- 'Supplier': '#6495ED',
- 'Purchase Order': '#4169E1',
-
- # Stock
- 'Delivery Note': '#4169E1',
-
- # Accounts
- 'Journal Voucher': '#4169E1',
- 'Payable Voucher': '#4169E1',
- 'Receivable Voucher': '#4169E1',
-
- # HR
- 'Expense Voucher': '#4169E1',
- 'Salary Slip': '#4169E1',
- 'Leave Transaction': '#4169E1',
-
- # Support
- 'Customer Issue': '#000080',
- 'Maintenance Visit': '#4169E1',
- 'Support Ticket': '#000080'
-}
-
-def make_feed(doc, subject, color):
+def make_feed(feedtype, doctype, name, owner, subject, color):
"makes a new Feed record"
#msgprint(subject)
from webnotes.model.doc import Document
- webnotes.conn.sql("delete from tabFeed where doc_type=%s and doc_name=%s", (doc.doctype, doc.name))
+
+ if feedtype in ('Login', 'Comment'):
+ # delete old login, comment feed
+ webnotes.conn.sql("""delete from tabFeed where
+ datediff(curdate(), creation) > 7 and doc_type in ('Comment', 'Login')""")
+ else:
+ # one feed per item
+ webnotes.conn.sql("""delete from tabFeed
+ where doc_type=%s and doc_name=%s
+ and ifnull(feed_type,'') != 'Comment'""", (doctype, name))
+
f = Document('Feed')
- f.doc_type = doc.doctype
- f.doc_name = doc.name
+ f.owner = owner
+ f.feed_type = feedtype
+ f.doc_type = doctype
+ f.doc_name = name
f.subject = subject
f.color = color
- f.save(1)
+ f.save()
-def update_feed1(doc):
- "adds a new feed"
- prop_rec = webnotes.conn.sql("select value from `tabProperty Setter` where doc_type = %s and property = 'subject'", (doc.doctype))
- if prop_rec:
- subject = prop_rec[0][0]
- else:
- rec = webnotes.conn.sql("select subject from tabDocType where name=%s", (doc.doctype))
- subject = rec[0][0]
-
- subject, color = [subject, feed_dict_color.get(doc.doctype)]
- if subject:
- subject = subject % doc.fields
- make_feed(doc, subject, color)
-
def update_feed(doc, method=None):
"adds a new feed"
- if method=='validate':
- return
- subject, color = feed_dict.get(doc.doctype, [None, None])
- if subject:
- subject = subject % doc.fields
- make_feed(doc, subject, color)
+ if method=='on_update':
+ subject, color = feed_dict.get(doc.doctype, [None, None])
+ if subject:
+ make_feed('', doc.doctype, doc.name, doc.owner, subject % doc.fields, color)
diff --git a/erpnext/home/doctype/feed/feed.txt b/erpnext/home/doctype/feed/feed.txt
index 5aa4f91..f239f7c 100644
--- a/erpnext/home/doctype/feed/feed.txt
+++ b/erpnext/home/doctype/feed/feed.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2011-04-08 10:50:41',
+ 'creation': '2011-04-06 18:11:38',
'docstatus': 0,
- 'modified': '2011-04-05 09:16:57',
+ 'modified': '2012-02-03 11:28:16',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -14,18 +14,18 @@
{
'autoname': '_FEED.#####',
'colour': 'White:FFF',
+ 'default_print_format': 'Standard',
'doctype': 'DocType',
'module': 'Home',
'name': '__common__',
'section_style': 'Simple',
'show_in_menu': 0,
- 'version': 1
+ 'version': 2
},
# These values are common for all DocField
{
'doctype': 'DocField',
- 'fieldtype': 'Data',
'name': '__common__',
'parent': 'Feed',
'parentfield': 'fields',
@@ -42,8 +42,16 @@
# DocField
{
'doctype': 'DocField',
+ 'fieldname': 'feed_type',
+ 'fieldtype': 'Select',
+ 'label': 'Feed Type'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
'fieldname': 'doc_type',
- 'idx': 1,
+ 'fieldtype': 'Data',
'label': 'Doc Type'
},
@@ -51,7 +59,7 @@
{
'doctype': 'DocField',
'fieldname': 'doc_name',
- 'idx': 2,
+ 'fieldtype': 'Data',
'label': 'Doc Name'
},
@@ -59,7 +67,7 @@
{
'doctype': 'DocField',
'fieldname': 'subject',
- 'idx': 3,
+ 'fieldtype': 'Data',
'label': 'Subject'
},
@@ -67,7 +75,7 @@
{
'doctype': 'DocField',
'fieldname': 'color',
- 'idx': 4,
+ 'fieldtype': 'Data',
'label': 'Color'
}
]
\ No newline at end of file
diff --git a/erpnext/home/doctype/home_control/home_control.py b/erpnext/home/doctype/home_control/home_control.py
index ce15bfd..9d82153 100644
--- a/erpnext/home/doctype/home_control/home_control.py
+++ b/erpnext/home/doctype/home_control/home_control.py
@@ -197,7 +197,10 @@
return count
def get_todo_list(self):
- return convert_to_lists(sql("select name, description, date, priority,checked from `tabToDo Item` where owner=%s order by field(priority,'High','Medium','Low') asc, date asc", session['user']))
+ return sql("""select name, description, date,
+ priority, checked, reference_type, reference_name from `tabToDo Item`
+ where owner=%s order by field(priority,'High','Medium','Low') asc, date asc""", \
+ session['user'], as_dict=1)
def add_todo_item(self,args):
args = json.loads(args)
diff --git a/erpnext/home/page/dashboard/dashboard.js b/erpnext/home/page/dashboard/dashboard.js
index aac42a3..e8f2992 100644
--- a/erpnext/home/page/dashboard/dashboard.js
+++ b/erpnext/home/page/dashboard/dashboard.js
@@ -1,6 +1,6 @@
pscript.onload_dashboard = function() {
// load jqplot
- $.scriptPath = 'js/'
+ wn.require('lib/css/jqpot.css');
wn.require('lib/js/legacy/jquery/jquery.jqplot.min.js');
wn.require('lib/js/legacy/jquery/jqplot-plugins/jqplot.barRenderer.js');
wn.require('lib/js/legacy/jquery/jqplot-plugins/jqplot.canvasAxisTickRenderer.min.js');
diff --git a/erpnext/home/page/event_updates/complete_registration.js b/erpnext/home/page/event_updates/complete_registration.js
new file mode 100644
index 0000000..4ed3fe9
--- /dev/null
+++ b/erpnext/home/page/event_updates/complete_registration.js
@@ -0,0 +1,88 @@
+// complete my company registration
+// --------------------------------
+pscript.complete_registration = function(is_complete) {
+ if(is_complete == 'No'){
+ var d = new Dialog(400, 200, "Please Complete Your Registration");
+ if(user != 'Administrator'){
+ d.no_cancel(); // Hide close image
+ $('header').toggle(false);
+ }
+
+ d.make_body([
+ ['Data','Company Name','Example: Your Company LLC'],
+ ['Data','Company Abbreviation', 'Example: YC (all your acconts will have this as a suffix)'],
+ ['Select','Fiscal Year Start Date'],
+ ['Select','Default Currency'],
+ ['Button','Save'],
+ ]);
+
+ // if company name is set, set the input value
+ // and disable it
+ if(wn.control_panel.company_name) {
+ d.widgets['Company Name'].value = wn.control_panel.company_name;
+ d.widgets['Company Name'].disabled = 1;
+ }
+
+
+ //d.widgets['Save'].disabled = true; // disable Save button
+ pscript.make_dialog_field(d);
+
+ // submit details
+ d.widgets['Save'].onclick = function()
+ {
+ d.widgets['Save'].set_working();
+
+ flag = pscript.validate_fields(d);
+ if(flag)
+ {
+ var args = [
+ d.widgets['Company Name'].value,
+ d.widgets['Company Abbreviation'].value,
+ d.widgets['Fiscal Year Start Date'].value,
+ d.widgets['Default Currency'].value
+ ];
+
+ $c_obj('Setup Control','setup_account',JSON.stringify(args),function(r, rt){
+ sys_defaults = r.message;
+ d.hide();
+ $('header').toggle(true);
+ });
+ }
+ }
+ d.show();
+ }
+}
+
+// make dialog fields
+// ------------------
+pscript.make_dialog_field = function(d)
+{
+ // fiscal year format
+ fisc_format = d.widgets['Fiscal Year Start Date'];
+ add_sel_options(fisc_format, ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct']);
+
+ // default currency
+ currency_list = ['', 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AZN', 'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL', 'BSD', 'BTN', 'BYR', 'BZD', 'CAD', 'CDF', 'CFA', 'CFP', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CUC', 'CZK', 'DJF', 'DKK', 'DOP', 'DZD', 'EEK', 'EGP', 'ERN', 'ETB', 'EUR', 'EURO', 'FJD', 'FKP', 'FMG', 'GBP', 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GQE', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF', 'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LTL', 'LVL', 'LYD', 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR', 'MZM', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NRs', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RMB', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SCR', 'SDG', 'SDR', 'SEK', 'SGD', 'SHP', 'SOS', 'SRD', 'STD', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', 'TND', 'TRY', 'TTD', 'TWD', 'TZS', 'UAE', 'UAH', 'UGX', 'USD', 'USh', 'UYU', 'UZS', 'VEB', 'VND', 'VUV', 'WST', 'XAF', 'XCD', 'XDR', 'XOF', 'XPF', 'YEN', 'YER', 'YTL', 'ZAR', 'ZMK', 'ZWR'];
+ currency = d.widgets['Default Currency'];
+ add_sel_options(currency, currency_list);
+}
+
+
+// validate fields
+// ---------------
+pscript.validate_fields = function(d)
+{
+ var lst = ['Company Abbreviation', 'Fiscal Year Start Date', 'Default Currency'];
+ var msg = 'Please enter the following fields';
+ var flag = 1;
+ for(var i=0; i<lst.length; i++)
+ {
+ if(!d.widgets[lst[i]].value){
+ flag = 0;
+ msg = msg + NEWLINE + lst[i];
+ }
+ }
+
+ if(!flag) alert(msg);
+ return flag;
+}
\ No newline at end of file
diff --git a/erpnext/home/page/event_updates/event_updates.js b/erpnext/home/page/event_updates/event_updates.js
index ee348e6..90aef9e 100644
--- a/erpnext/home/page/event_updates/event_updates.js
+++ b/erpnext/home/page/event_updates/event_updates.js
@@ -6,7 +6,7 @@
pscript.home_make_body();
pscript.home_make_status();
- pscript.home_pre_process();
+ pscript.home_set_banner();
pscript.home_make_widgets();
}
@@ -30,9 +30,9 @@
// ==================================
-pscript.home_pre_process = function(wrapper) {
+pscript.home_set_banner = function(wrapper) {
var wrapper = page_body.pages['Event Updates'];
- var cp = locals['Control Panel']['Control Panel'];
+ var cp = wn.control_panel;
// banner
if(cp.client_name) {
@@ -212,7 +212,8 @@
var callback = function(r,rt) {
$(me.wrapper).slideUp();
}
- $c_obj('Home Control',this.widget.delete_method, this.widget.get_item_id(this.det) ,callback);
+ $c_obj('Home Control',this.widget.delete_method,
+ this.widget.get_item_id(this.det) ,callback);
}
@@ -324,7 +325,7 @@
this.widget.get_list_method = 'get_todo_list';
this.widget.delete_method = 'remove_todo_item';
this.widget.no_items_message = 'Nothing to do?';
- this.widget.get_item_id = function(det) { return det[0]; }
+ this.widget.get_item_id = function(det) { return det.name; }
this.widget.decorator = this;
@@ -346,21 +347,32 @@
$y(tab, {tableLayout:'fixed'});
var span = $a($td(tab, 0, 0), 'span', '', {padding:'2px',color:'#FFF',fontSize:'10px'
- ,backgroundColor:(det[3]=='Low' ? '#888' : (det[3]=='High' ? '#EDA857' : '#687FD3'))});
+ , backgroundColor:(det.priority=='Low' ? '#888' :
+ (det.priority=='High' ? '#EDA857' : '#687FD3'))});
$(span).css('-moz-border-radius','3px').css('-webkit-border-radius','3px');
- span.innerHTML = det[3];
+ span.innerHTML = det.priority;
// text
- var span = $a($td(tab, 0, 1), 'span', 'social', {lineHeight:'1.5em'}, replace_newlines(det[1]));
- if(det[4]) $y(span,{textDecoration:'line-through'});
+ var span = $a($td(tab, 0, 1), 'div', 'social', {lineHeight:'1.5em'},
+ replace_newlines(det.description));
+ if(det.checked) $y(span,{textDecoration:'line-through'});
+
+ // reference link
+ if(det.reference_name) {
+ $a($td(tab, 0, 1), 'div', 'social', '',
+ repl('<a href="#!Form/%(reference_type)s/%(reference_name)s">%(reference_name)s</a>',
+ det))
+ }
// if expired & open, then in red
- if(!det[4] && dateutil.str_to_obj(det[2]) < new Date()) {
+ if(!det.checked && dateutil.str_to_obj(det.date) < new Date()) {
$y(span,{color:'RED'});
- $a($td(tab, 0, 1), 'div', '', {fontSize:'10px', color:'#666'}, dateutil.str_to_user(det[2]) + ' (Overdue)');
+ $a($td(tab, 0, 1), 'div', '', {fontSize:'10px', color:'#666'},
+ dateutil.str_to_user(det.date) + ' (Overdue)');
} else {
- $a($td(tab, 0, 1), 'div', '', {fontSize:'10px', color:'#666'}, dateutil.str_to_user(det[2]));
+ $a($td(tab, 0, 1), 'div', '', {fontSize:'10px', color:'#666'},
+ dateutil.str_to_user(det.date));
}
}
@@ -371,10 +383,10 @@
HomeToDo.prototype.set_dialog_values = function(det) {
var d = this.widget.dialog;
d.set_values({
- date: det[2],
- priority: det[3],
- description: det[1],
- checked: det[4]
+ date: det.date,
+ priority: det.priority,
+ description: det.description,
+ checked: det.checked
});
d.det = det;
}
@@ -389,8 +401,7 @@
return;
}
- det.name = d.det ? d.det[0] : '';
-
+ det.name = d.det.name;
var callback = function(r,rt) {
btn.done_working();
me.widget.dialog.hide();
@@ -420,9 +431,6 @@
// head
$a(this.head,'h1','', {display:'inline'}, 'Home');
- $a(this.head,'span','link_type', {marginLeft:'7px', fontSize:'11px'}, 'help', function() {
- msgprint('<b>What appears here?</b> This is where you get updates of everything you are permitted to follow')
- })
// refresh
$a(this.head,'span','link_type',
@@ -442,51 +450,36 @@
}
FeedList.prototype.make_list = function() {
- this.list_area = $a(this.wrapper,'div')
- this.no_result = $a(this.wrapper, 'div','help_box',{display:'none'},'Nothing to show yet. Your feed will be updated as you start your activities')
-
- var l = new Listing('Feed List',1);
var me = this;
-
- // style
- l.colwidths = ['100%']; l.page_len = 20;
- l.opts.cell_style = {padding:'0px'};
- l.opts.hide_rec_label = 1;
+ this.list_area = $a(this.wrapper,'div')
- // build query
- l.get_query = function(){
- this.query = repl('select \
- distinct t1.name, t1.doc_type, t1.doc_name, t1.subject, t1.modified_by, \
- concat(ifnull(t2.first_name,""), " ", ifnull(t2.last_name,"")), t1.modified, t1.color \
+ this.list = new wn.widgets.Listing({
+ parent: this.list_area,
+ query: repl('select \
+ distinct t1.name, t1.feed_type, t1.doc_type, t1.doc_name, t1.subject, t1.modified_by, \
+ concat(ifnull(t2.first_name,""), " ", ifnull(t2.last_name,"")) as full_name, \
+ t1.modified, t1.color \
from tabFeed t1, tabProfile t2, tabUserRole t3, tabDocPerm t4 \
where t1.doc_type = t4.parent \
and t2.name = t1.owner \
and t3.parent = "%(user)s" \
and t4.role = t3.role \
and ifnull(t4.`read`,0) = 1 \
- order by t1.modified desc', {user:user})
- this.query_max = ''
- }
-
- // render list ui
- l.show_cell = function(cell,ri,ci,d){ me.render_feed(cell,ri,ci,d); }
-
- // onrun
- l.onrun = function(){ $(me.wrapper).fadeIn(); if(me.after_run) me.after_run(); }
-
- // make
- l.make(this.list_area);
- $dh(l.btn_area);
-
- this.list = l;
+ order by t1.modified desc', {user:user}),
+ no_result_message: 'Nothing to show yet. Your feed will be updated as you start your activities',
+ render_row: function(parent, data) {
+ me.render_feed(parent, data)
+ },
+ onrun: function() {
+ $(me.wrapper).fadeIn();
+ if(me.after_run) me.after_run();
+ },
+ hide_refresh: true
+ });
}
-FeedList.prototype.after_run = function() {
- this.list.has_data() ? $dh(this.no_result) : $ds(this.no_result)
-}
-
-FeedList.prototype.render_feed = function(cell,ri,ci,d) {
- new FeedItem(cell, d[ri], this);
+FeedList.prototype.render_feed = function(parent, data) {
+ new FeedItem(parent, data, this);
}
// Item
@@ -502,13 +495,11 @@
this.tab = make_table(this.wrapper, 1, 2, '100%', [(100/7)+'%', (600/7)+'%']);
$y(this.tab,{tableLayout:'fixed'})
- // image
$y($td(this.tab,0,0),{textAlign:'right',paddingRight:'4px'});
// text
this.text_area = $a($td(this.tab,0,1), 'div');
- this.render_references(this.text_area, det);
-
+ this.render_references(this.text_area, det);
this.render_tag(det);
// add day separator
@@ -520,12 +511,12 @@
FeedItem.prototype.add_day_sep = function(det) {
var me = this;
- var prev_date = det[6].split(' ')[0];
+ var prev_date = det.modified.split(' ')[0];
var make_div = function() {
var div = $a(me.head, 'div', '',
{borderBottom:'1px solid #888', margin:'8px 0px', padding:'2px 0px', color:'#888', fontSize:'11px'});
- div.innerHTML = comment_when(det[6], 1);
+ div.innerHTML = comment_when(det.modified, 1);
// today?
if(prev_date==get_today()) {
@@ -544,35 +535,47 @@
// -------------------------------------------------
FeedItem.prototype.render_tag = function(det) {
+ // type is the name
tag = $a($td(this.tab,0,0), 'div', '',
- {color:'#FFF', padding:'3px', textAlign:'right', fontSize:'11px', whiteSpace:'nowrap', overflow:'hidden', cursor:'pointer'});
+ {color:'#FFF', padding:'3px', textAlign:'right', fontSize:'11px',
+ whiteSpace:'nowrap', overflow:'hidden', cursor:'pointer'});
$br(tag,'3px');
- $y(tag, {backgroundColor:(det[7] ? det[7] : '#273')});
- tag.innerHTML = get_doctype_label(det[1]);
- tag.dt = det[1]
- tag.onclick = function() { loaddocbrowser(this.dt); }
+ $y(tag, {backgroundColor:(det.color || '#273')});
+
+ // tag label
+ tag.innerHTML = det.feed_type || get_doctype_label(det.doc_type);
+
+ // not comment / label
+ if(!det.feed_type) {
+ tag.dt = det.doc_type;
+ tag.onclick = function() { loaddocbrowser(this.dt); }
+ }
}
FeedItem.prototype.render_references = function(div, det) {
// name
- div.tab = make_table(div, 1, 2, '100%', [null, '15%'])
- //div.innerHTML = '<b>' + (strip(det[11]) ? det[11] : det[2]) + ' (' + cint(det[12]) + '): </b> has ' + det[7] + ' ';
-
- var dt = det[1]; var dn = det[2]
+ div.tab = make_table(div, 1, 2, '100%', [null, '15%'])
+ var dt = det.doc_type; var dn = det.doc_name
// link
- var allow = in_list(profile.can_read, dt);
- var span = $a($td(div.tab,0,0), 'span', (allow ? 'link_type': ''), null, det[2]);
- span.dt = dt; span.dn = dn;
- if(allow) span.onclick = function() { loaddoc(this.dt, this.dn); }
+ if(det.feed_type=='Login') {
+ // nothing - no link
+ } else {
+ var allow = in_list(profile.can_read, dt);
+ var span = $a($td(div.tab,0,0), 'span', (allow ? 'link_type': ''), null,
+ det.doc_name);
+ span.dt = dt; span.dn = dn;
+ if(allow) span.onclick = function() { loaddoc(this.dt, this.dn); }
+ }
// subject
- if(det[3]) {
- $a($td(div.tab,0,0), 'span', '', {marginLeft:'7px', color:'#444'}, det[3]);
+ if(det.subject) {
+ $a($td(div.tab,0,0), 'span', '', {marginLeft:'7px', color:'#444'}, det.subject);
}
// by
- $y($td(div.tab,0,1), {fontSize:'11px'}).innerHTML = (strip(det[5]) ? det[5] : det[4]);
+ $y($td(div.tab,0,1), {fontSize:'11px'}).innerHTML =
+ (strip(det.full_name) ? det.full_name : det.modified_by);
}
HomeStatusBar = function() {
@@ -583,10 +586,6 @@
this.render = function(r) {
this.wrapper.innerHTML = '';
- this.profile_settings = $a($a(this.wrapper, 'p'), 'span', 'link_type', {fontWeight:'bold'});
- this.profile_settings.innerHTML = user_fullname + ' (Profile Settings)';
- this.profile_settings.onclick = function() { loadpage('profile-settings'); }
-
this.span = $a($a(this.wrapper, 'p'), 'span', 'link_type', {fontWeight:'bold'});
this.span.onclick = function() { loadpage('My Company') }
@@ -614,6 +613,7 @@
// complete registration
if(in_list(user_roles,'System Manager')) {
+ wn.require("erpnext/home/page/event_updates/complete_registration.js");
pscript.complete_registration(r.message.registration_complete);
}
@@ -625,95 +625,6 @@
);
}
-// complete my company registration
-// --------------------------------
-pscript.complete_registration = function(is_complete) {
- if(is_complete == 'No'){
- var d = new Dialog(400, 200, "Please Complete Your Registration");
- if(user != 'Administrator'){
- d.no_cancel(); // Hide close image
- $dh(page_body.wntoolbar.wrapper);
- }
-
- d.make_body([
- ['Data','Company Name','Example: Your Company LLC'],
- ['Data','Company Abbreviation', 'Example: YC (all your acconts will have this as a suffix)'],
- ['Select','Fiscal Year Start Date'],
- ['Select','Default Currency'],
- ['Button','Save'],
- ]);
-
- // if company name is set, set the input value
- // and disable it
- if(locals['Control Panel']['Control Panel'].company_name) {
- d.widgets['Company Name'].value = locals['Control Panel']['Control Panel'].company_name;
- d.widgets['Company Name'].disabled = 1;
- }
-
-
- //d.widgets['Save'].disabled = true; // disable Save button
- pscript.make_dialog_field(d);
-
- // submit details
- d.widgets['Save'].onclick = function()
- {
- d.widgets['Save'].set_working();
-
- flag = pscript.validate_fields(d);
- if(flag)
- {
- var args = [
- d.widgets['Company Name'].value,
- d.widgets['Company Abbreviation'].value,
- d.widgets['Fiscal Year Start Date'].value,
- d.widgets['Default Currency'].value
- ];
-
- $c_obj('Setup Control','setup_account',JSON.stringify(args),function(r, rt){
- sys_defaults = r.message;
- d.hide();
- $ds(page_body.wntoolbar.wrapper);
- });
- }
- }
- d.show();
- }
-}
-
-// make dialog fields
-// ------------------
-pscript.make_dialog_field = function(d)
-{
- // fiscal year format
- fisc_format = d.widgets['Fiscal Year Start Date'];
- add_sel_options(fisc_format, ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct']);
-
- // default currency
- currency_list = ['', 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AZN', 'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL', 'BSD', 'BTN', 'BYR', 'BZD', 'CAD', 'CDF', 'CFA', 'CFP', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CUC', 'CZK', 'DJF', 'DKK', 'DOP', 'DZD', 'EEK', 'EGP', 'ERN', 'ETB', 'EUR', 'EURO', 'FJD', 'FKP', 'FMG', 'GBP', 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GQE', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF', 'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LTL', 'LVL', 'LYD', 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR', 'MZM', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NRs', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RMB', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SCR', 'SDG', 'SDR', 'SEK', 'SGD', 'SHP', 'SOS', 'SRD', 'STD', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', 'TND', 'TRY', 'TTD', 'TWD', 'TZS', 'UAE', 'UAH', 'UGX', 'USD', 'USh', 'UYU', 'UZS', 'VEB', 'VND', 'VUV', 'WST', 'XAF', 'XCD', 'XDR', 'XOF', 'XPF', 'YEN', 'YER', 'YTL', 'ZAR', 'ZMK', 'ZWR'];
- currency = d.widgets['Default Currency'];
- add_sel_options(currency, currency_list);
-}
-
-
-// validate fields
-// ---------------
-pscript.validate_fields = function(d)
-{
- var lst = ['Company Abbreviation', 'Fiscal Year Start Date', 'Default Currency'];
- var msg = 'Please enter the following fields';
- var flag = 1;
- for(var i=0; i<lst.length; i++)
- {
- if(!d.widgets[lst[i]].value){
- flag = 0;
- msg = msg + NEWLINE + lst[i];
- }
- }
-
- if(!flag) alert(msg);
- return flag;
-}
-
SetupWizard = function(status) {
var me = this;
$.extend(this, {
diff --git a/erpnext/home/page/my_company/my_company.js b/erpnext/home/page/my_company/my_company.js
index 58ff91e..e85623f 100644
--- a/erpnext/home/page/my_company/my_company.js
+++ b/erpnext/home/page/my_company/my_company.js
@@ -43,14 +43,11 @@
//
pscript.myc_add_user = function() {
var fields = [{
- fieldtype: 'Data',
- fieldname: 'user',
- reqd: 1,
- label: 'Email Id of the user to add'
- }];
-
- if(!pscript.is_erpnext_saas) {
- fields = fields.concat([
+ fieldtype: 'Data',
+ fieldname: 'user',
+ reqd: 1,
+ label: 'Email Id of the user to add'
+ },
{
fieldtype: 'Data',
fieldname: 'first_name',
@@ -67,14 +64,14 @@
fieldname: 'password',
reqd: 1,
label: 'Password'
- }]);
- }
+ },
+ {
+ fieldtype: 'Button',
+ label: 'Add',
+ fieldname: 'add'
+ }];
- fields.push({
- fieldtype: 'Button',
- label: 'Add',
- fieldname: 'add'
- });
+ fields.push();
var d = new wn.widgets.Dialog({
title: 'Add User',
@@ -246,7 +243,8 @@
// image
this.img = $a($td(this.tab,0,0),'img','',{width:'41px'});
set_user_img(this.img, det.name, null,
- (det.file_list ? det.file_list.split(NEWLINE)[0].split(',')[1] : ('no_img_' + (det.gender=='Female' ? 'f' : 'm'))));
+ (det.file_list ? det.file_list.split(NEWLINE)[0].split(',')[1] :
+ ('no_img_' + (det.gender=='Female' ? 'f' : 'm'))));
}
// set other details like email id, name etc
@@ -464,7 +462,7 @@
// delete user
// create a confirm dialog and call server method
this.delete_user = function() {
- var cp = locals['Control Panel']['Control Panel'];
+ var cp = wn.control_panel;
var d = new Dialog(400,200,'Delete User');
d.make_body([
@@ -581,7 +579,7 @@
$ds(this.member_item.working_img);
$dh(this.wrapper);
this.loading = 1;
- $c('webnotes.widgets.form.getdoc', {'name':this.uid, 'doctype':'Profile', 'user':user}, callback); // onload
+ $c('webnotes.widgets.form.load.getdoc', {'name':this.uid, 'doctype':'Profile', 'user':user}, callback); // onload
}
// show / hide
diff --git a/erpnext/home/page/my_company/my_company.py b/erpnext/home/page/my_company/my_company.py
index c239162..48566f2 100644
--- a/erpnext/home/page/my_company/my_company.py
+++ b/erpnext/home/page/my_company/my_company.py
@@ -1,6 +1,7 @@
import webnotes
from webnotes.utils import cint, load_json, cstr
+from webnotes.model.doc import Document
try: import json
except: import simplejson as json
@@ -34,8 +35,7 @@
return 'Cannot disable Administrator'
webnotes.conn.sql("update tabProfile set enabled=0 where name=%s", arg)
- login_manager = LoginManager()
- login_manager.logout(user=arg)
+ webnotes.login_manager.logout(user=arg)
return 0
#
@@ -65,8 +65,7 @@
# add profile record
#
def add_profile(args):
- from webnotes.utils import validate_email_add
- from webnotes.model.doc import Document
+ from webnotes.utils import validate_email_add, now
email = args['user']
sql = webnotes.conn.sql
@@ -80,7 +79,7 @@
if sql("select name from tabProfile where name = %s", email):
# exists, enable it
sql("update tabProfile set enabled = 1, docstatus=0 where name = %s", email)
- webnotes.msgprint('Profile exists, enabled it')
+ webnotes.msgprint('Profile exists, enabled it with new password')
else:
# does not exist, create it!
pr = Document('Profile')
@@ -92,11 +91,25 @@
pr.user_type = 'System User'
pr.save(1)
- if args.get('password'):
- sql("""
- UPDATE tabProfile
- SET password = PASSWORD(%s)
- WHERE name = %s""", (args.get('password'), email))
+ if args.get('password'):
+ sql("""
+ UPDATE tabProfile
+ SET password = PASSWORD(%s), modified = %s
+ WHERE name = %s""", (args.get('password'), now, email))
+
+ send_welcome_mail(email, args)
+
+def send_welcome_mail(email, args):
+ """send welcome mail to user with password and login url"""
+ pr = Document('Profile', email)
+ from webnotes.utils.email_lib import sendmail_md
+ args.update({
+ 'company': webnotes.conn.get_default('company'),
+ 'password': args.get('password'),
+ 'account_url': webnotes.conn.get_default('account_url')
+ })
+ if not args.get('last_name'): args['last_name'] = ''
+ sendmail_md(pr.email, subject="Welcome to ERPNext", msg=welcome_txt % args)
#
# post comment
@@ -166,3 +179,20 @@
else:
webnotes.conn.sql("update tabProfile set password=password(%s) where name=%s", (args['new_password'], args['user']))
else: webnotes.msgprint('Settings Updated')
+
+welcome_txt = """
+## %(company)s
+
+Dear %(first_name)s %(last_name)s
+
+Welcome!
+
+A new account has been created for you, here are your details:
+
+login-id: %(user)s
+password: %(password)s
+
+To login to your new ERPNext account, please go to:
+
+%(account_url)s
+"""
diff --git a/erpnext/home/page/profile_settings/profile_settings.py b/erpnext/home/page/profile_settings/profile_settings.py
index 22af804..ef969ca 100644
--- a/erpnext/home/page/profile_settings/profile_settings.py
+++ b/erpnext/home/page/profile_settings/profile_settings.py
@@ -8,16 +8,12 @@
"""
arg = load_json(arg)
- if cint(webnotes.conn.get_value('Control Panel',None,'sync_with_gateway')):
- import server_tools.gateway_utils
- webnotes.msgprint(server_tools.gateway_utils.change_password(arg['old_password'], arg['new_password'])['message'])
- else:
- if not webnotes.conn.sql('select name from tabProfile where name=%s and password=password(%s)', (webnotes.session['user'], arg['old_password'])):
- webnotes.msgprint('Old password is not correct', raise_exception=1)
+ if not webnotes.conn.sql('select name from tabProfile where name=%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) where name=%s",(arg['new_password'], nowdate(), webnotes.session['user']))
- webnotes.msgprint('Password Updated');
+ 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.msgprint('Password Updated');
def get_user_details(arg=None):
"""
diff --git a/erpnext/hr/doctype/appraisal/appraisal.js b/erpnext/hr/doctype/appraisal/appraisal.js
index d040c53..78b5fd3 100644
--- a/erpnext/hr/doctype/appraisal/appraisal.js
+++ b/erpnext/hr/doctype/appraisal/appraisal.js
@@ -90,8 +90,6 @@
declare_completed_dialog.refresh_dt = function(){
cur_frm.cscript.refresh(this.doc, this.cdt, this.cdn);
- msgprint("refersh done");
- $c('webnotes.widgets.form.form_header.refresh_labels',this.doc,function(r,rt){});
}
declare_completed_dialog.add = function() {
diff --git a/erpnext/patches/jan_mar_2012/allocated_to_profile.py b/erpnext/patches/jan_mar_2012/allocated_to_profile.py
new file mode 100644
index 0000000..ac95c2b
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/allocated_to_profile.py
@@ -0,0 +1,20 @@
+def execute():
+ """
+ Changes allocated_to option to Profile in
+ DocType Customer Issue
+ """
+ import webnotes
+ webnotes.conn.sql("""
+ UPDATE `tabDocField`
+ SET options='Profile'
+ WHERE fieldname='allocated_to'
+ """)
+
+ webnotes.conn.sql("""
+ DELETE from `tabDocField`
+ WHERE parent='Customer Issue'
+ AND label='Make Maintenance Visit'
+ """)
+
+ from webnotes.modules.module_manager import reload_doc
+ reload_doc('support', 'doctype', 'customer_issue')
diff --git a/erpnext/patches/jan_mar_2012/cancel_purchase_returned.py b/erpnext/patches/jan_mar_2012/cancel_purchase_returned.py
new file mode 100644
index 0000000..8404f19
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/cancel_purchase_returned.py
@@ -0,0 +1,8 @@
+def execute():
+ """
+ Set docstatus = 2 where status = 'Purchase Returned' for serial no
+ """
+ import webnotes
+ webnotes.conn.sql("""\
+ UPDATE `tabSerial No` SET docstatus=2
+ WHERE status='Purchase Returned'""")
diff --git a/erpnext/patches/jan_mar_2012/customer_address_contact_patch.py b/erpnext/patches/jan_mar_2012/customer_address_contact_patch.py
new file mode 100644
index 0000000..b55acd4
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/customer_address_contact_patch.py
@@ -0,0 +1,58 @@
+import webnotes
+
+def execute():
+ """
+ * Reload Search Criteria "Customer Address Contact"
+ * SET is_primary_contact=1, is_primary_address=1 WHERE not specified
+ """
+ reload_sc()
+ patch_primary_contact()
+ patch_primary_address()
+
+def reload_sc():
+ from webnotes.modules.module_manager import reload_doc
+ reload_doc('selling', 'search_criteria', 'customer_address_contact')
+ reload_doc('selling', 'Module Def', 'Selling')
+
+def patch_primary_contact():
+ res = webnotes.conn.sql("""
+ SELECT name FROM `tabContact`
+ WHERE customer IN (
+ SELECT customer FROM `tabContact`
+ WHERE IFNULL(customer, '')!=''
+ GROUP BY customer HAVING SUM(IFNULL(is_primary_contact, 0))=0
+ ) OR supplier IN (
+ SELECT supplier FROM `tabContact`
+ WHERE IFNULL(supplier, '')!=''
+ GROUP BY supplier HAVING SUM(IFNULL(is_primary_contact, 0))=0
+ ) OR sales_partner IN (
+ SELECT sales_partner FROM `tabContact`
+ WHERE IFNULL(sales_partner, '')!=''
+ GROUP BY sales_partner HAVING SUM(IFNULL(is_primary_contact, 0))=0
+ )
+ """, as_list=1)
+ names = ", ".join(['"' + str(r[0]) + '"' for r in res if r])
+ if names: webnotes.conn.sql("UPDATE `tabContact` SET is_primary_contact=1 WHERE name IN (%s)" % names)
+
+def patch_primary_address():
+ res = webnotes.conn.sql("""
+ SELECT name FROM `tabAddress`
+ WHERE customer IN (
+ SELECT customer FROM `tabAddress`
+ WHERE IFNULL(customer, '')!=''
+ GROUP BY customer HAVING SUM(IFNULL(is_primary_address, 0))=0
+ AND SUM(IFNULL(is_shipping_address, 0))=0
+ ) OR supplier IN (
+ SELECT supplier FROM `tabAddress`
+ WHERE IFNULL(supplier, '')!=''
+ GROUP BY supplier HAVING SUM(IFNULL(is_primary_address, 0))=0
+ AND SUM(IFNULL(is_shipping_address, 0))=0
+ ) OR sales_partner IN (
+ SELECT sales_partner FROM `tabAddress`
+ WHERE IFNULL(sales_partner, '')!=''
+ GROUP BY sales_partner HAVING SUM(IFNULL(is_primary_address, 0))=0
+ AND SUM(IFNULL(is_shipping_address, 0))=0
+ )
+ """, as_list=1)
+ names = ", ".join(['"' + str(r[0]) + '"' for r in res if r])
+ if names: webnotes.conn.sql("UPDATE `tabAddress` SET is_primary_address=1 WHERE name IN (%s)" % names)
diff --git a/erpnext/patches/jan_mar_2012/deploy_packing_slip.py b/erpnext/patches/jan_mar_2012/deploy_packing_slip.py
new file mode 100644
index 0000000..94bda6e
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/deploy_packing_slip.py
@@ -0,0 +1,48 @@
+import webnotes
+from webnotes.modules.module_manager import reload_doc
+
+def execute():
+ delete_fields_dn_detail()
+ deploy_packing_slip()
+ del_packing_slip_pf()
+
+
+def delete_fields_dn_detail():
+ """
+ Delete old fields related to packing slip
+ """
+ from webnotes.model import delete_fields
+ delete_fields({
+ 'Delivery Note': [
+ 'print_packing_slip', 'shipping_mark', 'packed_by',
+ 'packing_checked_by', 'Text', 'pack_size'
+ ],
+ 'Delivery Note Detail': [
+ 'pack_no', 'pack_gross_wt', 'weight_uom',
+ 'pack_nett_wt', 'no_of_packs', 'pack_unit', 'pack_size',
+ 'packed_by', 'packing_checked_by'
+ ]
+ }, delete=1)
+ delete_fields({'Item': ['nett_weight', 'gross_weight']}, delete=1)
+ reload_doc('stock', 'doctype', 'delivery_note')
+ reload_doc('stock', 'doctype', 'delivery_note_detail')
+ reload_doc('stock', 'doctype', 'item')
+
+
+def deploy_packing_slip():
+ reload_doc('stock', 'doctype', 'packing_slip')
+ reload_doc('stock', 'doctype', 'packing_slip_detail')
+ reload_doc('stock', 'Module Def', 'Stock')
+ reload_doc('stock', 'DocType Mapper', 'Delivery Note-Packing Slip')
+
+
+def del_packing_slip_pf():
+ """
+ Delete Print Format: 'Delivery Note Packing List Wise'
+ """
+ webnotes.conn.sql("""\
+ DELETE FROM `tabDocFormat`
+ WHERE parent='Delivery Note'
+ AND format='Delivery Note Packing List Wise'""")
+ from webnotes.model import delete_doc
+ delete_doc('Print Format', 'Delivery Note Packing List Wise')
diff --git a/erpnext/patches/jan_mar_2012/doclabel_in_doclayer.py b/erpnext/patches/jan_mar_2012/doclabel_in_doclayer.py
new file mode 100644
index 0000000..eae0d21
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/doclabel_in_doclayer.py
@@ -0,0 +1,12 @@
+import webnotes
+def execute():
+ """
+ * Change option of doclayer's doc_type field
+ * Reload doclayer
+ """
+ webnotes.conn.sql("""
+ UPDATE `tabDocField` SET options=NULL
+ WHERE parent='DocLayer' AND fieldname='doc_type'
+ """)
+ from webnotes.modules.module_manager import reload_doc
+ reload_doc('core', 'doctype', 'doclayer')
diff --git a/erpnext/patches/jan_mar_2012/email_settings_reload.py b/erpnext/patches/jan_mar_2012/email_settings_reload.py
new file mode 100644
index 0000000..bfe3efe
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/email_settings_reload.py
@@ -0,0 +1,13 @@
+def execute():
+ """
+ * Change type of mail_port field to int
+ * reload email settings
+ """
+ import webnotes
+ webnotes.conn.sql("""
+ UPDATE `tabDocField` SET fieldtype='Int'
+ WHERE parent = 'Email Settings' AND fieldname = 'mail_port'
+ """)
+
+ from webnotes.modules.module_manager import reload_doc
+ reload_doc('setup', 'doctype', 'email_settings')
diff --git a/erpnext/patches/jan_mar_2012/jan_production_patches.py b/erpnext/patches/jan_mar_2012/jan_production_patches.py
index f868cea..8795cc3 100644
--- a/erpnext/patches/jan_mar_2012/jan_production_patches.py
+++ b/erpnext/patches/jan_mar_2012/jan_production_patches.py
@@ -6,4 +6,22 @@
"""
from webnotes.modules.module_manager import reload_doc
- reload_doc('stock', 'doctype', 'stock_entry_detail')
+ reload_doc('stock', 'doctype', 'stock_entry_detail')
+ reload_doc('stock', 'doctype', 'item_supplier')
+ reload_doc('stock', 'doctype', 'item')
+
+ webnotes.conn.sql("""
+ UPDATE tabDocField SET fieldtype='Float'
+ WHERE parent='Bill Of Materials'
+ AND fieldname IN ('operating_cost', 'raw_material_cost', 'total_cost')
+ """)
+
+ webnotes.conn.sql("""
+ UPDATE tabDocField SET fieldtype='Float'
+ WHERE parent='BOM Material'
+ AND fieldname IN ('qty', 'rate', 'amount', 'qty_consumed_per_unit')
+ """)
+
+ reload_doc('stock', 'doctype', 'stock_entry')
+ reload_doc('production', 'doctype', 'bill_of_materials')
+ reload_doc('production', 'doctype', 'bom_material')
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/patches/jan_mar_2012/latest/__init__.py
similarity index 100%
rename from erpnext/utilities/doctype/sso_control/__init__.py
rename to erpnext/patches/jan_mar_2012/latest/__init__.py
diff --git a/erpnext/patches/jan_mar_2012/latest/feed.py b/erpnext/patches/jan_mar_2012/latest/feed.py
new file mode 100644
index 0000000..c913c49
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/latest/feed.py
@@ -0,0 +1,6 @@
+import webnotes
+from webnotes.model.doc import Document
+from webnotes.modules import reload_doc
+
+def execute():
+ reload_doc('home', 'doctype', 'feed')
\ No newline at end of file
diff --git a/erpnext/patches/jan_mar_2012/latest/login.py b/erpnext/patches/jan_mar_2012/latest/login.py
new file mode 100644
index 0000000..fcf72dc
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/latest/login.py
@@ -0,0 +1,40 @@
+import webnotes
+from webnotes.model.doc import Document
+from webnotes.modules import reload_doc
+
+def execute():
+ add_default_home_page()
+ reload_doc('setup','doctype','manage_account')
+ webnotes.conn.commit()
+ webnotes.conn.sql("drop table if exists tabDocTrigger")
+ cleanup()
+
+def cleanup():
+ webnotes.conn.begin()
+ from webnotes.model import delete_doc
+ delete_doc("DocType", "SSO Control")
+ delete_doc("DocType", "WN ERP Client Control")
+ delete_doc("DocType", "Production Tips Common")
+ delete_doc("DocType", "DocTrigger")
+
+ # cleanup control panel
+ delete_doc("DocType", "Control Panel")
+ reload_doc("core", "doctype", "control_panel")
+
+ # cleanup page
+ delete_doc("DocType", "Page")
+ reload_doc("core", "doctype", "page")
+
+ webnotes.conn.sql("""delete from tabSingles
+ where field like 'startup_%' and doctype='Control Panel'""")
+
+def add_default_home_page():
+ if not webnotes.conn.sql("""select name from `tabDefault Home Page`
+ where role='Guest' and home_page='Login Page'"""):
+ d = Document('Default Home Page')
+ d.parent = 'Control Panel'
+ d.parenttype = 'Control Panel'
+ d.parentfield = 'default_home_pages'
+ d.role = 'Guest'
+ d.home_page = 'Login Page'
+ d.save(1)
diff --git a/erpnext/patches/jan_mar_2012/latest/website.py b/erpnext/patches/jan_mar_2012/latest/website.py
new file mode 100644
index 0000000..1b4754a
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/latest/website.py
@@ -0,0 +1,65 @@
+# website patch
+
+import webnotes
+from webnotes.model.doc import Document
+
+def execute():
+ add_website_manager()
+ cleanup_file_data()
+ update_patch_log()
+ from webnotes.modules import reload_doc
+ from webnotes.model import delete_doc
+
+ delete_doc('Website', 'Module Def', 'Website')
+ reload_doc('website', 'Module Def', 'Website')
+ reload_doc('website', 'Role', 'Website Manager')
+
+ webnotes.conn.sql("""delete from `tabModule Def Role` where parent='Website'""")
+ d = Document('Module Def Role')
+ d.parent = 'Website'
+ d.role = 'Website Manager'
+ d.save()
+
+ reload_doc('website', 'doctype', 'about_us_settings')
+ reload_doc('website', 'doctype', 'about_us_team')
+ reload_doc('website', 'doctype', 'blog')
+ reload_doc('website', 'doctype', 'blog_subscriber')
+ reload_doc('website', 'doctype', 'contact_us_settings')
+ reload_doc('website', 'doctype', 'product')
+ reload_doc('website', 'doctype', 'product_group')
+ reload_doc('website', 'doctype', 'products_settings')
+ reload_doc('website', 'doctype', 'related_page')
+ reload_doc('website', 'doctype', 'style_settings')
+ reload_doc('website', 'doctype', 'top_bar_item')
+ reload_doc('website', 'doctype', 'web_page')
+ reload_doc('website', 'doctype', 'website_settings')
+
+ reload_doc('website', 'page', 'about')
+ reload_doc('website', 'page', 'blog')
+ reload_doc('website', 'page', 'contact')
+ reload_doc('website', 'page', 'products')
+ reload_doc('website', 'page', 'unsubscribe')
+
+def add_website_manager():
+ """add website manager to system manager"""
+ for i in webnotes.conn.sql("""select distinct parent from tabUserRole
+ where role='System Manager'"""):
+ if not webnotes.conn.sql("""select parent from tabUserRole
+ where role='Website Manager' and parent=%s""", i[0]):
+ d = Document('UserRole')
+ d.parent = i[0]
+ d.role = 'Website Manager'
+ d.save(1)
+
+def cleanup_file_data():
+ webnotes.conn.commit()
+ try:
+ webnotes.conn.sql("""alter table `tabFile Data` drop column blob_content""")
+ except:
+ pass
+ webnotes.conn.begin()
+
+def update_patch_log():
+ webnotes.conn.commit()
+ webnotes.conn.sql("""alter table __PatchLog engine=InnoDB""")
+ webnotes.conn.begin()
diff --git a/erpnext/patches/jan_mar_2012/remove_get_tds_button.py b/erpnext/patches/jan_mar_2012/remove_get_tds_button.py
new file mode 100644
index 0000000..268c9ef
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/remove_get_tds_button.py
@@ -0,0 +1,14 @@
+def execute():
+ """
+ Remove One Get TDS button, which is appearing twice in JV
+ """
+ import webnotes
+ webnotes.conn.sql("""
+ DELETE from `tabDocField`
+ WHERE parent='Journal Voucher'
+ AND label='Get TDS'
+ AND fieldtype='Button'
+ """)
+
+ from webnotes.modules.module_manager import reload_doc
+ reload_doc('accounts', 'doctype', 'journal_voucher')
diff --git a/erpnext/patches/jan_mar_2012/serial_no_add_opt.py b/erpnext/patches/jan_mar_2012/serial_no_add_opt.py
new file mode 100644
index 0000000..92011b0
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/serial_no_add_opt.py
@@ -0,0 +1,18 @@
+def execute():
+ import webnotes
+ opts = webnotes.conn.sql("""\
+ SELECT options FROM `tabDocField`
+ WHERE parent='Serial No' AND fieldname='status' AND
+ fieldtype='Select'""")
+ if opts and opts[0][0]:
+ opt_list = opts[0][0].split("\n")
+ if not "Purchase Returned" in opt_list:
+ webnotes.conn.sql("""
+ UPDATE `tabDocField` SET options=%s
+ WHERE parent='Serial No' AND fieldname='status' AND
+ fieldtype='Select'""", "\n".join(opt_list + ["Purchase Returned"]))
+ webnotes.conn.commit()
+ webnotes.conn.begin()
+
+ from webnotes.modules.module_manager import reload_doc
+ reload_doc('stock', 'doctype', 'serial_no')
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index d9a8219..f569813 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -23,5 +23,46 @@
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'jan_production_patches',
'description': 'Fixes after Major changes in production module'
- }
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'allocated_to_profile',
+ 'description': """Change Options to "Profile" for fieldname "allocated_to"
+ as this is giving improper values in Permission Engine"""
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'remove_get_tds_button',
+ 'description': "Remove One Get TDS button, which is appearing twice in JV"
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'customer_address_contact_patch',
+ 'description': "Install Customer Address Contact report and run patches regarding primary address and contact"
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'doclabel_in_doclayer',
+ 'description': "Show DocType Labels instead of DocType names in Customize Form View"
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'email_settings_reload',
+ 'description': "Change type of mail_port field to Int and reload email_settings doctype"
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'serial_no_add_opt',
+ 'description': "Add option 'Purchase Returned' to Serial No status field"
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'cancel_purchase_returned',
+ 'description': "Set docstatus = 2 where status = 'Purchase Returned' for serial no"
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'deploy_packing_slip',
+ 'description': "Delete old packing slip fields & print format & deploy new doctypes related to Packing Slip"
+ },
]
diff --git a/erpnext/production/doctype/bill_of_materials/bill_of_materials.py b/erpnext/production/doctype/bill_of_materials/bill_of_materials.py
index 2a17817..4fec879 100644
--- a/erpnext/production/doctype/bill_of_materials/bill_of_materials.py
+++ b/erpnext/production/doctype/bill_of_materials/bill_of_materials.py
@@ -135,7 +135,7 @@
""" Uncheck others if current one is selected as default, update default bom in item master"""
if self.doc.is_default and self.doc.is_active == 'Yes':
- sql("update `tabBill Of Materials` set is_default = 0 where name != %s", self.doc.name)
+ sql("update `tabBill Of Materials` set is_default = 0 where name != %s and item=%s", (self.doc.name, self.doc.item))
# update default bom in Item Master
sql("update `tabItem` set default_bom = %s where name = %s", (self.doc.name, self.doc.item))
@@ -175,7 +175,6 @@
self.update_flat_bom_engine(is_submit = self.doc.docstatus)
-
def calculate_op_cost(self):
@@ -371,7 +370,6 @@
self.get_child_flat_bom_items(d.bom_no, d.qty)
-
def update_flat_bom_engine(self, is_submit = 0):
""" Update Flat BOM, following will be correct data"""
self.get_current_flat_bom_items()
diff --git a/erpnext/production/doctype/bill_of_materials/bill_of_materials.txt b/erpnext/production/doctype/bill_of_materials/bill_of_materials.txt
index bbb1cd9..cc29380 100644
--- a/erpnext/production/doctype/bill_of_materials/bill_of_materials.txt
+++ b/erpnext/production/doctype/bill_of_materials/bill_of_materials.txt
@@ -5,14 +5,14 @@
{
'creation': '2010-08-08 17:08:52',
'docstatus': 0,
- 'modified': '2012-01-11 14:33:04',
+ 'modified': '2012-01-24 19:49:00',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
- '_last_update': '1326272478',
+ '_last_update': '1326963484',
'allow_attach': 0,
'allow_copy': 0,
'allow_email': 0,
@@ -36,7 +36,7 @@
'server_code_error': ' ',
'show_in_menu': 0,
'subject': '%(item)s',
- 'version': 194
+ 'version': 196
},
# These values are common for all DocField
diff --git a/erpnext/production/doctype/bom_control/bom_control.txt b/erpnext/production/doctype/bom_control/bom_control.txt
index 6bf618c..127d997 100644
--- a/erpnext/production/doctype/bom_control/bom_control.txt
+++ b/erpnext/production/doctype/bom_control/bom_control.txt
@@ -5,8 +5,8 @@
{
'creation': '2010-08-08 17:08:53',
'docstatus': 0,
- 'modified': '2010-12-23 11:22:14',
- 'modified_by': 'umair@iwebnotes.com',
+ 'modified': '2012-01-24 20:56:54',
+ 'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -20,7 +20,7 @@
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
- 'version': 107
+ 'version': 108
},
# DocType, BOM Control
diff --git a/erpnext/production/doctype/bom_material/bom_material.txt b/erpnext/production/doctype/bom_material/bom_material.txt
index ff7c590..ebef2b4 100644
--- a/erpnext/production/doctype/bom_material/bom_material.txt
+++ b/erpnext/production/doctype/bom_material/bom_material.txt
@@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:08:53',
'docstatus': 0,
- 'modified': '2011-12-27 14:49:54',
+ 'modified': '2012-01-24 19:47:34',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -21,7 +21,7 @@
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
- 'version': 26
+ 'version': 27
},
# These values are common for all DocField
diff --git a/erpnext/production/page/bill_of_materials/bill_of_materials.html b/erpnext/production/page/bill_of_materials/bill_of_materials.html
index 1263e44..55b4e70 100644
--- a/erpnext/production/page/bill_of_materials/bill_of_materials.html
+++ b/erpnext/production/page/bill_of_materials/bill_of_materials.html
@@ -1,4 +1,4 @@
-<div style="margin:0px">
+<div class="layout_wrapper">
<div id="bom_header"> </div>
<!--
<div style="color: #444444;" mce_style="color: #444444;">
diff --git a/erpnext/production/page/bill_of_materials/bill_of_materials.js b/erpnext/production/page/bill_of_materials/bill_of_materials.js
index f2c9b0a..c40fa11 100644
--- a/erpnext/production/page/bill_of_materials/bill_of_materials.js
+++ b/erpnext/production/page/bill_of_materials/bill_of_materials.js
@@ -1,4 +1,5 @@
pscript['onload_Bill of Materials'] = function() {
+ wn.require('lib/js/legacy/widgets/tree.js');
// header and toolbar
var h = new PageHeader('bom_header','Bill of Materials','BOM gives the breakdown of cost for product');
@@ -113,12 +114,11 @@
$c('runserverobj', args={'doctype':'BOM Control', 'docname':'BOM Control', 'method':'calculate_cost', 'arg':pscript.bom_no}, function(r,rt) {
var calculated = r.message;
if (calculated == 'calculated') {pscript.show_bom();}
- else {$i('bom_tree').innerHTML = "Sorry it's taking too long try next time....";}
+ else {$i('bom_tree').innerHTML = "Not available";}
});
}
pscript.collapse_all = function(){
- alert("In");
pscript.bom_tree.collapseall()
}
diff --git a/erpnext/projects/page/projects/projects.js b/erpnext/projects/page/projects/projects.js
index 8335869..5f4c52d 100644
--- a/erpnext/projects/page/projects/projects.js
+++ b/erpnext/projects/page/projects/projects.js
@@ -58,7 +58,7 @@
var w = this.make_filter(label,idx);
var i = $a(w, 'input');
- var user_fmt = locals['Control Panel']['Control Panel'].date_format;
+ var user_fmt = wn.control_panel.date_format;
if(!this.user_fmt)this.user_fmt = 'dd-mm-yy';
$(i).datepicker({
diff --git a/erpnext/selling/Module Def/Selling/Selling.txt b/erpnext/selling/Module Def/Selling/Selling.txt
index 5500cb3..42c8449 100644
--- a/erpnext/selling/Module Def/Selling/Selling.txt
+++ b/erpnext/selling/Module Def/Selling/Selling.txt
@@ -1,673 +1,335 @@
+# Module Def, Selling
[
+
+ # These values are common in all dictionaries
{
- '_last_update': None,
- 'creation': '2011-06-30 15:45:03',
- 'disabled': 'No',
+ 'creation': '2011-07-01 17:39:08',
'docstatus': 0,
+ 'modified': '2012-01-23 18:25:58',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all Module Def Role
+ {
+ 'doctype': 'Module Def Role',
+ 'name': '__common__',
+ 'parent': 'Selling',
+ 'parentfield': 'roles',
+ 'parenttype': 'Module Def'
+ },
+
+ # These values are common for all Module Def Item
+ {
+ 'doctype': 'Module Def Item',
+ 'name': '__common__',
+ 'parent': 'Selling',
+ 'parentfield': 'items',
+ 'parenttype': 'Module Def'
+ },
+
+ # These values are common for all Module Def
+ {
+ 'disabled': 'No',
'doctype': u'Module Def',
'doctype_list': 'Print Format, Sales Order\nPrint Format, Quotation Format\nPrint Format, Delivery Note Format',
'file_list': 'crm.gif,FileData/00208',
- 'idx': None,
'is_hidden': 'No',
- 'last_updated_date': None,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
'module_desc': 'Manage you sales team, with your leads, customers, quotes, orders etc.',
'module_icon': 'Selling.gif',
'module_label': 'Selling',
'module_name': 'Selling',
- 'module_page': None,
'module_seq': 3,
- 'name': 'Selling',
- 'owner': 'Administrator',
- 'parent': None,
- 'parentfield': None,
- 'parenttype': None,
- 'trash_reason': None,
- 'widget_code': None
+ 'name': '__common__'
},
+
+ # Module Def, Selling
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
+ 'doctype': u'Module Def',
+ 'name': 'Selling'
+ },
+
+ # Module Def Item
+ {
'description': 'Database of potential customers you need to keep in touch with',
'display_name': 'Lead',
'doc_name': 'Lead',
'doc_type': 'Forms',
- 'docstatus': 0,
'doctype': 'Module Def Item',
- 'fields': 'status\nlead_owner\nlead_name\ncontact_no\ncontact_by\ncontact_date\nexpected_month',
- 'hide': None,
- 'icon': None,
- 'idx': 1,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01284',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'fields': 'status\nlead_owner\nlead_name\ncontact_no\ncontact_by\ncontact_date\nexpected_month'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
'description': 'Your Customer Database',
'display_name': 'Customer',
'doc_name': 'Customer',
'doc_type': 'Forms',
- 'docstatus': 0,
'doctype': 'Module Def Item',
- 'fields': 'customer_group\ncountry',
- 'hide': None,
- 'icon': None,
- 'idx': 2,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01285',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'fields': 'customer_group\ncountry'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
'description': 'Specific requirements from a Lead / Customer',
'display_name': 'Enquiry',
'doc_name': 'Enquiry',
'doc_type': 'Forms',
- 'docstatus': 0,
'doctype': 'Module Def Item',
- 'fields': 'status\ntransaction_date\ncustomer\ncontact_person\ncost_center\ncompany',
- 'hide': None,
- 'icon': None,
- 'idx': 3,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01286',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'fields': 'status\ntransaction_date\ncustomer\ncontact_person\ncost_center\ncompany'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
'description': 'Offers you have made to your customers',
'display_name': 'Quotation',
'doc_name': 'Quotation',
'doc_type': 'Forms',
- 'docstatus': 0,
'doctype': 'Module Def Item',
- 'fields': 'status\ntransaction_date\ncustomer\ncontact_person\ncost_center\ngrand_total\ncompany',
- 'hide': None,
- 'icon': None,
- 'idx': 4,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01287',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'fields': 'status\ntransaction_date\ncustomer\ncontact_person\ncost_center\ngrand_total\ncompany'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
'description': 'Database of confirmed Sale Orders from your Customers',
'display_name': 'Sales Order',
'doc_name': 'Sales Order',
'doc_type': 'Forms',
- 'docstatus': 0,
'doctype': 'Module Def Item',
- 'fields': 'status\ntransaction_date\ncustomer\ncost_center\ngrand_total\nper_delivered\nper_billed\ncompany',
- 'hide': None,
- 'icon': None,
- 'idx': 5,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01288',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'fields': 'status\ntransaction_date\ncustomer\ncost_center\ngrand_total\nper_delivered\nper_billed\ncompany'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
'display_name': 'Sales Dashboard',
'doc_name': 'Sales Dashboard',
'doc_type': 'Pages',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 6,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01289',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
- 'display_name': None,
'doc_name': 'Reports',
'doc_type': 'Separator',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 7,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01290',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
+ 'doc_name': 'Reports',
+ 'doc_type': 'Separator',
+ 'doctype': 'Module Def Item'
+ },
+
+ # Module Def Item
+ {
'display_name': 'Gross Profit',
'doc_name': 'Delivery Note Detail',
'doc_type': 'Reports',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 8,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01291',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
'display_name': 'Territory, Item Group wise GP',
'doc_name': 'Delivery Note',
'doc_type': 'Reports',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 9,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01292',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
'display_name': 'Itemwise Sales Details',
'doc_name': 'Sales Order Detail',
'doc_type': 'Reports',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 10,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01293',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
'display_name': 'Itemwise Delivery Details',
'doc_name': 'Delivery Note Detail',
'doc_type': 'Reports',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 11,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01294',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
'display_name': 'Sales Personwise Transaction Summary',
'doc_name': 'Sales Person',
'doc_type': 'Reports',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 12,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01295',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
'display_name': 'Total Target Variance Report',
'doc_name': 'Target Detail',
'doc_type': 'Reports',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 13,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01296',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
'display_name': 'Sales Persons Target Variance (Item Group wise)',
'doc_name': 'Target Detail',
'doc_type': 'Reports',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 14,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01297',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
'display_name': 'Territories Target Variance (Item Group wise)',
'doc_name': 'Target Detail',
'doc_type': 'Reports',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 15,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01298',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
'display_name': 'Sales Order Pending Items',
'doc_name': 'Sales Order Detail',
'doc_type': 'Reports',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 16,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01299',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
'display_name': 'Sales Orderwise Booking & Delivery Summary',
'doc_name': 'Sales Order Detail',
'doc_type': 'Reports',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 17,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01300',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
'display_name': 'Sales Orderwise Pending Qty To Deliver',
'doc_name': 'Sales Order Detail',
'doc_type': 'Reports',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 18,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01301',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
'display_name': 'Sales Orderwise Pending Amount To Bill',
'doc_name': 'Sales Order Detail',
'doc_type': 'Reports',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 19,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01302',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
'display_name': 'Delivered Items to be Install',
'doc_name': 'Delivery Note Detail',
'doc_type': 'Reports',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 20,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01303',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
'display_name': 'Itemwise Price List',
'doc_name': 'Ref Rate Detail',
'doc_type': 'Reports',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 21,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01304',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
- 'description': None,
'display_name': 'Follow-up Report',
'doc_name': 'Follow up',
'doc_type': 'Reports',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 22,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01305',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
'description': 'Ledger details of your debtors',
'display_name': "Debtor's Ledger",
'doc_name': 'GL Entry',
'doc_type': 'Reports',
- 'docstatus': 0,
- 'doctype': 'Module Def Item',
- 'fields': None,
- 'hide': None,
- 'icon': None,
- 'idx': 23,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01306',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'doctype': 'Module Def Item'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
+ 'description': 'Report displaying Customer, Primary Address Details & Primary Contact Details',
+ 'display_name': 'Customer Address Contact',
+ 'doc_name': 'Customer',
+ 'doc_type': 'Reports',
+ 'doctype': 'Module Def Item'
+ },
+
+ # Module Def Item
+ {
'description': 'Customer Category',
'display_name': 'Customer Group',
'doc_name': 'Customer Group',
'doc_type': 'Setup Forms',
- 'docstatus': 0,
'doctype': 'Module Def Item',
- 'fields': 'id\ndescription',
- 'hide': None,
- 'icon': None,
- 'idx': 24,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01307',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'fields': 'id\ndescription'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
'description': 'Sales person details',
'display_name': 'Sales Person',
'doc_name': 'Sales Person',
'doc_type': 'Setup Forms',
- 'docstatus': 0,
'doctype': 'Module Def Item',
- 'fields': 'id\nterritory\ndepartment\nmobile_no\nemail_id',
- 'hide': None,
- 'icon': None,
- 'idx': 25,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01308',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'fields': 'id\nterritory\ndepartment\nmobile_no\nemail_id'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
'description': 'Item master',
'display_name': 'Item',
'doc_name': 'Item',
'doc_type': 'Setup Forms',
- 'docstatus': 0,
'doctype': 'Module Def Item',
- 'fields': 'name\nitem_group\ndescription',
- 'hide': None,
- 'icon': None,
- 'idx': 26,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01309',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'fields': 'name\nitem_group\ndescription'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
'description': 'Sales partner details',
'display_name': 'Sales Partner',
'doc_name': 'Sales Partner',
'doc_type': 'Setup Forms',
- 'docstatus': 0,
'doctype': 'Module Def Item',
- 'fields': 'id\npartner_type\nmobile\nemail\nterritory',
- 'hide': None,
- 'icon': None,
- 'idx': 27,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01310',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'fields': 'id\npartner_type\nmobile\nemail\nterritory'
},
+
+ # Module Def Item
{
- 'click_function': None,
- 'creation': '2011-06-30 15:45:03',
'description': 'Business campaigns',
'display_name': 'Campaign',
'doc_name': 'Campaign',
'doc_type': 'Setup Forms',
- 'docstatus': 0,
'doctype': 'Module Def Item',
- 'fields': 'id\ncampaign_name\ndescription',
- 'hide': None,
- 'icon': None,
- 'idx': 28,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDI01311',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'items',
- 'parenttype': 'Module Def'
+ 'fields': 'id\ncampaign_name\ndescription'
},
+
+ # Module Def Role
{
- 'creation': '2011-06-30 15:45:03',
- 'docstatus': 0,
'doctype': 'Module Def Role',
- 'idx': 1,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDR00328',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'roles',
- 'parenttype': 'Module Def',
'role': 'Administrator'
},
+
+ # Module Def Role
{
- 'creation': '2011-06-30 15:45:03',
- 'docstatus': 0,
'doctype': 'Module Def Role',
- 'idx': 2,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDR00329',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'roles',
- 'parenttype': 'Module Def',
'role': 'Sales Manager'
},
+
+ # Module Def Role
{
- 'creation': '2011-06-30 15:45:03',
- 'docstatus': 0,
'doctype': 'Module Def Role',
- 'idx': 3,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDR00330',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'roles',
- 'parenttype': 'Module Def',
'role': 'Sales User'
},
+
+ # Module Def Role
{
- 'creation': '2011-06-30 15:45:03',
- 'docstatus': 0,
'doctype': 'Module Def Role',
- 'idx': 4,
- 'modified': '2011-06-30 15:45:03',
- 'modified_by': 'Administrator',
- 'name': 'MDR00331',
- 'owner': 'Administrator',
- 'parent': 'Selling',
- 'parentfield': 'roles',
- 'parenttype': 'Module Def',
'role': 'Sales Master Manager'
}
]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/installation_note/installation_note.py b/erpnext/selling/doctype/installation_note/installation_note.py
index e0af7ec..58b7d91 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.py
+++ b/erpnext/selling/doctype/installation_note/installation_note.py
@@ -98,7 +98,7 @@
#get list of serial no from previous_doc
#----------------------------------------------
def get_prevdoc_serial_no(self, prevdoc_detail_docname, prevdoc_docname):
- from material_management.doctype.stock_ledger.stock_ledger import get_sr_no_list
+ from stock.doctype.stock_ledger.stock_ledger import get_sr_no_list
res = sql("select serial_no from `tabDelivery Note Detail` where name = '%s' and parent ='%s'" % (prevdoc_detail_docname, prevdoc_docname))
return get_sr_no_list(res[0][0])
diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js
index fabf433..5039fcd 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.js
+++ b/erpnext/selling/doctype/sales_common/sales_common.js
@@ -5,7 +5,6 @@
// cur_frm.cscript.other_fname - Other Charges fieldname
// cur_frm.cscript.sales_team_fname - Sales Team fieldname
-
// ============== Load Default Taxes ===================
cur_frm.cscript.load_taxes = function(doc, cdt, cdn) {
// run if this is not executed from dt_map...
@@ -153,7 +152,8 @@
var basic_rate = cur_frm.cscript.back_calc_basic_rate(
doc, cur_frm.cscript.tname, fname, d, cur_frm.cscript.other_fname
);
- if (d.basic_rate != basic_rate.toFixed(2)) {
+ // TODO: remove roundNumber for basic_rate comparison
+ if (d.basic_rate != roundNumber(basic_rate, 2)) {
d.basic_rate = basic_rate;
refresh_field('basic_rate', d.name, fname);
msgprint("You cannot change Basic Rate* (Base Currency) when \
@@ -168,6 +168,13 @@
// ************************ EXPORT RATE *************************
cur_frm.cscript.export_rate = function(doc,cdt,cdn) {
+ var cur_rec = locals[cdt][cdn];
+ var fname = cur_frm.cscript.fname;
+ var tname = cur_frm.cscript.tname;
+ if(flt(cur_rec.ref_rate)>0 && flt(cur_rec.export_rate)>0 && !flt(cur_rec.adj_rate)) {
+ var adj_rate = 100 * (1 - (flt(cur_rec.export_rate) / flt(cur_rec.ref_rate)));
+ set_multiple(tname, cur_rec.name, { 'adj_rate': adj_rate }, fname);
+ }
doc = locals[doc.doctype][doc.name];
cur_frm.cscript.recalc(doc, 1);
}
@@ -238,6 +245,7 @@
var net_total_incl = 0
var cl = getchildren(tname, doc.name, fname);
for(var i = 0; i<cl.length; i++){
+ //net_total += flt(cl[i].basic_rate) * flt(cl[i].qty);
net_total += flt(cl[i].amount);
net_total_incl += flt(cl[i].export_amount);
}
@@ -245,23 +253,21 @@
var inclusive_rate = 0
var d = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype);
for(var j = 0; j<d.length; j++){
- other_charges_total += flt(d[j].amount);
+ other_charges_total += flt(d[j].tax_amount);
if(d[j].included_in_print_rate) {
inclusive_rate = 1;
}
}
- //console.log("Net Total: " + net_total);
- //console.log("Net Total Incl: " + net_total_incl);
- //console.log("Other Charges: " + other_charges_total);
+ if(flt(doc.conversion_rate)>1) {
+ net_total_incl *= flt(doc.conversion_rate);
+ }
+
doc.net_total = inclusive_rate ? flt(net_total_incl) : flt(net_total);
- doc.other_charges_total = flt(other_charges_total);
- //console.log('In calc doc values');
- //console.log(net_total);
- //console.log(other_charges_total);
- doc.grand_total = flt(flt(net_total) + flt(other_charges_total));
+ doc.other_charges_total = roundNumber(flt(other_charges_total), 2);
+ doc.grand_total = roundNumber((flt(net_total) + flt(other_charges_total)), 2);
doc.rounded_total = Math.round(doc.grand_total);
- doc.grand_total_export = flt(flt(doc.grand_total) / flt(doc.conversion_rate));
+ doc.grand_total_export = roundNumber((flt(doc.grand_total) / flt(doc.conversion_rate)), 2);
doc.rounded_total_export = Math.round(doc.grand_total_export);
doc.total_commission = flt(flt(net_total) * flt(doc.commission_rate) / 100);
}
@@ -281,10 +287,9 @@
var otc = make_table(cur_frm.fields_dict['Other Charges Calculation'].disp_area,
cl.length + 1, tax.length + 1, '90%', [], { border:'1px solid #AAA', padding:'2px' });
$y(otc,{marginTop:'8px'});
-
+
var tax_desc = {}; var tax_desc_rates = []; var net_total = 0;
-
for(var i=0;i<cl.length;i++) {
net_total += flt(flt(cl[i].qty) * flt(cl[i].basic_rate));
var prev_total = flt(cl[i].amount);
@@ -294,13 +299,13 @@
// Add Item Code in new Row
$td(otc,i+1,0).innerHTML = cl[i].item_code ? cl[i].item_code : cl[i].description;
- var tax = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype);
+ //var tax = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype);
var total = net_total;
+
for(var t=0;t<tax.length;t++){
var account = tax[t].account_head;
$td(otc,0,t+1).innerHTML = account?account:'';
-
//Check For Rate
if(cl[i].item_tax_rate && check_tax[account]!=null) {
var rate = flt(check_tax[account]);
@@ -311,38 +316,31 @@
//Check For Rate and get tax amount
var tax_amount = cur_frm.cscript.check_charge_type_and_get_tax_amount(doc,tax,t, cl[i], rate);
-
+
//enter item_wise_tax_detail i.e. tax rate on each item
var item_wise_tax_detail = cur_frm.cscript.get_item_wise_tax_detail(doc, rate, cl, i, tax, t);
-
- // this is calculation part for all types
- if(tax[t].charge_type != "Actual") {
- tax[t].item_wise_tax_detail += item_wise_tax_detail;
- }
- //console.log(tax[t]);
- //console.log(tax_amount);
- //console.log(total);
-
- tax[t].total_amount = flt(tax_amount.toFixed(2)); //stores actual tax amount in virtual field
+ if(tax[t].charge_type != "Actual") tax[t].item_wise_tax_detail += item_wise_tax_detail;
+ tax[t].total_amount = flt(tax_amount); //stores actual tax amount in virtual field
tax[t].total_tax_amount = flt(prev_total); //stores total amount in virtual field
- tax[t].tax_amount += flt(tax_amount.toFixed(2));
-
- var total_amount = flt(tax_amount);
+ tax[t].tax_amount += flt(tax_amount);
+ var total_amount = flt(tax[t].tax_amount);
total_tax_amount = flt(tax[t].total_tax_amount) + flt(total_amount);
- set_multiple('RV Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'amount':total_amount, 'total':flt((flt(total)+flt(tax[t].tax_amount)).toFixed(2))/*_tax_amount)*/}, other_fname);
- //console.log("Total: " + (flt(total)+flt(tax[t].tax_amount)));
+ set_multiple('RV Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'amount':roundNumber(flt(total_amount), 2), 'total':roundNumber(flt(total)+flt(tax[t].tax_amount), 2)}, other_fname);
prev_total += flt(tax[t].total_amount); // for previous row total
- total += flt(tax_amount); // for adding total to previous amount
+ total += flt(tax[t].tax_amount); // for adding total to previous amount
if(tax[t].charge_type == 'Actual')
$td(otc,i+1,t+1).innerHTML = fmt_money(tax[t].total_amount);
else
$td(otc,i+1,t+1).innerHTML = '('+fmt_money(rate) + '%) ' +fmt_money(tax[t].total_amount);
-
+
}
}
+
+ for(var t=0;t<tax.length;t++){
+ tax[t].tax_amount = roundNumber(tax[t].tax_amount, 2);
+ }
}
-
cur_frm.cscript.check_charge_type_and_get_tax_amount = function( doc, tax, t, cl, rate, print_amt) {
doc = locals[doc.doctype][doc.name];
if (! print_amt) print_amt = 0;
@@ -359,7 +357,6 @@
refresh_field('total_excise_rate');
return
}
-
return tax_amount = (flt(rate) * flt(cl.amount) / 100);
}
else if(tax[t].charge_type == 'On Previous Row Amount'){
@@ -482,37 +479,27 @@
// ********************** Update values in table ******************************
cur_frm.cscript.update_fname_table = function(doc , tname , fname , n, other_fname) {
- doc = locals[doc.doctype][doc.name]
- var net_total = 0
- var cl = getchildren(tname, doc.name, fname);
- var consider_incl_rate = cur_frm.cscript.consider_incl_rate(doc, other_fname);
- for(var i=0;i<cl.length;i++) {
- if(n == 1){
- if(!consider_incl_rate) {
- if(flt(cl[i].ref_rate) > 0) {
+ doc = locals[doc.doctype][doc.name]
+ var net_total = 0
+ var cl = getchildren(tname, doc.name, fname);
+ var consider_incl_rate = cur_frm.cscript.consider_incl_rate(doc, other_fname);
+ for(var i=0;i<cl.length;i++) {
+ if(n == 1){
+ if(!consider_incl_rate) {
+ if(flt(cl[i].ref_rate) > 0) {
+ set_multiple(tname, cl[i].name, {
+ 'export_rate': flt(flt(cl[i].ref_rate) * (100 - flt(cl[i].adj_rate)) / 100)
+ }, fname);
+ }
set_multiple(tname, cl[i].name, {
- 'export_rate': flt(flt(cl[i].ref_rate) * (100 - flt(cl[i].adj_rate)) / 100)
- }, fname);
-
- }
- // Commenting this part because ref_rate backcalculation injects floating point issues
- /*else if(flt(cl[i].export_rate) > 0) {
- var ref_rate = flt(cl[i].adj_rate)!=flt(100) ?
- flt((100 * flt(cl[i].export_rate))/flt(100 - flt(cl[i].adj_rate))) :
- flt(0)
- set_multiple(tname, cl[i].name, { 'ref_rate': flt(ref_rate) }, fname);
- } */
-
- set_multiple(tname, cl[i].name, {
- 'export_amount': flt(flt(cl[i].qty) * flt(cl[i].export_rate)),
- 'basic_rate': flt(flt(cl[i].export_rate) * flt(doc.conversion_rate)),
- 'amount': flt((flt(cl[i].export_rate) * flt(doc.conversion_rate)) * flt(cl[i].qty))
- }, fname);
-
- var base_ref_rate = flt(cl[i].basic_rate) + flt(flt(cl[i].basic_rate) * flt(cl[i].adj_rate) / 100);
- set_multiple(tname, cl[i].name, {
- 'base_ref_rate': flt(base_ref_rate)
- }, fname);
+ 'export_amount': flt(flt(cl[i].qty) * flt(cl[i].export_rate)),
+ 'basic_rate': flt(flt(cl[i].export_rate) * flt(doc.conversion_rate)),
+ 'amount': roundNumber(flt((flt(cl[i].export_rate) * flt(doc.conversion_rate)) * flt(cl[i].qty)), 2)
+ }, fname);
+ var base_ref_rate = flt(cl[i].basic_rate) + flt(flt(cl[i].basic_rate) * flt(cl[i].adj_rate) / 100);
+ set_multiple(tname, cl[i].name, {
+ 'base_ref_rate': flt(base_ref_rate)
+ }, fname);
} else if(consider_incl_rate) {
if(flt(cl[i].export_rate) > 0) {
@@ -532,7 +519,7 @@
var base_ref_rate = basic_rate + flt(basic_rate * flt(cl[i].adj_rate) / 100);
set_multiple(tname, cl[i].name, {
'basic_rate': flt(basic_rate),
- 'amount': flt(basic_rate * flt(cl[i].qty)),
+ 'amount': roundNumber(flt(basic_rate * flt(cl[i].qty)), 2),
'export_amount': flt(flt(cl[i].qty) * flt(cl[i].export_rate)),
'base_ref_rate': flt(base_ref_rate)
}, fname);
@@ -667,4 +654,3 @@
validated = false;
}
}
-
diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py
index 47a3483..0c3d858 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.py
+++ b/erpnext/selling/doctype/sales_common/sales_common.py
@@ -8,7 +8,6 @@
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
-sql = webnotes.conn.sql
get_value = webnotes.conn.get_value
in_transaction = webnotes.conn.in_transaction
convert_to_lists = webnotes.conn.convert_to_lists
@@ -44,7 +43,7 @@
if obj.doc.doctype != 'Quotation':
obj.doc.clear_table(obj.doclist,'sales_team')
idx = 0
- for d in sql("select sales_person, allocated_percentage, allocated_amount, incentives from `tabSales Team` where parent = '%s'" % obj.doc.customer):
+ for d in webnotes.conn.sql("select sales_person, allocated_percentage, allocated_amount, incentives from `tabSales Team` where parent = '%s'" % obj.doc.customer):
ch = addchild(obj.doc, 'sales_team', 'Sales Team', 1, obj.doclist)
ch.sales_person = d and cstr(d[0]) or ''
ch.allocated_percentage = d and flt(d[1]) or 0
@@ -59,7 +58,7 @@
def get_contact_details(self, obj = '', primary = 0):
cond = " and contact_name = '"+cstr(obj.doc.contact_person)+"'"
if primary: cond = " and is_primary_contact = 'Yes'"
- contact = sql("select contact_name, contact_no, email_id, contact_address from `tabContact` where customer = '%s' and docstatus != 2 %s" %(obj.doc.customer, cond), as_dict = 1)
+ contact = webnotes.conn.sql("select contact_name, contact_no, email_id, contact_address from `tabContact` where customer = '%s' and docstatus != 2 %s" %(obj.doc.customer, cond), as_dict = 1)
if not contact:
return
c = contact[0]
@@ -74,7 +73,7 @@
# Get customer's primary shipping details
# ==============================================================
def get_shipping_details(self, obj = ''):
- det = sql("select name, ship_to, shipping_address from `tabShipping Address` where customer = '%s' and docstatus != 2 and ifnull(is_primary_address, 'Yes') = 'Yes'" %(obj.doc.customer), as_dict = 1)
+ det = webnotes.conn.sql("select name, ship_to, shipping_address from `tabShipping Address` where customer = '%s' and docstatus != 2 and ifnull(is_primary_address, 'Yes') = 'Yes'" %(obj.doc.customer), as_dict = 1)
obj.doc.ship_det_no = det and det[0]['name'] or ''
obj.doc.ship_to = det and det[0]['ship_to'] or ''
obj.doc.shipping_address = det and det[0]['shipping_address'] or ''
@@ -84,14 +83,14 @@
# ====================
def get_invoice_details(self, obj = ''):
if obj.doc.company:
- acc_head = sql("select name from `tabAccount` where name = '%s' and docstatus != 2" % (cstr(obj.doc.customer) + " - " + get_value('Company', obj.doc.company, 'abbr')))
+ acc_head = webnotes.conn.sql("select name from `tabAccount` where name = '%s' and docstatus != 2" % (cstr(obj.doc.customer) + " - " + get_value('Company', obj.doc.company, 'abbr')))
obj.doc.debit_to = acc_head and acc_head[0][0] or ''
# Get Customer Details along with its primary contact details
# ==============================================================
def get_customer_details(self, obj = '', inv_det_reqd = 1):
- details = sql("select customer_name,address, territory, customer_group, default_sales_partner, default_commission_rate from `tabCustomer` where name = '%s' and docstatus != 2" %(obj.doc.customer), as_dict = 1)
+ details = webnotes.conn.sql("select customer_name,address, territory, customer_group, default_sales_partner, default_commission_rate from `tabCustomer` where name = '%s' and docstatus != 2" %(obj.doc.customer), as_dict = 1)
obj.doc.customer_name = details and details[0]['customer_name'] or ''
obj.doc.customer_address = details and details[0]['address'] or ''
obj.doc.territory = details and details[0]['territory'] or ''
@@ -113,8 +112,8 @@
if not obj.doc.price_list_name:
msgprint("Please Select Price List before selecting Items")
raise Exception
- item = sql("select description, item_name, brand, item_group, stock_uom, default_warehouse, default_income_account, default_sales_cost_center, description_html from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life > now() or end_of_life = '0000-00-00') and (is_sales_item = 'Yes' or is_service_item = 'Yes')" %(item_code), as_dict=1)
- tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item_code)
+ item = webnotes.conn.sql("select description, item_name, brand, item_group, stock_uom, default_warehouse, default_income_account, default_sales_cost_center, description_html from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life > now() or end_of_life = '0000-00-00') and (is_sales_item = 'Yes' or is_service_item = 'Yes')" %(item_code), as_dict=1)
+ tax = webnotes.conn.sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item_code)
t = {}
for x in tax: t[x[0]] = flt(x[1])
ret = {
@@ -145,7 +144,7 @@
# ***************** Get Ref rate as entered in Item Master ********************
def get_ref_rate(self, item_code, price_list_name, price_list_currency, plc_conv_rate):
- ref_rate = sql("select ref_rate from `tabRef Rate Detail` where parent = %s and price_list_name = %s and ref_currency = %s", (item_code, price_list_name, price_list_currency))
+ ref_rate = webnotes.conn.sql("select ref_rate from `tabRef Rate Detail` where parent = %s and price_list_name = %s and ref_currency = %s", (item_code, price_list_name, price_list_currency))
base_ref_rate = ref_rate and flt(ref_rate[0][0]) * flt(plc_conv_rate) or 0
return base_ref_rate
@@ -175,7 +174,7 @@
if default: add_cond = 'ifnull(t2.is_default,0) = 1'
else: add_cond = 't1.parent = "'+cstr(obj.doc.charge)+'"'
idx = 0
- other_charge = sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount,t1.included_in_print_rate from `tabRV Tax Detail` t1, `tabOther Charges` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1)
+ other_charge = webnotes.conn.sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount,t1.included_in_print_rate from `tabRV Tax Detail` t1, `tabOther Charges` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1)
for other in other_charge:
d = addchild(obj.doc, 'other_charges', 'RV Tax Detail', 1, obj.doclist)
d.charge_type = other['charge_type']
@@ -192,12 +191,12 @@
# Get TERMS AND CONDITIONS
# =======================================================================================
def get_tc_details(self,obj):
- r = sql("select terms from `tabTerm` where name = %s", obj.doc.tc_name)
+ r = webnotes.conn.sql("select terms from `tabTerm` where name = %s", obj.doc.tc_name)
if r: obj.doc.terms = r[0][0]
#---------------------------------------- Get Tax Details -------------------------------#
def get_tax_details(self, item_code, obj):
- tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item_code)
+ tax = webnotes.conn.sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item_code)
t = {}
for x in tax: t[x[0]] = flt(x[1])
ret = {
@@ -208,8 +207,8 @@
# Get Serial No Details
# ==========================================================================
def get_serial_details(self, serial_no, obj):
- item = sql("select item_code, make, label,brand, description from `tabSerial No` where name = '%s' and docstatus != 2" %(serial_no), as_dict=1)
- tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item[0]['item_code'])
+ item = webnotes.conn.sql("select item_code, make, label,brand, description from `tabSerial No` where name = '%s' and docstatus != 2" %(serial_no), as_dict=1)
+ tax = webnotes.conn.sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item[0]['item_code'])
t = {}
for x in tax: t[x[0]] = flt(x[1])
ret = {
@@ -226,7 +225,7 @@
# =======================================================================
def get_comm_rate(self, sales_partner, obj):
- comm_rate = sql("select commission_rate from `tabSales Partner` where name = '%s' and docstatus != 2" %(sales_partner), as_dict=1)
+ comm_rate = webnotes.conn.sql("select commission_rate from `tabSales Partner` where name = '%s' and docstatus != 2" %(sales_partner), as_dict=1)
if comm_rate:
total_comm = flt(comm_rate[0]['commission_rate']) * flt(obj.doc.net_total) / 100
ret = {
@@ -243,7 +242,7 @@
# =======================================================================================
def validate_max_discount(self,obj, detail_table):
for d in getlist(obj.doclist, detail_table):
- discount = sql("select max_discount from tabItem where name = '%s'" %(d.item_code),as_dict = 1)
+ discount = webnotes.conn.sql("select max_discount from tabItem where name = '%s'" %(d.item_code),as_dict = 1)
if discount and discount[0]['max_discount'] and (flt(d.adj_rate)>flt(discount[0]['max_discount'])):
msgprint("You cannot give more than " + cstr(discount[0]['max_discount']) + " % discount on Item Code : "+cstr(d.item_code))
raise Exception
@@ -279,7 +278,7 @@
# =========================================================================
def get_rate(self, arg):
arg = eval(arg)
- rate = sql("select account_type, tax_rate from `tabAccount` where name = '%s' and docstatus != 2" %(arg['account_head']), as_dict=1)
+ rate = webnotes.conn.sql("select account_type, tax_rate from `tabAccount` where name = '%s' and docstatus != 2" %(arg['account_head']), as_dict=1)
ret = {'rate' : 0}
if arg['charge_type'] == 'Actual' and rate[0]['account_type'] == 'Tax':
msgprint("You cannot select ACCOUNT HEAD of type TAX as your CHARGE TYPE is 'ACTUAL'")
@@ -296,10 +295,10 @@
# Make Packing List from Sales BOM
# =======================================================================
def has_sales_bom(self, item_code):
- return sql("select name from `tabSales BOM` where name=%s and docstatus != 2", item_code)
+ return webnotes.conn.sql("select name from `tabSales BOM` where name=%s and docstatus != 2", item_code)
def get_sales_bom_items(self, item_code):
- return sql("select item_code, qty, uom from `tabSales BOM Detail` where parent=%s", item_code)
+ return webnotes.conn.sql("select item_code, qty, uom from `tabSales BOM Detail` where parent=%s", item_code)
# --------------
@@ -339,14 +338,14 @@
def get_curr_and_ref_doc_details(self, curr_doctype, ref_tab_fname, ref_tab_dn, ref_doc_tname, curr_parent_name, curr_parent_doctype):
# Get total qty, amt of current doctype (eg RV) except for qty, amt of this transaction
if curr_parent_doctype == 'Installation Note':
- curr_det = sql("select sum(qty) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% (curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
+ curr_det = webnotes.conn.sql("select sum(qty) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% (curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
qty, amt = curr_det and flt(curr_det[0][0]) or 0, 0
else:
- curr_det = sql("select sum(qty), sum(amount) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% (curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
+ curr_det = webnotes.conn.sql("select sum(qty), sum(amount) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% (curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
qty, amt = curr_det and flt(curr_det[0][0]) or 0, curr_det and flt(curr_det[0][1]) or 0
# get total qty of ref doctype
- ref_det = sql("select qty, amount from `tab%s` where name = '%s' and docstatus = 1"% (ref_doc_tname, ref_tab_dn))
+ ref_det = webnotes.conn.sql("select qty, amount from `tab%s` where name = '%s' and docstatus = 1"% (ref_doc_tname, ref_tab_dn))
max_qty, max_amt = ref_det and flt(ref_det[0][0]) or 0, ref_det and flt(ref_det[0][1]) or 0
return qty, max_qty, amt, max_amt
@@ -359,10 +358,10 @@
# add packing list items
# -----------------------
def get_packing_item_details(self, item):
- return sql("select item_name, description, stock_uom from `tabItem` where name = %s", item, as_dict = 1)[0]
+ return webnotes.conn.sql("select item_name, description, stock_uom from `tabItem` where name = %s", item, as_dict = 1)[0]
def get_bin_qty(self, item, warehouse):
- det = sql("select actual_qty, projected_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (item, warehouse), as_dict = 1)
+ det = webnotes.conn.sql("select actual_qty, projected_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (item, warehouse), as_dict = 1)
return det and det[0] or ''
def add_packing_list_item(self,obj, item_code, qty, warehouse, line):
@@ -424,7 +423,7 @@
elif d.fields.has_key('sales_order') and d.sales_order and not d.delivery_note:
ref_doc_name = d.sales_order
if ref_doc_name:
- so_status = sql("select status from `tabSales Order` where name = %s",ref_doc_name)
+ so_status = webnotes.conn.sql("select status from `tabSales Order` where name = %s",ref_doc_name)
so_status = so_status and so_status[0][0] or ''
if so_status == 'Stopped':
msgprint("You cannot do any transaction against Sales Order : '%s' as it is Stopped." %(ref_doc_name))
@@ -435,7 +434,7 @@
def check_active_sales_items(self,obj):
for d in getlist(obj.doclist, obj.fname):
if d.item_code: # extra condn coz item_code is not mandatory in RV
- valid_item = sql("select docstatus,is_sales_item, is_service_item from tabItem where name = %s",d.item_code)
+ valid_item = webnotes.conn.sql("select docstatus,is_sales_item, is_service_item from tabItem where name = %s",d.item_code)
if valid_item and valid_item[0][0] == 2:
msgprint("Item : '%s' does not exist in system." %(d.item_code))
raise Exception
@@ -449,10 +448,10 @@
# **************************************************************************************************************************************************
def check_credit(self,obj,grand_total):
- acc_head = sql("select name from `tabAccount` where company = '%s' and master_name = '%s'"%(obj.doc.company, obj.doc.customer))
+ acc_head = webnotes.conn.sql("select name from `tabAccount` where company = '%s' and master_name = '%s'"%(obj.doc.company, obj.doc.customer))
if acc_head:
tot_outstanding = 0
- dbcr = sql("select sum(debit), sum(credit) from `tabGL Entry` where account = '%s' and ifnull(is_cancelled, 'No')='No'" % acc_head[0][0])
+ dbcr = webnotes.conn.sql("select sum(debit), sum(credit) from `tabGL Entry` where account = '%s' and ifnull(is_cancelled, 'No')='No'" % acc_head[0][0])
if dbcr:
tot_outstanding = flt(dbcr[0][0])-flt(dbcr[0][1])
@@ -460,7 +459,7 @@
get_obj('Account',acc_head[0][0]).check_credit_limit(acc_head[0][0], obj.doc.company, exact_outstanding)
def validate_fiscal_year(self,fiscal_year,transaction_date,dn):
- fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%fiscal_year)
+ fy=webnotes.conn.sql("select year_start_date from `tabFiscal Year` where name='%s'"%fiscal_year)
ysd=fy and fy[0][0] or ""
yed=add_days(str(ysd),365)
if str(transaction_date) < str(ysd) or str(transaction_date) > str(yed):
@@ -475,9 +474,9 @@
for d in getlist(obj.doclist, obj.fname):
if d.prevdoc_doctype and d.prevdoc_docname:
if d.prevdoc_doctype == 'Receivable Voucher':
- dt = sql("select posting_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))
+ dt = webnotes.conn.sql("select posting_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))
else:
- dt = sql("select transaction_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))
+ dt = webnotes.conn.sql("select transaction_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))
d.prevdoc_date = dt and dt[0][0].strftime('%Y-%m-%d') or ''
def update_prevdoc_detail(self, is_submit, obj):
@@ -593,7 +592,9 @@
If you want to increase your overflow tolerance, please increase tolerance %% in Global Defaults or Item master.
- Or, you must reduce the %(compare_ref_field)s by %(reduce_by)s""" % item, raise_exception=1)
+ Or, you must reduce the %(compare_ref_field)s by %(reduce_by)s
+
+ Also, please check if the order item has already been billed in the Sales Order""" % item, raise_exception=1)
def validate_qty(self, args, no_tolerance=None):
"""
@@ -605,7 +606,7 @@
args['name'] = d.fields[args['join_field']]
# get all qty where qty > compare_field
- item = sql("""
+ item = webnotes.conn.sql("""
select item_code, `%(compare_ref_field)s`, `%(compare_field)s`, parenttype, parent from `tab%(target_dt)s`
where `%(compare_ref_field)s` < `%(compare_field)s` and name="%(name)s" and docstatus=1
""" % args, as_dict=1)
@@ -710,7 +711,7 @@
args['detail_id'] = d.fields.get(args['join_field'])
if args['detail_id']:
- sql("""
+ webnotes.conn.sql("""
update
`tab%(target_dt)s`
set
@@ -725,7 +726,7 @@
args['name'] = name
# update percent complete in the parent table
- sql("""
+ webnotes.conn.sql("""
update
`tab%(target_parent_dt)s`
set
@@ -738,7 +739,7 @@
# update field
if args['status_field']:
- sql("""
+ webnotes.conn.sql("""
update
`tab%(target_parent_dt)s`
set
diff --git a/erpnext/selling/page/sales_browser/sales_browser.js b/erpnext/selling/page/sales_browser/sales_browser.js
index c0c4542..d2ba627 100644
--- a/erpnext/selling/page/sales_browser/sales_browser.js
+++ b/erpnext/selling/page/sales_browser/sales_browser.js
@@ -1,4 +1,5 @@
pscript['onload_Sales Browser'] = function(){
+ wn.require('lib/js/legacy/widgets/tree.js');
var parent = $i('tr_body');
parent.innerHTML = 'Please select your chart: '
var sel = $a(parent,'select');
diff --git a/erpnext/selling/page/sales_dashboard/sales_dashboard.js b/erpnext/selling/page/sales_dashboard/sales_dashboard.js
index cdb5c7c..d15c602 100644
--- a/erpnext/selling/page/sales_dashboard/sales_dashboard.js
+++ b/erpnext/selling/page/sales_dashboard/sales_dashboard.js
@@ -5,11 +5,10 @@
$dh(pscript.mnt_div);
$dh(pscript.mnt_div1);
//pscript.dx_axis = [];
-
- if($.jqplot) pscript.all_onchnge();
- else
- // import the library
- $c_js('jquery/jquery.jqplot.min.js', pscript.all_onchnge);
+
+ wn.require('lib/css/jqpot.css');
+ wn.require('lib/js/legacy/jquery/jquery.jqplot.min.js');
+ pscript.all_onchnge();
}
//=======================================================================
pscript.make_filters = function(){
diff --git a/erpnext/utilities/doctype/production_tips_common/__init__.py b/erpnext/selling/search_criteria/customer_address_contact/__init__.py
similarity index 100%
rename from erpnext/utilities/doctype/production_tips_common/__init__.py
rename to erpnext/selling/search_criteria/customer_address_contact/__init__.py
diff --git a/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.txt b/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.txt
new file mode 100644
index 0000000..9e0a715
--- /dev/null
+++ b/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.txt
@@ -0,0 +1,36 @@
+# Search Criteria, customer_address_contact
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-23 18:28:40',
+ 'docstatus': 0,
+ 'modified': '2012-01-23 18:28:40',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all Search Criteria
+ {
+ 'add_col': "`tabAddress`.address_line1 AS 'Address Line 1'\n`tabAddress`.address_line2 AS 'Address Line 2'\n`tabAddress`.city AS 'City'\n`tabAddress`.state AS 'State'\n`tabAddress`.pincode AS 'Pincode'\n`tabAddress`.country AS 'Country'\n`tabContact`.first_name AS 'Contact First Name'\n`tabContact`.last_name AS 'Contact Last Name'\n`tabContact`.phone AS 'Contact Phone'\n`tabContact`.mobile_no AS 'Contact Mobile'\n`tabContact`.email_id AS 'Contact Email'",
+ 'add_cond': '`tabAddress`.customer=`tabCustomer`.name\nifnull(`tabAddress`.is_primary_address, 0)=1\n`tabContact`.customer=`tabCustomer`.name\nifnull(`tabContact`.is_primary_contact, 0)=1',
+ 'add_tab': '`tabAddress`\n`tabContact`',
+ 'columns': 'Customer\x01ID,Customer\x01Customer Name',
+ 'criteria_name': 'Customer Address Contact',
+ 'doc_type': 'Customer',
+ 'doctype': 'Search Criteria',
+ 'filters': "{'Customer\x01Saved':1,'Customer\x01Submitted':1}",
+ 'module': 'Selling',
+ 'name': '__common__',
+ 'page_len': 50,
+ 'sort_by': '`tabCustomer`.`customer_name`',
+ 'sort_order': 'ASC',
+ 'standard': 'Yes'
+ },
+
+ # Search Criteria, customer_address_contact
+ {
+ 'doctype': 'Search Criteria',
+ 'name': 'customer_address_contact'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/email_settings/email_settings.py b/erpnext/setup/doctype/email_settings/email_settings.py
index ef0a763..c5e6a8e 100644
--- a/erpnext/setup/doctype/email_settings/email_settings.py
+++ b/erpnext/setup/doctype/email_settings/email_settings.py
@@ -21,6 +21,82 @@
"""
if self.doc.fields.get(key):
webnotes.conn.set_value('Control Panel', None, key, self.doc.fields[key])
+
+ def validate(self):
+ """
+ Checks connectivity to email servers before saving
+ """
+ self.validate_outgoing()
+ self.validate_incoming()
+
+
+ def validate_outgoing(self):
+ """
+ Checks incoming email settings
+ """
+ if self.doc.outgoing_mail_server:
+ from webnotes.utils import cint
+ import _socket
+ from webnotes.utils.email_lib.send import EMail
+ out_email = EMail()
+ out_email.server = self.doc.outgoing_mail_server.encode('utf-8')
+ out_email.port = cint(self.doc.mail_port)
+ out_email.use_ssl = self.doc.use_ssl
+ try:
+ out_email.login = self.doc.mail_login.encode('utf-8')
+ out_email.password = self.doc.mail_password.encode('utf-8')
+ except AttributeError, e:
+ webnotes.msgprint('Login Id or Mail Password missing. Please enter and try again.')
+ webnotes.msgprint(e)
+
+ try:
+ sess = out_email.smtp_connect()
+ try:
+ sess.quit()
+ except:
+ pass
+ except _socket.error, e:
+ # Invalid mail server -- due to refusing connection
+ webnotes.msgprint('Invalid Outgoing Mail Server. Please rectify and try again.')
+ webnotes.msgprint(e)
+ except smtplib.SMTPAuthenticationError, e:
+ webnotes.msgprint('Invalid Login Id or Mail Password. Please rectify and try again.')
+ except smtplib.SMTPException, e:
+ webnotes.msgprint('There is something wrong with your Outgoing Mail Settings. \
+ Please contact us at support@erpnext.com')
+ webnotes.msgprint(e)
+
+
+ def validate_incoming(self):
+ """
+ Checks support ticket email settings
+ """
+ if self.doc.sync_support_mails and self.doc.support_host:
+ 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.use_ssl = self.doc.support_use_ssl
+ try:
+ inc_email.username = self.doc.support_username.encode('utf-8')
+ inc_email.password = self.doc.support_password.encode('utf-8')
+ except AttributeError, e:
+ webnotes.msgprint('User Name or Support Password missing. Please enter and try again.')
+ webnotes.msgprint(e)
+
+ pop_mb = POP3Mailbox(inc_email)
+
+ try:
+ pop_mb.connect()
+ except _socket.error, e:
+ # Invalid mail server -- due to refusing connection
+ webnotes.msgprint('Invalid POP3 Mail Server. Please rectify and try again.')
+ webnotes.msgprint(e)
+ except poplib.error_proto, e:
+ webnotes.msgprint('Invalid User Name or Support Password. Please rectify and try again.')
+ webnotes.msgprint(e)
+
def on_update(self):
"""
@@ -39,4 +115,4 @@
set_event('support.doctype.support_ticket.get_support_mails', 60*5, 1)
else:
from webnotes.utils.scheduler import cancel_event
- cancel_event('support.doctype.support_ticket.get_support_mails')
\ No newline at end of file
+ cancel_event('support.doctype.support_ticket.get_support_mails')
diff --git a/erpnext/setup/doctype/email_settings/email_settings.txt b/erpnext/setup/doctype/email_settings/email_settings.txt
index ef6efe6..b6e52fc 100644
--- a/erpnext/setup/doctype/email_settings/email_settings.txt
+++ b/erpnext/setup/doctype/email_settings/email_settings.txt
@@ -5,18 +5,19 @@
{
'creation': '2010-08-08 17:08:59',
'docstatus': 0,
- 'modified': '2011-07-25 15:03:51',
+ 'modified': '2012-01-25 18:44:45',
'modified_by': 'Administrator',
'owner': 'harshada@webnotestech.com'
},
# These values are common for all DocType
{
- '_last_update': '1311586371',
+ '_last_update': '1325570647',
'allow_copy': 1,
'allow_email': 1,
'allow_print': 1,
'colour': 'White:FFF',
+ 'default_print_format': 'Standard',
'doctype': 'DocType',
'in_create': 1,
'issingle': 1,
@@ -24,7 +25,7 @@
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
- 'version': 34
+ 'version': 35
},
# These values are common for all DocField
@@ -59,21 +60,18 @@
# DocPerm
{
- 'doctype': 'DocPerm',
- 'idx': 1
+ 'doctype': 'DocPerm'
},
# DocPerm
{
- 'doctype': 'DocPerm',
- 'idx': 2
+ 'doctype': 'DocPerm'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 1,
'label': 'Outgoing Mails'
},
@@ -81,7 +79,6 @@
{
'doctype': 'DocField',
'fieldtype': 'HTML',
- 'idx': 2,
'label': '1',
'options': '<div class="help_box">Set your outgoing mail settings here. All system generated notifications, emails will go from this mail server</div>'
},
@@ -91,7 +88,6 @@
'doctype': 'DocField',
'fieldname': 'outgoing_mail_server',
'fieldtype': 'Data',
- 'idx': 3,
'label': 'Outgoing Mail Server'
},
@@ -99,8 +95,7 @@
{
'doctype': 'DocField',
'fieldname': 'mail_port',
- 'fieldtype': 'Data',
- 'idx': 4,
+ 'fieldtype': 'Int',
'label': 'Mail Port'
},
@@ -109,7 +104,6 @@
'doctype': 'DocField',
'fieldname': 'use_ssl',
'fieldtype': 'Check',
- 'idx': 5,
'label': 'Use SSL'
},
@@ -118,7 +112,6 @@
'doctype': 'DocField',
'fieldname': 'mail_login',
'fieldtype': 'Data',
- 'idx': 6,
'label': 'Login Id'
},
@@ -127,7 +120,6 @@
'doctype': 'DocField',
'fieldname': 'mail_password',
'fieldtype': 'Password',
- 'idx': 7,
'label': 'Mail Password'
},
@@ -136,7 +128,6 @@
'doctype': 'DocField',
'fieldname': 'auto_email_id',
'fieldtype': 'Data',
- 'idx': 8,
'label': 'Auto Email Id'
},
@@ -145,7 +136,6 @@
'description': 'Set the POP3 email settings to pull emails directly from a mailbox and create Support Tickets',
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 9,
'label': 'Support Ticket Mail Settings'
},
@@ -153,7 +143,6 @@
{
'doctype': 'DocField',
'fieldtype': 'HTML',
- 'idx': 10,
'label': '2',
'options': '<div class="help_box">To automatically create Support Tickets from your incoming mail, set your pop3 settings here.</div>'
},
@@ -162,7 +151,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 11,
'options': 'Simple'
},
@@ -173,7 +161,6 @@
'doctype': 'DocField',
'fieldname': 'sync_support_mails',
'fieldtype': 'Check',
- 'idx': 12,
'label': 'Sync Support Mails'
},
@@ -184,7 +171,6 @@
'doctype': 'DocField',
'fieldname': 'support_email',
'fieldtype': 'Data',
- 'idx': 13,
'label': 'Support Email'
},
@@ -195,7 +181,6 @@
'doctype': 'DocField',
'fieldname': 'support_host',
'fieldtype': 'Data',
- 'idx': 14,
'label': 'POP3 Mail Server'
},
@@ -204,7 +189,6 @@
'doctype': 'DocField',
'fieldname': 'support_use_ssl',
'fieldtype': 'Check',
- 'idx': 15,
'label': 'Use SSL'
},
@@ -213,7 +197,6 @@
'doctype': 'DocField',
'fieldname': 'support_username',
'fieldtype': 'Data',
- 'idx': 16,
'label': 'User Name'
},
@@ -222,15 +205,13 @@
'doctype': 'DocField',
'fieldname': 'support_password',
'fieldtype': 'Password',
- 'idx': 17,
'label': 'Support Password'
},
# DocField
{
'doctype': 'DocField',
- 'fieldtype': 'Column Break',
- 'idx': 18
+ 'fieldtype': 'Column Break'
},
# DocField
@@ -240,7 +221,6 @@
'doctype': 'DocField',
'fieldname': 'support_signature',
'fieldtype': 'Text',
- 'idx': 19,
'label': 'Signature'
},
@@ -251,7 +231,6 @@
'doctype': 'DocField',
'fieldname': 'support_autoreply',
'fieldtype': 'Text',
- 'idx': 20,
'label': 'Autoreply'
}
]
\ 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 d2604fd..2e0731c 100644
--- a/erpnext/setup/doctype/item_group/item_group.txt
+++ b/erpnext/setup/doctype/item_group/item_group.txt
@@ -5,16 +5,18 @@
{
'creation': '2010-08-08 17:09:06',
'docstatus': 0,
- 'modified': '2010-12-24 11:58:29',
- 'modified_by': 'abhishek@webnotestech.com',
+ 'modified': '2012-01-30 12:14:30',
+ 'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
+ '_last_update': '1322549700',
'allow_trash': 1,
'autoname': 'field:item_group_name',
'colour': 'White:FFF',
+ 'default_print_format': 'Standard',
'doctype': 'DocType',
'document_type': 'Master',
'in_create': 1,
@@ -25,7 +27,7 @@
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
- 'version': 54
+ 'version': 57
},
# These values are common for all DocField
@@ -59,7 +61,6 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 1,
'permlevel': 1,
'role': 'Material Manager',
'submit': 0,
@@ -72,7 +73,6 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 2,
'permlevel': 0,
'role': 'Material Manager',
'submit': 0,
@@ -85,7 +85,6 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 3,
'permlevel': 1,
'role': 'Material User',
'submit': 0,
@@ -98,7 +97,6 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 4,
'permlevel': 0,
'role': 'Material User',
'submit': 0,
@@ -110,7 +108,6 @@
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
- 'idx': 5,
'permlevel': 0,
'role': 'System Manager',
'write': 1
@@ -121,7 +118,6 @@
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
- 'idx': 6,
'permlevel': 0,
'role': 'Material Master Manager',
'write': 1
@@ -130,21 +126,8 @@
# DocField
{
'doctype': 'DocField',
- 'fieldname': 'trash_reason',
- 'fieldtype': 'Small Text',
- 'idx': 1,
- 'label': 'Trash Reason',
- 'oldfieldname': 'trash_reason',
- 'oldfieldtype': 'Small Text',
- 'permlevel': 1
- },
-
- # DocField
- {
- 'doctype': 'DocField',
'fieldname': 'item_group_name',
'fieldtype': 'Data',
- 'idx': 2,
'label': 'Item Group Name',
'oldfieldname': 'item_group_name',
'oldfieldtype': 'Data',
@@ -155,21 +138,8 @@
# DocField
{
'doctype': 'DocField',
- 'fieldname': 'show_in_catalogue',
- 'fieldtype': 'Check',
- 'idx': 3,
- 'label': 'Show in catalogue',
- 'oldfieldname': 'show_in_catalogue',
- 'oldfieldtype': 'Check',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Text',
- 'idx': 4,
'label': 'Description',
'oldfieldname': 'description',
'oldfieldtype': 'Text',
@@ -182,7 +152,6 @@
'doctype': 'DocField',
'fieldname': 'parent_item_group',
'fieldtype': 'Link',
- 'idx': 5,
'label': 'Parent Item Group',
'oldfieldname': 'parent_item_group',
'oldfieldtype': 'Link',
@@ -199,7 +168,6 @@
'doctype': 'DocField',
'fieldname': 'is_group',
'fieldtype': 'Select',
- 'idx': 6,
'label': 'Has Child Node',
'oldfieldname': 'is_group',
'oldfieldtype': 'Select',
@@ -211,10 +179,20 @@
# DocField
{
'doctype': 'DocField',
+ 'fieldname': 'trash_reason',
+ 'fieldtype': 'Small Text',
+ 'label': 'Trash Reason',
+ 'oldfieldname': 'trash_reason',
+ 'oldfieldtype': 'Small Text',
+ 'permlevel': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
'fieldname': 'lft',
'fieldtype': 'Int',
'hidden': 1,
- 'idx': 7,
'in_filter': 1,
'label': 'lft',
'no_copy': 1,
@@ -232,7 +210,6 @@
'fieldname': 'rgt',
'fieldtype': 'Int',
'hidden': 1,
- 'idx': 8,
'in_filter': 1,
'label': 'rgt',
'no_copy': 1,
@@ -248,13 +225,13 @@
{
'doctype': 'DocField',
'fieldname': 'old_parent',
- 'fieldtype': 'Data',
+ 'fieldtype': 'Link',
'hidden': 1,
- 'idx': 9,
'label': 'old_parent',
'no_copy': 1,
'oldfieldname': 'old_parent',
'oldfieldtype': 'Data',
+ 'options': 'Item Group',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1
diff --git a/erpnext/setup/doctype/manage_account/manage_account.js b/erpnext/setup/doctype/manage_account/manage_account.js
index 7c3b193..63cc1d5 100644
--- a/erpnext/setup/doctype/manage_account/manage_account.js
+++ b/erpnext/setup/doctype/manage_account/manage_account.js
@@ -1,6 +1,6 @@
// Validate
cur_frm.cscript.validate = function(doc, cdt, cdn) {
- $c_obj(make_doclist(cdt, cdn), 'update_cp', '', function(r, rt){
+ $c_obj(make_doclist(cdt, cdn), 'get_defaults', '', function(r, rt){
sys_defaults = r.message;
});
}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/manage_account/manage_account.py b/erpnext/setup/doctype/manage_account/manage_account.py
index 5b1292a..757d323 100644
--- a/erpnext/setup/doctype/manage_account/manage_account.py
+++ b/erpnext/setup/doctype/manage_account/manage_account.py
@@ -1,66 +1,60 @@
-# Please edit this list and import only required elements
+"""Global Defaults"""
import webnotes
-from webnotes.utils import cint, cstr, get_defaults, set_default, fmt_money, get_last_day, get_first_day
-from webnotes import session, form, is_testing, msgprint, errprint
-
-sql = webnotes.conn.sql
-
-
-# -----------------------------------------------------------------------------------------
-
+keydict = {
+ "fiscal_year": "current_fiscal_year",
+ 'company': 'default_company',
+ 'currency': 'default_currency',
+ 'price_list_name': 'default_price_list',
+ 'price_list_currency': 'default_price_list_currency',
+ 'item_group': 'default_item_group',
+ 'customer_group': 'default_customer_group',
+ 'cust_master_name': 'cust_master_name',
+ 'supplier_type': 'default_supplier_type',
+ 'supp_master_name': 'supp_master_name',
+ 'territory': 'default_territory',
+ 'stock_uom': 'default_stock_uom',
+ 'fraction_currency': 'default_currency_fraction',
+ 'valuation_method': 'default_valuation_method',
+ 'date_format': 'date_format',
+ 'currency_format':'default_currency_format',
+ 'account_url':'account_url'
+}
class DocType:
- def __init__(self, d, dl):
- self.doc, self.doclist = d, dl
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
-#---------------------------------------------------------------------------------------------------------------------------------------------
- def get_bal(self,arg):
- bal = sql("select `tabAccount Balance`.balance,`tabAccount`.debit_or_credit from `tabAccount`,`tabAccount Balance` where `tabAccount Balance`.account=%s and `tabAccount Balance`.period=%s and `tabAccount Balance`.account=`tabAccount`.name ",(arg,self.doc.current_fiscal_year))
- if bal:
- return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1]
-
-
-# =========================================================================================================================================
-
- # Update Default
- # ---------------
- def set_system_default(self, defkey, defvalue):
- set_default(defkey, defvalue)
-
- if defkey == 'fiscal_year':
- ysd = sql("select year_start_date from `tabFiscal Year` where name=%s", cstr(defvalue))
- ysd = ysd and ysd[0][0] or ''
- if ysd:
- set_default('year_start_date', ysd.strftime('%Y-%m-%d'))
- set_default('year_end_date', get_last_day(get_first_day(ysd,0,11)).strftime('%Y-%m-%d'))
-
-
- # Update
- # --------
- def update_cp(self):
- def_list = [['fiscal_year',self.doc.current_fiscal_year],
- ['company',self.doc.default_company],
- ['currency',self.doc.default_currency],
- ['price_list_name',self.doc.default_price_list or ''],
- ['price_list_currency', self.doc.default_price_list_currency or ''],
- ['item_group',self.doc.default_item_group or ''],
- ['customer_group',self.doc.default_customer_group or ''],
- ['cust_master_name',self.doc.cust_master_name or ''],
- ['supplier_type',self.doc.default_supplier_type or ''],
- ['supp_master_name',self.doc.supp_master_name],
- ['territory',self.doc.default_territory or ''],
- ['stock_uom',self.doc.default_stock_uom or ''],
- ['fraction_currency',self.doc.default_currency_fraction or ''],
- ['valuation_method',self.doc.default_valuation_method]]
-
- for d in def_list:
- self.set_system_default(d[0],d[1])
- # Update Currency Format
+ def get_bal(self,arg):
+ """get account balance (??)"""
+ from webnotes.utils import fmt_money, flt
+ bal = webnotes.conn.sql("select `tabAccount Balance`.balance,`tabAccount`.debit_or_credit from `tabAccount`,`tabAccount Balance` where `tabAccount Balance`.account=%s and `tabAccount Balance`.period=%s and `tabAccount Balance`.account=`tabAccount`.name ",(arg,self.doc.current_fiscal_year))
+ if bal:
+ return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1]
- sql("update `tabSingles` set value = '%s' where field = 'currency_format' and doctype = 'Control Panel'" % self.doc.default_currency_format)
- sql("update `tabSingles` set value = '%s' where field = 'date_format' and doctype = 'Control Panel'" %self.doc.date_format)
-
-
- return get_defaults()
-
+ def validate(self):
+ """validate"""
+ if not (self.doc.account_url and (self.doc.account_url.startswith('http://') \
+ or self.doc.account_url.startswith('https://'))):
+ webnotes.msgprint("Account URL must start with 'http://' or 'https://'", raise_exception=1)
+
+ def on_update(self):
+ """update defaults"""
+ self.validate()
+
+ for key in keydict:
+ webnotes.conn.set_default(key, self.doc.fields.get(keydict[key], ''))
+
+ # update year start date and year end date from fiscal_year
+ ysd = webnotes.conn.sql("""select year_start_date from `tabFiscal Year`
+ where name=%s""", self.doc.fiscal_year)
+
+ ysd = ysd and ysd[0][0] or ''
+ from webnotes.utils import get_first_day, get_last_day
+ if ysd:
+ webnotes.conn.set_default('year_start_date', ysd.strftime('%Y-%m-%d'))
+ webnotes.conn.set_default('year_end_date', \
+ get_last_day(get_first_day(ysd,0,11)).strftime('%Y-%m-%d'))
+
+ def get_defaults(self):
+ return webnotes.conn.get_defaults()
\ No newline at end of file
diff --git a/erpnext/setup/doctype/manage_account/manage_account.txt b/erpnext/setup/doctype/manage_account/manage_account.txt
index 8a156a0..18a9872 100644
--- a/erpnext/setup/doctype/manage_account/manage_account.txt
+++ b/erpnext/setup/doctype/manage_account/manage_account.txt
@@ -5,14 +5,13 @@
{
'creation': '2010-08-08 17:09:09',
'docstatus': 0,
- 'modified': '2011-12-21 13:22:33',
+ 'modified': '2012-01-20 11:25:18',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
-
'_last_update': '1323855502',
'allow_copy': 1,
'allow_email': 1,
@@ -29,7 +28,7 @@
'section_style': 'Tabbed',
'server_code_error': ' ',
'show_in_menu': 1,
- 'version': 515
+ 'version': 517
},
# These values are common for all DocField
@@ -106,6 +105,37 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
+ 'label': 'System'
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Example: http://frappe.erpnext.com',
+ 'doctype': 'DocField',
+ 'fieldname': 'account_url',
+ 'fieldtype': 'Data',
+ 'label': 'Account URL'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Column Break'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'sms_sender_name',
+ 'fieldtype': 'Data',
+ 'label': 'SMS Sender Name'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Section Break',
'label': 'Company'
},
@@ -176,14 +206,6 @@
# DocField
{
'doctype': 'DocField',
- 'fieldname': 'sms_sender_name',
- 'fieldtype': 'Data',
- 'label': 'SMS Sender Name'
- },
-
- # DocField
- {
- 'doctype': 'DocField',
'fieldtype': 'Section Break',
'label': 'Stock'
},
@@ -510,4 +532,4 @@
'label': 'Employee Records to be created by ',
'options': '\nNaming Series\nEmployee Number'
}
-]
+]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/notification_control/notification_control.js b/erpnext/setup/doctype/notification_control/notification_control.js
index 112395e..d8133bb 100644
--- a/erpnext/setup/doctype/notification_control/notification_control.js
+++ b/erpnext/setup/doctype/notification_control/notification_control.js
@@ -6,41 +6,42 @@
refresh_field('custom_message');
}
$c_obj('Notification Control','get_message',doc.select_transaction, callback)
- }
+}
}
cur_frm.cscript.notify = function(doc, args) {
- if(validate_email(args['send_to'] || doc.contact_email || '')) {
- $c_obj('Notification Control', 'get_formatted_message', {
- type: args['type'],
- doctype: args['doctype'],
- contact_name: args['contact_name'] || doc.contact_display
- }, function(r, rt) {
- if(!r.exc) {
- var res = JSON.parse(r.message);
- var send_from = (function() {
- if(user!='Administrator') {
- return user;
- } else {
- var cp = locals['Control Panel']['Control Panel'];
- return (cp.auto_email_id || 'automail@erpnext.com');
- }
- })();
- if(res.send) {
+ $c_obj('Notification Control', 'get_formatted_message', {
+ type: args['type'],
+ doctype: args['doctype'],
+ contact_name: args['contact_name'] || doc.contact_display
+ }, function(r, rt) {
+ if(!r.exc) {
+ var res = JSON.parse(r.message);
+ var send_from = (function() {
+ if(user!='Administrator') {
+ return user;
+ } else {
+ return (wn.control_panel.auto_email_id || 'automail@erpnext.com');
+ }
+ })();
+ if(res.send) {
+ if(validate_email(args['send_to'] || doc.contact_email || '')) {
var print_heading = (doc.select_print_heading || args['type'])
sendmail(
args['send_to'] || doc.contact_email,
send_from,
send_from,
- doc.company + " - " + print_heading,
+ doc.company + " - " + print_heading + " - " + doc.name,
res.message,
res.print_format
);
msgprint('This ' + print_heading + ' is being sent to <b>'
+ (args['send_to'] || doc.contact_email) + '</b><br />...');
+ } else {
+ msgprint('Invalid/Missing Email Address. ' + print_heading + ' not sent.');
}
}
- //console.log(JSON.parse(r.message));
- });
- }
+ }
+ //console.log(JSON.parse(r.message));
+ });
}
diff --git a/erpnext/setup/page/setup/setup.html b/erpnext/setup/page/setup/setup.html
index e60d00b..ec21ab7 100644
--- a/erpnext/setup/page/setup/setup.html
+++ b/erpnext/setup/page/setup/setup.html
@@ -1 +1,3 @@
-<div id="setup_div" class="layout_wrapper"></div>
\ No newline at end of file
+<div id="setup_div" class="layout_wrapper">
+ <div style="margin: 200px auto; text-align: center; color: #888">Loading...</div>
+</div>
\ No newline at end of file
diff --git a/erpnext/setup/page/setup/setup.js b/erpnext/setup/page/setup/setup.js
index b3a195e..d58f11a 100644
--- a/erpnext/setup/page/setup/setup.js
+++ b/erpnext/setup/page/setup/setup.js
@@ -1,9 +1,8 @@
pscript.onload_Setup = function() {
var parent = $i('setup_div');
- add_space_holder(parent);
var callback = function(r,rt){
-
+ $('#setup_div').empty();
// header
parent.page_head = new PageHeader(parent,'Setup');
@@ -11,7 +10,6 @@
var setup_data = new SetupData(r.message);
pscript.setup_make_sections(setup_data);
- remove_space_holder();
}
$c_obj('Setup Wizard Control','get_country','',callback);
}
diff --git a/erpnext/setup_masters/Module Def/Setup Masters/Setup Masters.txt b/erpnext/setup_masters/Module Def/Setup Masters/Setup Masters.txt
new file mode 100644
index 0000000..fe1a048
--- /dev/null
+++ b/erpnext/setup_masters/Module Def/Setup Masters/Setup Masters.txt
@@ -0,0 +1,29 @@
+# Module Def, Setup Masters
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2010-08-08 17:35:42',
+ 'docstatus': 0,
+ 'modified': '2012-01-23 17:04:53',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all Module Def
+ {
+ 'disabled': 'No',
+ 'doctype': u'Module Def',
+ 'is_hidden': 'No',
+ 'last_updated_date': '2010-11-29 12:02:02',
+ 'module_label': 'Setup Masters',
+ 'module_name': 'Setup Masters',
+ 'name': '__common__'
+ },
+
+ # Module Def, Setup Masters
+ {
+ 'doctype': u'Module Def',
+ 'name': 'Setup Masters'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py
index 304d2e4..e3e7fa9 100644
--- a/erpnext/startup/event_handlers.py
+++ b/erpnext/startup/event_handlers.py
@@ -1,103 +1,68 @@
import webnotes
import webnotes.defs
from webnotes.utils import cint
+import home
-#
-# alias the current user
-#
def on_login(login_manager):
-
- # login as
- if login_manager.user == 'Administrator':
- user = webnotes.form.getvalue('login_as')
-
- if user:
- # create if missing (due to some bug)
- login_as(user, login_manager)
-
- # alisaing here... so check if the user is disabled
- if not webnotes.conn.sql("select ifnull(enabled,0) from tabProfile where name=%s", user)[0][0]:
- # throw execption
- webnotes.msgprint("Authentication Failed", raise_exception=1)
-
- if hasattr(webnotes.defs, 'validate_ip'):
- msg = getattr(webnotes.defs, 'validate_ip')()
- if msg: webnotes.msgprint(msg, raise_exception=1)
-
- login_manager.user = user
-
-#
-# update account details
-#
-def update_account_details():
- # additional details (if from gateway)
- if webnotes.form_dict.get('is_trial'):
- webnotes.conn.set_global('is_trial', cint(webnotes.form_dict.get('is_trial')))
-
- if webnotes.form_dict.get('days_to_expiry'):
- webnotes.conn.set_global('days_to_expiry', webnotes.form_dict.get('days_to_expiry'))
-
- if webnotes.form_dict.get('first_name'):
- from server_tools.gateway_utils import update_user_details
- update_user_details()
+ """
+ called from login manager, before login
+ """
+ if login_manager.user not in ('Guest', None, ''):
+ try:
+ import server_tools.gateway_utils
+ server_tools.gateway_utils.check_login(login_manager.user)
+ except ImportError:
+ pass
-#
-# save (login from)
-#
def on_login_post_session(login_manager):
- # login from
- if webnotes.form_dict.get('login_from'):
- webnotes.session['data']['login_from'] = webnotes.form.getvalue('login_from')
- webnotes.session_obj.update()
-
+ """
+ called after login
+ update login_from and delete parallel sessions
+ """
# Clear previous sessions i.e. logout previous log-in attempts
- exception_list = ['demo@webnotestech.com', 'Administrator']
+ exception_list = ['demo@webnotestech.com', 'Administrator', 'Guest']
if webnotes.session['user'] not in exception_list:
sid_list = webnotes.conn.sql("""
- SELECT sid
- FROM `tabSessions`
+ DELETE FROM `tabSessions`
WHERE
user=%s AND
- sid!=%s
- ORDER BY lastupdate desc""", \
+ sid!=%s""", \
(webnotes.session['user'], webnotes.session['sid']), as_list=1)
- for sid in sid_list:
- webnotes.conn.sql("DELETE FROM `tabSessions` WHERE sid=%s", sid[0])
- update_account_details()
+ if webnotes.session['user'] not in ('Guest'):
+ # create feed
+ from webnotes.utils import nowtime
+ home.make_feed('Login', 'Profile', login_manager.user, login_manager.user,
+ '%s logged in at %s' % (login_manager.user_fullname, nowtime()),
+ login_manager.user=='Administrator' and '#8CA2B3' or '#1B750D')
-#
-# logout the user from SSO
-#
-def on_logout(login_manager):
- if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
- from server_tools.gateway_utils import logout_sso
- logout_sso(user=login_manager.user)
+def comment_added(doc):
+ """add comment to feed"""
+ import json
+ home.make_feed('Comment', doc.comment_doctype, doc.comment_docname, doc.comment_by,
+ '<i>"' + doc.comment + '"</i>', '#6B24B3')
-#
-# create a profile (if logs in for the first time)
-#
-def login_as(user, login_manager):
- import os
+def doclist_all(doc, method):
+ """doclist trigger called from webnotes.model.doclist on any event"""
+ home.update_feed(doc, method)
+
+def boot_session(bootinfo):
+ """boot session - send website info if guest"""
import webnotes
- webnotes.session = {'user': user}
- ip = os.environ.get('REMOTE_ADDR')
+ import webnotes.model.doc
+
+ if webnotes.session['user']=='Guest':
+ bootinfo['website_settings'] = webnotes.model.doc.getsingle('Website Settings')
+ bootinfo['website_menus'] = webnotes.conn.sql("""select label, std_page, custom_page,
+ parent_label, parentfield
+ from `tabTop Bar Item` where parent='Website Settings' order by idx asc""", as_dict=1)
+ bootinfo['custom_css'] = webnotes.conn.get_value('Style Settings', None, 'custom_css') or ''
+ else:
+ bootinfo['letter_heads'] = get_letter_heads()
- # validate if user is from SSO
- if ip == '72.55.168.105' or 1:
- # if user does not exist, create it
- if not webnotes.conn.sql("select name from tabProfile where name=%s", user):
- from webnotes.model.doc import Document
-
- import webnotes
- import webnotes.utils.webservice
-
- p = Document('Profile')
- p.first_name = webnotes.form_dict.get('first_name')
- p.last_name = webnotes.form_dict.get('last_name')
- p.email = user
- p.name = user
- p.enabled = 1
- p.owner = user
- p.save(1)
-
+def get_letter_heads():
+ """load letter heads with startup"""
+ import webnotes
+ ret = webnotes.conn.sql("""select name, content from `tabLetter Head`
+ where ifnull(disabled,0)=0""")
+ return dict(ret)
diff --git a/erpnext/startup/feature_setup.js b/erpnext/startup/feature_setup.js
new file mode 100644
index 0000000..ba81cbd
--- /dev/null
+++ b/erpnext/startup/feature_setup.js
@@ -0,0 +1,187 @@
+/* features setup "Dictionary", "Script"
+Dictionary Format
+ 'projects': {
+ 'Sales Order': {
+ 'fields':['project_name'],
+ 'sales_order_details':['projected_qty']
+ },
+ 'Purchase Order': {
+ 'fields':['project_name']
+ }
+ }
+// ====================================================================*/
+pscript.feature_dict = {
+ 'fs_projects': {
+ 'Bill Of Materials': {'fields':['project_name']},
+ 'Delivery Note': {'fields':['project_name']},
+ 'Payable Voucher': {'fields':['project_name']},
+ 'Production Order': {'fields':['project_name']},
+ 'Purchase Order': {'fields':['project_name']},
+ 'Purchase Receipt': {'fields':['project_name']},
+ 'Receivable Voucher': {'fields':['project_name']},
+ 'Sales Order': {'fields':['project_name']},
+ 'Stock Entry': {'fields':['project_name']},
+ 'Timesheet': {'timesheet_details':['project_name']}
+ },
+ 'fs_packing_details': {
+ 'Delivery Note': {'fields':['packing_details','print_packing_slip','packing_checked_by','packed_by','pack_size','shipping_mark'],'delivery_note_details':['no_of_packs','pack_gross_wt','pack_nett_wt','pack_no','pack_unit']},
+ 'Sales Order': {'fields':['packing_details']}
+ },
+ 'fs_discounts': {
+ 'Delivery Note': {'delivery_note_details':['adj_rate']},
+ 'Quotation': {'quotation_details':['adj_rate']},
+ 'Receivable Voucher': {'entries':['adj_rate']},
+ 'Sales Order': {'sales_order_details':['adj_rate','ref_rate']}
+ },
+ 'fs_purchase_discounts': {
+ 'Purchase Order': {'po_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
+ 'Purchase Receipt': {'purchase_receipt_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
+ 'Payable Voucher': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}
+ },
+ 'fs_brands': {
+ 'Delivery Note': {'delivery_note_details':['brand']},
+ 'Indent': {'indent_details':['brand']},
+ 'Item': {'fields':['brand']},
+ 'Purchase Order': {'po_details':['brand']},
+ 'Payable Voucher': {'entries':['brand']},
+ 'Quotation': {'quotation_details':['brand']},
+ 'Receivable Voucher': {'entries':['brand']},
+ 'Sales BOM': {'fields':['new_item_brand']},
+ 'Sales Order': {'sales_order_details':['brand']},
+ 'Serial No': {'fields':['brand']}
+ },
+ 'fs_after_sales_installations': {
+ 'Delivery Note': {'fields':['installation_status','per_installed'],'delivery_note_details':['installed_qty']}
+ },
+ 'fs_item_batch_nos': {
+ 'Delivery Note': {'delivery_note_details':['batch_no']},
+ 'Item': {'fields':['has_batch_no']},
+ 'Purchase Receipt': {'purchase_receipt_details':['batch_no']},
+ 'QA Inspection Report': {'fields':['batch_no']},
+ 'Sales and Pruchase Return Wizard': {'return_details':['batch_no']},
+ 'Receivable Voucher': {'entries':['batch_no']},
+ 'Stock Entry': {'mtn_details':['batch_no']},
+ 'Stock Ledger Entry': {'fields':['batch_no']}
+ },
+ 'fs_item_serial_nos': {
+ 'Customer Issue': {'fields':['serial_no']},
+ 'Delivery Note': {'delivery_note_details':['serial_no'],'packing_details':['serial_no']},
+ 'Installation Note': {'installed_item_details':['serial_no']},
+ 'Item': {'fields':['has_serial_no']},
+ 'Maintenance Schedule': {'item_maintenance_details':['serial_no'],'maintenance_schedule_details':['serial_no']},
+ 'Maintenance Visit': {'maintenance_visit_details':['serial_no']},
+ 'Purchase Receipt': {'purchase_receipt_details':['serial_no']},
+ 'QA Inspection Report': {'fields':['item_serial_no']},
+ 'Sales and Pruchase Return Wizard': {'return_details':['serial_no']},
+ 'Receivable Voucher': {'entries':['serial_no']},
+ 'Stock Entry': {'mtn_details':['serial_no']},
+ 'Stock Ledger Entry': {'fields':['serial_no']}
+ },
+ 'fs_item_group_in_details': {
+ 'Delivery Note': {'delivery_note_details':['item_group']},
+ 'Enquiry': {'enquiry_details':['item_group']},
+ 'Indent': {'indent_details':['item_group']},
+ 'Item': {'fields':['item_group']},
+ 'Manage Account': {'fields':['default_item_group']},
+ 'Purchase Order': {'po_details':['item_group']},
+ 'Purchase Receipt': {'purchase_receipt_details':['item_group']},
+ 'Purchase Voucher': {'entries':['item_group']},
+ 'Quotation': {'quotation_details':['item_group']},
+ 'Receivable Voucher': {'entries':['item_group']},
+ 'Sales BOM': {'fields':['serial_no']},
+ 'Sales Order': {'sales_order_details':['item_group']},
+ 'Serial No': {'fields':['item_group']},
+ 'Sales Partner': {'partner_target_details':['item_group']},
+ 'Sales Person': {'target_details':['item_group']},
+ 'Territory': {'target_details':['item_group']}
+ },
+ 'fs_page_break': {
+ 'Delivery Note': {'delivery_note_details':['page_break'],'packing_details':['page_break']},
+ 'Indent': {'indent_details':['page_break']},
+ 'Purchase Order': {'po_details':['page_break']},
+ 'Purchase Receipt': {'purchase_receipt_details':['page_break']},
+ 'Purchase Voucher': {'entries':['page_break']},
+ 'Quotation': {'quotation_details':['page_break']},
+ 'Receivable Voucher': {'entries':['page_break']},
+ 'Sales Order': {'sales_order_details':['page_break']}
+ },
+ 'fs_exports': {
+ 'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','export_amount','export_rate']},
+ 'POS Setting': {'fields':['conversion_rate','currency']},
+ 'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','export_amount','export_rate']},
+ 'Receivable Voucher': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','export_amount','export_rate']},
+ 'Item': {'ref_rate_details':['ref_currency']},
+ 'Sales BOM': {'fields':['currency']},
+ 'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','export_amount','export_rate']}
+ },
+ 'fs_imports': {
+ 'Payable Voucher': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['import_amount','import_rate']},
+ 'Purchase Order': {'fields':['Note HTML','conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'po_details':['import_amount','import_rate']},
+ 'Purchase Receipt': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'purchase_receipt_details':['import_amount','import_rate']},
+ 'Supplier Quotation': {'fields':['conversion_rate','currency']}
+ },
+ 'fs_item_advanced': {
+ 'Item': {'fields':['item_customer_details']}
+ },
+ 'fs_sales_extras': {
+ 'Address': {'fields':['sales_partner']},
+ 'Contact': {'fields':['sales_partner']},
+ 'Customer': {'fields':['sales_team']},
+ 'Delivery Note': {'fields':['sales_team','Packing List']},
+ 'Item': {'fields':['item_customer_details']},
+ 'Receivable Voucher': {'fields':['sales_team']},
+ 'Sales Order': {'fields':['sales_team','Packing List']}
+ },
+ 'fs_more_info': {
+ 'Customer': {'fields':['More Info']},
+ 'Delivery Note': {'fields':['More Info']},
+ 'Enquiry': {'fields':['More Info']},
+ 'Indent': {'fields':['More Info']},
+ 'Lead': {'fields':['More Info']},
+ 'Payable Voucher': {'fields':['More Info']},
+ 'Purchase Order': {'fields':['More Info']},
+ 'Purchase Receipt': {'fields':['More Info']},
+ 'Quotation': {'fields':['More Info']},
+ 'Receivable Voucher': {'fields':['More Info']},
+ 'Sales Order': {'fields':['More Info']},
+ 'Serial No': {'fields':['More Info']},
+ 'Supplier': {'fields':['More Info']}
+ },
+ 'fs_quality': {
+ 'Item': {'fields':['Item Inspection Criteria','inspection_required']},
+ 'Purchase Receipt': {'purchase_receipt_details':['qa_no']}
+ },
+ 'fs_manufacturing': {
+ 'Item': {'fields':['Manufacturing']}
+ },
+ 'fs_pos': {
+ 'Receivable Voucher': {'fields':['is_pos']}
+ },
+ 'fs_recurring_invoice': {
+ 'Receivable Voucher': {'fields': ['Recurring Invoice']}
+ }
+}
+
+$(document).bind('form_refresh', function() {
+ for(sys_feat in sys_defaults)
+ {
+ if(sys_defaults[sys_feat]=='0' && (sys_feat in pscript.feature_dict)) //"Features to hide" exists
+ {
+ if(cur_frm.doc.doctype in pscript.feature_dict[sys_feat])
+ {
+ for(fort in pscript.feature_dict[sys_feat][cur_frm.doc.doctype])
+ {
+ if(fort=='fields')
+ hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]);
+ else if(cur_frm.fields_dict[fort])
+ {
+ for(grid_field in pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort])
+ cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort][grid_field], false);
+ }
+ else
+ msgprint('Grid "'+fort+'" does not exists');
+ }
+ }
+ }
+ }
+})
diff --git a/erpnext/startup/modules.js b/erpnext/startup/modules.js
new file mode 100644
index 0000000..c22aee0
--- /dev/null
+++ b/erpnext/startup/modules.js
@@ -0,0 +1,384 @@
+// ====================================================================
+
+pscript.startup_make_sidebar = function() {
+ $y(page_body.left_sidebar, {width:(100/6)+'%', paddingTop:'8px'});
+
+ var callback = function(r,rt) {
+ // menu
+ var ml = r.message;
+
+ // clear
+ page_body.left_sidebar.innerHTML = '';
+
+ for(var m=0; m<ml.length; m++){
+ if(ml[m]) {
+ new SidebarItem(ml[m]);
+ }
+ }
+ if(in_list(user_roles, 'System Manager')) {
+ var div = $a(page_body.left_sidebar, 'div', 'link_type', {padding:'8px', fontSize:'11px'});
+ $(div).html('[edit]').click(pscript.startup_set_module_order)
+ }
+ nav_obj.observers.push({notify:function(t,dt,dn) { pscript.select_sidebar_menu(t, dt, dn); }});
+
+ // select current
+ var no = nav_obj.ol[nav_obj.ol.length-1];
+ if(no && menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
+ pscript.select_sidebar_menu(decodeURIComponent(no[0]), decodeURIComponent(no[1]));
+ }
+ $c_obj('Home Control', 'get_modules', '', callback);
+}
+
+// ====================================================================
+// Menu observer
+// ====================================================================
+
+cur_menu_pointer = null;
+var menu_item_map = {'Form':{}, 'Page':{}, 'Report':{}, 'List':{}}
+
+pscript.select_sidebar_menu = function(t, dt, dn) {
+ // get menu item
+ if(menu_item_map[t][dt]) {
+ // select
+ menu_item_map[t][dt].select();
+ } else {
+ // none found :-( Unselect
+ if(cur_menu_pointer)
+ cur_menu_pointer.deselect();
+ }
+}
+
+// ====================================================================
+// Menu pointer
+// ====================================================================
+
+var body_background = '#e2e2e2';
+
+MenuPointer = function(parent, label) {
+ var me = this;
+ this.wrapper = $a(parent, 'div', '', {padding:'0px', cursor:'pointer', margin:'2px 0px'});
+ $br(this.wrapper, '3px');
+
+ this.tab = make_table($a(this.wrapper, 'div'), 1, 2, '100%', ['', '11px'], {height:'22px',
+ verticalAlign:'middle', padding:'0px'}, {borderCollapse:'collapse', tableLayout:'fixed'});
+
+ $y($td(this.tab, 0, 0), {padding:'0px 4px', color:'#444', whiteSpace:'nowrap'});
+
+ // triangle border (?)
+ this.tab.triangle_div = $a($td(this.tab, 0, 1), 'div','', {
+ borderColor: body_background + ' ' + body_background + ' ' + body_background + ' ' + 'transparent',
+ borderWidth:'11px', borderStyle:'solid', height:'0px', width:'0px', marginRight:'-11px'});
+
+ this.label_area = $a($td(this.tab, 0, 0), 'span', '', '', label);
+
+ $(this.wrapper)
+ .hover(
+ function() { if(!me.selected)
+ $bg(this, '#eee'); } ,
+ function() { if(!me.selected)
+ $bg(this, body_background); }
+ )
+
+ $y($td(this.tab, 0, 0), {borderBottom:'1px solid #ddd'});
+
+}
+
+// ====================================================================
+
+MenuPointer.prototype.select = function(grey) {
+ $y($td(this.tab, 0, 0), {
+ color:'#fff', borderBottom:'0px solid #000'
+ });
+ $(this.wrapper).css('background-color', '#999');
+ this.selected = 1;
+
+ if(cur_menu_pointer && cur_menu_pointer != this)
+ cur_menu_pointer.deselect();
+
+ cur_menu_pointer = this;
+}
+
+// ====================================================================
+
+MenuPointer.prototype.deselect = function() {
+ $y($td(this.tab, 0, 0), {color:'#444', borderBottom:'1px solid #ddd'});
+ $(this.wrapper).css('background-color', body_background);
+ this.selected = 0;
+}
+
+
+// ====================================================================
+// Sidebar Item
+// ====================================================================
+
+var cur_sidebar_item = null;
+
+SidebarItem = function(det) {
+ var me = this;
+ this.det = det;
+ this.wrapper = $a(page_body.left_sidebar, 'div', '', {marginRight:'12px'});
+
+ this.body = $a(this.wrapper, 'div');
+ this.tab = make_table(this.body, 1, 2, '100%', ['24px', null], {verticalAlign:'middle'}, {tableLayout:'fixed'});
+
+ // icon
+ var ic = $a($td(this.tab, 0, 0), 'div', 'module-icons module-icons-' + det.module_label.toLowerCase(), {marginLeft:'3px', marginBottom:'-2px'});
+
+ // pointer table
+ this.pointer = new MenuPointer($td(this.tab, 0, 1), det.module_label);
+ $y($td(this.pointer.tab, 0, 0), {fontWeight:'bold'});
+
+ // for page type
+ if(det.module_page) {
+ menu_item_map.Page[det.module_page] = this.pointer;
+ }
+
+ // items area
+ this.items_area = $a(this.wrapper, 'div');
+
+ this.body.onclick = function() { me.onclick(); }
+}
+
+// ====================================================================
+
+SidebarItem.prototype.onclick = function() {
+ var me = this;
+
+ if(this.det.module_page) {
+ // page type
+ this.pointer.select();
+
+ $(me.pointer.label_area).set_working();
+ loadpage(this.det.module_page, function() {
+ $(me.pointer.label_area).done_working();
+ });
+
+ } else {
+ // show sub items
+ this.toggle();
+ }
+}
+
+// ====================================================================
+
+SidebarItem.prototype.collapse = function() {
+ $(this.items_area).slideUp();
+ this.is_open = 0;
+ $fg(this.pointer.label_area, '#444')
+}
+
+// ====================================================================
+
+SidebarItem.prototype.toggle = function() {
+ if(this.loading) return;
+
+ if(this.is_open) {
+ this.collapse();
+ } else {
+ if(this.loaded) $(this.items_area).slideDown();
+ else this.show_items();
+ this.is_open = 1;
+ $fg(this.pointer.label_area, '#000')
+ //this.pointer.select(1);
+
+ // close existing open
+ if(cur_sidebar_item && cur_sidebar_item != this) {
+ cur_sidebar_item.collapse();
+ }
+ cur_sidebar_item = this;
+ }
+}
+
+// ====================================================================
+
+SidebarItem.prototype.show_items = function() {
+ this.loading = 1;
+ var me = this;
+
+ $(this.pointer.label_area).set_working();
+ var callback = function(r,rt){
+ me.loaded = 1;
+ me.loading = 0;
+ var smi = null;
+ var has_reports = 0;
+ var has_tools = 0;
+
+ // widget code
+ $(me.pointer.label_area).done_working();
+
+ if(r.message.il) {
+ me.il = r.message.il;
+
+ // forms
+ for(var i=0; i<me.il.length;i++){
+ if(me.il[i].doc_type == 'Forms') {
+ if(in_list(profile.can_read, me.il[i].doc_name)) {
+ var smi = new SidebarModuleItem(me, me.il[i]);
+
+ menu_item_map['Form'][me.il[i].doc_name] = smi.pointer;
+ menu_item_map['List'][me.il[i].doc_name] = smi.pointer;
+ }
+ }
+ if(me.il[i].doc_type=='Reports') has_reports = 1;
+ if(in_list(['Single DocType', 'Pages', 'Setup Forms'], me.il[i].doc_type))
+ has_tools = 1;
+ }
+ // reports
+ if(has_reports) {
+ var smi = new SidebarModuleItem(me, {doc_name:'Reports', doc_type:'Reports'});
+
+ // add to menu-item mapper
+ menu_item_map['Page'][me.det.module_label + ' Reports'] = smi.pointer;
+ }
+
+ // tools
+ if(has_tools) {
+ var smi = new SidebarModuleItem(me, {doc_name:'Tools', doc_type:'Tools'});
+
+ // add to menu-item mapper
+ menu_item_map['Page'][me.det.module_label + ' Tools'] = smi.pointer;
+ }
+
+ // custom reports
+ if(r.message.custom_reports.length) {
+ me.il = add_lists(r.message.il, r.message.custom_reports);
+ var smi = new SidebarModuleItem(me, {doc_name:'Custom Reports', doc_type:'Custom Reports'});
+
+ // add to menu-item mapper
+ menu_item_map['Page'][me.det.module_label + ' Custom Reports'] = smi.pointer;
+ }
+ }
+
+
+ $(me.items_area).slideDown();
+
+ // high light
+ var no = nav_obj.ol[nav_obj.ol.length-1];
+ if(no && menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
+ pscript.select_sidebar_menu(decodeURIComponent(no[0]), decodeURIComponent(no[1]));
+
+ }
+
+ $c_obj('Home Control', 'get_module_details', me.det.name, callback);
+}
+
+// ====================================================================
+// Show Reports
+// ====================================================================
+
+SidebarItem.prototype.show_section = function(sec_type) {
+ var me = this;
+ var label = this.det.module_label + ' ' + sec_type;
+ var type_map = {'Reports':'Reports', 'Custom Reports':'Custom Reports',
+ 'Pages':'Tools', 'Single DocType':'Tools', 'Setup Forms':'Tools'}
+
+
+ if(page_body.pages[label]) {
+ loadpage(label, null, 1);
+ } else {
+
+ // make the reports page
+ var page = page_body.add_page(label);
+ this.wrapper = $a(page,'div','layout_wrapper');
+
+
+ // head
+ this.head = new PageHeader(this.wrapper, label);
+
+ // body
+ this.body1 = $a(this.wrapper, 'div', '', {marginTop:'16px'});
+
+ // add a report link
+ var add_link = function(det) {
+ var div = $a(me.body1, 'div', '', {marginBottom:'6px'});
+ var span = $a(div, 'span', 'link_type');
+
+ // tag the span
+ span.innerHTML = det.display_name; span.det = det;
+ if(sec_type=='Reports' || sec_type=='Custom Reports') {
+ // Reports
+ // -------
+ span.onclick = function() { loadreport(this.det.doc_name, this.det.display_name); }
+
+ } else {
+ // Tools
+ // -----
+
+ if(det.doc_type=='Pages') {
+ // Page
+ if(det.click_function) {
+ span.onclick = function() { eval(this.det.click_function) }
+ span.click_function = det.click_function;
+ } else {
+ span.onclick = function() { loadpage(this.det.doc_name); }
+ }
+ } else if(det.doc_type=='Setup Forms') {
+ // Doc Browser
+ span.onclick = function() { loaddocbrowser(this.det.doc_name); }
+ } else {
+ // Single
+ span.onclick = function() { loaddoc(this.det.doc_name, this.det.doc_name); }
+ }
+ }
+ }
+
+ // item list
+ for(var i=0; i<me.il.length;i++){
+ if(type_map[me.il[i].doc_type] == sec_type) {
+ add_link(me.il[i]);
+ }
+ }
+ loadpage(label, null, 1);
+ }
+}
+
+
+// ====================================================================
+// Sidebar module item
+// ====================================================================
+
+SidebarModuleItem = function(si, det) {
+ this.det = det;
+ var me= this;
+
+ this.pointer = new MenuPointer(si.items_area, get_doctype_label(det.doc_name));
+ $y(si.items_area, {marginLeft:'32px'})
+ $y($td(this.pointer.tab, 0, 0), {fontSize:'11px'});
+
+ this.pointer.wrapper.onclick = function() {
+ if(me.det.doc_type=='Forms')
+ loaddocbrowser(det.doc_name);
+ else
+ si.show_section(me.det.doc_type);
+ }
+}
+
+
+// ====================================================================
+// Drag & Drop order selection
+// ====================================================================
+
+pscript.startup_set_module_order = function() {
+ var update_order= function(ml) {
+ mdict = {};
+ for(var i=0; i<ml.length; i++) {
+ mdict[ml[i][3][3]] = {'module_seq':ml[i][1], 'is_hidden':(ml[i][2] ? 'No' : 'Yes')}
+ }
+ $c_obj('Home Control', 'set_module_order', JSON.stringify(mdict), function(r,rt) { pscript.startup_make_sidebar(); } )
+ }
+
+ var callback = function(r, rt) {
+ var ml = [];
+ for(var i=0; i<r.message.length; i++) {
+ var det = r.message[i];
+ ml.push([det[1], det[2], (det[3]!='No' ? 0 : 1), det[0]]);
+ }
+ new ListSelector('Set Module Sequence', 'Select items and set the order you want them to appear'+
+ '<br><b>Note:</b> <i>These changes will apply to all users!</i>', ml, update_order, 1);
+ }
+ $c_obj('Home Control', 'get_module_order', '', callback)
+
+}
+
+
+
diff --git a/erpnext/startup/modules_new.js b/erpnext/startup/modules_new.js
new file mode 100644
index 0000000..5f912b0
--- /dev/null
+++ b/erpnext/startup/modules_new.js
@@ -0,0 +1,36 @@
+// Tools Page
+erpnext.ListPage = Class.extend({
+ init: function(opts) {
+ var me = this;
+ this.opts = opts;
+ this.page = page_body.add_page[opts.title];
+ this.page.wrapper = $a(this.page, 'div', 'layout_wrapper');
+ this.page.head = new PageHeading(this.wrapper, this.title)
+ this.page.list = new wn.widgets.Listing({
+ parent: this.page.wrapper,
+ query: opts.query,
+ render:row: opts.render_row
+ });
+ },
+ show: function() {
+ if(this.first) {
+ this.page.list.run();
+ this.first = false;
+ }
+ page_body.change_to(this.opts.title);
+ }
+});
+
+erpnext.ToolsPage = erpnext.ListPage.extend({
+ init: function(opts) {
+ this._super({
+ title: opts.module + ' Settings',
+ query: repl('select name, description from tabDocType where \
+ module=%(module)s and ifnull(issingle,0)=1 order by name asc', opts),
+ render_row: function(parent, data) {
+ parent.innerHTML = repl('<a href="#!Form/%(name)s/%(name)s">%(name)s</a>\
+ <div class="comment">%(description)s</div>', data)
+ }
+ })
+ }
+});
\ No newline at end of file
diff --git a/erpnext/startup/startup.css b/erpnext/startup/startup.css
index 7b2b6e5..4f66519 100644
--- a/erpnext/startup/startup.css
+++ b/erpnext/startup/startup.css
@@ -1,33 +1,29 @@
-h1, h2, h3, h4 {
- font-family: Tahoma, Sans Serif;
+h1, h2, h3, h4, h5 {
+ font-family: Tahoma, Arial, Verdana, sans-serif;
font-weight: bold;
}
-body, span, div, td, input, textarea, button, select {
+body {
font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
font-size: 12px;
}
+span, div, td, input, textarea, button, select {
+ font-family: inherit;
+}
+
body {
background-color: #e2e2e2;
}
-.layout_wrapper {
- padding: 13px;
- margin: 7px;
- -moz-box-shadow: 1px 1px 6px #AAA;
- -webkit-box-shadow: 1px 1px 6px #AAA;
- box-shadow: 1px 1px 6px #AAA;
- background-color: #FFF;
+.erpnext-footer {
+ margin: 3px auto;
+ color: #888;
+ text-align: center;
}
-#birthday_area {
- display: none;
- padding: 4px;
- margin-bottom: 8px;
- background-color: #FDD;
- padding: 4px;
- color: #644;
+.erpnext-footer a, .erpnext-footer a:hover, .erpnext-footer a:visited {
+ color: #666;
}
.module-icons {
diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js
index 5a66ec6..cbb03a1 100644
--- a/erpnext/startup/startup.js
+++ b/erpnext/startup/startup.js
@@ -1,461 +1,47 @@
-if(user == 'Guest'){
- $dh(page_body.left_sidebar);
-}
-
var current_module;
var is_system_manager = 0;
var module_content_dict = {};
var user_full_nm = {};
-// check if session user is system manager
-if(inList(user_roles,'System Manager')) is_system_manager = 1;
+wn.provide('erpnext.startup');
-function startup_setup() {
- pscript.is_erpnext_saas = cint(locals['Control Panel']['Control Panel'].sync_with_gateway)
-
-
- if(get_url_arg('embed')) {
- // hide header, footer
- $dh(page_body.banner_area);
- $dh(page_body.wntoolbar);
- $dh(page_body.footer);
- return;
- }
-
- if(user=='Guest' && !get_url_arg('akey')) {
- if(pscript.is_erpnext_saas) {
- window.location.href = 'https://www.erpnext.com';
- return;
- }
- }
-
- // page structure
- // --------------
- $td(page_body.wntoolbar.body_tab,0,0).innerHTML = '<i><b>erp</b>next</i>';
- $y($td(page_body.wntoolbar.body_tab,0,0), {width:'140px', color:'#FFF', paddingLeft:'8px', paddingRight:'8px', fontSize:'14px'})
- $dh(page_body.banner_area);
-
- // sidebar
- // -------
- pscript.startup_make_sidebar();
-
- // border to the body
- // ------------------
- $dh(page_body.footer);
-
- // setup toolbar
- pscript.startup_setup_toolbar();
+erpnext.startup.set_globals = function() {
+ pscript.is_erpnext_saas = cint(wn.control_panel.sync_with_gateway)
+ if(inList(user_roles,'System Manager')) is_system_manager = 1;
}
-// ====================================================================
-
-pscript.startup_make_sidebar = function() {
- $y(page_body.left_sidebar, {width:(100/6)+'%', paddingTop:'8px'});
-
- var callback = function(r,rt) {
- // menu
- var ml = r.message;
-
- // login-file
- if(r.login_url){
- login_file = 'http://' + r.login_url;
- }
- else if(pscript.is_erpnext_saas) {
- login_file = 'https://www.erpnext.com';
- }
-
- // clear
- page_body.left_sidebar.innerHTML = '';
-
- for(var m=0; m<ml.length; m++){
- if(ml[m]) {
- new SidebarItem(ml[m]);
- }
- }
- if(in_list(user_roles, 'System Manager')) {
- var div = $a(page_body.left_sidebar, 'div', 'link_type', {padding:'8px', fontSize:'11px'});
- $(div).html('[edit]').click(pscript.startup_set_module_order)
- }
- nav_obj.observers.push({notify:function(t,dt,dn) { pscript.select_sidebar_menu(t, dt, dn); }});
-
- // select current
- var no = nav_obj.ol[nav_obj.ol.length-1];
- if(no && menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
- pscript.select_sidebar_menu(decodeURIComponent(no[0]), decodeURIComponent(no[1]));
- }
- $c_obj('Home Control', 'get_modules', '', callback);
-}
-
-// ====================================================================
-// Menu observer
-// ====================================================================
-
-cur_menu_pointer = null;
-var menu_item_map = {'Form':{}, 'Page':{}, 'Report':{}, 'List':{}}
-
-pscript.select_sidebar_menu = function(t, dt, dn) {
- // get menu item
- if(menu_item_map[t][dt]) {
- // select
- menu_item_map[t][dt].select();
- } else {
- // none found :-( Unselect
- if(cur_menu_pointer)
- cur_menu_pointer.deselect();
- }
-}
-
-// ====================================================================
-// Menu pointer
-// ====================================================================
-
-var body_background = '#e2e2e2';
-
-MenuPointer = function(parent, label) {
-
- this.wrapper = $a(parent, 'div', '', {padding:'0px', cursor:'pointer', margin:'2px 0px'});
- $br(this.wrapper, '3px');
-
- this.tab = make_table($a(this.wrapper, 'div'), 1, 2, '100%', ['', '11px'], {height:'22px',
- verticalAlign:'middle', padding:'0px'}, {borderCollapse:'collapse', tableLayout:'fixed'});
-
- $y($td(this.tab, 0, 0), {padding:'0px 4px', color:'#444', whiteSpace:'nowrap'});
-
- // triangle border (?)
- this.tab.triangle_div = $a($td(this.tab, 0, 1), 'div','', {
- borderColor: body_background + ' ' + body_background + ' ' + body_background + ' ' + 'transparent',
- borderWidth:'11px', borderStyle:'solid', height:'0px', width:'0px', marginRight:'-11px'});
-
- this.label_area = $a($td(this.tab, 0, 0), 'span', '', '', label);
-
- $(this.wrapper)
- .hover(
- function() { if(!this.selected)$bg(this, '#eee'); } ,
- function() { if(!this.selected)$bg(this, body_background); }
- )
-
- $y($td(this.tab, 0, 0), {borderBottom:'1px solid #ddd'});
-
-}
-
-// ====================================================================
-
-MenuPointer.prototype.select = function(grey) {
- $y($td(this.tab, 0, 0), {color:'#fff', borderBottom:'0px solid #000'});
- //$gr(this.wrapper, '#F84', '#F63');
- $gr(this.wrapper, '#888', '#666');
- this.selected = 1;
-
- if(cur_menu_pointer && cur_menu_pointer != this)
- cur_menu_pointer.deselect();
-
- cur_menu_pointer = this;
-}
-
-// ====================================================================
-
-MenuPointer.prototype.deselect = function() {
- $y($td(this.tab, 0, 0), {color:'#444', borderBottom:'1px solid #ddd'});
- $gr(this.wrapper, body_background, body_background);
- this.selected = 0;
-}
-
-
-// ====================================================================
-// Sidebar Item
-// ====================================================================
-
-var cur_sidebar_item = null;
-
-SidebarItem = function(det) {
- var me = this;
- this.det = det;
- this.wrapper = $a(page_body.left_sidebar, 'div', '', {marginRight:'12px'});
-
- this.body = $a(this.wrapper, 'div');
- this.tab = make_table(this.body, 1, 2, '100%', ['24px', null], {verticalAlign:'middle'}, {tableLayout:'fixed'});
-
- // icon
- var ic = $a($td(this.tab, 0, 0), 'div', 'module-icons module-icons-' + det.module_label.toLowerCase(), {marginLeft:'3px', marginBottom:'-2px'});
-
- // pointer table
- this.pointer = new MenuPointer($td(this.tab, 0, 1), det.module_label);
- $y($td(this.pointer.tab, 0, 0), {fontWeight:'bold'});
-
- // for page type
- if(det.module_page) {
- menu_item_map.Page[det.module_page] = this.pointer;
- }
-
- // items area
- this.items_area = $a(this.wrapper, 'div');
-
- this.body.onclick = function() { me.onclick(); }
-}
-
-// ====================================================================
-
-SidebarItem.prototype.onclick = function() {
- var me = this;
-
- if(this.det.module_page) {
- // page type
- this.pointer.select();
-
- $item_set_working(me.pointer.label_area);
- loadpage(this.det.module_page, function() { $item_done_working(me.pointer.label_area); });
-
- } else {
- // show sub items
- this.toggle();
- }
-}
-
-// ====================================================================
-
-SidebarItem.prototype.collapse = function() {
- $(this.items_area).slideUp();
- this.is_open = 0;
- $fg(this.pointer.label_area, '#444')
-}
-
-// ====================================================================
-
-SidebarItem.prototype.toggle = function() {
- if(this.loading) return;
-
- if(this.is_open) {
- this.collapse();
- } else {
- if(this.loaded) $(this.items_area).slideDown();
- else this.show_items();
- this.is_open = 1;
- $fg(this.pointer.label_area, '#000')
- //this.pointer.select(1);
-
- // close existing open
- if(cur_sidebar_item && cur_sidebar_item != this) {
- cur_sidebar_item.collapse();
- }
- cur_sidebar_item = this;
- }
-}
-
-// ====================================================================
-
-SidebarItem.prototype.show_items = function() {
- this.loading = 1;
- var me = this;
-
- $item_set_working(this.pointer.label_area);
- var callback = function(r,rt){
- me.loaded = 1;
- me.loading = 0;
- var smi = null;
- var has_reports = 0;
- var has_tools = 0;
-
- // widget code
- $item_done_working(me.pointer.label_area);
-
- if(r.message.il) {
- me.il = r.message.il;
-
- // forms
- for(var i=0; i<me.il.length;i++){
- if(me.il[i].doc_type == 'Forms') {
- if(in_list(profile.can_read, me.il[i].doc_name)) {
- var smi = new SidebarModuleItem(me, me.il[i]);
-
- menu_item_map['Form'][me.il[i].doc_name] = smi.pointer;
- menu_item_map['List'][me.il[i].doc_name] = smi.pointer;
- }
- }
- if(me.il[i].doc_type=='Reports') has_reports = 1;
- if(in_list(['Single DocType', 'Pages', 'Setup Forms'], me.il[i].doc_type)) has_tools = 1;
- }
- // reports
- if(has_reports) {
- var smi = new SidebarModuleItem(me, {doc_name:'Reports', doc_type:'Reports'});
-
- // add to menu-item mapper
- menu_item_map['Page'][me.det.module_label + ' Reports'] = smi.pointer;
- }
-
- // tools
- if(has_tools) {
- var smi = new SidebarModuleItem(me, {doc_name:'Tools', doc_type:'Tools'});
-
- // add to menu-item mapper
- menu_item_map['Page'][me.det.module_label + ' Tools'] = smi.pointer;
- }
-
- // custom reports
- if(r.message.custom_reports.length) {
- me.il = add_lists(r.message.il, r.message.custom_reports);
- var smi = new SidebarModuleItem(me, {doc_name:'Custom Reports', doc_type:'Custom Reports'});
-
- // add to menu-item mapper
- menu_item_map['Page'][me.det.module_label + ' Custom Reports'] = smi.pointer;
- }
- }
-
-
- $(me.items_area).slideDown();
-
- // high light
- var no = nav_obj.ol[nav_obj.ol.length-1];
- if(no && menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
- pscript.select_sidebar_menu(decodeURIComponent(no[0]), decodeURIComponent(no[1]));
-
- }
-
- $c_obj('Home Control', 'get_module_details', me.det.name, callback);
-}
-
-// ====================================================================
-// Show Reports
-// ====================================================================
-
-SidebarItem.prototype.show_section = function(sec_type) {
- var me = this;
- var label = this.det.module_label + ' ' + sec_type;
- var type_map = {'Reports':'Reports', 'Custom Reports':'Custom Reports', 'Pages':'Tools', 'Single DocType':'Tools', 'Setup Forms':'Tools'}
-
- if(page_body.pages[label]) {
- loadpage(label, null, 1);
- } else {
- // make the reports page
- var page = page_body.add_page(label);
- this.wrapper = $a(page,'div','layout_wrapper');
-
-
- // head
- this.head = new PageHeader(this.wrapper, label);
-
- // body
- this.body1 = $a(this.wrapper, 'div', '', {marginTop:'16px'});
-
- // add a report link
- var add_link = function(det) {
- var div = $a(me.body1, 'div', '', {marginBottom:'6px'});
- var span = $a(div, 'span', 'link_type');
-
- // tag the span
- span.innerHTML = det.display_name; span.det = det;
- if(sec_type=='Reports' || sec_type=='Custom Reports') {
- // Reports
- // -------
- span.onclick = function() { loadreport(this.det.doc_name, this.det.display_name); }
-
- } else {
- // Tools
- // -----
-
- if(det.doc_type=='Pages') {
- // Page
- if(det.click_function) {
- span.onclick = function() { eval(this.det.click_function) }
- span.click_function = det.click_function;
- } else {
- span.onclick = function() { loadpage(this.det.doc_name); }
- }
- } else if(det.doc_type=='Setup Forms') {
- // Doc Browser
- span.onclick = function() { loaddocbrowser(this.det.doc_name); }
- } else {
- // Single
- span.onclick = function() { loaddoc(this.det.doc_name, this.det.doc_name); }
- }
- }
- }
-
- // item list
- for(var i=0; i<me.il.length;i++){
- if(type_map[me.il[i].doc_type] == sec_type) {
- add_link(me.il[i]);
- }
- }
- loadpage(label, null, 1);
- }
-}
-
-
-// ====================================================================
-// Sidebar module item
-// ====================================================================
-
-SidebarModuleItem = function(si, det) {
- this.det = det;
- var me= this;
-
- this.pointer = new MenuPointer(si.items_area, get_doctype_label(det.doc_name));
- $y(si.items_area, {marginLeft:'32px'})
- $y($td(this.pointer.tab, 0, 0), {fontSize:'11px'});
-
- this.pointer.wrapper.onclick = function() {
- if(me.det.doc_type=='Forms')
- loaddocbrowser(det.doc_name);
- else
- si.show_section(me.det.doc_type);
- }
-}
-
-
-// ====================================================================
-// Drag & Drop order selection
-// ====================================================================
-
-pscript.startup_set_module_order = function() {
- var update_order= function(ml) {
- mdict = {};
- for(var i=0; i<ml.length; i++) {
- mdict[ml[i][3][3]] = {'module_seq':ml[i][1], 'is_hidden':(ml[i][2] ? 'No' : 'Yes')}
- }
- $c_obj('Home Control', 'set_module_order', JSON.stringify(mdict), function(r,rt) { pscript.startup_make_sidebar(); } )
- }
-
- var callback = function(r, rt) {
- var ml = [];
- for(var i=0; i<r.message.length; i++) {
- var det = r.message[i];
- ml.push([det[1], det[2], (det[3]!='No' ? 0 : 1), det[0]]);
- }
- new ListSelector('Set Module Sequence', 'Select items and set the order you want them to appear'+
- '<br><b>Note:</b> <i>These changes will apply to all users!</i>', ml, update_order, 1);
- }
- $c_obj('Home Control', 'get_module_order', '', callback)
-
-}
-
-// ====================================================================
-
-pscript.startup_setup_toolbar = function() {
- var menu_tab = page_body.wntoolbar.menu_table_right;
- // help
- // ----
- $td(menu_tab,0,0).innerHTML = '<a style="font-weight: bold; color: #FFF" href="http://erpnext.blogspot.com/2011/03/erpnext-help.html" target="_blank">Help</a>';
+erpnext.startup.start = function() {
+ $('#startup_div').html('Starting up...').toggle(true);
- $td(menu_tab,0,1).innerHTML = '<a style="font-weight: bold; color: #FFF" href="http://groups.google.com/group/erpnext-user-forum" target="_blank">Forum</a>';
+ erpnext.startup.set_globals();
- if(pscript.is_erpnext_saas){
- // Live Chat Help
- // --------------
- $td(menu_tab,0,2).innerHTML = '<a style="font-weight: bold; color: #FFF" href="http://www.providesupport.com?messenger=iwebnotes" target="_blank">Chat</a>';
-
- // Manage account
- // --------------
- if(is_system_manager) {
- $td(menu_tab,0,3).innerHTML = '<a style="font-weight: bold; color: #FFF;" href="#!billing">Billing</a>';
+ if(user == 'Guest'){
+ $dh(page_body.left_sidebar);
+ wn.require('erpnext/website/css/website.css');
+ wn.require('erpnext/website/js/topbar.js');
+ if(wn.boot.custom_css) {
+ set_style(wn.boot.custom_css);
}
- }
- else{
- $dh($td(menu_tab,0,2));
- $dh($td(menu_tab,0,3));
- }
+ if(wn.boot.website_settings.title_prefix) {
+ wn.title_prefix = wn.boot.website_settings.title_prefix;
+ }
+ } else {
+ // modules
+ wn.require('erpnext/startup/modules.js');
+ pscript.startup_make_sidebar();
- $y(cell, page_body.wntoolbar.right_table_style);
+ // setup toolbar
+ wn.require('erpnext/startup/toolbar.js');
+ erpnext.toolbar.setup();
+ wn.require('erpnext/startup/feature_setup.js');
+ // border to the body
+ // ------------------
+ $('footer').html('<div class="erpnext-footer">\
+ Powered by <a href="https://erpnext.com">ERPNext</a></div>');
+ }
+
+ $('#startup_div').toggle(false);
}
// chart of accounts
@@ -496,224 +82,5 @@
if(callback) this.callback = function(){ callback(); }
}
-
-// get plural
-// ====================================================================
-
-get_plural = function(str){
- if(str.charAt(str.length-1).toLowerCase() == 'y') return str.substr(0, str.length-1) + 'ies'
- else return str + 's';
-}
-
-// set user fullname
-// ====================================================================
-pscript.set_user_fullname = function(ele,username,get_latest){
-
- var set_it = function(){
- if(ele)
- ele.innerHTML = user_full_nm[username];
- }
-
- if(get_latest){
- $c_obj('Home Control','get_user_fullname',username, function(r,rt){ user_full_nm[username] = r.message; set_it(); });
- }
- else{
- if(user_full_nm[username]){
- set_it();
- }
-
- else
- $c_obj('Home Control','get_user_fullname',username, function(r,rt){ user_full_nm[username] = r.message; set_it(); });
- }
-}
-
-// ====================================================================
-startup_setup();
-
-/* features setup "Dictionary", "Script"
-Dictionary Format
- 'projects': {
- 'Sales Order': {
- 'fields':['project_name'],
- 'sales_order_details':['projected_qty']
- },
- 'Purchase Order': {
- 'fields':['project_name']
- }
- }
-// ====================================================================*/
-pscript.feature_dict = {
- 'fs_projects': {
- 'Bill Of Materials': {'fields':['project_name']},
- 'Delivery Note': {'fields':['project_name']},
- 'Payable Voucher': {'fields':['project_name']},
- 'Production Order': {'fields':['project_name']},
- 'Purchase Order': {'fields':['project_name']},
- 'Purchase Receipt': {'fields':['project_name']},
- 'Receivable Voucher': {'fields':['project_name']},
- 'Sales Order': {'fields':['project_name']},
- 'Stock Entry': {'fields':['project_name']},
- 'Timesheet': {'timesheet_details':['project_name']}
- },
- 'fs_packing_details': {
- 'Delivery Note': {'fields':['packing_details','print_packing_slip','packing_checked_by','packed_by','pack_size','shipping_mark'],'delivery_note_details':['no_of_packs','pack_gross_wt','pack_nett_wt','pack_no','pack_unit']},
- 'Sales Order': {'fields':['packing_details']}
- },
- 'fs_discounts': {
- 'Delivery Note': {'delivery_note_details':['adj_rate']},
- 'Quotation': {'quotation_details':['adj_rate']},
- 'Receivable Voucher': {'entries':['adj_rate']},
- 'Sales Order': {'sales_order_details':['adj_rate','ref_rate']}
- },
- 'fs_purchase_discounts': {
- 'Purchase Order': {'po_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
- 'Purchase Receipt': {'purchase_receipt_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
- 'Payable Voucher': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}
- },
- 'fs_brands': {
- 'Delivery Note': {'delivery_note_details':['brand']},
- 'Indent': {'indent_details':['brand']},
- 'Item': {'fields':['brand']},
- 'Purchase Order': {'po_details':['brand']},
- 'Payable Voucher': {'entries':['brand']},
- 'Quotation': {'quotation_details':['brand']},
- 'Receivable Voucher': {'entries':['brand']},
- 'Sales BOM': {'fields':['new_item_brand']},
- 'Sales Order': {'sales_order_details':['brand']},
- 'Serial No': {'fields':['brand']}
- },
- 'fs_after_sales_installations': {
- 'Delivery Note': {'fields':['installation_status','per_installed'],'delivery_note_details':['installed_qty']}
- },
- 'fs_item_batch_nos': {
- 'Delivery Note': {'delivery_note_details':['batch_no']},
- 'Item': {'fields':['has_batch_no']},
- 'Purchase Receipt': {'purchase_receipt_details':['batch_no']},
- 'QA Inspection Report': {'fields':['batch_no']},
- 'Sales and Pruchase Return Wizard': {'return_details':['batch_no']},
- 'Receivable Voucher': {'entries':['batch_no']},
- 'Stock Entry': {'mtn_details':['batch_no']},
- 'Stock Ledger Entry': {'fields':['batch_no']}
- },
- 'fs_item_serial_nos': {
- 'Customer Issue': {'fields':['serial_no']},
- 'Delivery Note': {'delivery_note_details':['serial_no'],'packing_details':['serial_no']},
- 'Installation Note': {'installed_item_details':['serial_no']},
- 'Item': {'fields':['has_serial_no']},
- 'Maintenance Schedule': {'item_maintenance_details':['serial_no'],'maintenance_schedule_details':['serial_no']},
- 'Maintenance Visit': {'maintenance_visit_details':['serial_no']},
- 'Purchase Receipt': {'purchase_receipt_details':['serial_no']},
- 'QA Inspection Report': {'fields':['item_serial_no']},
- 'Sales and Pruchase Return Wizard': {'return_details':['serial_no']},
- 'Receivable Voucher': {'entries':['serial_no']},
- 'Stock Entry': {'mtn_details':['serial_no']},
- 'Stock Ledger Entry': {'fields':['serial_no']}
- },
- 'fs_item_group_in_details': {
- 'Delivery Note': {'delivery_note_details':['item_group']},
- 'Enquiry': {'enquiry_details':['item_group']},
- 'Indent': {'indent_details':['item_group']},
- 'Item': {'fields':['item_group']},
- 'Manage Account': {'fields':['default_item_group']},
- 'Purchase Order': {'po_details':['item_group']},
- 'Purchase Receipt': {'purchase_receipt_details':['item_group']},
- 'Purchase Voucher': {'entries':['item_group']},
- 'Quotation': {'quotation_details':['item_group']},
- 'Receivable Voucher': {'entries':['item_group']},
- 'Sales BOM': {'fields':['serial_no']},
- 'Sales Order': {'sales_order_details':['item_group']},
- 'Serial No': {'fields':['item_group']},
- 'Sales Partner': {'partner_target_details':['item_group']},
- 'Sales Person': {'target_details':['item_group']},
- 'Territory': {'target_details':['item_group']}
- },
- 'fs_page_break': {
- 'Delivery Note': {'delivery_note_details':['page_break'],'packing_details':['page_break']},
- 'Indent': {'indent_details':['page_break']},
- 'Purchase Order': {'po_details':['page_break']},
- 'Purchase Receipt': {'purchase_receipt_details':['page_break']},
- 'Purchase Voucher': {'entries':['page_break']},
- 'Quotation': {'quotation_details':['page_break']},
- 'Receivable Voucher': {'entries':['page_break']},
- 'Sales Order': {'sales_order_details':['page_break']}
- },
- 'fs_exports': {
- 'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','export_amount','export_rate']},
- 'POS Setting': {'fields':['conversion_rate','currency']},
- 'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','export_amount','export_rate']},
- 'Receivable Voucher': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','export_amount','export_rate']},
- 'Item': {'ref_rate_details':['ref_currency']},
- 'Sales BOM': {'fields':['currency']},
- 'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','export_amount','export_rate']}
- },
- 'fs_imports': {
- 'Payable Voucher': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['import_amount','import_rate']},
- 'Purchase Order': {'fields':['Note HTML','conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'po_details':['import_amount','import_rate']},
- 'Purchase Receipt': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'purchase_receipt_details':['import_amount','import_rate']},
- 'Supplier Quotation': {'fields':['conversion_rate','currency']}
- },
- 'fs_item_advanced': {
- 'Item': {'fields':['item_customer_details']}
- },
- 'fs_sales_extras': {
- 'Address': {'fields':['sales_partner']},
- 'Contact': {'fields':['sales_partner']},
- 'Customer': {'fields':['sales_team']},
- 'Delivery Note': {'fields':['sales_team','Packing List']},
- 'Item': {'fields':['item_customer_details']},
- 'Receivable Voucher': {'fields':['sales_team']},
- 'Sales Order': {'fields':['sales_team','Packing List']}
- },
- 'fs_more_info': {
- 'Customer': {'fields':['More Info']},
- 'Delivery Note': {'fields':['More Info']},
- 'Enquiry': {'fields':['More Info']},
- 'Indent': {'fields':['More Info']},
- 'Lead': {'fields':['More Info']},
- 'Payable Voucher': {'fields':['More Info']},
- 'Purchase Order': {'fields':['More Info']},
- 'Purchase Receipt': {'fields':['More Info']},
- 'Quotation': {'fields':['More Info']},
- 'Receivable Voucher': {'fields':['More Info']},
- 'Sales Order': {'fields':['More Info']},
- 'Serial No': {'fields':['More Info']},
- 'Supplier': {'fields':['More Info']}
- },
- 'fs_quality': {
- 'Item': {'fields':['Item Inspection Criteria','inspection_required']},
- 'Purchase Receipt': {'purchase_receipt_details':['qa_no']}
- },
- 'fs_manufacturing': {
- 'Item': {'fields':['Manufacturing']}
- },
- 'fs_pos': {
- 'Receivable Voucher': {'fields':['is_pos']}
- },
- 'fs_recurring_invoice': {
- 'Receivable Voucher': {'fields': ['Recurring Invoice']}
- }
-}
-
-$(document).bind('form_refresh', function() {
- for(sys_feat in sys_defaults)
- {
- if(sys_defaults[sys_feat]=='0' && (sys_feat in pscript.feature_dict)) //"Features to hide" exists
- {
- if(cur_frm.doc.doctype in pscript.feature_dict[sys_feat])
- {
- for(fort in pscript.feature_dict[sys_feat][cur_frm.doc.doctype])
- {
- if(fort=='fields')
- hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]);
- else if(cur_frm.fields_dict[fort])
- {
- for(grid_field in pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort])
- cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort][grid_field], false);
- }
- else
- msgprint('Grid "'+fort+'" does not exists');
- }
- }
- }
- }
-})
+// start
+erpnext.startup.start();
\ No newline at end of file
diff --git a/erpnext/startup/toolbar.js b/erpnext/startup/toolbar.js
new file mode 100644
index 0000000..49738ce
--- /dev/null
+++ b/erpnext/startup/toolbar.js
@@ -0,0 +1,27 @@
+/* toolbar settings */
+wn.provide('erpnext.toolbar');
+
+erpnext.toolbar.setup = function() {
+ // profile
+ $('#toolbar-user').append('<li><a href="#profile-settings">Profile Settings</a></li>')
+
+ // help
+ $('.topbar .secondary-nav').append('<li class="dropdown">\
+ <a class="dropdown-toggle" href="#" onclick="return false;">Help</a>\
+ <ul class="dropdown-menu" id="toolbar-help">\
+ </ul></li>')
+
+ $('#toolbar-help').append('<li><a href="http://erpnext.blogspot.com/2011/03/erpnext-help.html" target="_blank">\
+ Documentation</a></li>')
+
+ $('#toolbar-help').append('<li><a href="http://groups.google.com/group/erpnext-user-forum" target="_blank">\
+ Forum</a></li>')
+
+ $('#toolbar-help').append('<li><a href="http://www.providesupport.com?messenger=iwebnotes" target="_blank">\
+ Live Chat (Office Hours)</a></li>')
+
+ // billing
+ if(pscript.is_erpnext_saas && is_system_manager) {
+ $('#toolbar-user').append('<li><a href="#billing">Billing</a></li>')
+ }
+}
\ No newline at end of file
diff --git a/erpnext/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt b/erpnext/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt
new file mode 100644
index 0000000..171e08f
--- /dev/null
+++ b/erpnext/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt
@@ -0,0 +1,93 @@
+# DocType Mapper, Delivery Note-Packing Slip
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-02-02 11:35:53',
+ 'docstatus': 0,
+ 'modified': '2012-02-02 11:35:53',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all Table Mapper Detail
+ {
+ 'doctype': 'Table Mapper Detail',
+ 'name': '__common__',
+ 'parent': 'Delivery Note-Packing Slip',
+ 'parentfield': 'table_mapper_details',
+ 'parenttype': 'DocType Mapper'
+ },
+
+ # These values are common for all Field Mapper Detail
+ {
+ 'doctype': 'Field Mapper Detail',
+ 'name': '__common__',
+ 'parent': 'Delivery Note-Packing Slip',
+ 'parentfield': 'field_mapper_details',
+ 'parenttype': 'DocType Mapper'
+ },
+
+ # These values are common for all DocType Mapper
+ {
+ 'doctype': u'DocType Mapper',
+ 'from_doctype': 'Delivery Note',
+ 'module': 'Stock',
+ 'name': '__common__',
+ 'ref_doc_submitted': 1,
+ 'to_doctype': 'Packing Slip'
+ },
+
+ # DocType Mapper, Delivery Note-Packing Slip
+ {
+ 'doctype': u'DocType Mapper',
+ 'name': 'Delivery Note-Packing Slip'
+ },
+
+ # Field Mapper Detail
+ {
+ 'doctype': 'Field Mapper Detail',
+ 'from_field': 'name',
+ 'map': 'Yes',
+ 'match_id': 0,
+ 'to_field': 'delivery_note'
+ },
+
+ # Field Mapper Detail
+ {
+ 'doctype': 'Field Mapper Detail',
+ 'from_field': 'qty',
+ 'map': 'No',
+ 'match_id': 1,
+ 'to_field': 'qty'
+ },
+
+ # Field Mapper Detail
+ {
+ 'doctype': 'Field Mapper Detail',
+ 'from_field': 'naming_series',
+ 'map': 'No',
+ 'match_id': 0,
+ 'to_field': 'naming_series'
+ },
+
+ # Table Mapper Detail
+ {
+ 'doctype': 'Table Mapper Detail',
+ 'from_table': 'Delivery Note',
+ 'match_id': 0,
+ 'to_table': 'Packing Slip',
+ 'validation_logic': 'docstatus=1'
+ },
+
+ # Table Mapper Detail
+ {
+ 'doctype': 'Table Mapper Detail',
+ 'from_field': 'delivery_note_details',
+ 'from_table': 'Delivery Note Detail',
+ 'match_id': 1,
+ 'to_field': 'item_details',
+ 'to_table': 'Packing Slip Detail',
+ 'validation_logic': 'IFNULL(packed_qty, 0) < IFNULL(qty, 0)'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/stock/Module Def/Stock/Stock.txt b/erpnext/stock/Module Def/Stock/Stock.txt
index 4fc8790..991d410 100644
--- a/erpnext/stock/Module Def/Stock/Stock.txt
+++ b/erpnext/stock/Module Def/Stock/Stock.txt
@@ -5,7 +5,7 @@
{
'creation': '2011-07-01 17:40:49',
'docstatus': 0,
- 'modified': '2011-10-10 17:01:34',
+ 'modified': '2012-02-01 15:43:00',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -90,6 +90,16 @@
# Module Def Item
{
+ 'description': 'Generate Packing Slips based on a Delivery Note',
+ 'display_name': 'Packing Slip',
+ 'doc_name': 'Packing Slip',
+ 'doc_type': 'Forms',
+ 'doctype': 'Module Def Item',
+ 'fields': 'delivery_note\nfrom_case_no\nto_case_no\nnet_weight_pkg\ngross_weight_pkg'
+ },
+
+ # Module Def Item
+ {
'description': 'Record of incoming material from your suppliers',
'display_name': 'Purchase Receipt',
'doc_name': 'Purchase Receipt',
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index 5cb4276..59dff8a 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -46,6 +46,10 @@
cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
unhide_field(['SMS','Send SMS', 'message', 'customer_mobile_no', 'Repair Delivery Note']);
}
+
+ if(doc.docstatus==1) {
+ cur_frm.add_custom_button('Make Packing Slip', cur_frm.cscript['Make Packing Slip']);
+ }
set_print_hide(doc, cdt, cdn);
}
@@ -280,6 +284,23 @@
msgprint("Item installation is already completed")
}
+//-----------------------------------Make Sales Invoice----------------------------------------------
+cur_frm.cscript['Make Packing Slip'] = function() {
+ var doc = cur_frm.doc
+ n = createLocal('Packing Slip');
+ $c('dt_map', args={
+ 'docs':compress_doclist([locals['Packing Slip'][n]]),
+ 'from_doctype':doc.doctype,
+ 'to_doctype':'Packing Slip',
+ 'from_docname':doc.name,
+ 'from_to_list':"[['Delivery Note','Packing Slip'],['Delivery Note Detail','Packing Slip Detail']]"
+ }, function(r,rt) {
+ loaddoc('Packing Slip', n);
+ }
+ );
+}
+
+
//get query select Territory
//=======================================================================================================================
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 8fc1abc..f791893 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -171,9 +171,6 @@
self.doc.in_words = sales_com_obj.get_total_in_words(dcc, self.doc.rounded_total)
self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
- # ::::::: Set Net Weight of each Packing
- self.update_pack_nett_weight()
- self.print_packing_slip()
# ::::::: Set actual qty for each item in selected warehouse :::::::
self.update_current_stock()
# :::::: set DN status :::::::
@@ -340,6 +337,7 @@
self.update_stock_ledger(update_stock = -1)
# :::::: set DN status :::::::
set(self.doc, 'status', 'Cancelled')
+ self.cancel_packing_slips()
# ******************** Check Next DocStatus **************************
@@ -355,6 +353,23 @@
raise Exception , "Validation Error."
+ def cancel_packing_slips(self):
+ """
+ Cancel submitted packing slips related to this delivery note
+ """
+ res = webnotes.conn.sql("""\
+ SELECT name, count(*) FROM `tabPacking Slip`
+ WHERE delivery_note = %s AND docstatus = 1
+ """, self.doc.name)
+
+ if res and res[0][1]>0:
+ from webnotes.model.doclist import DocList
+ for r in res:
+ ps = DocList(dt='Packing Slip', dn=r[0])
+ ps.cancel()
+ webnotes.msgprint("%s Packing Slip(s) Cancelled" % res[0][1])
+
+
# UPDATE STOCK LEDGER
# =================================================================================================
def update_stock_ledger(self, update_stock, is_stopped = 0):
@@ -432,84 +447,3 @@
def repair_delivery_note(self):
get_obj('Sales Common', 'Sales Common').repair_curr_doctype_details(self)
- # Packing Slip Related
- # ==========================================
- def update_pack_nett_weight(self):
- for d in getlist(self.doclist, 'delivery_note_details'):
- if d.item_code and not d.pack_nett_wt:
- item_wt = sql("select nett_weight from `tabItem` where name = %s", (d.item_code))
- d.pack_nett_wt = item_wt and flt(item_wt[0][0]) or 0
-
-
- # ==========================================
- def get_header(self, so_no, shipping_mark):
- header = '''
- <div align="center">[HEADER GOES HERE]</div>
- <div><center><h2>Packing Slip</h2></center></div>
- <table width="100%" class="large_font">
- <tr>
- <td width="20%">ORDER NO.</td>
- <td width="30%">'''+cstr(so_no)+'''</td>
- <td width="20%">SHIPPING MARKS</td>
- <td width="30%">'''+cstr(shipping_mark)+'''</td>
- </tr>
- </table>''';
-
- return header
-
- def get_footer(self, row, tot_nett, tot_gross):
- footer = '''
- <table style="page-break-after:always" width="100%" class="large_font">
- <tr>
- <td>CASE NO</td><td>'''+cstr(row.pack_no)+'''</td>
- <td>NETT WT</td><td>'''+cstr(tot_nett)+'''</td>
- <td>CHECKED BY</td><td>'''+cstr(row.packing_checked_by)+'''</td>
- </tr>
- <tr>
- <td>SIZE</td><td>'''+cstr(row.pack_size)+'''</td>
- <td>GROSS WT</td><td>'''+cstr(tot_gross)+'''</td>
- <td>PACKED BY</td><td>'''+cstr(row.packed_by)+'''</td>
- </tr>
- </table>'''
-
- return footer
-
- def print_packing_slip(self):
- plist = {}
- for d in getlist(self.doclist, 'delivery_note_details'):
- if not plist.has_key(cstr(d.pack_no)):
- plist[cstr(d.pack_no)] = [d]
- else:
- plist.get(cstr(d.pack_no)).append(d)
-
- html=''
-
- for d in sorted(plist.keys()):
- tot_nett_wt,tot_gross_wt=0,0
-
- # header
- html += self.get_header(self.doc.sales_order_no, self.doc.shipping_mark)
-
- # item table header
- html += '''
- <table class="cust_tbl" width="100%">
- <tr>
- <td><b>SR.NO.</b></td><td><b>CS.NO.</b></td><td><b>DESCRIPTION</b></td>
- <td><b>QUANTITY</b></td><td><b>WEIGHT</b></td>
- </tr>'''
-
- # item table data
- sr_no = 1
- for r in plist.get(d):
- html += '<tr><td>'+cstr(sr_no)+'</td><td>'+r.item_code+'</td><td>'+r.description+'</td><td>'+cstr(r.qty)+'</td><td>'+cstr(r.pack_nett_wt)+'</td></tr>'
-
- tot_nett_wt += flt(r.pack_nett_wt)
- tot_gross_wt += flt(r.pack_gross_wt)
-
- sr_no += 1
-
- html += '</table>'
-
- # footer
- html += self.get_footer(r, tot_nett_wt, tot_gross_wt)
- self.doc.print_packing_slip=html
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.txt b/erpnext/stock/doctype/delivery_note/delivery_note.txt
index 3078bf6..00bf9a8 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.txt
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.txt
@@ -5,7 +5,7 @@
{
'creation': '2011-04-18 15:58:20',
'docstatus': 0,
- 'modified': '2012-01-09 16:52:43',
+ 'modified': '2012-01-30 16:52:12',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -21,7 +21,7 @@
# These values are common for all DocType
{
- '_last_update': '1326105502',
+ '_last_update': '1326273792',
'colour': 'White:FFF',
'default_print_format': 'Standard',
'doctype': 'DocType',
@@ -37,7 +37,7 @@
'show_in_menu': 0,
'subject': 'To %(customer_name)s on %(transaction_date)s | %(per_billed)s% billed',
'tag_fields': 'billing_status',
- 'version': 463
+ 'version': 464
},
# These values are common for all DocFormat
@@ -1433,53 +1433,5 @@
'options': 'repair_delivery_note',
'permlevel': 0,
'print_hide': 1
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'print_packing_slip',
- 'fieldtype': 'Text',
- 'hidden': 1,
- 'in_filter': 0,
- 'label': 'Print Packing Slip',
- 'permlevel': 0,
- 'print_hide': 1
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'shipping_mark',
- 'fieldtype': 'Text',
- 'label': 'Shipping Mark',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'packed_by',
- 'fieldtype': 'Text',
- 'label': 'Packed By',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'packing_checked_by',
- 'fieldtype': 'Text',
- 'label': 'Packing Checked By',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'pack_size',
- 'fieldtype': 'Text',
- 'label': 'Pack Size',
- 'permlevel': 0
}
]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/delivery_note_detail/delivery_note_detail.txt b/erpnext/stock/doctype/delivery_note_detail/delivery_note_detail.txt
index 806803f..a10d1d6 100644
--- a/erpnext/stock/doctype/delivery_note_detail/delivery_note_detail.txt
+++ b/erpnext/stock/doctype/delivery_note_detail/delivery_note_detail.txt
@@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:08:58',
'docstatus': 0,
- 'modified': '2011-10-18 16:32:44',
+ 'modified': '2012-02-01 16:08:06',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -23,7 +23,7 @@
'section_style': 'Tray',
'server_code_error': ' ',
'show_in_menu': 0,
- 'version': 43
+ 'version': 51
},
# These values are common for all DocField
@@ -292,104 +292,6 @@
# DocField
{
'doctype': 'DocField',
- 'fieldname': 'pack_no',
- 'fieldtype': 'Data',
- 'label': 'Pack No',
- 'permlevel': 0,
- 'print_hide': 1
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'pack_gross_wt',
- 'fieldtype': 'Float',
- 'label': 'Pack Gross Wt',
- 'permlevel': 0,
- 'print_hide': 1
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'weight_uom',
- 'fieldtype': 'Link',
- 'label': 'Weight UOM',
- 'options': 'UOM',
- 'permlevel': 0,
- 'print_hide': 1
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'pack_nett_wt',
- 'fieldtype': 'Float',
- 'label': 'Pack Nett Wt',
- 'permlevel': 0,
- 'print_hide': 1
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'no_of_packs',
- 'fieldtype': 'Int',
- 'label': 'No of Packs',
- 'oldfieldname': 'no_of_packs',
- 'oldfieldtype': 'Int',
- 'permlevel': 0,
- 'print_hide': 1,
- 'width': '100px'
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'pack_unit',
- 'fieldtype': 'Data',
- 'label': 'Pack Unit',
- 'oldfieldname': 'pack_unit',
- 'oldfieldtype': 'Data',
- 'permlevel': 0,
- 'print_hide': 1,
- 'width': '100px'
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'pack_size',
- 'fieldtype': 'Data',
- 'label': 'Pack Size',
- 'no_copy': 0,
- 'permlevel': 0,
- 'print_hide': 1
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'packed_by',
- 'fieldtype': 'Data',
- 'label': 'Packed By',
- 'permlevel': 0,
- 'print_hide': 1
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'packing_checked_by',
- 'fieldtype': 'Data',
- 'label': 'Packing Checked By',
- 'permlevel': 0,
- 'print_hide': 1
- },
-
- # DocField
- {
- 'doctype': 'DocField',
'fieldname': 'installed_qty',
'fieldtype': 'Currency',
'label': 'Installed Qty',
@@ -507,6 +409,20 @@
# DocField
{
'allow_on_submit': 1,
+ 'colour': 'White:FFF',
+ 'default': '0',
+ 'doctype': 'DocField',
+ 'fieldname': 'packed_qty',
+ 'fieldtype': 'Currency',
+ 'label': 'Packed Quantity',
+ 'no_copy': 1,
+ 'permlevel': 1,
+ 'print_hide': 1
+ },
+
+ # DocField
+ {
+ 'allow_on_submit': 1,
'doctype': 'DocField',
'fieldname': 'page_break',
'fieldtype': 'Check',
diff --git a/erpnext/stock/doctype/item/item.txt b/erpnext/stock/doctype/item/item.txt
index c670700..d37114d 100644
--- a/erpnext/stock/doctype/item/item.txt
+++ b/erpnext/stock/doctype/item/item.txt
@@ -5,14 +5,14 @@
{
'creation': '2010-08-08 17:09:05',
'docstatus': 0,
- 'modified': '2011-12-20 11:15:42',
+ 'modified': '2012-01-30 17:34:23',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
- '_last_update': '1323333040',
+ '_last_update': '1326963484',
'allow_attach': 1,
'allow_trash': 1,
'autoname': 'field:item_code',
@@ -29,7 +29,7 @@
'show_in_menu': 0,
'subject': '%(item_name)s',
'tag_fields': 'item_group',
- 'version': 162
+ 'version': 165
},
# These values are common for all DocField
@@ -467,19 +467,11 @@
# DocField
{
+ 'description': 'Net Weight of each Item',
'doctype': 'DocField',
- 'fieldname': 'nett_weight',
+ 'fieldname': 'net_weight',
'fieldtype': 'Float',
- 'label': 'Nett Weight',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'gross_weight',
- 'fieldtype': 'Float',
- 'label': 'Gross Weight',
+ 'label': 'Net Weight',
'permlevel': 0
},
@@ -909,4 +901,4 @@
'permlevel': 0,
'print_hide': 1
}
-]
\ No newline at end of file
+]
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/stock/doctype/item_supplier/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/stock/doctype/item_supplier/__init__.py
diff --git a/erpnext/stock/doctype/item_supplier/item_supplier.txt b/erpnext/stock/doctype/item_supplier/item_supplier.txt
new file mode 100644
index 0000000..609c1e9
--- /dev/null
+++ b/erpnext/stock/doctype/item_supplier/item_supplier.txt
@@ -0,0 +1,58 @@
+# DocType, Item Supplier
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-17 18:36:35',
+ 'docstatus': 0,
+ 'modified': '2012-01-17 18:40:37',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocType',
+ 'istable': 1,
+ 'module': 'Stock',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 3
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'Item Supplier',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType',
+ 'permlevel': 0
+ },
+
+ # DocType, Item Supplier
+ {
+ 'doctype': 'DocType',
+ 'name': 'Item Supplier'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'supplier',
+ 'fieldtype': 'Link',
+ 'label': 'Supplier',
+ 'options': 'Supplier'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'supplier_part_no',
+ 'fieldtype': 'Data',
+ 'label': 'Supplier Part Number',
+ 'width': '200px'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/stock/doctype/packing_slip/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/stock/doctype/packing_slip/__init__.py
diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.js b/erpnext/stock/doctype/packing_slip/packing_slip.js
new file mode 100644
index 0000000..1bf1f2e
--- /dev/null
+++ b/erpnext/stock/doctype/packing_slip/packing_slip.js
@@ -0,0 +1,123 @@
+cur_frm.fields_dict['delivery_note'].get_query = function(doc, cdt, cdn) {
+ return 'SELECT name FROM `tabDelivery Note` WHERE docstatus=1 AND %(key)s LIKE "%s"';
+}
+
+
+cur_frm.fields_dict['item_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
+ return 'SELECT name, description FROM `tabItem` WHERE name IN ( \
+ SELECT item_code FROM `tabDelivery Note Detail` \
+ WHERE parent="' + doc.delivery_note + '") AND %(key)s LIKE "%s" LIMIT 50';
+}
+
+
+// Fetch item details
+cur_frm.cscript.item_code = function(doc, cdt, cdn) {
+ if(locals[cdt][cdn].item_code) {
+ $c_obj(make_doclist(cdt, cdn), 'get_item_details', doc.delivery_note, function(r, rt) {
+ if(r.exc) {
+ msgprint(r.exc);
+ } else {
+ refresh_field('item_details');
+ }
+ });
+ }
+}
+
+
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+ if(doc.delivery_note) {
+ var ps_detail = getchildren('Packing Slip Detail', doc.name, 'item_details');
+ if(!(flt(ps_detail[0].net_weight) && cstr(ps_detail[0].weight_uom))) {
+ cur_frm.cscript.update_item_details(doc);
+ refresh_field('naming_series');
+ }
+ }
+}
+
+
+cur_frm.cscript.update_item_details = function(doc) {
+ $c_obj(make_doclist(doc.doctype, doc.name), 'update_item_details', '', function(r, rt) {
+ if(r.exc) {
+ msgprint(r.exc);
+ } else {
+ refresh_field('item_details');
+ }
+ });
+}
+
+
+cur_frm.cscript.validate = function(doc, cdt, cdn) {
+ cur_frm.cscript.validate_case_nos(doc);
+ cur_frm.cscript.validate_calculate_item_details(doc);
+}
+
+
+// To Case No. cannot be less than From Case No.
+cur_frm.cscript.validate_case_nos = function(doc) {
+ doc = locals[doc.doctype][doc.name];
+ if(cint(doc.from_case_no)==0) {
+ msgprint("Case No. cannot be 0")
+ validated = false;
+ } else if(!cint(doc.to_case_no)) {
+ doc.to_case_no = doc.from_case_no;
+ refresh_field('to_case_no');
+ } else if(cint(doc.to_case_no) < cint(doc.from_case_no)) {
+ msgprint("'To Case No.' cannot be less than 'From Case No.'");
+ validated = false;
+ }
+}
+
+
+cur_frm.cscript.validate_calculate_item_details = function(doc) {
+ doc = locals[doc.doctype][doc.name];
+ var ps_detail = getchildren('Packing Slip Detail', doc.name, 'item_details');
+
+ cur_frm.cscript.validate_duplicate_items(doc, ps_detail);
+ cur_frm.cscript.calc_net_total_pkg(doc, ps_detail);
+}
+
+
+// Do not allow duplicate items i.e. items with same item_code
+// Also check for 0 qty
+cur_frm.cscript.validate_duplicate_items = function(doc, ps_detail) {
+ for(var i=0; i<ps_detail.length; i++) {
+ for(var j=0; j<ps_detail.length; j++) {
+ if(i!=j && ps_detail[i].item_code==ps_detail[j].item_code) {
+ msgprint("You have entered duplicate items. Please rectify and try again.");
+ validated = false;
+ return;
+ }
+ }
+ if(flt(ps_detail[i].qty)<=0) {
+ msgprint("Invalid quantity specified for item " + ps_detail[i].item_code +
+ ". Quantity should be greater than 0.");
+ validated = false;
+ }
+ }
+}
+
+
+// Calculate Net Weight of Package
+cur_frm.cscript.calc_net_total_pkg = function(doc, ps_detail) {
+ var net_weight_pkg = 0;
+ doc.net_weight_uom = ps_detail?ps_detail[0].weight_uom:'';
+ doc.gross_weight_uom = doc.net_weight_uom;
+
+ for(var i=0; i<ps_detail.length; i++) {
+ var item = ps_detail[i];
+ if(item.weight_uom != doc.net_weight_uom) {
+ msgprint("Different UOM for items will lead to incorrect \
+ (Total) Net Weight value. Make sure that Net Weight of each item is \
+ in the same UOM.")
+ validated = false;
+ }
+ net_weight_pkg += flt(item.net_weight) * flt(item.qty);
+ }
+
+ doc.net_weight_pkg = roundNumber(net_weight_pkg, 2);
+ if(!flt(doc.gross_weight_pkg)) {
+ doc.gross_weight_pkg = doc.net_weight_pkg
+ }
+ refresh_many(['net_weight_pkg', 'net_weight_uom', 'gross_weight_uom', 'gross_weight_pkg']);
+}
+
diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.py b/erpnext/stock/doctype/packing_slip/packing_slip.py
new file mode 100644
index 0000000..33ec2b5
--- /dev/null
+++ b/erpnext/stock/doctype/packing_slip/packing_slip.py
@@ -0,0 +1,156 @@
+import webnotes
+from webnotes.utils import flt, cint
+
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
+
+
+ def validate(self):
+ """
+ * Validate existence of submitted Delivery Note
+ * Case nos do not overlap
+ * Check if packed qty doesn't exceed actual qty of delivery note
+
+ It is necessary to validate case nos before checking quantity
+ """
+ self.validate_delivery_note()
+ self.validate_case_nos()
+ self.validate_qty()
+
+
+ def validate_delivery_note(self):
+ """
+ Validates if delivery note has status as submitted
+ """
+ res = webnotes.conn.sql("""\
+ SELECT docstatus FROM `tabDelivery Note`
+ WHERE name=%(delivery_note)s
+ """, self.doc.fields)
+
+ if not(res and res[0][0]==1):
+ webnotes.msgprint("""Invalid Delivery Note. Delivery Note should exist
+ and should be submitted. Please rectify and try again.""", raise_exception=1)
+
+
+ def validate_case_nos(self):
+ """
+ Validate if case nos overlap
+ If they do, recommend next case no.
+ """
+ res = webnotes.conn.sql("""\
+ SELECT name FROM `tabPacking Slip`
+ WHERE delivery_note = %(delivery_note)s AND docstatus = 1 AND
+ (from_case_no BETWEEN %(from_case_no)s AND %(to_case_no)s
+ OR to_case_no BETWEEN %(from_case_no)s AND %(to_case_no)s)\
+ """, self.doc.fields)
+
+ if res:
+ recommended_case_no = webnotes.conn.sql("""\
+ SELECT MAX(to_case_no) FROM `tabPacking Slip`
+ WHERE delivery_note = %(delivery_note)s AND docstatus=1""", self.doc.fields)
+
+ webnotes.msgprint("""Case No(s). already in use. Please rectify and try again.
+ Recommended <b>From Case No. = %s</b>""" % (cint(recommended_case_no[0][0]) + 1),
+ raise_exception=1)
+
+
+ def validate_qty(self):
+ """
+ Check packed qty across packing slips and delivery note
+ """
+ # Get Delivery Note Details, Item Quantity Dict and No. of Cases for this Packing slip
+ dn_details, ps_item_qty, no_of_cases = self.get_details_for_packing()
+
+ for item in dn_details:
+ new_packed_qty = (flt(ps_item_qty[item['item_code']]) * no_of_cases) + flt(item['packed_qty'])
+ if new_packed_qty > flt(item['qty']):
+ self.recommend_new_qty(item, ps_item_qty, no_of_cases)
+
+
+ def get_details_for_packing(self):
+ """
+ Returns
+ * 'Delivery Note Details' query result as a list of dict
+ * Item Quantity dict of current packing slip doc
+ * No. of Cases of this packing slip
+ """
+ item_codes = ", ".join([('"' + d.item_code + '"') for d in self.doclist])
+
+ res = webnotes.conn.sql("""\
+ SELECT item_code, IFNULL(SUM(qty), 0) as qty, IFNULL(packed_qty, 0) as packed_qty, stock_uom
+ FROM `tabDelivery Note Detail`
+ WHERE parent = "%s" AND item_code IN (%s)
+ GROUP BY item_code""" % (self.doc.delivery_note, item_codes), as_dict=1)
+
+ ps_item_qty = dict([[d.item_code, d.qty] for d in self.doclist])
+
+ no_of_cases = cint(self.doc.to_case_no) - cint(self.doc.from_case_no) + 1
+
+ return res, ps_item_qty, no_of_cases
+
+
+ def recommend_new_qty(self, item, ps_item_qty, no_of_cases):
+ """
+ Recommend a new quantity and raise a validation exception
+ """
+ item['recommended_qty'] = (flt(item['qty']) - flt(item['packed_qty'])) / no_of_cases
+ item['specified_qty'] = flt(ps_item_qty[item['item_code']])
+
+ webnotes.msgprint("""\
+ Invalid Quantity specified (%(specified_qty)s %(stock_uom)s).
+ %(packed_qty)s out of %(qty)s %(stock_uom)s already packed for %(item_code)s.
+ <b>Recommended quantity for %(item_code)s = %(recommended_qty)s \
+ %(stock_uom)s</b>""" % item, raise_exception=1)
+
+
+ def on_submit(self):
+ """
+ * Update packed qty for all items
+ """
+ self.update_packed_qty(event='submit')
+
+
+ def on_cancel(self):
+ """
+ * Update packed qty for all items
+ """
+ self.update_packed_qty(event='cancel')
+
+
+ def update_packed_qty(self, event=''):
+ """
+ Updates packed qty for all items
+ """
+ if event not in ['submit', 'cancel']:
+ raise Exception('update_packed_quantity can only be called on submit or cancel')
+
+ # Get Delivery Note Details, Item Quantity Dict and No. of Cases for this Packing slip
+ dn_details, ps_item_qty, no_of_cases = self.get_details_for_packing()
+
+ for item in dn_details:
+ if event=='submit':
+ new_packed_qty = flt(item['packed_qty']) + (flt(ps_item_qty[item['item_code']]) * no_of_cases)
+
+ elif event=='cancel':
+ new_packed_qty = flt(item['packed_qty']) - (flt(ps_item_qty[item['item_code']]) * no_of_cases)
+
+ if (new_packed_qty < 0) or (new_packed_qty > flt(item['qty'])):
+ webnotes.msgprint("Invalid new packed quantity for item %s. \
+ Please try again or contact support@erpnext.com" % item['item_code'], raise_exception=1)
+
+ webnotes.conn.sql("""\
+ UPDATE `tabDelivery Note Detail`
+ SET packed_qty = %s
+ WHERE parent = %s AND item_code = %s""",
+ (new_packed_qty, self.doc.delivery_note, item['item_code']))
+
+
+ def update_item_details(self):
+ """
+ Fill empty columns in Packing Slip Detail
+ """
+ from webnotes.model.code import get_obj
+ for d in self.doclist:
+ psd_obj = get_obj(doc=d)
+ psd_obj.get_item_details(self.doc.delivery_note)
diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.txt b/erpnext/stock/doctype/packing_slip/packing_slip.txt
new file mode 100644
index 0000000..6c54a9d
--- /dev/null
+++ b/erpnext/stock/doctype/packing_slip/packing_slip.txt
@@ -0,0 +1,314 @@
+# DocType, Packing Slip
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-30 12:13:10',
+ 'docstatus': 0,
+ 'modified': '2012-02-02 10:37:15',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ '_last_update': '1328091392',
+ 'autoname': 'PS.#######',
+ 'colour': 'White:FFF',
+ 'doctype': 'DocType',
+ 'document_type': 'Transaction',
+ 'is_transaction_doc': 1,
+ 'module': 'Stock',
+ 'name': '__common__',
+ 'read_only_onload': 1,
+ 'search_fields': 'delivery_note',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'subject': '[%(delivery_note)s] Case Nos: %(from_case_no)s - %(to_case_no)s | Net Weight: %(net_weight_pkg)s %(net_weight_uom)s | Gross Weight: %(gross_weight_pkg)s %(gross_weight_uom)s',
+ 'version': 40
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'Packing Slip',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType'
+ },
+
+ # These values are common for all DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'name': '__common__',
+ 'parent': 'Packing Slip',
+ 'parentfield': 'permissions',
+ 'parenttype': 'DocType',
+ 'read': 1
+ },
+
+ # DocType, Packing Slip
+ {
+ 'doctype': 'DocType',
+ 'name': 'Packing Slip'
+ },
+
+ # DocPerm
+ {
+ 'amend': 1,
+ 'cancel': 1,
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'permlevel': 0,
+ 'role': 'Material User',
+ 'submit': 1,
+ 'write': 1
+ },
+
+ # DocPerm
+ {
+ 'amend': 1,
+ 'cancel': 1,
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'permlevel': 0,
+ 'role': 'Sales User',
+ 'submit': 1,
+ 'write': 1
+ },
+
+ # DocPerm
+ {
+ 'amend': 1,
+ 'cancel': 1,
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'permlevel': 0,
+ 'role': 'Material Master Manager',
+ 'submit': 1,
+ 'write': 1
+ },
+
+ # DocPerm
+ {
+ 'amend': 1,
+ 'cancel': 1,
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'permlevel': 0,
+ 'role': 'Material Manager',
+ 'submit': 1,
+ 'write': 1
+ },
+
+ # DocPerm
+ {
+ 'amend': 1,
+ 'cancel': 1,
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'permlevel': 0,
+ 'role': 'Sales Manager',
+ 'submit': 1,
+ 'write': 1
+ },
+
+ # DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'permlevel': 1,
+ 'role': 'All'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Section Break',
+ 'label': 'Packing Slip Details',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Column Break',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'delivery_note',
+ 'fieldtype': 'Link',
+ 'label': 'Delivery Note',
+ 'options': 'Delivery Note',
+ 'permlevel': 0,
+ 'reqd': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Column Break',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'naming_series',
+ 'fieldtype': 'Select',
+ 'label': 'Series',
+ 'no_copy': 0,
+ 'options': 'PS',
+ 'permlevel': 0,
+ 'print_hide': 1,
+ 'reqd': 1
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocField',
+ 'fieldtype': 'Section Break',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Column Break',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocField',
+ 'fieldname': 'from_case_no',
+ 'fieldtype': 'Data',
+ 'label': 'From Case No.',
+ 'no_copy': 1,
+ 'permlevel': 0,
+ 'reqd': 1,
+ 'width': '50px'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Column Break',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocField',
+ 'fieldname': 'to_case_no',
+ 'fieldtype': 'Data',
+ 'label': 'To Case No.',
+ 'no_copy': 1,
+ 'permlevel': 0,
+ 'width': '50px'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Section Break',
+ 'label': 'Package Item Details',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'item_details',
+ 'fieldtype': 'Table',
+ 'label': 'Items',
+ 'options': 'Packing Slip Detail',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Section Break',
+ 'label': 'Package Weight Details',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocField',
+ 'fieldname': 'net_weight_pkg',
+ 'fieldtype': 'Currency',
+ 'label': 'Net Weight',
+ 'no_copy': 1,
+ 'permlevel': 1
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocField',
+ 'fieldname': 'net_weight_uom',
+ 'fieldtype': 'Data',
+ 'label': 'Net Weight UOM',
+ 'no_copy': 1,
+ 'permlevel': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Column Break',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocField',
+ 'fieldname': 'gross_weight_pkg',
+ 'fieldtype': 'Currency',
+ 'label': 'Gross Weight',
+ 'no_copy': 1,
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocField',
+ 'fieldname': 'gross_weight_uom',
+ 'fieldtype': 'Link',
+ 'label': 'Gross Weight UOM',
+ 'no_copy': 1,
+ 'options': 'UOM',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'depends_on': 'eval:doc.amended_from',
+ 'doctype': 'DocField',
+ 'fieldtype': 'Section Break',
+ 'label': 'Misc Details',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'amended_from',
+ 'fieldtype': 'Link',
+ 'label': 'Amended From',
+ 'no_copy': 1,
+ 'options': 'Packing Slip',
+ 'permlevel': 1,
+ 'print_hide': 1
+ }
+]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/stock/doctype/packing_slip_detail/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/stock/doctype/packing_slip_detail/__init__.py
diff --git a/erpnext/stock/doctype/packing_slip_detail/packing_slip_detail.py b/erpnext/stock/doctype/packing_slip_detail/packing_slip_detail.py
new file mode 100644
index 0000000..05f502c
--- /dev/null
+++ b/erpnext/stock/doctype/packing_slip_detail/packing_slip_detail.py
@@ -0,0 +1,29 @@
+import webnotes
+
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
+
+ def get_item_details(self, delivery_note):
+ res = webnotes.conn.sql("""\
+ SELECT item_name, SUM(IFNULL(qty, 0)) as total_qty,
+ IFNULL(packed_qty, 0) as packed_qty, stock_uom
+ FROM `tabDelivery Note Detail`
+ WHERE parent=%s AND item_code=%s GROUP BY item_code""",
+ (delivery_note, self.doc.item_code), as_dict=1)
+
+ if res and len(res)>0:
+ res = res[0]
+ res['qty'] = res['total_qty'] - res['packed_qty']
+ res['qty'] = self.doc.qty or (res['qty']>=0 and res['qty'] or 0)
+ del res['total_qty']
+ del res['packed_qty']
+ self.doc.fields.update(res)
+
+ res = webnotes.conn.sql("""\
+ SELECT net_weight, weight_uom FROM `tabItem`
+ WHERE name=%s""", self.doc.item_code, as_dict=1)
+
+ if res and len(res)>0:
+ res = res[0]
+ self.doc.fields.update(res)
diff --git a/erpnext/stock/doctype/packing_slip_detail/packing_slip_detail.txt b/erpnext/stock/doctype/packing_slip_detail/packing_slip_detail.txt
new file mode 100644
index 0000000..5a83b6f
--- /dev/null
+++ b/erpnext/stock/doctype/packing_slip_detail/packing_slip_detail.txt
@@ -0,0 +1,113 @@
+# DocType, Packing Slip Detail
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-30 17:40:50',
+ 'docstatus': 0,
+ 'modified': '2012-01-31 13:15:40',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ 'autoname': 'PSD/.#######',
+ 'colour': 'White:FFF',
+ 'doctype': 'DocType',
+ 'istable': 1,
+ 'module': 'Stock',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 9
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'Packing Slip Detail',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType'
+ },
+
+ # DocType, Packing Slip Detail
+ {
+ 'doctype': 'DocType',
+ 'name': 'Packing Slip Detail'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'item_code',
+ 'fieldtype': 'Link',
+ 'label': 'Item Code',
+ 'options': 'Item',
+ 'permlevel': 0,
+ 'reqd': 1,
+ 'width': '100px'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'item_name',
+ 'fieldtype': 'Data',
+ 'label': 'Item Name',
+ 'permlevel': 1,
+ 'width': '200px'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'qty',
+ 'fieldtype': 'Currency',
+ 'label': 'Quantity',
+ 'permlevel': 0,
+ 'reqd': 1,
+ 'width': '100px'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'stock_uom',
+ 'fieldtype': 'Data',
+ 'label': 'UOM',
+ 'permlevel': 1,
+ 'width': '100px'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'net_weight',
+ 'fieldtype': 'Float',
+ 'label': 'Net Weight',
+ 'permlevel': 1,
+ 'width': '100px'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'weight_uom',
+ 'fieldtype': 'Link',
+ 'label': 'Weight UOM',
+ 'options': 'UOM',
+ 'permlevel': 1,
+ 'width': '100px'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'page_break',
+ 'fieldtype': 'Check',
+ 'label': 'Page Break',
+ 'permlevel': 0
+ }
+]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 944fa8a..41ee2ff 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -92,6 +92,18 @@
raise Exception
+ def validate_challan_no(self):
+ "Validate if same challan no exists for same supplier in a submitted purchase receipt"
+ if self.doc.challan_no:
+ exists = webnotes.conn.sql("""
+ SELECT name FROM `tabPurchase Receipt`
+ WHERE name!=%s AND supplier=%s AND challan_no=%s
+ AND docstatus=1""", (self.doc.name, self.doc.supplier, self.doc.challan_no))
+ if exists:
+ webnotes.msgprint("Another Purchase Receipt using the same Challan No. already exists.\
+ Please enter a valid Challan No.", raise_exception=1)
+
+
# update valuation rate
def update_valuation_rate(self):
total_b_cost = flt(self.doc.buying_cost_transport) + flt(self.doc.buying_cost_taxes) + flt(self.doc.buying_cost_other)
@@ -127,6 +139,7 @@
self.validate_accepted_rejected_qty()
self.validate_inspection() # Validate Inspection
get_obj('Stock Ledger').validate_serial_no(self, 'purchase_receipt_details')
+ self.validate_challan_no()
pc_obj = get_obj(dt='Purchase Common')
pc_obj.validate_for_items(self)
diff --git a/erpnext/stock/doctype/serial_no/serial_no.txt b/erpnext/stock/doctype/serial_no/serial_no.txt
index 277a2ec..df42c7f 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.txt
+++ b/erpnext/stock/doctype/serial_no/serial_no.txt
@@ -5,14 +5,14 @@
{
'creation': '2010-08-08 17:09:23',
'docstatus': 0,
- 'modified': '2011-10-10 17:08:57',
+ 'modified': '2012-01-31 15:53:38',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
- '_last_update': '1317365120',
+ '_last_update': '1325570647',
'allow_trash': 1,
'autoname': 'field:serial_no',
'colour': 'White:FFF',
@@ -25,8 +25,9 @@
'section_style': 'Tabbed',
'server_code_error': ' ',
'show_in_menu': 0,
+ 'subject': 'Item Code: %(item_code)s, Warehouse: %(warehouse)s',
'tag_fields': 'status',
- 'version': 190
+ 'version': 191
},
# These values are common for all DocField
@@ -163,7 +164,7 @@
'no_copy': 1,
'oldfieldname': 'status',
'oldfieldtype': 'Select',
- 'options': '\nIn Store\nDelivered\nNot in Use',
+ 'options': '\nIn Store\nDelivered\nNot in Use\nPurchase Returned',
'permlevel': 1,
'reqd': 1,
'search_index': 1
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index c94e71d..1a3e783 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -107,7 +107,8 @@
if fg_item and bom_no:
# re-calculate cost for production item from bom
get_obj('BOM Control').calculate_cost(bom_no)
- in_rate = flt(get_value('Bill Of Materials', bom_no, 'total_cost'))
+ bom_obj = get_obj('Bill Of Materials', bom_no)
+ in_rate = flt(bom_obj.doc.total_cost) / (flt(bom_obj.doc.quantity) or 1)
elif wh:
in_rate = get_obj('Valuation Control').get_incoming_rate(dt, tm, item, wh, qty, serial_no)
@@ -146,7 +147,6 @@
child items of sub-contracted and sub assembly items
and sub assembly items itself.
"""
-
if pro_obj.doc.consider_sa_items == 'Yes':
# Get all raw materials considering SA items as raw materials,
# so no childs of SA items
@@ -157,6 +157,7 @@
group by item_code
""" % ((self.doc.process == 'Backflush') and flt(self.doc.fg_completed_qty) \
or flt(pro_obj.doc.qty), cstr(pro_obj.doc.bom_no)))
+
self.make_items_dict(fl_bom_sa_items)
else:
@@ -174,7 +175,6 @@
group by item_code,stock_uom
""" , ((self.doc.process == 'Backflush') and flt(self.doc.fg_completed_qty) \
or flt(pro_obj.doc.qty), cstr(pro_obj.doc.bom_no)))
-
self.make_items_dict(fl_bom_sa_child_item)
# Update only qty remaining to be issued for production
@@ -435,7 +435,11 @@
sl_obj.update_serial_purchase_details(self, d, serial_no, is_submit, self.doc.purpose)
if self.doc.purpose == 'Purchase Return':
- delete_doc("Serial No", serial_no)
+ #delete_doc("Serial No", serial_no)
+ serial_doc = Document("Serial No", serial_no)
+ serial_doc.status = 'Purchase Returned'
+ serial_doc.docstatus = 2
+ serial_doc.save()
def on_submit(self):
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.txt b/erpnext/stock/doctype/stock_entry/stock_entry.txt
index 63f718b..395082f 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.txt
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.txt
@@ -5,14 +5,14 @@
{
'creation': '2010-08-08 17:09:25',
'docstatus': 0,
- 'modified': '2011-08-22 14:36:19',
+ 'modified': '2012-01-24 19:47:47',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
- '_last_update': '1311621379',
+ '_last_update': '1325570647',
'allow_attach': 0,
'allow_copy': 0,
'allow_email': 0,
@@ -20,6 +20,7 @@
'allow_rename': 0,
'allow_trash': 0,
'colour': 'White:FFF',
+ 'default_print_format': 'Standard',
'doctype': 'DocType',
'hide_heading': 0,
'hide_toolbar': 0,
@@ -40,7 +41,7 @@
'subject': '%(remarks)s',
'tag_fields': 'purpose',
'use_template': 0,
- 'version': 245
+ 'version': 248
},
# These values are common for all DocField
@@ -74,7 +75,6 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 1,
'permlevel': 1,
'role': 'Material Manager',
'submit': 0,
@@ -87,7 +87,6 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 2,
'permlevel': 1,
'role': 'Material User',
'submit': 0,
@@ -100,7 +99,6 @@
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
- 'idx': 3,
'permlevel': 0,
'role': 'Production User',
'submit': 1,
@@ -113,7 +111,6 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 4,
'permlevel': 1,
'role': 'Production User',
'submit': 0,
@@ -126,7 +123,6 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 5,
'permlevel': 2,
'role': 'Production User',
'submit': 0,
@@ -139,7 +135,6 @@
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
- 'idx': 6,
'permlevel': 0,
'role': 'Production Manager',
'submit': 1,
@@ -152,7 +147,6 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 7,
'permlevel': 1,
'role': 'Production Manager',
'submit': 0,
@@ -165,7 +159,6 @@
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
- 'idx': 8,
'permlevel': 2,
'role': 'Production Manager',
'submit': 0,
@@ -176,7 +169,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 1,
'label': 'Warehouse',
'oldfieldtype': 'Section Break',
'permlevel': 0
@@ -186,7 +178,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
- 'idx': 2,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
@@ -200,7 +191,6 @@
'doctype': 'DocField',
'fieldname': 'naming_series',
'fieldtype': 'Select',
- 'idx': 3,
'in_filter': 0,
'label': 'Series',
'no_copy': 1,
@@ -221,7 +211,6 @@
'doctype': 'DocField',
'fieldname': 'amendment_date',
'fieldtype': 'Date',
- 'idx': 4,
'in_filter': 0,
'label': 'Amendment Date',
'no_copy': 1,
@@ -240,7 +229,6 @@
'doctype': 'DocField',
'fieldname': 'purpose',
'fieldtype': 'Select',
- 'idx': 5,
'in_filter': 1,
'label': 'Purpose',
'no_copy': 0,
@@ -262,7 +250,6 @@
'fieldname': 'delivery_note_no',
'fieldtype': 'Link',
'hidden': 1,
- 'idx': 6,
'in_filter': 0,
'label': 'Delivery Note No',
'no_copy': 0,
@@ -284,7 +271,6 @@
'fieldname': 'purchase_receipt_no',
'fieldtype': 'Link',
'hidden': 1,
- 'idx': 7,
'in_filter': 0,
'label': 'Purchase Receipt No',
'no_copy': 0,
@@ -304,7 +290,6 @@
'fieldname': 'sales_invoice_no',
'fieldtype': 'Link',
'hidden': 1,
- 'idx': 8,
'label': 'Sales Invoice No',
'options': 'Receivable Voucher',
'permlevel': 0,
@@ -319,7 +304,6 @@
'fieldname': 'supplier',
'fieldtype': 'Link',
'hidden': 1,
- 'idx': 9,
'in_filter': 0,
'label': 'Supplier',
'no_copy': 0,
@@ -339,7 +323,6 @@
'doctype': 'DocField',
'fieldname': 'supplier_name',
'fieldtype': 'Data',
- 'idx': 10,
'in_filter': 0,
'label': 'Supplier Name',
'no_copy': 0,
@@ -358,7 +341,6 @@
'fieldname': 'supplier_address',
'fieldtype': 'Small Text',
'hidden': 1,
- 'idx': 11,
'in_filter': 0,
'label': 'Supplier Address',
'no_copy': 0,
@@ -378,7 +360,6 @@
'fieldname': 'customer',
'fieldtype': 'Link',
'hidden': 1,
- 'idx': 12,
'in_filter': 0,
'label': 'Customer',
'no_copy': 0,
@@ -399,7 +380,6 @@
'fieldname': 'customer_name',
'fieldtype': 'Data',
'hidden': 1,
- 'idx': 13,
'in_filter': 0,
'label': 'Customer Name',
'no_copy': 0,
@@ -417,7 +397,6 @@
'fieldname': 'customer_address',
'fieldtype': 'Small Text',
'hidden': 1,
- 'idx': 14,
'in_filter': 0,
'label': 'Customer Address',
'no_copy': 0,
@@ -436,7 +415,6 @@
'fieldname': 'process',
'fieldtype': 'Select',
'hidden': 1,
- 'idx': 15,
'in_filter': 1,
'label': 'Process',
'no_copy': 0,
@@ -458,7 +436,6 @@
'fieldname': 'production_order',
'fieldtype': 'Link',
'hidden': 1,
- 'idx': 16,
'in_filter': 1,
'label': 'Production Order',
'no_copy': 0,
@@ -478,7 +455,6 @@
'doctype': 'DocField',
'fieldname': 'fg_completed_qty',
'fieldtype': 'Currency',
- 'idx': 17,
'in_filter': 0,
'label': 'FG Completed Qty',
'no_copy': 0,
@@ -496,7 +472,6 @@
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'HTML',
- 'idx': 18,
'label': 'Warehouse HTML',
'no_copy': 0,
'oldfieldtype': 'HTML',
@@ -512,7 +487,6 @@
'doctype': 'DocField',
'fieldname': 'from_warehouse',
'fieldtype': 'Link',
- 'idx': 19,
'in_filter': 0,
'label': 'Source Warehouse',
'no_copy': 0,
@@ -535,7 +509,6 @@
'doctype': 'DocField',
'fieldname': 'to_warehouse',
'fieldtype': 'Link',
- 'idx': 20,
'in_filter': 0,
'label': 'Target Warehouse',
'no_copy': 0,
@@ -555,7 +528,6 @@
'doctype': 'DocField',
'fieldname': 'project_name',
'fieldtype': 'Link',
- 'idx': 21,
'in_filter': 1,
'label': 'Project Name',
'oldfieldname': 'project_name',
@@ -568,7 +540,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
- 'idx': 22,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
@@ -581,7 +552,6 @@
'doctype': 'DocField',
'fieldname': 'transfer_date',
'fieldtype': 'Date',
- 'idx': 23,
'in_filter': 1,
'label': 'Transfer Date',
'no_copy': 1,
@@ -601,7 +571,6 @@
'doctype': 'DocField',
'fieldname': 'posting_date',
'fieldtype': 'Date',
- 'idx': 24,
'in_filter': 1,
'label': 'Posting Date',
'no_copy': 1,
@@ -620,7 +589,6 @@
'doctype': 'DocField',
'fieldname': 'posting_time',
'fieldtype': 'Time',
- 'idx': 25,
'in_filter': 0,
'label': 'Posting Time',
'no_copy': 1,
@@ -639,7 +607,6 @@
'doctype': 'DocField',
'fieldname': 'amended_from',
'fieldtype': 'Link',
- 'idx': 26,
'in_filter': 0,
'label': 'Amended From',
'no_copy': 1,
@@ -658,7 +625,6 @@
'doctype': 'DocField',
'fieldname': 'transporter',
'fieldtype': 'Data',
- 'idx': 27,
'in_filter': 0,
'label': 'Transporter',
'no_copy': 0,
@@ -676,7 +642,6 @@
'doctype': 'DocField',
'fieldname': 'is_excisable_goods',
'fieldtype': 'Select',
- 'idx': 28,
'in_filter': 0,
'label': 'Is Excisable Goods',
'no_copy': 0,
@@ -695,7 +660,6 @@
'doctype': 'DocField',
'fieldname': 'excisable_goods',
'fieldtype': 'Select',
- 'idx': 29,
'in_filter': 0,
'label': 'Excisable Goods',
'no_copy': 0,
@@ -715,7 +679,6 @@
'fieldname': 'under_rule',
'fieldtype': 'Select',
'hidden': 1,
- 'idx': 30,
'in_filter': 0,
'label': 'Under Rule',
'no_copy': 0,
@@ -734,7 +697,6 @@
'doctype': 'DocField',
'fieldname': 'remarks',
'fieldtype': 'Text',
- 'idx': 31,
'in_filter': 0,
'label': 'Remarks',
'no_copy': 1,
@@ -754,7 +716,6 @@
'fieldname': 'cancel_reason',
'fieldtype': 'Data',
'hidden': 1,
- 'idx': 32,
'in_filter': 0,
'label': 'Cancel Reason',
'no_copy': 1,
@@ -771,7 +732,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 33,
'label': 'Items',
'oldfieldtype': 'Section Break',
'permlevel': 0
@@ -781,7 +741,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Button',
- 'idx': 34,
'label': 'Get Stock and Rate',
'oldfieldtype': 'Button',
'options': 'get_stock_and_rate',
@@ -793,7 +752,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
- 'idx': 35,
'oldfieldtype': 'Column Break',
'permlevel': 0
},
@@ -805,7 +763,6 @@
'doctype': 'DocField',
'fieldtype': 'Button',
'hidden': 0,
- 'idx': 36,
'in_filter': 0,
'label': 'Get Items',
'no_copy': 0,
@@ -821,7 +778,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 37,
'oldfieldtype': 'Section Break',
'options': 'Simple',
'permlevel': 0
@@ -834,7 +790,6 @@
'doctype': 'DocField',
'fieldname': 'mtn_details',
'fieldtype': 'Table',
- 'idx': 38,
'in_filter': 0,
'label': 'MTN Details',
'no_copy': 0,
@@ -853,7 +808,6 @@
'doctype': 'DocField',
'fieldname': 'total_amount',
'fieldtype': 'Currency',
- 'idx': 39,
'in_filter': 0,
'label': 'Total Amount',
'no_copy': 0,
@@ -869,7 +823,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 40,
'label': 'Other Details',
'oldfieldtype': 'Section Break',
'permlevel': 0
@@ -881,7 +834,6 @@
'doctype': 'DocField',
'fieldname': 'company',
'fieldtype': 'Link',
- 'idx': 41,
'in_filter': 1,
'label': 'Company',
'no_copy': 0,
@@ -901,7 +853,6 @@
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
- 'idx': 42,
'in_filter': 0,
'label': 'Fiscal Year',
'no_copy': 0,
@@ -921,7 +872,6 @@
'doctype': 'DocField',
'fieldname': 'select_print_heading',
'fieldtype': 'Link',
- 'idx': 43,
'in_filter': 0,
'label': 'Select Print Heading',
'no_copy': 0,
diff --git a/erpnext/support/doctype/customer_issue/customer_issue.txt b/erpnext/support/doctype/customer_issue/customer_issue.txt
index 122f92d..b19a1a8 100644
--- a/erpnext/support/doctype/customer_issue/customer_issue.txt
+++ b/erpnext/support/doctype/customer_issue/customer_issue.txt
@@ -5,15 +5,16 @@
{
'creation': '2010-08-08 17:08:57',
'docstatus': 0,
- 'modified': '2011-05-27 18:30:14',
+ 'modified': '2012-01-19 12:29:40',
'modified_by': 'Administrator',
'owner': 'harshada@webnotestech.com'
},
# These values are common for all DocType
{
- '_last_update': '1308741898',
+ '_last_update': '1325570647',
'colour': 'White:FFF',
+ 'default_print_format': 'Standard',
'doctype': 'DocType',
'module': 'Support',
'name': '__common__',
@@ -23,7 +24,7 @@
'show_in_menu': 0,
'subject': '%(complaint)s By %(complaint_raised_by)s on %(issue_date)s',
'tag_fields': 'status',
- 'version': 96
+ 'version': 97
},
# These values are common for all DocField
@@ -55,7 +56,6 @@
{
'create': 1,
'doctype': 'DocPerm',
- 'idx': 1,
'permlevel': 0,
'role': 'Guest',
'write': 1
@@ -67,7 +67,6 @@
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
- 'idx': 2,
'permlevel': 0,
'role': 'System Manager',
'submit': 1,
@@ -77,7 +76,6 @@
# DocPerm
{
'doctype': 'DocPerm',
- 'idx': 3,
'permlevel': 1,
'role': 'System Manager'
},
@@ -88,7 +86,6 @@
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
- 'idx': 4,
'permlevel': 0,
'role': 'Maintenance Manager',
'submit': 1,
@@ -98,7 +95,6 @@
# DocPerm
{
'doctype': 'DocPerm',
- 'idx': 5,
'permlevel': 1,
'role': 'Maintenance Manager'
},
@@ -109,7 +105,6 @@
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
- 'idx': 6,
'permlevel': 0,
'role': 'Maintenance User',
'submit': 1,
@@ -119,7 +114,6 @@
# DocPerm
{
'doctype': 'DocPerm',
- 'idx': 7,
'permlevel': 1,
'role': 'Maintenance User'
},
@@ -128,7 +122,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 1,
'label': 'Customer Issue',
'oldfieldtype': 'Section Break',
'permlevel': 0
@@ -139,7 +132,6 @@
'doctype': 'DocField',
'fieldname': 'naming_series',
'fieldtype': 'Select',
- 'idx': 2,
'in_filter': 0,
'label': 'Series',
'no_copy': 1,
@@ -158,7 +150,6 @@
'doctype': 'DocField',
'fieldname': 'status',
'fieldtype': 'Select',
- 'idx': 3,
'in_filter': 1,
'label': 'Status',
'no_copy': 1,
@@ -167,7 +158,7 @@
'options': '\nOpen\nClosed\nWork In Progress\nCancelled',
'permlevel': 0,
'reqd': 1,
- 'search_index': 0
+ 'search_index': 1
},
# DocField
@@ -176,7 +167,6 @@
'doctype': 'DocField',
'fieldname': 'complaint_date',
'fieldtype': 'Date',
- 'idx': 4,
'in_filter': 1,
'label': 'Issue Date',
'oldfieldname': 'complaint_date',
@@ -191,7 +181,6 @@
'doctype': 'DocField',
'fieldname': 'complaint_raised_by',
'fieldtype': 'Data',
- 'idx': 5,
'label': 'Raised By',
'oldfieldname': 'complaint_raised_by',
'oldfieldtype': 'Data',
@@ -203,7 +192,6 @@
'doctype': 'DocField',
'fieldname': 'from_company',
'fieldtype': 'Data',
- 'idx': 6,
'label': 'From Company',
'oldfieldname': 'from_company',
'oldfieldtype': 'Data',
@@ -215,7 +203,6 @@
'doctype': 'DocField',
'fieldname': 'service_address',
'fieldtype': 'Small Text',
- 'idx': 7,
'label': 'Service Address',
'oldfieldname': 'service_address',
'oldfieldtype': 'Small Text',
@@ -226,7 +213,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
- 'idx': 8,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
@@ -238,7 +224,6 @@
'doctype': 'DocField',
'fieldname': 'customer',
'fieldtype': 'Link',
- 'idx': 9,
'in_filter': 1,
'label': 'Customer',
'oldfieldname': 'customer',
@@ -256,7 +241,6 @@
'doctype': 'DocField',
'fieldname': 'customer_address',
'fieldtype': 'Link',
- 'idx': 10,
'label': 'Customer Address',
'options': 'Address',
'permlevel': 0,
@@ -268,7 +252,6 @@
'doctype': 'DocField',
'fieldname': 'contact_person',
'fieldtype': 'Link',
- 'idx': 11,
'label': 'Contact Person',
'options': 'Contact',
'permlevel': 0,
@@ -280,7 +263,6 @@
'doctype': 'DocField',
'fieldname': 'customer_name',
'fieldtype': 'Data',
- 'idx': 12,
'label': 'Name',
'permlevel': 1
},
@@ -290,7 +272,6 @@
'doctype': 'DocField',
'fieldname': 'address_display',
'fieldtype': 'Small Text',
- 'idx': 13,
'label': 'Address',
'permlevel': 1
},
@@ -300,7 +281,6 @@
'doctype': 'DocField',
'fieldname': 'contact_display',
'fieldtype': 'Small Text',
- 'idx': 14,
'label': 'Contact',
'permlevel': 1
},
@@ -310,7 +290,6 @@
'doctype': 'DocField',
'fieldname': 'contact_mobile',
'fieldtype': 'Data',
- 'idx': 15,
'label': 'Mobile No',
'permlevel': 1
},
@@ -320,7 +299,6 @@
'doctype': 'DocField',
'fieldname': 'contact_email',
'fieldtype': 'Data',
- 'idx': 16,
'label': 'Contact Email',
'permlevel': 1
},
@@ -331,7 +309,6 @@
'doctype': 'DocField',
'fieldname': 'territory',
'fieldtype': 'Link',
- 'idx': 17,
'in_filter': 1,
'label': 'Territory',
'oldfieldname': 'territory',
@@ -340,7 +317,7 @@
'permlevel': 0,
'print_hide': 1,
'reqd': 0,
- 'search_index': 0
+ 'search_index': 1
},
# DocField
@@ -348,7 +325,6 @@
'doctype': 'DocField',
'fieldname': 'customer_group',
'fieldtype': 'Link',
- 'idx': 18,
'label': 'Customer Group',
'options': 'Customer Group',
'permlevel': 0,
@@ -362,7 +338,6 @@
'doctype': 'DocField',
'fieldname': 'company',
'fieldtype': 'Link',
- 'idx': 19,
'in_filter': 1,
'label': 'Company',
'oldfieldname': 'company',
@@ -371,7 +346,7 @@
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
- 'search_index': 0,
+ 'search_index': 1,
'trigger': 'Client'
},
@@ -380,7 +355,6 @@
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
- 'idx': 20,
'in_filter': 1,
'label': 'Fiscal Year',
'oldfieldname': 'fiscal_year',
@@ -389,7 +363,7 @@
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
- 'search_index': 0
+ 'search_index': 1
},
# DocField
@@ -398,7 +372,6 @@
'fieldname': 'amended_from',
'fieldtype': 'Data',
'hidden': 1,
- 'idx': 21,
'label': 'Amended From',
'no_copy': 1,
'oldfieldname': 'amended_from',
@@ -414,7 +387,6 @@
'fieldname': 'amendment_date',
'fieldtype': 'Date',
'hidden': 1,
- 'idx': 22,
'label': 'Amendment Date',
'no_copy': 1,
'oldfieldname': 'amendment_date',
@@ -428,7 +400,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 23,
'label': 'Issue Details',
'oldfieldtype': 'Section Break',
'options': 'Simple',
@@ -440,7 +411,6 @@
'doctype': 'DocField',
'fieldname': 'serial_no',
'fieldtype': 'Link',
- 'idx': 24,
'label': 'Serial No',
'options': 'Serial No',
'permlevel': 0,
@@ -453,7 +423,6 @@
'doctype': 'DocField',
'fieldname': 'item_code',
'fieldtype': 'Link',
- 'idx': 25,
'in_filter': 1,
'label': 'Item Code',
'oldfieldname': 'item_code',
@@ -472,7 +441,6 @@
'doctype': 'DocField',
'fieldname': 'item_name',
'fieldtype': 'Data',
- 'idx': 26,
'label': 'Item Name',
'oldfieldname': 'item_name',
'oldfieldtype': 'Data',
@@ -486,7 +454,6 @@
'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Small Text',
- 'idx': 27,
'label': 'Description',
'oldfieldname': 'description',
'oldfieldtype': 'Small Text',
@@ -499,7 +466,6 @@
'doctype': 'DocField',
'fieldname': 'complaint',
'fieldtype': 'Small Text',
- 'idx': 28,
'label': 'Issue',
'no_copy': 1,
'oldfieldname': 'complaint',
@@ -512,7 +478,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
- 'idx': 29,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
@@ -525,7 +490,6 @@
'fieldname': 'warranty_amc_status',
'fieldtype': 'Select',
'hidden': 0,
- 'idx': 30,
'in_filter': 1,
'label': 'Warranty / AMC Status',
'options': '\nUnder Warranty\nOut of Warranty\nUnder AMC\nOut of AMC',
@@ -537,7 +501,6 @@
'doctype': 'DocField',
'fieldname': 'warranty_expiry_date',
'fieldtype': 'Date',
- 'idx': 31,
'label': 'Warranty Expiry Date',
'permlevel': 0
},
@@ -547,7 +510,6 @@
'doctype': 'DocField',
'fieldname': 'amc_expiry_date',
'fieldtype': 'Date',
- 'idx': 32,
'label': 'AMC Expiry Date',
'permlevel': 0
},
@@ -557,13 +519,12 @@
'doctype': 'DocField',
'fieldname': 'allocated_on',
'fieldtype': 'Date',
- 'idx': 33,
'in_filter': 1,
'label': 'Allocated On',
'oldfieldname': 'allocated_on',
'oldfieldtype': 'Date',
'permlevel': 0,
- 'search_index': 0
+ 'search_index': 1
},
# DocField
@@ -571,21 +532,19 @@
'doctype': 'DocField',
'fieldname': 'allocated_to',
'fieldtype': 'Link',
- 'idx': 34,
'in_filter': 1,
'label': 'Allocated To',
'oldfieldname': 'allocated_to',
'oldfieldtype': 'Link',
- 'options': 'Sales Person',
+ 'options': 'Profile',
'permlevel': 0,
- 'search_index': 0
+ 'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 35,
'label': 'Resolution Detail',
'oldfieldtype': 'Section Break',
'options': 'Simple',
@@ -597,7 +556,6 @@
'doctype': 'DocField',
'fieldname': 'resolution_details',
'fieldtype': 'Text',
- 'idx': 36,
'label': 'Resolution Details',
'no_copy': 1,
'oldfieldname': 'resolution_details',
@@ -609,7 +567,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
- 'idx': 37,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
@@ -620,14 +577,13 @@
'doctype': 'DocField',
'fieldname': 'resolution_date',
'fieldtype': 'Date',
- 'idx': 38,
'in_filter': 1,
'label': 'Resolution Date',
'no_copy': 1,
'oldfieldname': 'resolution_date',
'oldfieldtype': 'Date',
'permlevel': 0,
- 'search_index': 0
+ 'search_index': 1
},
# DocField
@@ -635,7 +591,6 @@
'doctype': 'DocField',
'fieldname': 'resolved_by',
'fieldtype': 'Link',
- 'idx': 39,
'in_filter': 1,
'label': 'Resolved By',
'no_copy': 1,
@@ -643,7 +598,7 @@
'oldfieldtype': 'Link',
'options': 'Sales Person',
'permlevel': 0,
- 'search_index': 0
+ 'search_index': 1
},
# DocField
@@ -653,7 +608,6 @@
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldtype': 'Section Break',
- 'idx': 40,
'label': 'Next Steps',
'oldfieldtype': 'Section Break',
'permlevel': 0
@@ -665,7 +619,6 @@
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Button',
- 'idx': 41,
'label': 'Make Maintenance Visit',
'oldfieldtype': 'Button',
'permlevel': 0,
diff --git a/erpnext/support/doctype/support_ticket/support_ticket.py b/erpnext/support/doctype/support_ticket/support_ticket.py
index 2db784e..943d418 100644
--- a/erpnext/support/doctype/support_ticket/support_ticket.py
+++ b/erpnext/support/doctype/support_ticket/support_ticket.py
@@ -19,7 +19,7 @@
if not self.doc.new_response:
webnotes.msgprint("Please write something as a response", raise_exception=1)
- subject = '[' + self.doc.name + '] ' + self.doc.subject
+ subject = '[' + self.doc.name + '] ' + (self.doc.subject or 'No Subject Specified')
response = self.doc.new_response + '\n\n[Please do not change the subject while responding.]'
@@ -36,7 +36,7 @@
recipients = [self.doc.raised_by], \
sender=webnotes.conn.get_value('Email Settings',None,'support_email'), \
subject=subject, \
- msg=response)
+ msg=response.encode('utf-8'))
self.doc.new_response = None
webnotes.conn.set(self.doc,'status','Waiting for Customer')
@@ -48,7 +48,15 @@
where parent = %s order by creation desc limit 1
""", self.doc.name)
- return '\n\n=== In response to ===\n\n' + tmp[0][0]
+ if not tmp:
+ tmp = webnotes.conn.sql("""
+ SELECT description from `tabSupport Ticket`
+ where name = %s
+ """, self.doc.name)
+
+ response_title = "=== In response to ==="
+
+ return "\n\n" + response_title + "\n\n" + tmp[0][0].split(response_title)[0]
def make_response_record(self, response, from_email = None, content_type='text/plain'):
"""
@@ -59,6 +67,8 @@
d = Document('Support Ticket Response')
d.from_email = from_email or webnotes.user.name
d.parent = self.doc.name
+ d.parenttype = "Support Ticket"
+ d.parentfield = "responses"
d.mail = response
d.content_type = content_type
d.save(1)
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 64f6bd2..783f91a 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
@@ -26,7 +26,7 @@
lft_rgt = sql("select lft, rgt from `tab%s` where name = '%s'" % (opt,r[col_idx[opt]].strip()))
- det = sql("select COUNT(CASE WHEN t1.amc_expiry_date < '%s' THEN t1.name ELSE NULL END), COUNT(CASE WHEN t1.amc_expiry_date >= '%s' THEN t1.name ELSE NULL END), COUNT(CASE WHEN t1.warranty_expiry_date < '%s' THEN t1.name ELSE NULL END), COUNT(CASE WHEN t1.warranty_expiry_date >= '%s' THEN t1.name ELSE NULL END) from `tabSerial No` t1, `tab%s` t2 where t1.%s = t2.name and t2.lft>= '%s' and t2. rgt <= '%s' and t1.status not in ('In Store', 'Scrapped','Not in Use') and ifnull(item_group,'')!='' and ifnull(territory,'')!=''" %(nowdate,nowdate,nowdate,nowdate,opt, opt_dict[opt], lft_rgt[0][0], lft_rgt[0][1]))
+ det = sql("select COUNT(CASE WHEN t1.amc_expiry_date < '%s' THEN t1.name ELSE NULL END), COUNT(CASE WHEN t1.amc_expiry_date >= '%s' THEN t1.name ELSE NULL END), COUNT(CASE WHEN t1.warranty_expiry_date < '%s' THEN t1.name ELSE NULL END), COUNT(CASE WHEN t1.warranty_expiry_date >= '%s' THEN t1.name ELSE NULL END) from `tabSerial No` t1, `tab%s` t2 where t1.%s = t2.name and t2.lft>= '%s' and t2. rgt <= '%s' and t1.status = 'Delivered' and ifnull(item_group,'')!='' and ifnull(territory,'')!=''" %(nowdate,nowdate,nowdate,nowdate,opt, opt_dict[opt], lft_rgt[0][0], lft_rgt[0][1]))
r.append(cint(det[0][0]))
r.append(cint(det[0][1]))
diff --git a/erpnext/utilities/doctype/address/address.py b/erpnext/utilities/doctype/address/address.py
index eabf624..7602d1d 100644
--- a/erpnext/utilities/doctype/address/address.py
+++ b/erpnext/utilities/doctype/address/address.py
@@ -4,53 +4,64 @@
from webnotes.model.doc import Document
from webnotes import session, form, msgprint, errprint
-sql = webnotes.conn.sql
-
# -----------------------------------------------------------------------------------------
class DocType:
- def __init__(self, doc, doclist=[]):
- self.doc = doc
- self.doclist = doclist
+ def __init__(self, doc, doclist=[]):
+ self.doc = doc
+ self.doclist = doclist
- def autoname(self):
- if self.doc.customer:
- self.doc.name = self.doc.customer + '-' + self.doc.address_type
- elif self.doc.supplier:
- self.doc.name = self.doc.supplier + '-' + self.doc.address_type
- elif self.doc.sales_partner:
- self.doc.name = self.doc.sales_partner + '-' + self.doc.address_type
-
- # filter out bad characters in name
- #self.doc.name = self.doc.name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','').replace('`','')
+ def autoname(self):
+ if self.doc.customer:
+ self.doc.name = self.doc.customer + '-' + self.doc.address_type
+ elif self.doc.supplier:
+ self.doc.name = self.doc.supplier + '-' + self.doc.address_type
+ elif self.doc.sales_partner:
+ self.doc.name = self.doc.sales_partner + '-' + self.doc.address_type
+
+ # filter out bad characters in name
+ #self.doc.name = self.doc.name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','').replace('`','')
#----------------------
# Call to Validate
#----------------------
- def validate(self):
- self.validate_primary_address()
- self.validate_shipping_address()
+ def validate(self):
+ self.validate_primary_address()
+ self.validate_shipping_address()
#----------------------
# Validate that there can only be one primary address for particular customer, supplier
#----------------------
- def validate_primary_address(self):
- if self.doc.is_primary_address == 1:
- if self.doc.customer:
- sql("update tabAddress set is_primary_address=0 where customer = '%s'" % (self.doc.customer))
- elif self.doc.supplier:
- sql("update tabAddress set is_primary_address=0 where supplier = '%s'" % (self.doc.supplier))
- elif self.doc.sales_partner:
- sql("update tabAddress set is_primary_address=0 where sales_partner = '%s'" % (self.doc.sales_partner))
-
+ def validate_primary_address(self):
+ sql = webnotes.conn.sql
+ if self.doc.is_primary_address == 1:
+ if self.doc.customer:
+ sql("update tabAddress set is_primary_address=0 where customer = '%s'" % (self.doc.customer))
+ elif self.doc.supplier:
+ sql("update tabAddress set is_primary_address=0 where supplier = '%s'" % (self.doc.supplier))
+ elif self.doc.sales_partner:
+ sql("update tabAddress set is_primary_address=0 where sales_partner = '%s'" % (self.doc.sales_partner))
+ elif not self.doc.is_shipping_address:
+ if self.doc.customer:
+ if not sql("select name from tabAddress where is_primary_address=1 and customer = '%s'" % (self.doc.customer)):
+ self.doc.is_primary_address = 1
+ elif self.doc.supplier:
+ if not sql("select name from tabAddress where is_primary_address=1 and supplier = '%s'" % (self.doc.supplier)):
+ self.doc.is_primary_address = 1
+ elif self.doc.sales_partner:
+ if not sql("select name from tabAddress where is_primary_address=1 and sales_partner = '%s'" % (self.doc.sales_partner)):
+ self.doc.is_primary_address = 1
+
+
#----------------------
# Validate that there can only be one shipping address for particular customer, supplier
#----------------------
- def validate_shipping_address(self):
- if self.doc.is_shipping_address == 1:
- if self.doc.customer:
- sql("update tabAddress set is_shipping_address=0 where customer = '%s'" % (self.doc.customer))
- elif self.doc.supplier:
- sql("update tabAddress set is_shipping_address=0 where supplier = '%s'" % (self.doc.supplier))
- elif self.doc.sales_partner:
- sql("update tabAddress set is_shipping_address=0 where sales_partner = '%s'" % (self.doc.sales_partner))
+ def validate_shipping_address(self):
+ sql = webnotes.conn.sql
+ if self.doc.is_shipping_address == 1:
+ if self.doc.customer:
+ sql("update tabAddress set is_shipping_address=0 where customer = '%s'" % (self.doc.customer))
+ elif self.doc.supplier:
+ sql("update tabAddress set is_shipping_address=0 where supplier = '%s'" % (self.doc.supplier))
+ elif self.doc.sales_partner:
+ sql("update tabAddress set is_shipping_address=0 where sales_partner = '%s'" % (self.doc.sales_partner))
diff --git a/erpnext/utilities/doctype/contact/contact.js b/erpnext/utilities/doctype/contact/contact.js
index bca1615..d33750d 100644
--- a/erpnext/utilities/doctype/contact/contact.js
+++ b/erpnext/utilities/doctype/contact/contact.js
@@ -3,6 +3,7 @@
if(doc.customer) cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
if(doc.supplier) cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
}
+
/*
//---------- on refresh ----------------------
cur_frm.cscript.refresh = function(doc,cdt,cdn){
diff --git a/erpnext/utilities/doctype/contact/contact.py b/erpnext/utilities/doctype/contact/contact.py
index 6d7c4c4..8cc9ba1 100644
--- a/erpnext/utilities/doctype/contact/contact.py
+++ b/erpnext/utilities/doctype/contact/contact.py
@@ -4,40 +4,49 @@
from webnotes.model.doc import Document
from webnotes import session, form, msgprint, errprint
-sql = webnotes.conn.sql
-
# -----------------------------------------------------------------------------------------
class DocType:
- def __init__(self, doc, doclist=[]):
- self.doc = doc
- self.doclist = doclist
+ def __init__(self, doc, doclist=[]):
+ self.doc = doc
+ self.doclist = doclist
- def autoname(self):
- if self.doc.customer:
- self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.customer
- elif self.doc.supplier:
- self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.supplier
- elif self.doc.sales_partner:
- self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.sales_partner
-
- # filter out bad characters in name
- #self.doc.name = self.doc.name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','')
+ def autoname(self):
+ if self.doc.customer:
+ self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.customer
+ elif self.doc.supplier:
+ self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.supplier
+ elif self.doc.sales_partner:
+ self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.sales_partner
+
+ # filter out bad characters in name
+ #self.doc.name = self.doc.name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','')
#----------------------
# Call to Validate
#----------------------
- def validate(self):
- self.validate_primary_contact()
+ def validate(self):
+ self.validate_primary_contact()
#----------------------
# Validate that there can only be one primary contact for particular customer, supplier
#----------------------
- def validate_primary_contact(self):
- if self.doc.is_primary_contact == 1:
- if self.doc.customer:
- sql("update tabContact set is_primary_contact=0 where customer = '%s'" % (self.doc.customer))
- elif self.doc.supplier:
- sql("update tabContact set is_primary_contact=0 where supplier = '%s'" % (self.doc.supplier))
- elif self.doc.sales_partner:
- sql("update tabContact set is_primary_contact=0 where sales_partner = '%s'" % (self.doc.sales_partner))
+ def validate_primary_contact(self):
+ sql = webnotes.conn.sql
+ if self.doc.is_primary_contact == 1:
+ if self.doc.customer:
+ sql("update tabContact set is_primary_contact=0 where customer = '%s'" % (self.doc.customer))
+ elif self.doc.supplier:
+ sql("update tabContact set is_primary_contact=0 where supplier = '%s'" % (self.doc.supplier))
+ elif self.doc.sales_partner:
+ sql("update tabContact set is_primary_contact=0 where sales_partner = '%s'" % (self.doc.sales_partner))
+ else:
+ if self.doc.customer:
+ if not sql("select name from tabContact where is_primary_contact=1 and customer = '%s'" % (self.doc.customer)):
+ self.doc.is_primary_contact = 1
+ elif self.doc.supplier:
+ if not sql("select name from tabContact where is_primary_contact=1 and supplier = '%s'" % (self.doc.supplier)):
+ self.doc.is_primary_contact = 1
+ elif self.doc.sales_partner:
+ if not sql("select name from tabContact where is_primary_contact=1 and sales_partner = '%s'" % (self.doc.sales_partner)):
+ self.doc.is_primary_contact = 1
diff --git a/erpnext/utilities/doctype/contact/contact.txt b/erpnext/utilities/doctype/contact/contact.txt
index e5a6757..9167ed4 100644
--- a/erpnext/utilities/doctype/contact/contact.txt
+++ b/erpnext/utilities/doctype/contact/contact.txt
@@ -5,14 +5,14 @@
{
'creation': '2010-08-08 17:08:55',
'docstatus': 0,
- 'modified': '2011-12-19 14:11:08',
+ 'modified': '2012-01-23 16:07:56',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
- '_last_update': '1316075905',
+ '_last_update': '1327314958',
'allow_trash': 1,
'colour': 'White:FFF',
'default_print_format': 'Standard',
@@ -26,7 +26,7 @@
'server_code_error': ' ',
'show_in_menu': 0,
'subject': '%(first_name)s %(last_name)s - Email: %(email_id)s | Contact: %(phone)s | Mobile: %(mobile_no)s',
- 'version': 243
+ 'version': 245
},
# These values are common for all DocField
@@ -225,7 +225,7 @@
{
'colour': 'White:FFF',
'default': '0',
- 'depends_on': 'eval:(cint(doc.is_customer) || cint(doc.is_supplier) || cint(doc.is_sales_partner))',
+ 'depends_on': 'eval:(doc.customer || doc.supplier || doc.sales_partner)',
'doctype': 'DocField',
'fieldname': 'is_primary_contact',
'fieldtype': 'Check',
diff --git a/erpnext/utilities/doctype/production_tips_common/production_tips_common.js b/erpnext/utilities/doctype/production_tips_common/production_tips_common.js
deleted file mode 100644
index 4dfc00a3..0000000
--- a/erpnext/utilities/doctype/production_tips_common/production_tips_common.js
+++ /dev/null
@@ -1,71 +0,0 @@
-// Global dictionary of next steps for doctypes
-// ============================================
-pscript.tip_prod_dict = {'Production Order':['Material Transfer', 'Backflush']};
-
-
-// Set tips depending on conditions
-// ================================
-cur_frm.cscript.get_tips = function(doc, cdt, cdn){
- var next_step_list = pscript.tip_prod_dict[cur_frm.doctype] ? pscript.tip_prod_dict[cur_frm.doctype] : 0;
-
- if(cur_frm.doctype!='Production Planning Tool'){
- // new doc
- if(doc.__islocal){
- if(doc.status=='Cancelled' || doc.amended_from)
- cur_frm.set_tip("You can now make changes in this " + cur_frm.doctype + " and save it by clicking on the <div style='font-weight:bold; display:inline'>Save</div> button in the above toolbar.");
- else{
- cur_frm.set_tip("To create " + cur_frm.doctype + " please start by entering all the mandatory fields (marked <div style='color:Red; display:inline'> Red</div>).");
- if(cur_frm.doctype=='Stock Entry') cur_frm.append_tip("If your purpose is Production Order, please go to <div style='font-weight:bold; display:inline'>Items</div> tab and click <div style='font-weight:bold; display:inline'>Get Items</div> to fetch the items.");
- cur_frm.append_tip("You can then save this form by clicking on the <div style='font-weight:bold; display:inline'>Save</div> button in the above toolbar.");
- }
- }
-
- // doc exists
- else if(!doc.__islocal){
- // execute when doc is saved
- if(doc.docstatus==0 && cur_frm.doctype!='Production Planning Tool')
- cur_frm.set_tip("You have saved your " + cur_frm.doctype + ". You can make this draft permanent by clicking on <div style='font-weight:bold; display:inline'>Submit</div> button above.");
-
- // execute if doc is submitted
- else if(doc.docstatus==1){
- cur_frm.set_tip("You have submitted this " + cur_frm.doctype + ".");
- for(var i=0; i<next_step_list.length; i++){
- if(i==0) cur_frm.append_tip("To proceed select the <div style='font-weight:bold; display:inline'>Next Steps</div> tab below. To transfer raw materials to Finished Goods Warehouse click on <div style='font-weight:bold; display:inline'>" + next_step_list[i] +"</div>.");
- else cur_frm.append_tip("To update the quantity of finished goods and raw materials in their respective warehouses click on <div style='font-weight:bold; display:inline'>" + next_step_list[i] + "</div>.");
- }
- cur_frm.append_tip("(To amend this "+ cur_frm.doctype + " click on the <div style='font-weight:bold; display:inline'>Cancel</div> button above.)");
- }
-
- // execute when doc is amended
- else if(doc.docstatus==2){
- cur_frm.set_tip("To make this " + cur_frm.doctype + " editable click on the <div style='font-weight:bold; display:inline'>Amend</div> button above.");
- }
- }
- }
-}
-
-
-// Execute if current doctype is Production Planning Tool
-// ======================================================
-cur_frm.cscript.get_PPT_tips = function(doc, cdt, cdn)
-{
- cur_frm.set_tip('Welcome to Production Planning Wizard. This helps you to raise production order and see your raw material status as you plan your production.');
- cur_frm.append_tip("To start fetch all open Production Orders and Sales Orders by clicking on the <div style='font-weight:bold; display:inline'>Get Open Documents</div> button in the <div style='font-weight:bold; display:inline'>Against Document</div> tab below");
-
- cur_frm.cscript['Get Open Documents'] = function(doc, cdt, cdn){
- cur_frm.set_tip("To include the required orders in the Production Plan check mark the <div style='font-weight:bold; display:inline'>Include In Plan</div> cell below.");
- cur_frm.append_tip("Next you can go to the <div style='font-weight:bold; display:inline'>Items</div> tab and click on <div style='font-weight:bold; display:inline'>Get Items</div> button to fetch the items of the selected orders.");
- }
-
- cur_frm.cscript['Get Items'] = function(doc, cdt, cdn){
- cur_frm.set_tip("Now to raise a Production Order just click on <div style='font-weight:bold; display:inline'>Raise Production Ordre</div> button below the table.");
- cur_frm.append_tip("In order to see the Raw Material Report click on <div style='font-weight:bold; display:inline'>Get Raw Material Report</div> button below the table.");
- }
-}
-
-
-// Executes when doc is edit status of doc is changed
-// ==================================================
-cur_frm.cscript.edit_status_changed = function(doc, cdt, cdn){
- cur_frm.cscript.get_tips();
-}
diff --git a/erpnext/utilities/doctype/production_tips_common/production_tips_common.txt b/erpnext/utilities/doctype/production_tips_common/production_tips_common.txt
deleted file mode 100644
index 13209ad..0000000
--- a/erpnext/utilities/doctype/production_tips_common/production_tips_common.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# DocType, Production Tips Common
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2010-08-08 17:09:14',
- 'docstatus': 0,
- 'modified': '2010-09-20 14:06:57',
- 'modified_by': 'Administrator',
- 'owner': 'Administrator'
- },
-
- # These values are common for all DocType
- {
- 'colour': 'White:FFF',
- 'doctype': 'DocType',
- 'issingle': 1,
- 'module': 'Utilities',
- 'name': '__common__',
- 'section_style': 'Simple',
- 'server_code_error': ' ',
- 'version': 37
- },
-
- # DocType, Production Tips Common
- {
- 'doctype': 'DocType',
- 'name': 'Production Tips Common'
- }
-]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/profile_control/profile_control.py b/erpnext/utilities/doctype/profile_control/profile_control.py
index 189d8b1..b8db231 100644
--- a/erpnext/utilities/doctype/profile_control/profile_control.py
+++ b/erpnext/utilities/doctype/profile_control/profile_control.py
@@ -22,66 +22,9 @@
self.doc, self.doclist = d,dl
self.last_profile = None
- # Sync Profile with Gateway
- # -------------------------
- def sync_with_gateway(self,pid):
- p = Document('Profile',pid)
-
- # login to gateway
- from webnotes.utils.webservice import FrameworkServer
- fw = FrameworkServer('www.erpnext.com','/','__system@webnotestech.com','password',https=1)
-
- account_id = sql("select value from tabSingles where doctype='Control Panel' and field='account_id'")[0][0]
-
- # call add profile
- ret = fw.runserverobj('Profile Control','Profile Control','add_profile_gateway',str([p.first_name, p.middle_name, p.last_name, p.email, p.name, account_id]))
-
- if ret.get('exc'):
- msgprint(ret['exc'])
- raise Exception
-
def get_role_permission(self,role):
perm = sql("select distinct t1.`parent`, t1.`read`, t1.`write`, t1.`create`, t1.`submit`,t1.`cancel`,t1.`amend` from `tabDocPerm` t1, `tabDocType` t2 where t1.`role` ='%s' and t1.docstatus !=2 and t1.permlevel = 0 and t1.`read` = 1 and t2.module != 'Recycle Bin' and t1.parent=t2.name "%role)
return perm or ''
-
-
- # Check if password is expired
- # --------------------------------
- def has_pwd_expired(self):
- if session['user'] != 'Administrator' and session['user'].lower() != 'demo':
- last_pwd_date = None
- try:
- last_pwd_date = sql("select password_last_updated from tabProfile where name=%s",session['user'])[0][0] or ''
- except:
- return 'No'
- if cstr(last_pwd_date) == '':
- sql("update tabProfile set password_last_updated = '%s' where name='%s'"% (nowdate(),session['user']))
- return 'No'
- else:
- date_diff = (getdate(nowdate()) - last_pwd_date).days
- expiry_period = sql("select value from tabSingles where doctype='Control Panel' and field='password_expiry_days'")
- if expiry_period and cint(expiry_period[0][0]) and cint(expiry_period[0][0]) < date_diff:
- return 'Yes'
- return 'No'
-
- def reset_password(self,pwd):
- if sql("select name from tabProfile where password=PASSWORD(%s) and name=%s", (pwd,session['user'])):
- return 'Password cannot be same as old password'
- sql("update tabProfile set password=PASSWORD(%s),password_last_updated=%s where name = %s", (pwd,nowdate(),session['user']))
- return 'ok'
-
-#-------------------------------------------------------------------------------------------------------
- #functions for manage user page
- #-----------Enable/Disable Profile-----------------------------------------------------------------------------------------------
- def change_login(self,args):
- args = eval(args)
-
- if cint(args['set_disabled'])==0:
- sql("update `tabProfile` set enabled=1 where name='%s'"%args['user'])
- else:
- sql("update `tabProfile` set enabled=0 where name='%s'"%args['user'])
-
- return 'ok'
#------------return role list -------------------------------------------------------------------------------------------------
# All roles of Role Master
@@ -113,75 +56,3 @@
pr.parentfield = 'userroles'
pr.save(1)
-
-
- # Add new member
- # ---------------
- def add_profile(self,arg):
-
- # Check credit balance
- get_obj('WN ERP Client Control').check_credit_balance()
-
- arg=eval(arg)
- pr=Document('Profile')
- for d in arg.keys():
- if d!='role':
- pr.fields[d] = arg[d]
-
- pr.enabled=0
- pr.user_type='System User'
- pr.save(1)
- pr_obj = get_obj('Profile',pr.name)
- if (pr.name):
- msg="New member is added"
- pr_obj.on_update()
- else:
- msg="Profile not created"
-
- return cstr(msg)
-
- # to find currently login user
- def current_login(self):
- cl_list=sql("select distinct user from tabSessions")
- if cl_list:
- cl_list=[x[0] for x in cl_list]
-
- return cl_list
-
-
- # Remove Profile
- # ---------------
- def remove_profile(self, user):
- # delete profile
- webnotes.model.delete_doc('Profile',user)
-
- # Update WN ERP Client Control
- sql("update tabSingles set value = value - 1 where field = 'total_users' and doctype = 'WN ERP Client Control'")
-
- # login to gateway
- from webnotes.utils.webservice import FrameworkServer
- fw = FrameworkServer('www.erpnext.com','/','__system@webnotestech.com','password',https=1)
-
- account_id = sql("select value from tabSingles where doctype='Control Panel' and field='account_id'")[0][0]
-
- # call remove profile
- ret = fw.runserverobj('Profile Control','Profile Control','remove_app_sub',str([user, account_id, session['user']]))
-
- if ret.get('exc'):
- msgprint(ret['exc'])
- raise Exception
-
- return "User Removed Successfully"
-
-
- # Create Profile
- # ---------------
- def create_profile(self, email):
- if sql("select name from tabProfile where name = %s", email):
- sql("update tabProfile set docstatus = 0 where name = %s", email)
- else:
- pr = Document('Profile')
- pr.email = email
- pr.enabled=0
- pr.user_type='System User'
- pr.save(1)
diff --git a/erpnext/utilities/doctype/sso_control/sso_control.py b/erpnext/utilities/doctype/sso_control/sso_control.py
deleted file mode 100644
index bfc0e43..0000000
--- a/erpnext/utilities/doctype/sso_control/sso_control.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-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 logout_sso(self):
- import webnotes
- import webnotes.utils.webservice
-
- if session['data'].get('login_from'):
- sso = webnotes.utils.webservice.FrameworkServer(session['data'].get('login_from'), '/', '__system@webnotestech.com', 'password')
- sso.runserverobj('SSO Control', 'SSO Control', 'logout_user', session['user'])
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/sso_control.txt b/erpnext/utilities/doctype/sso_control/sso_control.txt
deleted file mode 100644
index ee0224e..0000000
--- a/erpnext/utilities/doctype/sso_control/sso_control.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# DocType, SSO Control
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2010-08-08 17:09:24',
- 'docstatus': 0,
- 'modified': '2010-12-20 19:44:29',
- 'modified_by': 'umair@iwebnotes.com',
- 'owner': 'Administrator'
- },
-
- # These values are common for all DocType
- {
- 'colour': 'White:FFF',
- 'doctype': 'DocType',
- 'issingle': 1,
- 'module': 'Utilities',
- 'name': '__common__',
- 'section_style': 'Simple',
- 'server_code_error': ' ',
- 'version': 1
- },
-
- # DocType, SSO Control
- {
- 'doctype': 'DocType',
- 'name': 'SSO Control'
- }
-]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/wn_erp_client_control/__init__.py b/erpnext/utilities/doctype/wn_erp_client_control/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/utilities/doctype/wn_erp_client_control/__init__.py
+++ /dev/null
diff --git a/erpnext/utilities/doctype/wn_erp_client_control/wn_erp_client_control.py b/erpnext/utilities/doctype/wn_erp_client_control/wn_erp_client_control.py
deleted file mode 100644
index 288f305..0000000
--- a/erpnext/utilities/doctype/wn_erp_client_control/wn_erp_client_control.py
+++ /dev/null
@@ -1,141 +0,0 @@
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-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, self.doclist = doc, doclist
-
-
- # Check End of Trial Period
- # -------------------------
- def trial_payment_reminders(self):
- if cint(self.doc.is_trial_account)==1:
- # Trial Period Expiry
- trial_end_date = add_days(self.doc.account_start_date, 30)
- days = date_diff(trial_end_date, nowdate())
- # check if trial period has expired
- if days < 10 and days >= 0 and has_common(['System Manager'],webnotes.user.get_roles()):
- return "Your Trial Period expires on '%s'. Please buy credits online using Manage Account." % (formatdate(trial_end_date))
-
- # trial period has already expired
- elif days < 0 and days >= -6:
- extended_days = 7 + days
- return "Your Trial Period has expired on %s. However, your account will be live for %s days. Please contact your System Manager to buy credits." % (formatdate(trial_end_date),cstr(extended_days))
- elif not has_common(['Administrator'],webnotes.user.get_roles()) and days < -6:
- return "Stopped"
-
- # Account is not a trial account
- else:
- return self.account_expiry_reminder()
-
-
- # Account Expiry Reminder
- # -----------------------
- def account_expiry_reminder(self):
- import webnotes.utils
- from datetime import datetime
- # Payment Reminder in case of not enough balance
- cr_reqd = cint(self.doc.total_users)
- days_left = cint(self.calc_days())
- # check if account balance is sufficient
- if cint(self.doc.credit_balance)<(cr_reqd):
-
- # Difference between last payment date and current date
- if self.doc.last_deduction_date: last_payment = date_diff(nowdate(),self.doc.last_deduction_date)
- else: last_payment = -1
-
- # 7 days extension
- remaining_days = days_left - 24
- if last_payment > 30 or last_payment == -1:
- if remaining_days < 8 and remaining_days >= 1:
- return "Your account will be de-activated in " + cstr(remaining_days) + " days. Please contact your System Manager to buy credits."
- elif remaining_days==0:
- return "Your account will be disabled from tomorrow. Please contact your System Manager to buy credits."
- elif not has_common(['Administrator'],webnotes.user.get_roles()):
- return "Stopped"
-
- # check if user account is extended for seven days
- if cint(self.doc.is_trial_account)==0:
- if days_left < 10 and days_left >= 0:
- return "You have only %s Credits in your account. Buy credits before %s." % (cint(self.doc.credit_balance),formatdate(self.next_bill_sdate))
-
-
-
- # Calculate days between current date and billing cycle end date
- # --------------------------------------------------------------
- def calc_days(self):
- if self.doc.billing_cycle_date:
- next_bill_month = cint(nowdate().split('-')[1])
- if cint(nowdate().split('-')[2]) > cint(self.doc.billing_cycle_date.split('-')[2]):
- next_bill_month = cint(nowdate().split('-')[1]) + 1
- next_bill_year = nowdate().split('-')[0]
- if next_bill_month > 12:
- next_bill_month = next_bill_month % 12
- next_bill_year += 1
- self.next_bill_sdate = cstr(next_bill_year)+'-'+cstr(next_bill_month)+'-'+(self.calc_next_day(next_bill_year,next_bill_month))
- #msgprint("next_bill_month :::" + self.next_bill_sdate)
- return date_diff(self.next_bill_sdate, nowdate())
-
-
- # Calculate next billing date day
- # --------------------------------
- def calc_next_day(self, next_year, next_month):
- bill_cycle_day = cstr(self.doc.billing_cycle_date).split('-')[2]
- if cint(next_month) == 2 and next_year%4==0 and (next_year%100!=0 or next_year%400==0) and cint(bill_cycle_day) > 28:
- bill_cycle_day = '28'
- elif cint(bill_cycle_day) == 31 and cint(next_month) in (4,6,9,11):
- bill_cycle_day = '30'
- return bill_cycle_day
-
-
- # Update acc credits and balance (making payment from gateway)
- # -------------------------------------------------------------
- def update_acc_bal(self,args):
- args = eval(args)
- self.doc.credit_balance = cint(self.doc.credit_balance) + cint(args.get('net_cr'))
- self.doc.total_users = cint(self.doc.total_users) + cint(args.get('total_users'))
- if cint(self.doc.is_trial_account) == 1:
- if not self.doc.account_start_date:
- self.doc.account_start_date = nowdate()
- self.doc.is_trial_account = 0
- self.doc.billing_cycle_date = nowdate()
- self.doc.last_deduction_date = nowdate()
- self.doc.save()
-
-
- # Check Credit Balance
- # ---------------------
- def check_credit_balance(self):
- if cint(self.doc.is_trial_account) == 0:
- if cint(self.doc.credit_balance) < 1:
- msgprint("You do not have enough credits to add new user. Please buy credits.")
- raise Exception
- else:
- self.doc.credit_balance = cint(self.doc.credit_balance) - 1
- msgprint("Your one credit is consumed. Balance Credits : %s" % (self.doc.credit_balance))
- self.doc.total_users = cint(self.doc.total_users) + 1
- self.doc.save()
-
-
- # Monthly Deduction
- # ------------------
- def monthly_deduction(self, cr_ded):
- self.doc.credit_balance = cint(self.doc.credit_balance) - cint(cr_ded)
- self.doc.last_deduction_date = nowdate()
- self.doc.save()
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/wn_erp_client_control/wn_erp_client_control.txt b/erpnext/utilities/doctype/wn_erp_client_control/wn_erp_client_control.txt
deleted file mode 100644
index 1ab4ed8..0000000
--- a/erpnext/utilities/doctype/wn_erp_client_control/wn_erp_client_control.txt
+++ /dev/null
@@ -1,124 +0,0 @@
-# DocType, WN ERP Client Control
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2010-08-08 17:09:30',
- 'docstatus': 0,
- 'modified': '2010-09-20 14:06:57',
- 'modified_by': 'Administrator',
- 'owner': 'Administrator'
- },
-
- # These values are common for all DocType
- {
- 'colour': 'White:FFF',
- 'doctype': 'DocType',
- 'issingle': 1,
- 'istable': 0,
- 'module': 'Utilities',
- 'name': '__common__',
- 'read_only': 1,
- 'section_style': 'Simple',
- 'server_code_error': ' ',
- 'show_in_menu': 1,
- 'version': 137
- },
-
- # These values are common for all DocField
- {
- 'doctype': 'DocField',
- 'name': '__common__',
- 'parent': 'WN ERP Client Control',
- 'parentfield': 'fields',
- 'parenttype': 'DocType',
- 'permlevel': 0
- },
-
- # These values are common for all DocPerm
- {
- 'doctype': 'DocPerm',
- 'name': '__common__',
- 'parent': 'WN ERP Client Control',
- 'parentfield': 'permissions',
- 'parenttype': 'DocType',
- 'read': 1,
- 'role': 'System Manager'
- },
-
- # DocType, WN ERP Client Control
- {
- 'doctype': 'DocType',
- 'name': 'WN ERP Client Control'
- },
-
- # DocPerm
- {
- 'create': 1,
- 'doctype': 'DocPerm',
- 'idx': 1,
- 'permlevel': 0,
- 'write': 1
- },
-
- # DocPerm
- {
- 'doctype': 'DocPerm',
- 'idx': 2,
- 'permlevel': 1
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'account_start_date',
- 'fieldtype': 'Date',
- 'idx': 1,
- 'label': 'Account Start Date'
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'billing_cycle_date',
- 'fieldtype': 'Date',
- 'idx': 2,
- 'label': 'Billing Cycle Date'
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'total_users',
- 'fieldtype': 'Int',
- 'idx': 3,
- 'label': 'Total Users'
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'credit_balance',
- 'fieldtype': 'Int',
- 'idx': 4,
- 'label': 'Credit Balance'
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'is_trial_account',
- 'fieldtype': 'Check',
- 'idx': 5,
- 'label': 'Is Trial Account'
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'last_deduction_date',
- 'fieldtype': 'Date',
- 'idx': 6,
- 'label': 'Last Credit Deduction Date'
- }
-]
\ No newline at end of file
diff --git a/erpnext/utilities/page/trash/trash.html b/erpnext/utilities/page/trash/trash.html
index 0fdca75..b17e475 100644
--- a/erpnext/utilities/page/trash/trash.html
+++ b/erpnext/utilities/page/trash/trash.html
@@ -1,2 +1,4 @@
-<div id="trash_header"> </div>
-<div id="trash_div" style="margin: 0px;"> </div>
\ No newline at end of file
+<div class="layout_wrapper">
+<div id="trash_header"></div>
+<div id="trash_div" style="margin: 0px;"></div>
+</div>
\ No newline at end of file
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index 3678298..7979036 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -4,8 +4,6 @@
from webnotes.model.doclist import getlist, copy_doclist
from webnotes import msgprint
-sql = webnotes.conn.sql
-
class TransactionBase:
# Get Customer Default Primary Address - first load
@@ -66,9 +64,9 @@
cond = 'name="%s"' % address_name
if is_shipping_address:
- details = sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where %s and docstatus != 2 order by is_shipping_address desc limit 1" % cond, as_dict = 1)
+ details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where %s and docstatus != 2 order by is_shipping_address desc limit 1" % cond, as_dict = 1)
else:
- details = sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where %s and docstatus != 2 order by is_primary_address desc limit 1" % cond, as_dict = 1)
+ details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where %s and docstatus != 2 order by is_primary_address desc limit 1" % cond, as_dict = 1)
extract = lambda x: details and details[0] and details[0].get(x,'') or ''
address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),(' ','pincode'),('\n','state'),('\n','country'),('\nPhone: ','phone')]
@@ -88,11 +86,11 @@
else:
cond = 'name="%s"' % contact_name
- details = sql("select name, first_name, last_name, email_id, phone, mobile_no, department, designation from `tabContact` where %s and docstatus != 2 order by is_primary_contact desc limit 1" % cond, as_dict = 1)
+ details = webnotes.conn.sql("select name, first_name, last_name, email_id, phone, mobile_no, department, designation from `tabContact` where %s and docstatus != 2 order by is_primary_contact desc limit 1" % cond, as_dict = 1)
extract = lambda x: details and details[0] and details[0].get(x,'') or ''
- contact_fields = [('','first_name'),('\n','lastname')]
- contact_display = ''.join([a[0]+extract(a[1]) for a in contact_fields if extract(a[1])])
+ contact_fields = [('','first_name'),(' ','last_name')]
+ contact_display = ''.join([a[0]+cstr(extract(a[1])) for a in contact_fields if extract(a[1])])
if contact_display.startswith('\n'): contact_display = contact_display[1:]
contact_name = details and details[0]['name'] or ''
@@ -103,7 +101,7 @@
# Get Customer Details
# -----------------------
def get_customer_details(self, name):
- customer_details = sql("select customer_name, customer_group, territory, default_sales_partner, default_commission_rate from tabCustomer where name = '%s' and docstatus != 2" %(name), as_dict = 1)
+ customer_details = webnotes.conn.sql("select customer_name, customer_group, territory, default_sales_partner, default_commission_rate from tabCustomer where name = '%s' and docstatus != 2" %(name), as_dict = 1)
if customer_details:
self.doc.customer_name = customer_details[0]['customer_name'] or ''
self.doc.customer_group = customer_details[0]['customer_group'] or ''
@@ -114,7 +112,7 @@
# Get Customer Shipping Address
# -----------------------
def get_shipping_address(self, name):
- details = sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where customer = '%s' and docstatus != 2 order by is_shipping_address desc limit 1" %(name), as_dict = 1)
+ details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where customer = '%s' and docstatus != 2 order by is_shipping_address desc limit 1" %(name), as_dict = 1)
extract = lambda x: details and details[0] and details[0].get(x,'') or ''
address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),(' ','pincode'),('\n','state'),('\n','country'),('\nPhone: ','phone')]
@@ -130,7 +128,7 @@
# Get Lead Details
# -----------------------
def get_lead_details(self, name):
- details = sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, territory, contact_no, mobile_no, email_id from `tabLead` where name = '%s'" %(name), as_dict = 1)
+ details = webnotes.conn.sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, territory, contact_no, mobile_no, email_id from `tabLead` where name = '%s'" %(name), as_dict = 1)
extract = lambda x: details and details[0] and details[0].get(x,'') or ''
address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),(' ','pincode'),('\n','state'),('\n','country'),('\nPhone: ','contact_no')]
@@ -183,7 +181,7 @@
# Get Supplier Details
# -----------------------
def get_supplier_details(self, name):
- supplier_details = sql("select supplier_name from tabSupplier where name = '%s' and docstatus != 2" %(name), as_dict = 1)
+ supplier_details = webnotes.conn.sql("select supplier_name from tabSupplier where name = '%s' and docstatus != 2" %(name), as_dict = 1)
ret = {
'supplier_name' : supplier_details and supplier_details[0]['supplier_name'] or ''
}
@@ -194,7 +192,7 @@
def get_sales_person(self, name):
self.doc.clear_table(self.doclist,'sales_team')
idx = 0
- for d in sql("select sales_person, allocated_percentage, allocated_amount, incentives from `tabSales Team` where parent = '%s'" % name):
+ for d in webnotes.conn.sql("select sales_person, allocated_percentage, allocated_amount, incentives from `tabSales Team` where parent = '%s'" % name):
ch = addchild(self.doc, 'sales_team', 'Sales Team', 1, self.doclist)
ch.sales_person = d and cstr(d[0]) or ''
ch.allocated_percentage = d and flt(d[1]) or 0
@@ -206,6 +204,6 @@
# Get Company Specific Default Currency
# -------------------------------------
def get_company_currency(self, name):
- ret = sql("select default_currency from tabCompany where name = '%s'" %(name))
+ ret = webnotes.conn.sql("select default_currency from tabCompany where name = '%s'" %(name))
dcc = ret and ret[0][0] or get_defaults()['currency']
return dcc
diff --git a/erpnext/website/Module Def/Website/Website.txt b/erpnext/website/Module Def/Website/Website.txt
new file mode 100644
index 0000000..e423869
--- /dev/null
+++ b/erpnext/website/Module Def/Website/Website.txt
@@ -0,0 +1,142 @@
+# Module Def, Website
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-23 17:05:32',
+ 'docstatus': 0,
+ 'modified': '2012-02-02 13:23:41',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all Module Def Role
+ {
+ 'doctype': 'Module Def Role',
+ 'name': '__common__',
+ 'parent': 'Website',
+ 'parentfield': 'roles',
+ 'parenttype': 'Module Def'
+ },
+
+ # These values are common for all Module Def Item
+ {
+ 'doctype': 'Module Def Item',
+ 'name': '__common__',
+ 'parent': 'Website',
+ 'parentfield': 'items',
+ 'parenttype': 'Module Def'
+ },
+
+ # These values are common for all Module Def
+ {
+ 'disabled': 'No',
+ 'doctype': u'Module Def',
+ 'is_hidden': 'No',
+ 'module_label': 'Website',
+ 'module_name': 'Website',
+ 'name': '__common__'
+ },
+
+ # Module Def, Website
+ {
+ 'doctype': u'Module Def',
+ 'name': 'Website'
+ },
+
+ # Module Def Item
+ {
+ 'display_name': 'Web Page',
+ 'doc_name': 'Web Page',
+ 'doc_type': 'Forms',
+ 'doctype': 'Module Def Item'
+ },
+
+ # Module Def Item
+ {
+ 'display_name': 'Product',
+ 'doc_name': 'Product',
+ 'doc_type': 'Forms',
+ 'doctype': 'Module Def Item'
+ },
+
+ # Module Def Item
+ {
+ 'display_name': 'Blog',
+ 'doc_name': 'Blog',
+ 'doc_type': 'Forms',
+ 'doctype': 'Module Def Item'
+ },
+
+ # Module Def Item
+ {
+ 'display_name': 'Style Settings',
+ 'doc_name': 'Style Settings',
+ 'doc_type': 'Single DocType',
+ 'doctype': 'Module Def Item'
+ },
+
+ # Module Def Item
+ {
+ 'display_name': 'Website Settings',
+ 'doc_name': 'Website Settings',
+ 'doc_type': 'Single DocType',
+ 'doctype': 'Module Def Item'
+ },
+
+ # Module Def Item
+ {
+ 'display_name': 'Home Settings',
+ 'doc_name': 'Home Settings',
+ 'doc_type': 'Single DocType',
+ 'doctype': 'Module Def Item'
+ },
+
+ # Module Def Item
+ {
+ 'display_name': 'About Us Settings',
+ 'doc_name': 'About Us Settings',
+ 'doc_type': 'Single DocType',
+ 'doctype': 'Module Def Item'
+ },
+
+ # Module Def Item
+ {
+ 'display_name': 'Contact Us Settings',
+ 'doc_name': 'Contact Us Settings',
+ 'doc_type': 'Single DocType',
+ 'doctype': 'Module Def Item'
+ },
+
+ # Module Def Item
+ {
+ 'display_name': 'Products Settings',
+ 'doc_name': 'Products Settings',
+ 'doc_type': 'Single DocType',
+ 'doctype': 'Module Def Item'
+ },
+
+ # Module Def Role
+ {
+ 'doctype': 'Module Def Role',
+ 'role': 'System Manager'
+ },
+
+ # Module Def Role
+ {
+ 'doctype': 'Module Def Role',
+ 'role': 'System Manager'
+ },
+
+ # Module Def Role
+ {
+ 'doctype': 'Module Def Role',
+ 'role': 'Website Manager'
+ },
+
+ # Module Def Role
+ {
+ 'doctype': 'Module Def Role',
+ 'role': 'Website Manager'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/__init__.py
diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css
new file mode 100644
index 0000000..cdea087
--- /dev/null
+++ b/erpnext/website/css/website.css
@@ -0,0 +1,86 @@
+#body_div {
+ width: 900px;
+ margin: auto;
+}
+
+.layout_wrapper {
+ padding: 20px;
+}
+
+h1 {
+ margin-bottom: 15px;
+}
+
+footer {
+ width: 900px;
+ margin: auto;
+}
+header .topbar .container {
+ width: 900px;
+ margin: auto;
+}
+
+.web-head-section {
+ margin-bottom: 20px
+}
+
+.web-content input[type="text"], .web-content input[type="password"], .web-content select {
+ min-width: 180px;
+}
+
+.web-main-section {
+ width: 65%;
+ float: left;
+ margin-bottom: 20px;
+}
+
+.web-side-section {
+ width: 30%;
+ float: right;
+ margin-bottom: 20px;
+ margin-right: 15px;
+ color: #606060;
+ overflow-x: hidden;
+}
+
+footer {
+ color: #777;
+}
+
+.web-footer {
+ color: inherit;
+ text-align: center;
+ margin: 10px;
+ line-height: 1.7;
+}
+
+.web-footer div, .web-footer a {
+ font-size: 11px;
+}
+
+.web-footer-menu {
+ margin-bottom: 7px;
+}
+footer a, footer a:visited {
+ color: #777;
+}
+
+footer a:hover {
+ background-color: #777;
+ color: #fff;
+}
+
+.web-footer-menu ul {
+ list-style: none;
+ margin: 0px;
+}
+
+.web-footer-menu ul li {
+ display: inline;
+ padding: 2px 15px;
+ border-right: 1px solid #999;
+}
+
+.web-footer-menu ul li:last-child {
+ border-right: 0px solid #777 !important;
+}
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/doctype/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/doctype/__init__.py
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/doctype/about_us_settings/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/doctype/about_us_settings/__init__.py
diff --git a/erpnext/website/doctype/about_us_settings/about_us_settings.py b/erpnext/website/doctype/about_us_settings/about_us_settings.py
new file mode 100644
index 0000000..770f1d2
--- /dev/null
+++ b/erpnext/website/doctype/about_us_settings/about_us_settings.py
@@ -0,0 +1,24 @@
+"""
+generate html
+"""
+import webnotes
+
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
+
+ def on_update(self):
+ """make home html"""
+ from website.utils import make_template
+ import os
+ path = os.path.join(os.path.dirname(__file__), 'template.html')
+
+ self.doc.about_team = webnotes.conn.sql("""select * from `tabAbout Us Team`
+ where parent='About Us Settings' order by idx""", as_dict=1)
+
+ import markdown2
+ for t in self.doc.about_team:
+ t['bio'] = markdown2.markdown(t.get('bio') or '')
+
+ webnotes.conn.set_value('Page', 'about', 'title', self.doc.headline)
+ webnotes.conn.set_value('Page', 'about', 'content', make_template(self.doc, path))
diff --git a/erpnext/website/doctype/about_us_settings/about_us_settings.txt b/erpnext/website/doctype/about_us_settings/about_us_settings.txt
new file mode 100644
index 0000000..5ecae16
--- /dev/null
+++ b/erpnext/website/doctype/about_us_settings/about_us_settings.txt
@@ -0,0 +1,106 @@
+# DocType, About Us Settings
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-27 10:13:16',
+ 'docstatus': 0,
+ 'modified': '2012-01-27 11:36:44',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ '_last_update': '1327641155',
+ 'allow_attach': 1,
+ 'colour': 'White:FFF',
+ 'doctype': 'DocType',
+ 'issingle': 1,
+ 'max_attachments': 10,
+ 'module': 'Website',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 4
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'About Us Settings',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType',
+ 'permlevel': 0
+ },
+
+ # These values are common for all DocPerm
+ {
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'name': '__common__',
+ 'parent': 'About Us Settings',
+ 'parentfield': 'permissions',
+ 'parenttype': 'DocType',
+ 'permlevel': 0,
+ 'read': 1,
+ 'role': 'Website Manager',
+ 'write': 1
+ },
+
+ # DocType, About Us Settings
+ {
+ 'doctype': 'DocType',
+ 'name': 'About Us Settings'
+ },
+
+ # DocPerm
+ {
+ 'doctype': 'DocPerm'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'headline',
+ 'fieldtype': 'Data',
+ 'label': 'Headline'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'main_section',
+ 'fieldtype': 'Code',
+ 'label': 'Main Section'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'team',
+ 'fieldtype': 'Table',
+ 'label': 'Team',
+ 'options': 'About Us Team'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'side_section',
+ 'fieldtype': 'Code',
+ 'label': 'Side Section'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'file_list',
+ 'fieldtype': 'Text',
+ 'hidden': 1,
+ 'label': 'File List',
+ 'no_copy': 1,
+ 'print_hide': 1
+ }
+]
\ No newline at end of file
diff --git a/erpnext/website/doctype/about_us_settings/template.html b/erpnext/website/doctype/about_us_settings/template.html
new file mode 100644
index 0000000..47ef402
--- /dev/null
+++ b/erpnext/website/doctype/about_us_settings/template.html
@@ -0,0 +1,36 @@
+<div class="layout_wrapper">
+ <div class="web-content" id="content-about-us">
+ {% if doc.headline %}
+ <h1>{{ doc.headline }}</h1>
+ {% endif %}
+ <div class="web-main-section">
+ {{ doc.main_section_html }}
+
+ {% if doc.about_team %}
+ <h2>Team</h2>
+ <table style="width: 90%">
+ <tbody>
+ {% for p in doc.about_team %}
+ <tr>
+ <td style="width: 110px">
+ <img src="files/{{ p.image }}"
+ style="width: 100px; margin-right: 10px;
+ margin-bottom: 15px;" />
+ </td>
+ <td>
+ <h4>{{ p.person_name }}</h4>
+ <div class="comment">{{ p.designation }}</div>
+ <div style="margin-bottom: 15px">{{ p.bio }}</div>
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ {% endif %}
+ </div>
+ <div class="web-side-section">
+ {{ doc.side_section_html }}
+ </div>
+ <div style="clear: both"></div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/doctype/about_us_team/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/doctype/about_us_team/__init__.py
diff --git a/erpnext/website/doctype/about_us_team/about_us_team.txt b/erpnext/website/doctype/about_us_team/about_us_team.txt
new file mode 100644
index 0000000..bbbf47d
--- /dev/null
+++ b/erpnext/website/doctype/about_us_team/about_us_team.txt
@@ -0,0 +1,74 @@
+# DocType, About Us Team
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-27 10:14:18',
+ 'docstatus': 0,
+ 'modified': '2012-01-27 11:54:18',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocType',
+ 'istable': 1,
+ 'module': 'Website',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 5
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'About Us Team',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType',
+ 'permlevel': 0
+ },
+
+ # DocType, About Us Team
+ {
+ 'doctype': 'DocType',
+ 'name': 'About Us Team'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'person_name',
+ 'fieldtype': 'Data',
+ 'label': 'Person Name'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'designation',
+ 'fieldtype': 'Data',
+ 'label': 'Designation'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'image',
+ 'fieldtype': 'Select',
+ 'label': 'Image',
+ 'options': 'attach_files:'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'bio',
+ 'fieldtype': 'Text',
+ 'label': 'Bio (markdown)',
+ 'width': '300px'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/doctype/blog/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/doctype/blog/__init__.py
diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py
new file mode 100644
index 0000000..05391ee
--- /dev/null
+++ b/erpnext/website/doctype/blog/blog.py
@@ -0,0 +1,38 @@
+"""
+record of files
+
+naming for same name files: file.gif, file-1.gif, file-2.gif etc
+"""
+
+import webnotes
+import website.utils
+
+class DocType():
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
+
+ def autoname(self):
+ """save file by its name"""
+ self.doc.name = website.utils.page_name(self.doc.title)
+
+ def on_update(self):
+ """write/update 'Page' with the blog"""
+ p = website.utils.add_page(self.doc.title)
+
+ from jinja2 import Template
+ import markdown2
+ import os
+
+ self.doc.content_html = markdown2.markdown(self.doc.content or '')
+
+ with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
+ p.content = Template(f.read()).render(doc=self.doc)
+
+ with open(os.path.join(os.path.dirname(__file__), 'blog_page.js'), 'r') as f:
+ p.script = Template(f.read()).render(doc=self.doc)
+
+ p.save()
+
+ website.utils.add_guest_access_to_page(p.name)
+
+
\ No newline at end of file
diff --git a/erpnext/website/doctype/blog/blog.txt b/erpnext/website/doctype/blog/blog.txt
new file mode 100644
index 0000000..9e09492
--- /dev/null
+++ b/erpnext/website/doctype/blog/blog.txt
@@ -0,0 +1,88 @@
+# DocType, Blog
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-27 12:24:03',
+ 'docstatus': 0,
+ 'modified': '2012-01-27 12:24:03',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocType',
+ 'module': 'Website',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 1
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'Blog',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType',
+ 'permlevel': 0
+ },
+
+ # These values are common for all DocPerm
+ {
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'name': '__common__',
+ 'parent': 'Blog',
+ 'parentfield': 'permissions',
+ 'parenttype': 'DocType',
+ 'permlevel': 0,
+ 'read': 1,
+ 'write': 1
+ },
+
+ # DocType, Blog
+ {
+ 'doctype': 'DocType',
+ 'name': 'Blog'
+ },
+
+ # DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'role': 'Website Manager'
+ },
+
+ # DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'role': 'Blogger'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'title',
+ 'fieldtype': 'Data',
+ 'label': 'Title'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'published',
+ 'fieldtype': 'Check',
+ 'label': 'Published'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'content',
+ 'fieldtype': 'Code',
+ 'label': 'Content'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/website/doctype/blog/blog_page.js b/erpnext/website/doctype/blog/blog_page.js
new file mode 100644
index 0000000..1df9b54
--- /dev/null
+++ b/erpnext/website/doctype/blog/blog_page.js
@@ -0,0 +1,71 @@
+// js inside blog page
+
+pscript['onload_{{ doc.name }}'] = function(wrapper) {
+ // sidebar
+ var side = $(wrapper).find('.web-side-section')
+ .append('<h4>Recent Posts</h4>').get(0);
+
+ wrapper.recent_list = new wn.widgets.Listing({
+ parent: side,
+ query: 'select name, title, left(content, 100) as content from tabBlog\
+ where ifnull(published,1)=1',
+ hide_refresh: true,
+ render_row: function(parent, data) {
+ if(data.content.length==100) data.content += '...';
+ parent.innerHTML = repl('<a href="#!%(name)s">%(title)s</a>\
+ <div class="comment">%(content)s</div><br>', data);
+ },
+ page_length: 5
+ });
+ wrapper.recent_list.run();
+
+
+ // comments
+ $(wrapper).find('.web-main-section').append('<h3>Comments</h3>');
+
+ wrapper.comment_list = new wn.widgets.Listing({
+ parent: $(wrapper).find('.web-main-section').get(0),
+ query: 'select comment, comment_by_fullname, comment_date\
+ from `tabComment Widget Record` where comment_doctype="Page"\
+ and comment_docname="{{ doc.name }}"',
+ no_result_message: 'Be the first one to comment',
+ render_row: function(parent, data) {
+ data.comment_date = dateutil.str_to_user(data.comment_date);
+ $(parent).html(repl("<div style='color:#777'>\
+ On %(comment_date)s %(comment_by_fullname)s said:\
+ </div>\
+ <p style='margin-left: 20px;'>%(comment)s</p><br>", data))
+ },
+ hide_refresh: true
+ });
+ wrapper.comment_list.run();
+
+ // add comment
+ $(wrapper).find('.web-main-section').append('<br><button class="btn add-comment">\
+ Add Comment</button>');
+ $(wrapper).find('button.add-comment').click(function(){
+ d = new wn.widgets.Dialog({
+ title: 'Add Comment',
+ fields: [
+ {fieldname:'comment_by_fullname', label:'Your Name', reqd:1, fieldtype:'Data'},
+ {fieldname:'comment_by', label:'Email Id', reqd:1, fieldtype:'Data'},
+ {fieldname:'comment', label:'Comment', reqd:1, fieldtype:'Text'},
+ {fieldname:'post', label:'Post', fieldtype:'Button'}
+ ]
+ });
+ d.fields_dict.post.input.onclick = function() {
+ var btn = this;
+ var args = d.get_values();
+ if(!args) return;
+ args.comment_doctype = 'Page';
+ args.comment_docname = '{{ doc.name }}';
+ $(btn).set_working();
+ $c('webnotes.widgets.form.comments.add_comment', args, function(r) {
+ $(btn).done_working();
+ d.hide();
+ wrapper.comment_list.refresh();
+ })
+ }
+ d.show();
+ })
+}
\ No newline at end of file
diff --git a/erpnext/website/doctype/blog/template.html b/erpnext/website/doctype/blog/template.html
new file mode 100644
index 0000000..8c33d83
--- /dev/null
+++ b/erpnext/website/doctype/blog/template.html
@@ -0,0 +1,14 @@
+<div class="layout_wrapper">
+ <div class="web-content" id="blog-{{ doc.name }}">
+ <h1>Blog</h1>
+ <div class="web-main-section">
+ <h2>{{ doc.title }}</h2>
+ <br>
+ {{ doc.content_html }}
+ </div>
+ <div class="web-side-section">
+ <p><a href="#!blog">All Blogs</a></p>
+ </div>
+ <div style="clear: both"></div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/doctype/blog_subscriber/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/doctype/blog_subscriber/__init__.py
diff --git a/erpnext/website/doctype/blog_subscriber/blog_subscriber.txt b/erpnext/website/doctype/blog_subscriber/blog_subscriber.txt
new file mode 100644
index 0000000..1b4a987
--- /dev/null
+++ b/erpnext/website/doctype/blog_subscriber/blog_subscriber.txt
@@ -0,0 +1,29 @@
+# DocType, Blog Subscriber
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-27 17:18:33',
+ 'docstatus': 0,
+ 'modified': '2012-01-27 17:18:33',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocType',
+ 'module': 'Website',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 1
+ },
+
+ # DocType, Blog Subscriber
+ {
+ 'doctype': 'DocType',
+ 'name': 'Blog Subscriber'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/doctype/contact_us_settings/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/doctype/contact_us_settings/__init__.py
diff --git a/erpnext/website/doctype/contact_us_settings/contact_us_settings.py b/erpnext/website/doctype/contact_us_settings/contact_us_settings.py
new file mode 100644
index 0000000..d2fc3c4
--- /dev/null
+++ b/erpnext/website/doctype/contact_us_settings/contact_us_settings.py
@@ -0,0 +1,17 @@
+"""
+generate html
+"""
+import webnotes
+
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
+
+ def on_update(self):
+ """make home html"""
+ from website.utils import make_template
+ import os
+ path = os.path.join(os.path.dirname(__file__), 'template.html')
+
+ webnotes.conn.set_value('Page', 'contact', 'title', self.doc.headline)
+ webnotes.conn.set_value('Page', 'contact', 'content', make_template(self.doc, path))
diff --git a/erpnext/website/doctype/contact_us_settings/contact_us_settings.txt b/erpnext/website/doctype/contact_us_settings/contact_us_settings.txt
new file mode 100644
index 0000000..ff43a0a
--- /dev/null
+++ b/erpnext/website/doctype/contact_us_settings/contact_us_settings.txt
@@ -0,0 +1,100 @@
+# DocType, Contact Us Settings
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-25 16:01:33',
+ 'docstatus': 0,
+ 'modified': '2012-01-25 16:01:33',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocType',
+ 'document_type': 'Other',
+ 'issingle': 1,
+ 'module': 'Website',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 1
+ },
+
+ # These values are common for all DocField
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'Contact Us Settings',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType',
+ 'permlevel': 0
+ },
+
+ # These values are common for all DocPerm
+ {
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'name': '__common__',
+ 'parent': 'Contact Us Settings',
+ 'parentfield': 'permissions',
+ 'parenttype': 'DocType',
+ 'permlevel': 0,
+ 'read': 1,
+ 'write': 1
+ },
+
+ # DocType, Contact Us Settings
+ {
+ 'doctype': 'DocType',
+ 'name': 'Contact Us Settings'
+ },
+
+ # DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'role': 'Website Manager'
+ },
+
+ # DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'role': 'System Manager'
+ },
+
+ # DocField
+ {
+ 'default': 'Contact Us',
+ 'doctype': 'DocField',
+ 'fieldname': 'headline',
+ 'fieldtype': 'Data',
+ 'label': 'Headline'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'send_email_notification',
+ 'fieldtype': 'Check',
+ 'label': 'Send Email Notification'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'main_section',
+ 'fieldtype': 'Code',
+ 'label': 'Main Section'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'side_section',
+ 'fieldtype': 'Code',
+ 'label': 'Side Section'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/website/doctype/contact_us_settings/template.html b/erpnext/website/doctype/contact_us_settings/template.html
new file mode 100644
index 0000000..6453784
--- /dev/null
+++ b/erpnext/website/doctype/contact_us_settings/template.html
@@ -0,0 +1,24 @@
+<div class="layout_wrapper">
+ <div class="web-content" id="content-contact-us">
+ {% if doc.headline %}
+ <h1>{{ doc.headline }}</h1>
+ {% endif %}
+ <div class="web-main-section">
+ <label>Your Name*</label>
+ <div><input name="contact-name" type="text"/></div>
+ <br>
+ <label>Email*</label>
+ <div><input name="contact-email" type="text"/></div>
+ <br>
+ <label>Message*</label>
+ <div><textarea name="contact-message" style="height: 200px"></textarea></div>
+ <br>
+ <div><button class="btn primary">Send</button></div>
+ {{ doc.main_section_html }}
+ </div>
+ <div class="web-side-section">
+ {{ doc.side_section_html }}
+ </div>
+ <div style="clear: both"></div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/doctype/product/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/doctype/product/__init__.py
diff --git a/erpnext/website/doctype/product/product.js b/erpnext/website/doctype/product/product.js
new file mode 100644
index 0000000..c0b507e
--- /dev/null
+++ b/erpnext/website/doctype/product/product.js
@@ -0,0 +1,6 @@
+$.extend(cur_frm.cscript, {
+ onload: function() {
+ cur_frm.add_fetch('item', 'description', 'short_description');
+ cur_frm.add_fetch('item', 'item_name', 'title');
+ }
+});
\ No newline at end of file
diff --git a/erpnext/website/doctype/product/product.py b/erpnext/website/doctype/product/product.py
new file mode 100644
index 0000000..935d762
--- /dev/null
+++ b/erpnext/website/doctype/product/product.py
@@ -0,0 +1,27 @@
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
+
+ def validate(self):
+ """make page for this product"""
+ import website.utils
+
+ p = website.utils.add_page("Product " + self.doc.title)
+
+ from jinja2 import Template
+ import markdown2
+ import os
+
+ self.doc.long_description_html = markdown2.markdown(self.doc.long_description or '')
+
+ with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
+ p.content = Template(f.read()).render(doc=self.doc)
+
+ with open(os.path.join(os.path.dirname(__file__), 'product_page.js'), 'r') as f:
+ p.script = Template(f.read()).render(doc=self.doc)
+
+ p.save()
+
+ website.utils.add_guest_access_to_page(p.name)
+ self.doc.page_name = p.name
+ del self.doc.fields['long_description_html']
\ No newline at end of file
diff --git a/erpnext/website/doctype/product/product.txt b/erpnext/website/doctype/product/product.txt
new file mode 100644
index 0000000..fac4cfb
--- /dev/null
+++ b/erpnext/website/doctype/product/product.txt
@@ -0,0 +1,251 @@
+# DocType, Product
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-30 16:21:29',
+ 'docstatus': 0,
+ 'modified': '2012-01-31 13:46:23',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ '_last_update': '1327995660',
+ 'allow_attach': 1,
+ 'autoname': 'field:item',
+ 'colour': 'White:FFF',
+ 'description': 'A Product is shown on the website and is linked to an item.',
+ 'doctype': 'DocType',
+ 'max_attachments': 5,
+ 'module': 'Website',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 10
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'Product',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType'
+ },
+
+ # These values are common for all DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'name': '__common__',
+ 'parent': 'Product',
+ 'parentfield': 'permissions',
+ 'parenttype': 'DocType',
+ 'read': 1,
+ 'role': 'Website Manager'
+ },
+
+ # DocType, Product
+ {
+ 'doctype': 'DocType',
+ 'name': 'Product'
+ },
+
+ # DocPerm
+ {
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'permlevel': 0,
+ 'write': 1
+ },
+
+ # DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'permlevel': 1
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocField',
+ 'fieldname': 'item',
+ 'fieldtype': 'Link',
+ 'label': 'Item',
+ 'options': 'Item',
+ 'permlevel': 0,
+ 'reqd': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'title',
+ 'fieldtype': 'Link',
+ 'label': 'Title',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'published',
+ 'fieldtype': 'Check',
+ 'label': 'Published',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Select Price List for the web. Leave blank to hide price.',
+ 'doctype': 'DocField',
+ 'fieldname': 'price_list',
+ 'fieldtype': 'Link',
+ 'label': 'Price List',
+ 'options': 'Price List',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Select shipping warehouse to show "In Stock" or "Out of Stock". To hide, leave blank',
+ 'doctype': 'DocField',
+ 'fieldname': 'warehouse',
+ 'fieldtype': 'Link',
+ 'label': 'Warehouse',
+ 'options': 'Warehouse',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Column Break',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Image for listing (Width: 100px) (Attach First)',
+ 'doctype': 'DocField',
+ 'fieldname': 'thumbnail_image',
+ 'fieldtype': 'Select',
+ 'label': 'Thumbnail Image',
+ 'options': 'attach_files:',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Image for listing (Width: 300px) (Attach First)',
+ 'doctype': 'DocField',
+ 'fieldname': 'full_image',
+ 'fieldtype': 'Select',
+ 'label': 'Full Image',
+ 'options': 'attach_files:',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocField',
+ 'fieldname': 'short_description',
+ 'fieldtype': 'Text',
+ 'label': 'Short Description',
+ 'permlevel': 0,
+ 'reqd': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Section Break',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Full description (formatted as markdown)',
+ 'doctype': 'DocField',
+ 'fieldname': 'long_description',
+ 'fieldtype': 'Code',
+ 'label': 'Long Description',
+ 'permlevel': 0,
+ 'reqd': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Section Break',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'page_name',
+ 'fieldtype': 'Data',
+ 'label': 'Page Name',
+ 'permlevel': 1
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocField',
+ 'fieldname': 'price',
+ 'fieldtype': 'Currency',
+ 'hidden': 0,
+ 'label': 'Price',
+ 'permlevel': 1
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocField',
+ 'fieldname': 'sales',
+ 'fieldtype': 'Currency',
+ 'label': 'Sales',
+ 'permlevel': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'stock',
+ 'fieldtype': 'Currency',
+ 'label': 'Stock',
+ 'permlevel': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'currency',
+ 'fieldtype': 'Link',
+ 'label': 'Currency',
+ 'options': 'Currency',
+ 'permlevel': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'file_list',
+ 'fieldtype': 'Text',
+ 'hidden': 1,
+ 'label': 'File List',
+ 'no_copy': 1,
+ 'permlevel': 0,
+ 'print_hide': 1
+ }
+]
\ No newline at end of file
diff --git a/erpnext/website/doctype/product/product_page.js b/erpnext/website/doctype/product/product_page.js
new file mode 100644
index 0000000..7d031ef
--- /dev/null
+++ b/erpnext/website/doctype/product/product_page.js
@@ -0,0 +1,13 @@
+wn.require('erpnext/website/js/product_category.js');
+
+pscript["onload_{{ doc.page_name }}"] = function(wrapper) {
+ erpnext.make_product_categories(wrapper);
+ $(wrapper).find('.product-inquiry').click(function() {
+ loadpage('contact', function() {
+ $('#content-contact-us [name="contact-message"]').val("Hello,\n\n\
+ Please send me more information on {{ doc.title }} (Item Code:{{ doc.item }})\n\n\
+ My contact details are:\n\nThank you!\
+ ");
+ })
+ })
+}
\ No newline at end of file
diff --git a/erpnext/website/doctype/product/template.html b/erpnext/website/doctype/product/template.html
new file mode 100644
index 0000000..8c7f918
--- /dev/null
+++ b/erpnext/website/doctype/product/template.html
@@ -0,0 +1,28 @@
+<div class="layout_wrapper">
+ <div class="web-content" id="content-product-{{ doc.name }}">
+ <h1>{{ doc.title }}</h1>
+ <div class="web-main-section">
+ <div style="float: left;">
+ <image src="files/{{ doc.full_image }}" style="width: 300px;
+ margin-left: 15px;" />
+ {{ doc.long_description_html }}
+ <button class="btn primary product-inquiry"
+ data-product="{{ doc.name }}"
+ data-description="{{ doc.short_description }}">Send Inquiry</button>
+ </div>
+ </div>
+ <div class="web-side-section">
+ <div class="info-box round">
+ <p><b>Item Code:</b> {{ doc.item }}</p>
+ <p>{{ doc.short_description }}</p>
+ <p><button class="btn primary product-inquiry"
+ data-product="{{ doc.name }}"
+ data-description="{{ doc.short_description }}">Send Inquiry</button>
+ </p>
+ </div>
+ <br>
+ <h4>More Categories</h4>
+ </div>
+ <div style="clear: both"></div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/doctype/product_group/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/doctype/product_group/__init__.py
diff --git a/erpnext/website/doctype/product_group/product_group.txt b/erpnext/website/doctype/product_group/product_group.txt
new file mode 100644
index 0000000..b26ec13
--- /dev/null
+++ b/erpnext/website/doctype/product_group/product_group.txt
@@ -0,0 +1,57 @@
+# DocType, Product Group
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-30 12:17:12',
+ 'docstatus': 0,
+ 'modified': '2012-01-30 12:17:12',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocType',
+ 'istable': 1,
+ 'module': 'Website',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 1
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'Product Group',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType',
+ 'permlevel': 0
+ },
+
+ # DocType, Product Group
+ {
+ 'doctype': 'DocType',
+ 'name': 'Product Group'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'item_group',
+ 'fieldtype': 'Link',
+ 'label': 'Item Group',
+ 'options': 'Item Group'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'label',
+ 'fieldtype': 'Data',
+ 'label': 'Label'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/doctype/products_settings/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/doctype/products_settings/__init__.py
diff --git a/erpnext/website/doctype/products_settings/products_settings.py b/erpnext/website/doctype/products_settings/products_settings.py
new file mode 100644
index 0000000..195f37f
--- /dev/null
+++ b/erpnext/website/doctype/products_settings/products_settings.py
@@ -0,0 +1,15 @@
+import webnotes
+
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
+
+ def on_update(self):
+ tmp = None
+ for d in self.doclist:
+ if d.doctype=="Product Group":
+ import json
+ tmp = json.dumps({"item_group": d.item_group, "label":d.label})
+ break
+
+ webnotes.conn.set_default("default_product_category", tmp)
\ No newline at end of file
diff --git a/erpnext/website/doctype/products_settings/products_settings.txt b/erpnext/website/doctype/products_settings/products_settings.txt
new file mode 100644
index 0000000..9e60f95
--- /dev/null
+++ b/erpnext/website/doctype/products_settings/products_settings.txt
@@ -0,0 +1,72 @@
+# DocType, Products Settings
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-30 12:15:00',
+ 'docstatus': 0,
+ 'modified': '2012-01-30 13:50:53',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ '_last_update': '1327906116',
+ 'colour': 'White:FFF',
+ 'description': 'Products are automatically updated from the item master. To add products to the website, go to the <a href="#!List/Item">Item master</a> and check "Show in Website" in the "Website Details"\n\n',
+ 'doctype': 'DocType',
+ 'issingle': 1,
+ 'module': 'Website',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 3
+ },
+
+ # These values are common for all DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Product Groups that are listed on the website. The first product group from this list will be listed by default on the "Products Page"',
+ 'doctype': 'DocField',
+ 'fieldname': 'groups',
+ 'fieldtype': 'Table',
+ 'label': 'Groups',
+ 'name': '__common__',
+ 'options': 'Product Group',
+ 'parent': 'Products Settings',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType',
+ 'permlevel': 0
+ },
+
+ # These values are common for all DocPerm
+ {
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'name': '__common__',
+ 'parent': 'Products Settings',
+ 'parentfield': 'permissions',
+ 'parenttype': 'DocType',
+ 'permlevel': 0,
+ 'read': 1,
+ 'role': 'Website Manager',
+ 'write': 1
+ },
+
+ # DocType, Products Settings
+ {
+ 'doctype': 'DocType',
+ 'name': 'Products Settings'
+ },
+
+ # DocPerm
+ {
+ 'doctype': 'DocPerm'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/doctype/related_page/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/doctype/related_page/__init__.py
diff --git a/erpnext/website/doctype/related_page/related_page.txt b/erpnext/website/doctype/related_page/related_page.txt
new file mode 100644
index 0000000..3cb674f
--- /dev/null
+++ b/erpnext/website/doctype/related_page/related_page.txt
@@ -0,0 +1,49 @@
+# DocType, Related Page
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-02-01 16:16:47',
+ 'docstatus': 0,
+ 'modified': '2012-02-01 16:16:48',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocType',
+ 'istable': 1,
+ 'module': 'Website',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 1
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'page',
+ 'fieldtype': 'Link',
+ 'label': 'Page',
+ 'name': '__common__',
+ 'options': 'Page',
+ 'parent': 'Related Page',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType',
+ 'permlevel': 0
+ },
+
+ # DocType, Related Page
+ {
+ 'doctype': 'DocType',
+ 'name': 'Related Page'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/doctype/style_settings/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/doctype/style_settings/__init__.py
diff --git a/erpnext/website/doctype/style_settings/custom_template.css b/erpnext/website/doctype/style_settings/custom_template.css
new file mode 100644
index 0000000..e6eeeb3
--- /dev/null
+++ b/erpnext/website/doctype/style_settings/custom_template.css
@@ -0,0 +1,31 @@
+body {
+{% if doc.background_image %}
+ background: url("files/{{ doc.background_image }}") repeat !important;
+{% elif doc.background_color %}
+ background-color: #{{ doc.background_color }};
+{% endif %}
+{% if doc.font %}
+ font-family: {{ doc.font }} !important;
+{% endif %}
+{% if doc.font_size %}
+ font-size: {{ doc.font_size }} !important;
+{% endif %}
+}
+
+{% if doc.footer_font_color %}
+footer {
+ color: {{ doc.footer_font_color }};
+}
+footer a, footer a:visited, footer a:hover {
+ color: {{ doc.footer_font_color }};
+}
+.web-footer-menu ul li {
+ border-right: 1px solid {{ doc.footer_font_color }};
+}
+{% endif %}
+
+{% if doc.heading_font %}
+h1, h2, h3, h4, h5 {
+ font-family: {{ doc.heading_font}} !important;
+}
+{% endif %}
diff --git a/erpnext/website/doctype/style_settings/style_settings.js b/erpnext/website/doctype/style_settings/style_settings.js
new file mode 100644
index 0000000..95c4143
--- /dev/null
+++ b/erpnext/website/doctype/style_settings/style_settings.js
@@ -0,0 +1,6 @@
+wn.require('lib/js/lib/jscolor/jscolor.js');
+
+cur_frm.cscript.onload_post_render = function() {
+ cur_frm.fields_dict.background_color.input.className = 'color';
+ jscolor.bind();
+}
\ No newline at end of file
diff --git a/erpnext/website/doctype/style_settings/style_settings.py b/erpnext/website/doctype/style_settings/style_settings.py
new file mode 100644
index 0000000..4aefbf6
--- /dev/null
+++ b/erpnext/website/doctype/style_settings/style_settings.py
@@ -0,0 +1,17 @@
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
+
+ def validate(self):
+ """make custom css"""
+ from jinja2 import Template
+
+ with open('erpnext/website/doctype/style_settings/custom_template.css', 'r') as f:
+ temp = Template(f.read())
+
+ self.doc.custom_css = temp.render(doc = self.doc)
+
+ from webnotes.session_cache import clear_cache
+ clear_cache('Guest')
+
+
\ No newline at end of file
diff --git a/erpnext/website/doctype/style_settings/style_settings.txt b/erpnext/website/doctype/style_settings/style_settings.txt
new file mode 100644
index 0000000..f07a947
--- /dev/null
+++ b/erpnext/website/doctype/style_settings/style_settings.txt
@@ -0,0 +1,156 @@
+# DocType, Style Settings
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-02-02 09:57:25',
+ 'docstatus': 0,
+ 'modified': '2012-02-02 10:47:38',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ '_last_update': '1328159294',
+ 'allow_attach': 1,
+ 'colour': 'White:FFF',
+ 'description': 'Set your background color, font and image (tiled)',
+ 'doctype': 'DocType',
+ 'issingle': 1,
+ 'max_attachments': 1,
+ 'module': 'Website',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 9
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'Style Settings',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType'
+ },
+
+ # These values are common for all DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'name': '__common__',
+ 'parent': 'Style Settings',
+ 'parentfield': 'permissions',
+ 'parenttype': 'DocType',
+ 'read': 1,
+ 'role': 'Website Manager'
+ },
+
+ # DocType, Style Settings
+ {
+ 'doctype': 'DocType',
+ 'name': 'Style Settings'
+ },
+
+ # DocPerm
+ {
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'permlevel': 0,
+ 'write': 1
+ },
+
+ # DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'permlevel': 1
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Solid background color (default light gray)',
+ 'doctype': 'DocField',
+ 'fieldname': 'background_color',
+ 'fieldtype': 'Data',
+ 'label': 'Background Color',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'If image is selected, color will be ignored (attach first)',
+ 'doctype': 'DocField',
+ 'fieldname': 'background_image',
+ 'fieldtype': 'Select',
+ 'label': 'Background Image',
+ 'options': 'attach_files:',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'font',
+ 'fieldtype': 'Select',
+ 'label': 'Font',
+ 'options': '\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'font_size',
+ 'fieldtype': 'Select',
+ 'label': 'Font Size',
+ 'options': '\n12px\n13px\n14px',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'heading_font',
+ 'fieldtype': 'Select',
+ 'label': 'Heaing Font',
+ 'options': '\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Select a white footer foreground color if you have a dark background',
+ 'doctype': 'DocField',
+ 'fieldname': 'footer_font_color',
+ 'fieldtype': 'Select',
+ 'label': 'Footer Font Color',
+ 'options': '\nwhite',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Auto generated',
+ 'doctype': 'DocField',
+ 'fieldname': 'custom_css',
+ 'fieldtype': 'Code',
+ 'label': 'Custom CSS',
+ 'permlevel': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'file_list',
+ 'fieldtype': 'Text',
+ 'hidden': 1,
+ 'label': 'File List',
+ 'no_copy': 1,
+ 'permlevel': 0,
+ 'print_hide': 1
+ }
+]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/doctype/top_bar_item/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/doctype/top_bar_item/__init__.py
diff --git a/erpnext/website/doctype/top_bar_item/top_bar_item.txt b/erpnext/website/doctype/top_bar_item/top_bar_item.txt
new file mode 100644
index 0000000..410352c
--- /dev/null
+++ b/erpnext/website/doctype/top_bar_item/top_bar_item.txt
@@ -0,0 +1,74 @@
+# DocType, Top Bar Item
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-24 10:24:19',
+ 'docstatus': 0,
+ 'modified': '2012-01-30 14:14:48',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocType',
+ 'istable': 1,
+ 'module': 'Website',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 2
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'Top Bar Item',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType',
+ 'permlevel': 0
+ },
+
+ # DocType, Top Bar Item
+ {
+ 'doctype': 'DocType',
+ 'name': 'Top Bar Item'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'label',
+ 'fieldtype': 'Data',
+ 'label': 'Label'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'std_page',
+ 'fieldtype': 'Select',
+ 'label': 'Std Page',
+ 'options': 'Home\nAbout\nContact\nProducts\nBlog\nCustom'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'custom_page',
+ 'fieldtype': 'Link',
+ 'label': 'Custom Page',
+ 'options': 'Web Page'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'parent_label',
+ 'fieldtype': 'Select',
+ 'label': 'Parent Label'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/doctype/web_page/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/doctype/web_page/__init__.py
diff --git a/erpnext/website/doctype/web_page/template.html b/erpnext/website/doctype/web_page/template.html
new file mode 100644
index 0000000..faacca1
--- /dev/null
+++ b/erpnext/website/doctype/web_page/template.html
@@ -0,0 +1,24 @@
+<div class="layout_wrapper">
+ <div class="web-content" id="content-{{ doc.name }}">
+ {% if doc.head_section %}
+ <div class="web-head-section">
+ {{ doc.head_section_html }}
+ </div>
+ {% endif %}
+ <div class="web-main-section">
+ {{ doc.main_section_html }}
+ {% if doc.next_page_html %}
+ {{ doc.next_page_html }}
+ {% endif %}
+ </div>
+ <div class="web-side-section">
+ {{ doc.side_section_html }}
+ {% if doc.see_also %}
+ <h4>See Also</h4>
+ {{ doc.see_also }}
+ {% endif %}
+ </div>
+ <div style="clear: both">
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/erpnext/website/doctype/web_page/web_page.py b/erpnext/website/doctype/web_page/web_page.py
new file mode 100644
index 0000000..14a082b
--- /dev/null
+++ b/erpnext/website/doctype/web_page/web_page.py
@@ -0,0 +1,52 @@
+import webnotes
+import website.utils
+
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
+
+ def autoname(self):
+ """name from title"""
+ self.doc.name = website.utils.page_name(self.doc.title)
+
+ def validate(self):
+ """make page for this product"""
+ p = website.utils.add_page(self.doc.title)
+
+ from jinja2 import Template
+ import os
+
+ website.utils.markdown(self.doc, ['head_section','main_section', 'side_section'])
+
+ self.add_page_links()
+
+ with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
+ p.content = Template(f.read()).render(doc=self.doc)
+
+ p.save()
+
+ website.utils.add_guest_access_to_page(p.name)
+ self.cleanup_temp()
+
+ def add_page_links(self):
+ """add links for next_page and see_also"""
+ if self.doc.next_page:
+ self.doc.next_page_html = """<div class="info-box round">
+ <p style="text-align: right"><b>Next:</b>
+ <a href="#!%(name)s">%(title)s</a></p></div>""" % {"name":self.doc.next_page, \
+ "title": webnotes.conn.get_value("Page", self.doc.next_page, "title")}
+
+ self.doc.see_also = ''
+ for l in webnotes.conn.sql("""select distinct t1.page, t2.title from
+ `tabRelated Page` t1, tabPage t2 where
+ t1.page = t2.name order by t2.title""", as_dict=1):
+ self.doc.see_also += """<p><a href="#!%(page)s">%(title)s</a></p>""" % l
+
+ def cleanup_temp(self):
+ """cleanup temp fields"""
+ fl = ['main_section_html', 'side_section_html', 'see_also', \
+ 'next_page_html', 'head_section_html']
+ for f in fl:
+ if f in self.doc.fields:
+ del self.doc.fields[f]
+
\ No newline at end of file
diff --git a/erpnext/website/doctype/web_page/web_page.txt b/erpnext/website/doctype/web_page/web_page.txt
new file mode 100644
index 0000000..0bacc43
--- /dev/null
+++ b/erpnext/website/doctype/web_page/web_page.txt
@@ -0,0 +1,142 @@
+# DocType, Web Page
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-31 15:18:49',
+ 'docstatus': 0,
+ 'modified': '2012-02-02 13:15:36',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ '_last_update': '1328093379',
+ 'allow_attach': 1,
+ 'colour': 'White:FFF',
+ 'description': 'A custom page is a simple page with the layout - headline, main section, side section\n\nEditing:\n\n- Editing is in [markdown format](http://daringfireball.net/projects/markdown/syntax)\n- You can also add images and embed html code\n\nAccessing the page:\n\n- The page can be accessed as #![page-name] after the main url\n\nIdeal for pages like FAQ, Terms, Help etc.\n\n',
+ 'doctype': 'DocType',
+ 'max_attachments': 5,
+ 'module': 'Website',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 6
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'Web Page',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType',
+ 'permlevel': 0
+ },
+
+ # These values are common for all DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'name': '__common__',
+ 'parent': 'Web Page',
+ 'parentfield': 'permissions',
+ 'parenttype': 'DocType',
+ 'read': 1,
+ 'role': 'Website Manager'
+ },
+
+ # DocType, Web Page
+ {
+ 'doctype': 'DocType',
+ 'name': 'Web Page'
+ },
+
+ # DocPerm
+ {
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'permlevel': 0,
+ 'write': 1
+ },
+
+ # DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'permlevel': 1
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Title / headline of your page',
+ 'doctype': 'DocField',
+ 'fieldname': 'title',
+ 'fieldtype': 'Data',
+ 'label': 'Title',
+ 'reqd': 1
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Section that will span 2 columns, formatted as markdown. If no head, leave blank. If you are displaying a banner, it must be 860px',
+ 'doctype': 'DocField',
+ 'fieldname': 'head_section',
+ 'fieldtype': 'Text',
+ 'label': 'Head Section'
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Content in markdown format that appears on the main side of your page',
+ 'doctype': 'DocField',
+ 'fieldname': 'main_section',
+ 'fieldtype': 'Code',
+ 'label': 'Main Section'
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Content in markdown format that appears on the right side',
+ 'doctype': 'DocField',
+ 'fieldname': 'side_section',
+ 'fieldtype': 'Code',
+ 'label': 'Side Section'
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Link for next page appears at the bottom of the page',
+ 'doctype': 'DocField',
+ 'fieldname': 'next_page',
+ 'fieldtype': 'Link',
+ 'label': 'Next Page',
+ 'options': 'Page'
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Related pages appear on the right side of the link and are linked both ways.',
+ 'doctype': 'DocField',
+ 'fieldname': 'related_pages',
+ 'fieldtype': 'Table',
+ 'label': 'Related Pages',
+ 'options': 'Related Page'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'file_list',
+ 'fieldtype': 'Text',
+ 'hidden': 1,
+ 'label': 'File List',
+ 'no_copy': 1,
+ 'print_hide': 1
+ }
+]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/doctype/website_settings/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/doctype/website_settings/__init__.py
diff --git a/erpnext/website/doctype/website_settings/website_settings.py b/erpnext/website/doctype/website_settings/website_settings.py
new file mode 100644
index 0000000..0cbc97d
--- /dev/null
+++ b/erpnext/website/doctype/website_settings/website_settings.py
@@ -0,0 +1,20 @@
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
+
+ def validate(self):
+ """clear cache"""
+ # set home page
+ import webnotes
+ from webnotes.model.doc import Document
+
+ webnotes.conn.sql("""delete from `tabDefault Home Page` where role='Guest'""")
+
+ d = Document('Default Home Page')
+ d.parent = 'Control Panel'
+ d.role = 'Guest'
+ d.home_page = self.doc.home_page
+ d.save()
+
+ from webnotes.session_cache import clear_cache
+ clear_cache('Guest')
\ No newline at end of file
diff --git a/erpnext/website/doctype/website_settings/website_settings.txt b/erpnext/website/doctype/website_settings/website_settings.txt
new file mode 100644
index 0000000..aaa7327
--- /dev/null
+++ b/erpnext/website/doctype/website_settings/website_settings.txt
@@ -0,0 +1,160 @@
+# DocType, Website Settings
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-02-02 13:19:50',
+ 'docstatus': 0,
+ 'modified': '2012-02-02 13:31:24',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ '_last_update': '1328169455',
+ 'allow_attach': 1,
+ 'colour': 'White:FFF',
+ 'doctype': 'DocType',
+ 'document_type': 'Other',
+ 'issingle': 1,
+ 'max_attachments': 1,
+ 'module': 'Website',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 3
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'Website Settings',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType',
+ 'permlevel': 0
+ },
+
+ # These values are common for all DocPerm
+ {
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'name': '__common__',
+ 'parent': 'Website Settings',
+ 'parentfield': 'permissions',
+ 'parenttype': 'DocType',
+ 'permlevel': 0,
+ 'read': 1,
+ 'write': 1
+ },
+
+ # DocType, Website Settings
+ {
+ 'doctype': 'DocType',
+ 'name': 'Website Settings'
+ },
+
+ # DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'role': 'System Manager'
+ },
+
+ # DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'role': 'Website Manager'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Section Break',
+ 'label': 'Top Bar'
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'The name of your company / website as you want to appear on browser title bar. All pages will have this as the prefix to the title.',
+ 'doctype': 'DocField',
+ 'fieldname': 'title_prefix',
+ 'fieldtype': 'Data',
+ 'label': 'Title Prefix'
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'The "Web Page" that is the website home page',
+ 'doctype': 'DocField',
+ 'fieldname': 'home_page',
+ 'fieldtype': 'Link',
+ 'label': 'Home Page',
+ 'options': 'Web Page',
+ 'reqd': 1
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Brand is what appears on the top-right of the toolbar. If it is an image, make sure it\nhas a transparent background and use the <img /> tag',
+ 'doctype': 'DocField',
+ 'fieldname': 'brand_html',
+ 'fieldtype': 'Text',
+ 'label': 'Brand HTML'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'top_bar_items',
+ 'fieldtype': 'Table',
+ 'label': 'Top Bar Items',
+ 'options': 'Top Bar Item'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Section Break',
+ 'label': 'Footer'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'address',
+ 'fieldtype': 'Text',
+ 'label': 'Address'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'copyright',
+ 'fieldtype': 'Data',
+ 'label': 'Copyright'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'footer_items',
+ 'fieldtype': 'Table',
+ 'label': 'Footer Items',
+ 'options': 'Top Bar Item'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'file_list',
+ 'fieldtype': 'Text',
+ 'hidden': 1,
+ 'label': 'File List',
+ 'no_copy': 1,
+ 'print_hide': 1
+ }
+]
\ No newline at end of file
diff --git a/erpnext/website/js/product_category.js b/erpnext/website/js/product_category.js
new file mode 100644
index 0000000..04b7e71
--- /dev/null
+++ b/erpnext/website/js/product_category.js
@@ -0,0 +1,22 @@
+// make sidelisting of categories
+erpnext.product_item_group = {}
+
+erpnext.make_product_categories = function(wrapper) {
+ wrapper.category_list = new wn.widgets.Listing({
+ parent: $(wrapper).find('.web-side-section').get(0),
+ query: 'select label, count(t2.name) as items, t1.item_group \
+ from `tabProduct Group` t1, `tabItem` t2\
+ where t1.parent="Products Settings" \
+ and t2.item_group = t1.item_group \
+ and ifnull(t2.show_in_website, 0)=1 \
+ group by t2.item_group \
+ order by t1.idx desc',
+ hide_refresh: true,
+ render_row: function(parent, data) {
+ parent.innerHTML = repl('<a href="#!products/%(label)s">%(label)s</a> (%(items)s)',
+ data);
+ erpnext.product_item_group[data.label] = data.item_group;
+ }
+ });
+ wrapper.category_list.run();
+}
diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js
new file mode 100644
index 0000000..8a7870c
--- /dev/null
+++ b/erpnext/website/js/topbar.js
@@ -0,0 +1,75 @@
+wn.provide('erpnext.topbar');
+wn.require('lib/css/bootstrap/bootstrap-topbar.css');
+wn.require('lib/js/bootstrap/bootstrap-dropdown.js');
+
+/*
+<li class="dropdown">\
+ <a class="dropdown-toggle" href="#" onclick="return false;"></a>\
+ <ul class="dropdown-menu" id="toolbar-user">\
+ </ul>\
+</li>\
+*/
+
+erpnext.topbar.TopBar = Class.extend({
+ init: function() {
+ this.make();
+ $('.brand').html(wn.boot.website_settings.brand_html);
+ this.make_items();
+ },
+ make: function() {
+ $('header').append('<div class="topbar">\
+ <div class="topbar-inner">\
+ <div class="container">\
+ <a class="brand">[brand]</a>\
+ <ul class="nav">\
+ </ul>\
+ <img src="lib/images/ui/spinner.gif" id="spinner"/>\
+ <ul class="nav secondary-nav">\
+ <li><a href="#!Login Page">Login</a></li>\
+ </ul>\
+ </div>\
+ </div>\
+ </div>');
+ $('.brand').attr('href', '#!' + (wn.boot.website_settings.home_page || 'Login Page'))
+ },
+ make_items: function() {
+ var items = wn.boot.website_menus
+ for(var i=0;i<items.length;i++) {
+ var item = items[i];
+ if(!item.parent_label && item.parentfield=='top_bar_items') {
+ item.route = item.std_page ? item.std_page.toLowerCase() : item.custom_page;
+ $('header .nav:first').append(repl('<li><a href="#!%(route)s" \
+ data-label="%(label)s">%(label)s</a></li>', item))
+ }
+ }
+ }
+});
+
+erpnext.topbar.topbar = new erpnext.topbar.TopBar();
+
+// footer
+erpnext.Footer = Class.extend({
+ init: function() {
+ $('footer').html(repl('<div class="web-footer">\
+ <div class="web-footer-menu"><ul></ul></div>\
+ <div class="web-footer-address">%(address)s</div>\
+ <div class="web-footer-copyright">© %(copyright)s</div>\
+ <div class="web-footer-powered">Powered by \
+ <a href="https://erpnext.com">erpnext.com</a></div>\
+ </div>', wn.boot.website_settings));
+ this.make_items();
+ },
+ make_items: function() {
+ var items = wn.boot.website_menus
+ for(var i=0;i<items.length;i++) {
+ var item = items[i];
+ if(!item.parent_label && item.parentfield=='footer_items') {
+ item.route = item.std_page ? item.std_page.toLowerCase() : item.custom_page;
+ $('.web-footer-menu ul').append(repl('<li><a href="#!%(route)s" \
+ data-label="%(label)s">%(label)s</a></li>', item))
+ }
+ }
+ }
+});
+
+erpnext.footer = new erpnext.Footer();
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/page/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/page/__init__.py
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/page/about/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/page/about/__init__.py
diff --git a/erpnext/website/page/about/about.txt b/erpnext/website/page/about/about.txt
new file mode 100644
index 0000000..a106513
--- /dev/null
+++ b/erpnext/website/page/about/about.txt
@@ -0,0 +1,43 @@
+# Page, about
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-27 11:37:57',
+ 'docstatus': 0,
+ 'modified': '2012-01-27 13:26:42',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all Page
+ {
+ 'doctype': 'Page',
+ 'module': 'Website',
+ 'name': '__common__',
+ 'page_name': 'about',
+ 'standard': 'Yes',
+ 'title': 'About Us'
+ },
+
+ # These values are common for all Page Role
+ {
+ 'doctype': 'Page Role',
+ 'name': '__common__',
+ 'parent': 'about',
+ 'parentfield': 'roles',
+ 'parenttype': 'Page',
+ 'role': 'Guest'
+ },
+
+ # Page, about
+ {
+ 'doctype': 'Page',
+ 'name': 'about'
+ },
+
+ # Page Role
+ {
+ 'doctype': 'Page Role'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/page/blog/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/page/blog/__init__.py
diff --git a/erpnext/website/page/blog/blog.html b/erpnext/website/page/blog/blog.html
new file mode 100644
index 0000000..f271e03
--- /dev/null
+++ b/erpnext/website/page/blog/blog.html
@@ -0,0 +1,14 @@
+<div class="layout_wrapper">
+ <div class="web-content" id="content-blog">
+ <h1>Blog</h1>
+ <br>
+ <div class="web-main-section">
+ </div>
+ <div class="web-side-section">
+ <h4>Get Updates</h4>
+ <input name="blog-subscribe">
+ <button class="btn" id="blog-subscribe">Subscribe</button>
+ </div>
+ <div style="clear: both"></div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/erpnext/website/page/blog/blog.js b/erpnext/website/page/blog/blog.js
new file mode 100644
index 0000000..6be1d07
--- /dev/null
+++ b/erpnext/website/page/blog/blog.js
@@ -0,0 +1,38 @@
+
+pscript.onload_blog = function(wrapper) {
+ wrapper.blog_list = new wn.widgets.Listing({
+ parent: $(wrapper).find('.web-main-section').get(0),
+ query: 'select tabBlog.name, title, left(content, 300) as content, tabBlog.modified, \
+ ifnull(first_name, "") as first_name, ifnull(last_name, "") as last_name \
+ from tabProfile, tabBlog\
+ where ifnull(published,1)=1 and tabBlog.owner = tabProfile.name',
+ hide_refresh: true,
+ render_row: function(parent, data) {
+ if(data.content.length==300) data.content += '...';
+ data.date = prettyDate(data.modified);
+ parent.innerHTML = repl('<h4><a href="#!%(name)s">%(title)s</a></h4>\
+ <div class="help">By %(first_name)s %(last_name)s on %(date)s</div>\
+ <p><div class="comment">%(content)s</div></p><br>', data);
+ },
+ page_length: 10
+ });
+ wrapper.blog_list.run();
+
+ // subscribe button
+ $('#blog-subscribe').click(function() {
+ var email = $(wrapper).find('input[name="blog-subscribe"]').val();
+ if(!validate_email(email)) {
+ msgprint('Please enter a valid email!');
+ }
+ wn.call({
+ module:'website',
+ page:'blog',
+ method:'subscribe',
+ args:email,
+ btn: this,
+ callback: function() {
+ $(wrapper).find('input[name="blog-subscribe"]').val('');
+ }
+ });
+ })
+}
\ No newline at end of file
diff --git a/erpnext/website/page/blog/blog.py b/erpnext/website/page/blog/blog.py
new file mode 100644
index 0000000..6e7a62e
--- /dev/null
+++ b/erpnext/website/page/blog/blog.py
@@ -0,0 +1,11 @@
+import webnotes
+def subscribe(arg):
+ """subscribe to blog (blog_subscriber)"""
+ if webnotes.conn.sql("""select name from `tabBlog Subscriber` where name=%s""", arg):
+ webnotes.msgprint("Already a subscriber. Thanks!")
+ else:
+ from webnotes.model.doc import Document
+ d = Document('Blog Subscriber')
+ d.name = arg
+ d.save()
+ webnotes.msgprint("Thank you for subscribing!")
\ No newline at end of file
diff --git a/erpnext/website/page/blog/blog.txt b/erpnext/website/page/blog/blog.txt
new file mode 100644
index 0000000..4443ec8
--- /dev/null
+++ b/erpnext/website/page/blog/blog.txt
@@ -0,0 +1,44 @@
+# Page, blog
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-27 15:47:52',
+ 'docstatus': 0,
+ 'modified': '2012-01-27 15:47:52',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all Page
+ {
+ 'doctype': 'Page',
+ 'module': 'Website',
+ 'name': '__common__',
+ 'page_name': 'blog',
+ 'standard': 'Yes',
+ 'title': 'Blog'
+ },
+
+ # These values are common for all Page Role
+ {
+ '__islocal': 1,
+ 'doctype': 'Page Role',
+ 'name': '__common__',
+ 'parent': 'blog',
+ 'parentfield': 'roles',
+ 'parenttype': 'Page',
+ 'role': 'Guest'
+ },
+
+ # Page, blog
+ {
+ 'doctype': 'Page',
+ 'name': 'blog'
+ },
+
+ # Page Role
+ {
+ 'doctype': 'Page Role'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/page/contact/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/page/contact/__init__.py
diff --git a/erpnext/website/page/contact/contact.js b/erpnext/website/page/contact/contact.js
new file mode 100644
index 0000000..e05023b
--- /dev/null
+++ b/erpnext/website/page/contact/contact.js
@@ -0,0 +1,30 @@
+pscript.onload_contact = function(wrapper) {
+ $('#content-contact-us .btn.primary').click(function() {
+ var me = this;
+ var args = {};
+ args.name = $('#content-contact-us [name="contact-name"]').val();
+ args.email = $('#content-contact-us [name="contact-email"]').val();
+ args.message = $('#content-contact-us [name="contact-message"]').val();
+
+ if(!validate_email(args.email)) {
+ msgprint('Please enter a valid email id');
+ return;
+ }
+
+ if(args.name && args.email && args.message) {
+ $(this).set_working();
+ $c_page('website', 'contact', 'send', args, function(r) {
+ $('#content-contact-us [name*="contact"]').val('');
+ $(me).done_working();
+ });
+ } else {
+ msgprint("Please enter info in all the fields.")
+ }
+ });
+
+ $('#content-contact-us :input').keyup(function(ev) {
+ if(ev.which == 13) {
+ $('#content-contact-us .btn.primary').click();
+ }
+ });
+}
\ No newline at end of file
diff --git a/erpnext/website/page/contact/contact.py b/erpnext/website/page/contact/contact.py
new file mode 100644
index 0000000..a6566a9
--- /dev/null
+++ b/erpnext/website/page/contact/contact.py
@@ -0,0 +1,15 @@
+import json, webnotes
+
+def send(args):
+ """create support ticket"""
+ args = json.loads(args)
+
+ from webnotes.model.doc import Document
+ d = Document('Support Ticket')
+ d.raised_by = args['email']
+ d.description = 'From: ' + args['name'] + '\n\n' + args['message']
+ d.subject = 'Website Query'
+ d.status = 'Open'
+ d.owner = 'Guest'
+ d.save(1)
+ webnotes.msgprint("Thank you for your query. We will respond as soon as we can.")
\ No newline at end of file
diff --git a/erpnext/website/page/contact/contact.txt b/erpnext/website/page/contact/contact.txt
new file mode 100644
index 0000000..6051c6f
--- /dev/null
+++ b/erpnext/website/page/contact/contact.txt
@@ -0,0 +1,42 @@
+# Page, contact
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-25 16:02:15',
+ 'docstatus': 0,
+ 'modified': '2012-01-25 16:02:15',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all Page
+ {
+ 'doctype': 'Page',
+ 'module': 'Website',
+ 'name': '__common__',
+ 'page_name': 'contact',
+ 'standard': 'Yes'
+ },
+
+ # These values are common for all Page Role
+ {
+ 'doctype': 'Page Role',
+ 'name': '__common__',
+ 'parent': 'contact',
+ 'parentfield': 'roles',
+ 'parenttype': 'Page',
+ 'role': 'Guest'
+ },
+
+ # Page, contact
+ {
+ 'doctype': 'Page',
+ 'name': 'contact'
+ },
+
+ # Page Role
+ {
+ 'doctype': 'Page Role'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/website/page/products/README.md b/erpnext/website/page/products/README.md
new file mode 100644
index 0000000..e40b446
--- /dev/null
+++ b/erpnext/website/page/products/README.md
@@ -0,0 +1,27 @@
+## Products
+
+Contains
+
+- List of Products tagged by Item master
+ - image
+ - short description (md)
+ - pricing info (if public) (public pricelist)
+ - stock info (website warehouse)
+- Search
+- Sidebar contains categories (# of items in each category)
+
+When Item is Saved, a page for that item is created with
+
+- Large image
+- Smaller images
+- Long Description
+- Pricing info
+- Stock info
+- Contact Button (instead of Buy / Add to cart)
+
+### Steps
+
+- update item master
+- update item category (show in web + priority) (or in a products settings page)
+- # of public items in each category
+- validation - item cannot have show in item if parent does not have it
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/page/products/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/page/products/__init__.py
diff --git a/erpnext/website/page/products/products.html b/erpnext/website/page/products/products.html
new file mode 100644
index 0000000..4ef5bf4
--- /dev/null
+++ b/erpnext/website/page/products/products.html
@@ -0,0 +1,12 @@
+<div class="layout_wrapper" id="content-products">
+ <div class="web-main-section">
+ <h1 class="products-category"></h1>
+ <div class="products-search">
+ <input name="products-search" /><button class="btn">Search</button>
+ </div>
+ </div>
+ <div class="web-side-section">
+ <h3>Categories</h3>
+ </div>
+ <div style="clear:both;">
+</div>
\ No newline at end of file
diff --git a/erpnext/website/page/products/products.js b/erpnext/website/page/products/products.js
new file mode 100644
index 0000000..0e7dec5
--- /dev/null
+++ b/erpnext/website/page/products/products.js
@@ -0,0 +1,84 @@
+erpnext.products = {}
+
+wn.require('erpnext/website/js/product_category.js');
+
+pscript.onload_products = function(wrapper) {
+ sys_defaults.default_product_category = JSON.parse(sys_defaults.default_product_category);
+ erpnext.products.wrapper = wrapper;
+
+ // make lists
+ erpnext.make_product_categories(wrapper);
+ erpnext.products.make_product_list(wrapper);
+
+ // button
+ $(wrapper).find('.products-search .btn').click(function() {
+ wrapper.mainlist.run();
+ });
+
+ $(wrapper).find('.products-search input').keypress(function(ev) {
+ if(ev.which==13) $(wrapper).find('.products-search .btn').click();
+ });
+}
+
+pscript.onshow_products = function(wrapper) {
+ // show default product category
+ erpnext.products.set_group();
+}
+
+erpnext.products.get_group = function() {
+ var route = window.location.hash.split('/');
+ if(route.length>1) {
+ // from url
+ var grp = erpnext.product_item_group[route[1]];
+ var label = route[1];
+ } else {
+ // default
+ var grp = sys_defaults.default_product_category.item_group;
+ var label = sys_defaults.default_product_category.label;
+ }
+ erpnext.products.cur_group = grp;
+ return {grp:grp, label:label};
+}
+
+erpnext.products.make_product_list = function(wrapper) {
+ wrapper.mainlist = new wn.widgets.Listing({
+ parent: $(wrapper).find('.web-main-section').get(0),
+ run_btn: $(wrapper).find('.products-search .btn').get(0),
+ hide_refresh: true,
+ get_query: function() {
+ args = {
+ searchstr: $('input[name="products-search"]').val() || '',
+ cat: erpnext.products.cur_group
+ };
+ return repl('select t1.name, t1.title, t1.thumbnail_image, \
+ t1.page_name, t1.short_description \
+ from tabProduct t1, tabItem t2 \
+ where t1.item = t2.name \
+ and t2.item_group="%(cat)s" \
+ and t1.short_description like "%%(searchstr)s%"', args)
+ },
+ render_row: function(parent, data) {
+ parent.innerHTML = repl('<div style="float:left; width: 115px;">\
+ <img src="files/%(thumbnail_image)s" style="width:100px;"></div>\
+ <div style="float:left; width: 400px">\
+ <b><a href="#!%(page_name)s">%(title)s</a></b>\
+ <p>%(short_description)s</p></div>\
+ <div style="clear: both; margin-bottom: 7px;"></div>', data);
+ }
+ });
+
+}
+
+erpnext.products.set_group = function() {
+ var cat = erpnext.products.get_group();
+ if(!cat.grp) {
+ // still nothing
+ setTimeout('erpnext.products.set_group()', 1000);
+ return;
+ }
+ // get erpnext.products.default_category
+ var wrapper = erpnext.products.wrapper;
+
+ $(wrapper).find('h1').html(cat.label);
+ wrapper.mainlist.run();
+}
\ No newline at end of file
diff --git a/erpnext/website/page/products/products.txt b/erpnext/website/page/products/products.txt
new file mode 100644
index 0000000..f00a05b
--- /dev/null
+++ b/erpnext/website/page/products/products.txt
@@ -0,0 +1,43 @@
+# Page, products
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-30 10:49:01',
+ 'docstatus': 0,
+ 'modified': '2012-01-30 10:49:01',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all Page
+ {
+ 'doctype': 'Page',
+ 'module': 'Website',
+ 'name': '__common__',
+ 'page_name': 'products',
+ 'standard': 'Yes',
+ 'title': 'Products'
+ },
+
+ # These values are common for all Page Role
+ {
+ 'doctype': 'Page Role',
+ 'name': '__common__',
+ 'parent': 'products',
+ 'parentfield': 'roles',
+ 'parenttype': 'Page',
+ 'role': 'Guest'
+ },
+
+ # Page, products
+ {
+ 'doctype': 'Page',
+ 'name': 'products'
+ },
+
+ # Page Role
+ {
+ 'doctype': 'Page Role'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sso_control/__init__.py b/erpnext/website/page/unsubscribe/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/sso_control/__init__.py
copy to erpnext/website/page/unsubscribe/__init__.py
diff --git a/erpnext/website/page/unsubscribe/unsubscribe.html b/erpnext/website/page/unsubscribe/unsubscribe.html
new file mode 100644
index 0000000..7b2b68e
--- /dev/null
+++ b/erpnext/website/page/unsubscribe/unsubscribe.html
@@ -0,0 +1,13 @@
+<div class="layout_wrapper">
+ <div class="web-content">
+ <h1>Unsubscribe</h1>
+ <br>
+ <div class="web-main-section">
+ <input name="unsubscribe">
+ <button class="btn" id="btn-unsubscribe">Unsubscribe</button>
+ </div>
+ <div class="web-side-section">
+ </div>
+ <div style="clear: both"></div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/erpnext/website/page/unsubscribe/unsubscribe.js b/erpnext/website/page/unsubscribe/unsubscribe.js
new file mode 100644
index 0000000..7cbed37
--- /dev/null
+++ b/erpnext/website/page/unsubscribe/unsubscribe.js
@@ -0,0 +1,21 @@
+pscript.onload_unsubscribe = function(wrapper) {
+ var email = window.location.hash.split('/').splice(-1);
+ $(wrapper).find('input[name="unsubscribe"]').val(email)
+
+ $('#btn-unsubscribe').click(function() {
+ var email = $(wrapper).find('input[name="unsubscribe"]').val();
+ if(email) {
+ var btn = this;
+ wn.call({
+ module:'website',
+ page:'unsubscribe',
+ method:'unsubscribe',
+ args:email,
+ btn: this,
+ callback: function() {
+ $(wrapper).find('input[name="unsubscribe"]').val('');
+ }
+ });
+ }
+ });
+}
\ No newline at end of file
diff --git a/erpnext/website/page/unsubscribe/unsubscribe.py b/erpnext/website/page/unsubscribe/unsubscribe.py
new file mode 100644
index 0000000..57d1d47
--- /dev/null
+++ b/erpnext/website/page/unsubscribe/unsubscribe.py
@@ -0,0 +1,8 @@
+def unsubscribe(arg):
+ """unsubscribe from lists"""
+ import webnotes
+ 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/unsubscribe/unsubscribe.txt b/erpnext/website/page/unsubscribe/unsubscribe.txt
new file mode 100644
index 0000000..2cc3b58
--- /dev/null
+++ b/erpnext/website/page/unsubscribe/unsubscribe.txt
@@ -0,0 +1,43 @@
+# Page, unsubscribe
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-01-27 17:19:02',
+ 'docstatus': 0,
+ 'modified': '2012-01-27 17:19:02',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all Page
+ {
+ 'doctype': 'Page',
+ 'module': 'Website',
+ 'name': '__common__',
+ 'page_name': 'unsubscribe',
+ 'standard': 'Yes',
+ 'title': 'Unsubscribe'
+ },
+
+ # These values are common for all Page Role
+ {
+ 'doctype': 'Page Role',
+ 'name': '__common__',
+ 'parent': 'unsubscribe',
+ 'parentfield': 'roles',
+ 'parenttype': 'Page',
+ 'role': 'Guest'
+ },
+
+ # Page, unsubscribe
+ {
+ 'doctype': 'Page',
+ 'name': 'unsubscribe'
+ },
+
+ # Page Role
+ {
+ 'doctype': 'Page Role'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/website/utils.py b/erpnext/website/utils.py
new file mode 100644
index 0000000..330f7a3
--- /dev/null
+++ b/erpnext/website/utils.py
@@ -0,0 +1,53 @@
+import webnotes
+from webnotes.model.doc import Document
+
+def make_template(doc, path, convert_fields = ['main_section', 'side_section']):
+ """make template"""
+ import os, jinja2
+
+ markdown(doc, convert_fields)
+
+ # write template
+ with open(path, 'r') as f:
+ temp = jinja2.Template(f.read())
+
+ return temp.render(doc = doc.fields)
+
+def markdown(doc, fields):
+ """convert fields to markdown"""
+ import markdown2
+ # markdown
+ for f in fields:
+ doc.fields[f + '_html'] = markdown2.markdown(doc.fields[f] or '', \
+ extras=["wiki-tables"])
+
+
+def page_name(title):
+ """make page name from title, and check that there is no duplicate"""
+ import re
+ name = re.sub('[~!@#$%^&*()<>,."\']', '', title.lower())
+ return '-'.join(name.split()[:4])
+
+def add_page(title):
+ """add a custom page with title"""
+ name = page_name(title)
+ if webnotes.conn.sql("""select name from tabPage where name=%s""", name):
+ p = Document('Page', name)
+ else:
+ p = Document('Page')
+
+ p.title = title
+ p.name = p.page_name = name
+ p.module = 'Website'
+ p.standard = 'No'
+
+ return p
+
+def add_guest_access_to_page(page):
+ """add Guest in Page Role"""
+ if not webnotes.conn.sql("""select parent from `tabPage Role`
+ where role='Guest' and parent=%s""", page):
+ d = Document('Page Role')
+ d.parent = page
+ d.role = 'Guest'
+ d.save()
\ No newline at end of file
diff --git a/index.cgi b/index.cgi
index 3d61c56..a119dae 100755
--- a/index.cgi
+++ b/index.cgi
@@ -9,33 +9,29 @@
sys.path.append('erpnext')
import webnotes
+import webnotes.handler
+import webnotes.auth
-webnotes.form = cgi.FieldStorage()
+def init():
+ # make the form_dict
+ webnotes.form = cgi.FieldStorage(keep_blank_values=True)
+ for key in webnotes.form.keys():
+ webnotes.form_dict[key] = webnotes.form.getvalue(key)
-# make the form_dict
-for key in webnotes.form.keys():
- webnotes.form_dict[key] = webnotes.form.getvalue(key)
+ # init request
+ webnotes.http_request = webnotes.auth.HTTPRequest()
-# url comes with sid, redirect to html, sid set and all
-if 'sid' in webnotes.form_dict:
- import webnotes.auth
- import webnotes.widgets.page_body
+def respond():
+ import webnotes
+ if 'cmd' in webnotes.form_dict:
+ webnotes.handler.handle()
+ else:
+ import webnotes.index
+ print "Content-Type: text/html"
+ webnotes.handler.print_cookies()
+ print
+ print webnotes.index.get()
- webnotes.auth.HTTPRequest()
-
- print "Content-Type: text/html"
-
- # print cookies, if there ar additional cookies defined during the request, add them here
- if webnotes.cookies or webnotes.add_cookies:
- for c in webnotes.add_cookies.keys():
- webnotes.cookies[c] = webnotes.add_cookies[c]
-
- print webnotes.cookies
-
- print
- print webnotes.widgets.page_body.redirect_template % ('Redirecting...', 'index.html')
-
-else:
- # pass on to legacy handler
- import webnotes.handler
-
+if __name__=="__main__":
+ init()
+ respond()
\ No newline at end of file
diff --git a/index.html b/index.html
deleted file mode 100644
index ce1a617..0000000
--- a/index.html
+++ /dev/null
@@ -1,79 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<head>
- <meta charset="utf-8">
- <title>ERPNext</title>
- <meta name="author" content="">
- <script type="text/javascript">window._version_number="34"
-
-wn={}
-wn.provide=function(namespace){var nsl=namespace.split('.');var l=nsl.length;var parent=window;for(var i=0;i<l;i++){var n=nsl[i];if(!parent[n]){parent[n]={}}
-parent=parent[n];}}
-wn.provide('wn.settings');wn.provide('wn.ui');wn.xmlhttp={request:function(){if(window.XMLHttpRequest)
-return new XMLHttpRequest();else if(window.ActiveXObject)
-return new ActiveXObject("MsXml2.XmlHttp");},complete:function(req,callback,url){if(req.status==200||req.status==304){callback(req.responseText);}else{alert(url+' request error: '+req.statusText+' ('+req.status+')');}},get:function(url,callback,args,async){if(async===null)async=true;var req=wn.xmlhttp.request();req.onreadystatechange=function(){if(req.readyState==4){wn.xmlhttp.complete(req,callback,url)}}
-var sep=((args&&args.indexOf('?'))==-1)?'?':'&';var u=args?(url+sep+args):url;req.open('GET',u,async);req.send(null);if(!async){wn.xmlhttp.complete(req,callback,url)}}}
-wn.versions={check:function(){if(localStorage){if(window._version_number==-1||parseInt(localStorage._version_number)!=parseInt(window._version_number)){localStorage.clear();}
-localStorage.setItem('_version_number',window._version_number);}}}
-wn.assets={executed_:{},exists:function(src){if('localStorage'in window&&localStorage.getItem(src))
-return true},add:function(src,txt){if('localStorage'in window){localStorage.setItem(src,txt);}},get:function(src){return localStorage.getItem(src);},extn:function(src){if(src.indexOf('?')!=-1){src=src.split('?').slice(-1)[0];}
-return src.split('.').slice(-1)[0];},html_src:function(src){if(src.indexOf('/')!=-1){var t=src.split('/').slice(0,-1);t.push('src');t=t.join('/')+'/'+a.split('/').slice(-1)[0];}else{var t='src/'+src;}
-return t;},load:function(src){var t=wn.assets.extn(src)=='html'?wn.assets.html_src(src):src;wn.xmlhttp.get(t,function(txt){wn.assets.add(src,txt);},'q='&Math.floor(Math.random()*1000),false)},execute:function(src){if(!wn.assets.exists(src)){wn.assets.load(src);}
-var type=wn.assets.extn(src);if(wn.assets.handler[type]){wn.assets.handler[type](wn.assets.get(src),src);wn.assets.executed_[src]=1;}},handler:{js:function(txt,src){wn.dom.eval(txt);},css:function(txt,src){var se=document.createElement('style');se.type="text/css";if(se.styleSheet){se.styleSheet.cssText=txt;}else{se.appendChild(document.createTextNode(txt));}
-document.getElementsByTagName('head')[0].appendChild(se);},html:function(txt,src){var page=wn.dom.add($('.outer .inner').get(0),'div','content',null,txt);page.setAttribute("_src",src);},cgi:function(txt,src){wn.dom.eval(txt)}}}
-wn.require=function(items){if(typeof items==="string"){items=[items];}
-var l=items.length;for(var i=0;i<l;i++){var src=items[i];if(!(src in wn.assets.executed_)){wn.assets.execute(src);}}}
-wn.provide('wn.dom');wn.dom.by_id=function(id){return document.getElementById(id);}
-wn.dom.eval=function(txt){var el=document.createElement('script');el.appendChild(document.createTextNode(txt));document.getElementsByTagName('head')[0].appendChild(el);}
-wn.dom.add=function(parent,newtag,className,cs,innerHTML,onclick){if(parent&&parent.substr)parent=wn.dom.by_id(parent);var c=document.createElement(newtag);if(parent)
-parent.appendChild(c);if(className){if(newtag.toLowerCase()=='img')
-c.src=className
-else
-c.className=className;}
-if(cs)wn.dom.css(c,cs);if(innerHTML)c.innerHTML=innerHTML;if(onclick)c.onclick=onclick;return c;}
-wn.dom.css=function(ele,s){if(ele&&s){for(var i in s)ele.style[i]=s[i];};return ele;}
-wn.dom.hide=function(ele){ele.style.display='none';}
-wn.dom.show=function(ele,value){if(!value)value='block';ele.style.display=value;}
-wn.page={set:function(src){var new_selection=$('.inner div.content[_src="'+src+'"]');if(!new_selection.length){wn.assets.execute(src);new_selection=$('.inner div.content[_src="'+src+'"]');}
-$('.inner .current_page').removeClass('current_page');new_selection.addClass('current_page');var title=$('nav ul li a[href*="'+src+'"]').attr('title')||'No Title'
-state=window.location.hash;if(state!=src){window.location.hash=state;}
-else{document.title=title;}}}
-var JSON;if(!JSON){JSON={};}
-(function(){"use strict";function f(n){return n<10?'0'+n:n;}
-if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
-f(this.getUTCMonth()+1)+'-'+
-f(this.getUTCDate())+'T'+
-f(this.getUTCHours())+':'+
-f(this.getUTCMinutes())+':'+
-f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
-var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
-function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
-if(typeof rep==='function'){value=rep.call(holder,key,value);}
-switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
-gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
-v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v;}
-if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==='string'){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
-v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
-if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
-rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
-return str('',{'':value});};}
-if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
-return reviver.call(holder,key,value);}
-text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
-('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
-if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
-throw new SyntaxError('JSON.parse');};}}());wn.versions.check();wn.require("lib/js/lib/jquery.min.js");wn.require("lib/js/lib/history/history.min.js");$(document).bind('ready',function(){var base=window.location.href.split('#')[0];$.each($('a[softlink!="false"]'),function(i,v){if(v.href.substr(0,base.length)==base){var path=(v.href.substr(base.length));if(path.substr(0,1)!='#'){v.href=base+'#'+path;}}});if(!wn.settings.no_history&&window.location.hash){wn.page.set(window.location.hash.substr(1));}});</script>
-</head>
-<body>
- <div id="startup_div" style="padding: 8px; font-size: 14px;"></div>
-
- <!-- Main Starts -->
- <div id="body_div">
-
- <!--static (no script) content-->
- <div class="no_script" style='font-family: verdana, sans'>
- Loading...
- </div>
- </div>
- <script>wn.require('js/app.js');</script>
- <div id="dialog_back"></div>
-</body>
diff --git a/js/app.js b/js/app.js
index 5a8597d..6b72451 100644
--- a/js/app.js
+++ b/js/app.js
@@ -1,3 +1,13 @@
+wn.app = {
+ name: 'ERPNext',
+ license: 'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is',
+ source: 'https://github.com/webnotes/erpnext',
+ publisher: 'Web Notes Technologies Pvt Ltd, Mumbai',
+ copyright: '© Web Notes Technologies Pvt Ltd',
+ version: '2.' + window._version_number
+}
+
+wn.modules_path = 'erpnext';
wn.settings.no_history = true;
wn.require('lib/js/lib/jquery.min.js');
@@ -11,4 +21,8 @@
$(document).bind('ready', function() {
startup();
-});
\ No newline at end of file
+});
+
+$(document).bind('toolbar_setup', function() {
+ $('.brand').html('<b>erp</b>next');
+})
\ No newline at end of file
diff --git a/templates/index.html b/templates/index.html
deleted file mode 100644
index af0b8e5..0000000
--- a/templates/index.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<head>
- <meta charset="utf-8">
- <title>ERPNext</title>
- <meta name="author" content="">
- <script type="text/javascript">%s</script>
-</head>
-<body>
- <div id="startup_div" style="padding: 8px; font-size: 14px;"></div>
-
- <!-- Main Starts -->
- <div id="body_div">
-
- <!--static (no script) content-->
- <div class="no_script" style='font-family: verdana, sans'>
- Loading...
- </div>
- </div>
- <script>wn.require('js/app.js');</script>
- <div id="dialog_back"></div>
-</body>
diff --git a/version.num b/version.num
index 3e932fe..2a9c18a 100644
--- a/version.num
+++ b/version.num
@@ -1 +1 @@
-34
\ No newline at end of file
+357
\ No newline at end of file