diff --git a/.gitignore b/.gitignore
index 62cc5771bae..ba0a9a311b2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,4 +14,4 @@ public/images/lib
public/files
public/backups
public/css/wn-web.css
-public/js/wn-web.js
\ No newline at end of file
+public/js/wn-web.js
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.py b/erpnext/accounts/doctype/cost_center/cost_center.py
index ec1e17e2d44..83ad9d23cd9 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.py
+++ b/erpnext/accounts/doctype/cost_center/cost_center.py
@@ -49,6 +49,13 @@ class DocType:
}
return ret
+ def validate_mandatory(self):
+ if not self.doc.group_or_ledger:
+ msgprint("Please select Group or Ledger value", raise_exception=1)
+
+ if self.doc.cost_center_name != 'Root' and not self.doc.parent_cost_center:
+ msgprint("Please enter parent cost center", raise_exception=1)
+
#-------------------------------------------------------------------------
def convert_group_to_ledger(self):
if self.check_if_child_exists():
@@ -78,6 +85,16 @@ class DocType:
def check_if_child_exists(self):
return sql("select name from `tabCost Center` where parent_cost_center = %s and docstatus != 2", self.doc.name)
+
+ def validate_budget_details(self):
+ check_acc_list = []
+ for d in getlist(self.doclist, 'budget_details'):
+ if [d.account, d.fiscal_year] in check_acc_list:
+ msgprint("Account " + cstr(d.account) + "has been entered more than once for fiscal year " + cstr(d.fiscal_year), raise_exception=1)
+ else:
+ check_acc_list.append([d.account, d.fiscal_year])
+
+
#-------------------------------------------------------------------------
def validate(self):
"""
@@ -86,12 +103,8 @@ class DocType:
if (self.doc.__islocal or not self.doc.name) and sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)):
msgprint("Cost Center Name already exists, please rename", raise_exception=1)
- check_acc_list = []
- for d in getlist(self.doclist, 'budget_details'):
- if [d.account, d.fiscal_year] in check_acc_list:
- msgprint("Account " + cstr(d.account) + "has been entered more than once for fiscal year " + cstr(d.fiscal_year), raise_exception=1)
- else:
- check_acc_list.append([d.account, d.fiscal_year])
+ self.validate_mandatory()
+ self.validate_budget_details()
#-------------------------------------------------------------------------
def update_nsm_model(self):
diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js
index c4288a40b55..830092b284c 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js
@@ -20,19 +20,8 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
}
-cur_frm.cscript.refresh = function(doc, cdt, cdn) {
- hide_field('repost_account_balances');
- hide_field('next_fiscal_year');
- hide_field('repost');
-
- if (doc.docstatus == 1) {
- unhide_field('repost_account_balances');
- unhide_field('next_fiscal_year');
- unhide_field('repost');
- }
-}
// ***************** Get Account Head *****************
cur_frm.fields_dict['closing_account_head'].get_query = function(doc, cdt, cdn) {
- return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.is_pl_account = "No" AND `tabAccount`.debit_or_credit = "Credit" AND `tabAccount`.company = "'+ cstr(doc.company) +'" AND `tabAccount`.freeze_account = "No" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name ASC LIMIT 50';
+ return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.is_pl_account = "No" AND `tabAccount`.debit_or_credit = "Credit" AND `tabAccount`.company = "'+ cstr(doc.company) +'" AND ifnull(`tabAccount`.freeze_account, "No") = "No" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name ASC LIMIT 50';
}
diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
index 1b59bc616ed..f4cf47d23ee 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
@@ -8,11 +8,11 @@
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
# Please edit this list and import only required elements
import webnotes
@@ -34,179 +34,165 @@ convert_to_lists = webnotes.conn.convert_to_lists
class DocType:
- def __init__(self,d,dl):
- self.doc, self.doclist = d, dl
- self.td, self.tc = 0, 0
- self.year_start_date = ''
- self.year_end_date = ''
+ def __init__(self,d,dl):
+ self.doc, self.doclist = d, dl
+ self.td, self.tc = 0, 0
+ self.year_start_date = ''
+ self.year_end_date = ''
- # Validate Account Head
- #============================================================
- def validate_account_head(self):
- acc_det = sql("select debit_or_credit, is_pl_account, group_or_ledger, company from `tabAccount` where name = '%s'" % (self.doc.closing_account_head))
+ def validate_account_head(self):
+ acc_det = sql("select debit_or_credit, is_pl_account, group_or_ledger, company \
+ from `tabAccount` where name = '%s'" % (self.doc.closing_account_head))
- # Account should be under liability
- if cstr(acc_det[0][0]) != 'Credit' or cstr(acc_det[0][1]) != 'No':
- msgprint("Account: %s must be created under 'Source of Funds'" % self.doc.closing_account_head)
- raise Exception
-
- # Account must be a ledger
- if cstr(acc_det[0][2]) != 'Ledger':
- msgprint("Account %s must be a ledger" % self.doc.closing_account_head)
- raise Exception
-
- # Account should belong to company selected
- if cstr(acc_det[0][3]) != self.doc.company:
- msgprint("Account %s does not belong to Company %s ." % (self.doc.closing_account_head, self.doc.company))
- raise Exception
+ # Account should be under liability
+ if cstr(acc_det[0][0]) != 'Credit' or cstr(acc_det[0][1]) != 'No':
+ msgprint("Account: %s must be created under 'Source of Funds'" % self.doc.closing_account_head)
+ raise Exception
+
+ # Account must be a ledger
+ if cstr(acc_det[0][2]) != 'Ledger':
+ msgprint("Account %s must be a ledger" % self.doc.closing_account_head)
+ raise Exception
+
+ # Account should belong to company selected
+ if cstr(acc_det[0][3]) != self.doc.company:
+ msgprint("Account %s does not belong to Company %s ." % (self.doc.closing_account_head, self.doc.company))
+ raise Exception
- # validate posting date
- #=============================================================
- def validate_posting_date(self):
- yr = sql("select start_date, end_date from `tabPeriod` where period_name = '%s'" % (self.doc.fiscal_year))
- self.year_start_date = yr and yr[0][0] or ''
- self.year_end_date = yr and yr[0][1] or ''
-
- # Posting Date should be within closing year
- if getdate(self.doc.posting_date) < self.year_start_date or getdate(self.doc.posting_date) > self.year_end_date:
- msgprint("Posting Date should be within Closing Fiscal Year")
- raise Exception
- # Period Closing Entry
- pce = sql("select name from `tabPeriod Closing Voucher` where posting_date > '%s' and fiscal_year = '%s' and docstatus = 1" % (self.doc.posting_date, self.doc.fiscal_year))
- if pce and pce[0][0]:
- msgprint("Another Period Closing Entry: %s has been made after posting date: %s" % (cstr(pce[0][0]), self.doc.posting_date))
- raise Exception
-
- # Validate closing entry requirement
- #==========================================================
- def validate_pl_balances(self):
- income_bal = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, tabAccount t2 where t1.account = t2.name and t1.posting_date between '%s' and '%s' and t2.debit_or_credit = 'Credit' and t2.group_or_ledger = 'Ledger' and ifnull(t2.freeze_account, 'No') = 'No' and t2.is_pl_account = 'Yes' and t2.docstatus < 2 and t2.company = '%s'" % (self.year_start_date, self.doc.posting_date, self.doc.company))
- expense_bal = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, tabAccount t2 where t1.account = t2.name and t1.posting_date between '%s' and '%s' and t2.debit_or_credit = 'Debit' and t2.group_or_ledger = 'Ledger' and ifnull(t2.freeze_account, 'No') = 'No' and t2.is_pl_account = 'Yes' and t2.docstatus < 2 and t2.company = '%s'" % (self.year_start_date, self.doc.posting_date, self.doc.company))
-
- income_bal = income_bal and income_bal[0][0] or 0
- expense_bal = expense_bal and expense_bal[0][0] or 0
-
- if not income_bal and not expense_bal:
- msgprint("Both Income and Expense balances are zero. No Need to make Period Closing Entry.")
- raise Exception
-
- # Get account (pl) specific balance
- #===========================================================
- def get_pl_balances(self, d_or_c):
- acc_bal = sql("select t1.account, sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 where t1.account = t2.name and t2.group_or_ledger = 'Ledger' and ifnull(t2.freeze_account, 'No') = 'No' and ifnull(t2.is_pl_account, 'No') = 'Yes' and ifnull(is_cancelled, 'No') = 'No' and t2.debit_or_credit = '%s' and t2.docstatus < 2 and t2.company = '%s' and t1.posting_date between '%s' and '%s' group by t1.account " % (d_or_c, self.doc.company, self.year_start_date, self.doc.posting_date))
- return acc_bal
+ def validate_posting_date(self):
+ yr = sql("select start_date, end_date from `tabPeriod` where period_name = '%s'" % (self.doc.fiscal_year))
+ self.year_start_date = yr and yr[0][0] or ''
+ self.year_end_date = yr and yr[0][1] or ''
+
+ # Posting Date should be within closing year
+ if getdate(self.doc.posting_date) < self.year_start_date or getdate(self.doc.posting_date) > self.year_end_date:
+ msgprint("Posting Date should be within Closing Fiscal Year")
+ raise Exception
-
- # Makes GL Entries
- # ==========================================================
- def make_gl_entries(self, acc_det):
- for a in acc_det:
- if flt(a[1]):
- fdict = {
- 'account': a[0],
- 'cost_center': '',
- 'against': '',
- 'debit': flt(a[1]) < 0 and -1*flt(a[1]) or 0,
- 'credit': flt(a[1]) > 0 and flt(a[1]) or 0,
- 'remarks': self.doc.remarks,
- 'voucher_type': self.doc.doctype,
- 'voucher_no': self.doc.name,
- 'transaction_date': self.doc.transaction_date,
- 'posting_date': self.doc.posting_date,
- 'fiscal_year': self.doc.fiscal_year,
- 'against_voucher': '',
- 'against_voucher_type': '',
- 'company': self.doc.company,
- 'is_opening': 'No',
- 'aging_date': self.doc.posting_date
- }
-
- self.save_entry(fdict)
-
+ # Period Closing Entry
+ pce = sql("select name from `tabPeriod Closing Voucher` \
+ where posting_date > '%s' and fiscal_year = '%s' and docstatus = 1" \
+ % (self.doc.posting_date, self.doc.fiscal_year))
+ if pce and pce[0][0]:
+ msgprint("Another Period Closing Entry: %s has been made after posting date: %s"\
+ % (cstr(pce[0][0]), self.doc.posting_date))
+ raise Exception
+
+
+ def validate_pl_balances(self):
+ income_bal = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) \
+ from `tabGL Entry` t1, tabAccount t2 where t1.account = t2.name \
+ and t1.posting_date between '%s' and '%s' and t2.debit_or_credit = 'Credit' \
+ and t2.group_or_ledger = 'Ledger' and t2.is_pl_account = 'Yes' and t2.docstatus < 2 \
+ and t2.company = '%s'" % (self.year_start_date, self.doc.posting_date, self.doc.company))
+
+ expense_bal = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) \
+ from `tabGL Entry` t1, tabAccount t2 where t1.account = t2.name \
+ and t1.posting_date between '%s' and '%s' and t2.debit_or_credit = 'Debit' \
+ and t2.group_or_ledger = 'Ledger' and t2.is_pl_account = 'Yes' and t2.docstatus < 2 \
+ and t2.company = '%s'" % (self.year_start_date, self.doc.posting_date, self.doc.company))
+
+ income_bal = income_bal and income_bal[0][0] or 0
+ expense_bal = expense_bal and expense_bal[0][0] or 0
+
+ if not income_bal and not expense_bal:
+ msgprint("Both Income and Expense balances are zero. No Need to make Period Closing Entry.")
+ raise Exception
+
+
+ def get_pl_balances(self, d_or_c):
+ """Get account (pl) specific balance"""
+ acc_bal = sql("select t1.account, sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) \
+ from `tabGL Entry` t1, `tabAccount` t2 where t1.account = t2.name and t2.group_or_ledger = 'Ledger' \
+ and ifnull(t2.is_pl_account, 'No') = 'Yes' and ifnull(is_cancelled, 'No') = 'No' \
+ and t2.debit_or_credit = '%s' and t2.docstatus < 2 and t2.company = '%s' \
+ and t1.posting_date between '%s' and '%s' group by t1.account " \
+ % (d_or_c, self.doc.company, self.year_start_date, self.doc.posting_date))
+ return acc_bal
+
+
+ def make_gl_entries(self, acc_det):
+ for a in acc_det:
+ if flt(a[1]):
+ fdict = {
+ 'account': a[0],
+ 'cost_center': '',
+ 'against': '',
+ 'debit': flt(a[1]) < 0 and -1*flt(a[1]) or 0,
+ 'credit': flt(a[1]) > 0 and flt(a[1]) or 0,
+ 'remarks': self.doc.remarks,
+ 'voucher_type': self.doc.doctype,
+ 'voucher_no': self.doc.name,
+ 'transaction_date': self.doc.transaction_date,
+ 'posting_date': self.doc.posting_date,
+ 'fiscal_year': self.doc.fiscal_year,
+ 'against_voucher': '',
+ 'against_voucher_type': '',
+ 'company': self.doc.company,
+ 'is_opening': 'No',
+ 'aging_date': self.doc.posting_date
+ }
+
+ self.save_entry(fdict)
+
+
+ def save_entry(self, fdict, is_cancel = 'No'):
+ # Create new GL entry object and map values
+ le = Document('GL Entry')
+ for k in fdict:
+ le.fields[k] = fdict[k]
+
+ le_obj = get_obj(doc=le)
+ # validate except on_cancel
+ if is_cancel == 'No':
+ le_obj.validate()
+
+ # update total debit / credit except on_cancel
+ self.td += flt(le.credit)
+ self.tc += flt(le.debit)
+
+ # save
+ le.save(1)
+ le_obj.on_update(adv_adj = '', cancel = '')
- # Save GL Entry
- # ==========================================================
- def save_entry(self, fdict, is_cancel = 'No'):
- # Create new GL entry object and map values
- le = Document('GL Entry')
- for k in fdict:
- le.fields[k] = fdict[k]
-
- le_obj = get_obj(doc=le)
- # validate except on_cancel
- if is_cancel == 'No':
- le_obj.validate()
-
- # update total debit / credit except on_cancel
- self.td += flt(le.credit)
- self.tc += flt(le.debit)
+
+ def validate(self):
+ # validate account head
+ self.validate_account_head()
- # save
- le.save(1)
- le_obj.on_update(adv_adj = '', cancel = '')
-
+ # validate posting date
+ self.validate_posting_date()
- # Reposting Balances
- # ==========================================================
- def repost_account_balances(self):
- # Get Next Fiscal Year
- fy = sql("select name, is_fiscal_year_closed from `tabFiscal Year` where name = '%s' and past_year = '%s'" % (self.doc.next_fiscal_year, self.doc.fiscal_year))
- if not fy:
- msgprint("There is no Fiscal Year with Name " + cstr(self.doc.next_fiscal_year) + " and Past Year " + cstr(self.doc.fiscal_year))
- raise Exception
-
- if fy and fy[0][1] == 'Yes':
- msgprint("Fiscal Year %s has been closed." % cstr(fy[1]))
- raise Exception
-
- # Repost Balances
- get_obj('Fiscal Year', fy[0][0]).repost()
-
-
- # Validation
- # ===========================================================
- def validate(self):
-
- # validate account head
- self.validate_account_head()
-
- # validate posting date
- self.validate_posting_date()
-
- # check if pl balance:
- self.validate_pl_balances()
+ # check if pl balance:
+ self.validate_pl_balances()
- # On Submit
- # ===========================================================
- def on_submit(self):
-
- # Makes closing entries for Expense Account
- in_acc_det = self.get_pl_balances('Credit')
- self.make_gl_entries(in_acc_det)
+ def on_submit(self):
+
+ # Makes closing entries for Expense Account
+ in_acc_det = self.get_pl_balances('Credit')
+ self.make_gl_entries(in_acc_det)
- # Makes closing entries for Expense Account
- ex_acc_det = self.get_pl_balances('Debit')
- self.make_gl_entries(ex_acc_det)
+ # Makes closing entries for Expense Account
+ ex_acc_det = self.get_pl_balances('Debit')
+ self.make_gl_entries(ex_acc_det)
- # Makes Closing entry for Closing Account Head
- bal = self.tc - self.td
- self.make_gl_entries([[self.doc.closing_account_head, flt(bal)]])
+ # Makes Closing entry for Closing Account Head
+ bal = self.tc - self.td
+ self.make_gl_entries([[self.doc.closing_account_head, flt(bal)]])
- # On Cancel
- # =============================================================
- def on_cancel(self):
- # get all submit entries of current closing entry voucher
- gl_entries = sql("select account, debit, credit from `tabGL Entry` where voucher_type = 'Period Closing Voucher' and voucher_no = '%s' and ifnull(is_cancelled, 'No') = 'No'" % (self.doc.name))
+ def on_cancel(self):
+ # get all submit entries of current closing entry voucher
+ gl_entries = sql("select account, debit, credit from `tabGL Entry` where voucher_type = 'Period Closing Voucher' and voucher_no = '%s' and ifnull(is_cancelled, 'No') = 'No'" % (self.doc.name))
- # Swap Debit & Credit Column and make gl entry
- for gl in gl_entries:
- fdict = {'account': gl[0], 'cost_center': '', 'against': '', 'debit': flt(gl[2]), 'credit' : flt(gl[1]), 'remarks': self.doc.cancel_reason, 'voucher_type': self.doc.doctype, 'voucher_no': self.doc.name, 'transaction_date': self.doc.transaction_date, 'posting_date': self.doc.posting_date, 'fiscal_year': self.doc.fiscal_year, 'against_voucher': '', 'against_voucher_type': '', 'company': self.doc.company, 'is_opening': 'No', 'aging_date': 'self.doc.posting_date'}
- self.save_entry(fdict, is_cancel = 'Yes')
+ # Swap Debit & Credit Column and make gl entry
+ for gl in gl_entries:
+ fdict = {'account': gl[0], 'cost_center': '', 'against': '', 'debit': flt(gl[2]), 'credit' : flt(gl[1]), 'remarks': self.doc.cancel_reason, 'voucher_type': self.doc.doctype, 'voucher_no': self.doc.name, 'transaction_date': self.doc.transaction_date, 'posting_date': self.doc.posting_date, 'fiscal_year': self.doc.fiscal_year, 'against_voucher': '', 'against_voucher_type': '', 'company': self.doc.company, 'is_opening': 'No', 'aging_date': 'self.doc.posting_date'}
+ self.save_entry(fdict, is_cancel = 'Yes')
- # Update is_cancelled = 'Yes' to all gl entries for current voucher
- sql("update `tabGL Entry` set is_cancelled = 'Yes' where voucher_type = '%s' and voucher_no = '%s'" % (self.doc.doctype, self.doc.name))
+ # Update is_cancelled = 'Yes' to all gl entries for current voucher
+ sql("update `tabGL Entry` set is_cancelled = 'Yes' where voucher_type = '%s' and voucher_no = '%s'" % (self.doc.doctype, self.doc.name))
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.txt b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
index c70745e7e22..f56c1b0c938 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-04-13 11:56:17',
+ 'creation': '2012-06-11 12:09:52',
'docstatus': 0,
- 'modified': '2012-05-31 11:38:17',
+ 'modified': '2012-07-10 14:21:21',
'modified_by': u'Administrator',
'owner': u'jai@webnotestech.com'
},
@@ -273,42 +273,5 @@
'permlevel': 0,
'print_hide': 1,
'search_index': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'repost_account_balances',
- 'fieldtype': u'Section Break',
- 'label': u'Repost Account Balances',
- 'oldfieldtype': u'Section Break',
- 'options': u'Simple',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'allow_on_submit': 1,
- 'doctype': u'DocField',
- 'fieldname': u'next_fiscal_year',
- 'fieldtype': u'Select',
- 'label': u'Fiscal Year (For Reposting)',
- 'oldfieldname': u'next_fiscal_year',
- 'oldfieldtype': u'Select',
- 'options': u'link:Fiscal Year',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'allow_on_submit': 1,
- 'colour': u'White:FFF',
- 'doctype': u'DocField',
- 'fieldname': u'repost',
- 'fieldtype': u'Button',
- 'label': u'Repost',
- 'oldfieldtype': u'Button',
- 'options': u'repost_account_balances',
- 'permlevel': 0
}
]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.txt b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.txt
index 88af72b2792..0dddb8a9248 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.txt
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-04-13 11:56:18',
+ 'creation': '2012-06-08 16:07:55',
'docstatus': 0,
- 'modified': '2012-06-07 19:05:06',
+ 'modified': '2012-07-09 11:00:18',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -67,6 +67,17 @@
'trigger': u'Client'
},
+ # DocField
+ {
+ 'doctype': u'DocField',
+ 'fieldname': u'customer_item_code',
+ 'fieldtype': u'Data',
+ 'hidden': 1,
+ 'label': u"Customer's Item Code",
+ 'permlevel': 1,
+ 'print_hide': 1
+ },
+
# DocField
{
'doctype': u'DocField',
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt
index b8c8a5ee034..2a25a6a61ee 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-03-27 14:35:48',
+ 'creation': '2012-05-15 12:14:34',
'docstatus': 0,
- 'modified': '2012-03-27 14:35:48',
+ 'modified': '2012-07-04 13:27:05',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -23,7 +23,7 @@
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
- 'version': 20
+ 'version': 1
},
# These values are common for all DocField
@@ -213,11 +213,12 @@
'doctype': u'DocField',
'fieldname': u'included_in_print_rate',
'fieldtype': u'Check',
- 'label': u'Included in Print Rate',
+ 'label': u'Is this Tax included in Basic Rate?',
'no_column': 0,
'no_copy': 1,
'permlevel': 0,
'print_hide': 1,
- 'report_hide': 1
+ 'report_hide': 1,
+ 'width': u'150px'
}
]
\ No newline at end of file
diff --git a/erpnext/patches/july_2012/deprecate_import_data_control.py b/erpnext/patches/july_2012/deprecate_import_data_control.py
new file mode 100644
index 00000000000..d0cd7de820f
--- /dev/null
+++ b/erpnext/patches/july_2012/deprecate_import_data_control.py
@@ -0,0 +1,10 @@
+def execute():
+ """
+ deprecate:
+ * doctype - import data control
+ * page - import data (old)
+ """
+ import webnotes
+ from webnotes.model import delete_doc
+ delete_doc('DocType', 'Import Data Control')
+ delete_doc('Page', 'Import Data')
\ No newline at end of file
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index 0307a0fedb8..ab95e9553d5 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -481,5 +481,10 @@ patch_list = [
'patch_module': 'patches.july_2012',
'patch_file': 'packing_list_cleanup_and_serial_no',
'description': "packing list cleanup and serial no status update"
- },
+ },
+ {
+ 'patch_module': 'patches.july_2012',
+ 'patch_file': 'deprecate_import_data_control',
+ 'description': "deprecate doctype - Import Data Control and page - Import Data"
+ },
]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/opportunity/opportunity.js b/erpnext/selling/doctype/opportunity/opportunity.js
index c672aa11f3a..4487c8909a8 100644
--- a/erpnext/selling/doctype/opportunity/opportunity.js
+++ b/erpnext/selling/doctype/opportunity/opportunity.js
@@ -140,79 +140,8 @@ cur_frm.fields_dict['enquiry_details'].grid.get_field('item_code').get_query = f
else
return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_sales_item="Yes" AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
}
-
- //Fetch Item Details
-//====================================================================================================================
-cur_frm.cscript.item_code = function(doc, cdt, cdn) {
- var d = locals[cdt][cdn];
- if (d.item_code) {
- get_server_fields('get_item_details',d.item_code,'enquiry_details',doc,cdt,cdn,1);
- }
-}
-/*
- //Fetch Customer Details
-//======================================================================================================================
-cur_frm.cscript.customer = function(doc, cdt, cdn){
- if (doc.customer) {
- get_server_fields('get_cust_address',doc.customer,'',doc,cdt,cdn,1);
- }
-}
-*/
-
-/*
-//=======================================================================================================================
-cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
- return 'SELECT `tabContact`.contact_name FROM `tabContact` WHERE `tabContact`.is_customer = 1 AND `tabContact`.customer = "'+ doc.customer+'" AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
-}
-*/
-
-/*
-//=======================================================================================================================
-cur_frm.cscript.contact_person = function(doc, cdt, cdn){
- if (doc.contact_person) {
- arg = {};
- arg.contact_person = doc.contact_person;
- arg.customer = doc.customer;
- get_server_fields('get_contact_details',docstring(arg),'',doc,cdt,cdn,1);
- }
-}
-*/
-
-/*
-// hide - unhide fields based on lead or customer..
-//=======================================================================================================================
-cur_frm.cscript.clear_values = function(doc,cdt,cdn) {
- if(doc.enquiry_from == 'Lead') {
- doc.customer = doc.customer_name = doc.contact_person = doc.customer_group = "";
- }
- else if(doc.enquiry_from == 'Customer') {
- doc.lead = doc.lead_name = "";
- }
- refresh_many(['lead','lead_name','customer','customer_name','contact_person','customer_group']);
-}
-*/
-
-/*
-//================ hide - unhide fields on basis of enquiry from either lead or customer ===============================
-cur_frm.cscript.enquiry_from = function(doc,cdt,cdn){
- cur_frm.cscript.clear_values(doc,cdt,cdn);
- doc.address = doc.territory = doc.contact_no = doc.email_id = "";
- refresh_many(['territory','address','contact_no','email_id']);
-}
-*/
-
-/*
-//================ create new contact ============================================================================
-cur_frm.cscript.new_contact = function(){
- tn = createLocal('Contact');
- locals['Contact'][tn].is_customer = 1;
- if(doc.customer) locals['Contact'][tn].customer = doc.customer;
- loaddoc('Contact', tn);
-}
-*/
- // Create New Quotation
-// =======================================================================================================================
+// Create New Quotation
cur_frm.cscript['Create Quotation'] = function(){
n = createLocal("Quotation");
$c('dt_map', args={
@@ -284,39 +213,5 @@ cur_frm.cscript['Declare Opportunity Lost'] = function(){
}
//get query select Territory
-//=======================================================================================================================
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';}
-
-/*
-//===================== Opportunity From validation - either customer or lead is mandatory =====================================
-cur_frm.cscript.enq_frm_validate = function(doc,cdt,cdn){
-
- if(doc.enquiry_from == 'Lead'){
- if(!doc.lead){
- alert("Lead is mandatory.");
- validated = false;
- }
- }
- else if(doc.enquiry_from == 'Customer'){
- if(!doc.customer){
- alert("Customer is mandatory.");
- validated = false;
- }
- else if(!doc.contact_person){
- alert("Contact Person is mandatory.");
- validated = false;
- }
- else if(!doc.customer_group){
- alert("Customer Group is mandatory.");
- validated = false;
- }
- }
-}
-*/
-
-//===================validation function ==============================================================================
-
-cur_frm.cscript.validate = function(doc,cdt,cdn){
- //cur_frm.cscript.enq_frm_validate(doc,cdt,cdn);
-}
diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.txt b/erpnext/selling/doctype/quotation_item/quotation_item.txt
index d5ece1f6021..6ae657cbf14 100644
--- a/erpnext/selling/doctype/quotation_item/quotation_item.txt
+++ b/erpnext/selling/doctype/quotation_item/quotation_item.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-06-04 15:40:56',
+ 'creation': '2012-06-08 16:07:57',
'docstatus': 0,
- 'modified': '2012-06-07 17:58:39',
+ 'modified': '2012-07-09 11:04:47',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -60,6 +60,17 @@
'width': u'150px'
},
+ # DocField
+ {
+ 'doctype': u'DocField',
+ 'fieldname': u'customer_item_code',
+ 'fieldtype': u'Data',
+ 'hidden': 1,
+ 'label': u"Customer's Item Code",
+ 'permlevel': 1,
+ 'print_hide': 1
+ },
+
# DocField
{
'doctype': u'DocField',
diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py
index 718bc869799..74963fbc07e 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.py
+++ b/erpnext/selling/doctype/sales_common/sales_common.py
@@ -163,6 +163,15 @@ class DocType(TransactionBase):
if ret['warehouse'] or ret['reserved_warehouse']:
av_qty = self.get_available_qty({'item_code': args['item_code'], 'warehouse': ret['warehouse'] or ret['reserved_warehouse']})
ret.update(av_qty)
+
+ # get customer code for given item from Item Customer Detail
+ customer_item_code_row = webnotes.conn.sql("""\
+ select ref_code from `tabItem Customer Detail`
+ where parent = %s and customer_name = %s""",
+ (args['item_code'], obj.doc.customer))
+ if customer_item_code_row and customer_item_code_row[0][0]:
+ ret['customer_item_code'] = customer_item_code_row[0][0]
+
return ret
@@ -411,7 +420,8 @@ class DocType(TransactionBase):
'reserved_qty': (flt(p.qty)/qty)*(reserved_qty),
'uom': p.uom,
'batch_no': p.batch_no,
- 'serial_no': p.serial_no
+ 'serial_no': p.serial_no,
+ 'name': d.name
})
else:
il.append({
@@ -422,7 +432,8 @@ class DocType(TransactionBase):
'reserved_qty': reserved_qty,
'uom': d.stock_uom,
'batch_no': d.batch_no,
- 'serial_no': d.serial_no
+ 'serial_no': d.serial_no,
+ 'name': d.name
})
return il
@@ -532,7 +543,9 @@ class DocType(TransactionBase):
# delete from db
webnotes.conn.sql("""\
delete from `tabDelivery Note Packing Item`
- where name in ("%s")""" % '", "'.join(delete_list))
+ where name in (%s)"""
+ % (", ".join(["%s"] * len(delete_list))),
+ tuple(delete_list))
# Get total in words
# ==================================================================
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.txt b/erpnext/selling/doctype/sales_order_item/sales_order_item.txt
index 1d2f358bac4..1c806982c67 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.txt
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-04-13 11:56:28',
+ 'creation': '2012-06-08 16:07:58',
'docstatus': 0,
- 'modified': '2012-06-07 18:04:52',
+ 'modified': '2012-07-09 11:05:16',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -57,6 +57,17 @@
'width': u'150px'
},
+ # DocField
+ {
+ 'doctype': u'DocField',
+ 'fieldname': u'customer_item_code',
+ 'fieldtype': u'Data',
+ 'hidden': 1,
+ 'label': u"Customer's Item Code",
+ 'permlevel': 1,
+ 'print_hide': 1
+ },
+
# DocField
{
'doctype': u'DocField',
diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py
index b0f0e9f231a..1e382d198da 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.py
+++ b/erpnext/setup/doctype/email_digest/email_digest.py
@@ -255,7 +255,10 @@ class DocType:
args['sum_if_reqd'] = "IFNULL(SUM(IFNULL(%(sum_col)s, 0)), 0) AS '%(sum_col)s'," % args
if args['type'] == 'new_transactions':
- args['company_condition'] = ''
+ # tabFeed doesn't have company column
+ # using this arg to set condition of feed_type as null
+ # so that comments, logins and assignments are not counted
+ args['company_condition'] = "feed_type IS NULL AND"
else:
args['company_condition'] = "company = '%(company)s' AND" % args
@@ -418,8 +421,7 @@ class DocType:
sender='notifications+email_digest@erpnext.com',
reply_to='support@erpnext.com',
subject=self.doc.frequency + ' Digest',
- msg=email_body,
- from_defs=1
+ msg=email_body
)
except Exception, e:
webnotes.msgprint('There was a problem in sending your email. Please contact support@erpnext.com')
diff --git a/erpnext/setup/doctype/email_settings/email_settings.py b/erpnext/setup/doctype/email_settings/email_settings.py
index 755b91d20ac..118dba2e1c3 100644
--- a/erpnext/setup/doctype/email_settings/email_settings.py
+++ b/erpnext/setup/doctype/email_settings/email_settings.py
@@ -54,24 +54,13 @@ class DocType:
webnotes.msgprint(err_msg)
raise e
+ # exceptions are handled in smtp_connect
+ sess = out_email.smtp_connect()
+
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 or Port. Please rectify and try again.')
- raise e
- except smtplib.SMTPAuthenticationError, e:
- webnotes.msgprint('Invalid Login Id or Mail Password. Please rectify and try again.')
- raise e
- except smtplib.SMTPException, e:
- webnotes.msgprint('There is something wrong with your Outgoing Mail Settings. \
- Please contact us at support@erpnext.com')
- raise e
+ sess.quit()
+ except:
+ pass
def validate_incoming(self):
diff --git a/erpnext/setup/doctype/import_data_control/__init__.py b/erpnext/setup/doctype/import_data_control/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/erpnext/setup/doctype/import_data_control/import_data_control.py b/erpnext/setup/doctype/import_data_control/import_data_control.py
deleted file mode 100644
index 9e7461ec7e6..00000000000
--- a/erpnext/setup/doctype/import_data_control/import_data_control.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, getchildren, make_autoname
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-
-# -----------------------------------------------------------------------------------------
-
-
-class DocType:
- def __init__(self,d,dl):
- self.doc, self.doclist = d,dl
-
- def get_master_lst(self):
-
- return [r[0] for r in sql("select name from `tabDocType` where document_type = 'Master'")]
-
- def get_child_lst(self,nm):
- res = [nm]
-
- ret=sql("select options from `tabDocField` where parent='%s' and fieldtype = 'Table'"%nm)
- for r in ret:
- res.append(r[0])
- return res
\ No newline at end of file
diff --git a/erpnext/setup/doctype/import_data_control/import_data_control.txt b/erpnext/setup/doctype/import_data_control/import_data_control.txt
deleted file mode 100644
index fa19e109c80..00000000000
--- a/erpnext/setup/doctype/import_data_control/import_data_control.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# DocType, Import Data Control
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2012-03-27 14:36:21',
- 'docstatus': 0,
- 'modified': '2012-03-27 14:36:21',
- 'modified_by': u'Administrator',
- 'owner': u'harshada@webnotestech.com'
- },
-
- # These values are common for all DocType
- {
- 'colour': u'White:FFF',
- 'doctype': 'DocType',
- 'issingle': 1,
- 'module': u'Setup',
- 'name': '__common__',
- 'section_style': u'Simple',
- 'server_code_error': u' ',
- 'version': 12
- },
-
- # DocType, Import Data Control
- {
- 'doctype': 'DocType',
- 'name': u'Import Data Control'
- }
-]
\ No newline at end of file
diff --git a/erpnext/setup/page/import_data/__init__.py b/erpnext/setup/page/import_data/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/erpnext/setup/page/import_data/import_data.html b/erpnext/setup/page/import_data/import_data.html
deleted file mode 100644
index b655442cef1..00000000000
--- a/erpnext/setup/page/import_data/import_data.html
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
Data Import Guide
-
-
Get the template of the DocType for which you want to import in CSV (Comma seperated values) format.
-
Fill in the data in the template. You can remove columns that are not relevant
-
Save the template in CSV format
-
Select the saved CSV file, identify the date format if any
-
Click on "Import"
-
-
-
Over-writing Guide
-
-
To over-write data, click on "Do you want to over-write records?" and then download template
-
To over-write parent table data, mention existing ID in "Name" column
-
Over-writing of child table data will delete all previous data from child table of those parents which you are importing. So before over-writing child tables, take a backup of the child table data by exporting from report builder. Re-import all rows of the child table for a particular parent. For example: If you want to overwrite tax rate for tax account "VAT" ifor item: ITEM001 and suppose there are 3 rows in "Item Tax" table for item : ITEM001. While overwriting the system will delete all 3 rows. So, you have to re-import all 3 rows for that item.
-
Over-write checkbox will be checked while importing
-
-
-
Do you have Non-English data?
- You may need to save the file with UTF-8 encoding for data to be imported correctly.
-
- Microsoft Excel Users:
- There is no obvious way of saving a CSV file with UTF-8 encoding.
- You will need to follow these steps:
-
-
In Excel, save the file in CSV (Comma Delimited) format
-
Open this saved file in Notepad
-
Click on File -> Save As
-
File Name: <your filename>.csv
- Save as type: Text Documents (*.txt)
- Encoding: UTF-8
-
-
Click on Save
-
-
- OpenOffice or LibreOffice Users:
-
-
While saving as CSV, check "Edit Filter Settings".
-
You will be prompted for Encoding.
-
Make sure it is "UTF-8" and click on OK.
-
-
-
-
-
Import Log:
-
-
-
-
-
-
-
-
-
diff --git a/erpnext/setup/page/import_data/import_data.js b/erpnext/setup/page/import_data/import_data.js
deleted file mode 100644
index 734c16d6e7b..00000000000
--- a/erpnext/setup/page/import_data/import_data.js
+++ /dev/null
@@ -1,71 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see .
-
-pscript['onload_Import Data'] = function() {
-
- //alert(profile.can_get_report);
-
- callback = function(r,rt) {
- var h = new PageHeader('di_header','Import Data','Tool to download template and upload data');
- var sel = $i('import_template');
- if(r.message){
- add_sel_options(sel, r.message);
-
- // please collapse here when editing :)
- sel.onchange=function(){
- $i('child_tab_lst').innerHTML ='';
- if(sel.value != 'Select Master...'){
- $c_obj('Import Data Control','get_child_lst',sel.value,
- function(r,rt){
- var me = this;
- $y($i('child_tab_lst'),{backgroundColor:'#EEEEEE', margin: '17px 17px', padding: '13px'})
- var desc = $a($i('child_tab_lst'), 'div', '', {padding:'4px'});
-
- desc.innerHTML = "Download template(s) for importing "+sel_val(sel)+"";
-
-
- var parent = $a($i('child_tab_lst'), 'div');
- var tab = make_table(parent,r.message.length,1,'100%',[],{padding:'3px',borderCollapse: 'collapse'});
-
- for(var i=0;i Numbering Series\n"
+ else:
+ delete_masters()
+ reset_series()
+ delete_main_masters()
+ reset_global_defaults()
+
+ print "System cleaned up succesfully"
+ webnotes.conn.close()
+
+
+if __name__ == '__main__':
+ run()
diff --git a/erpnext/utilities/page/questions/questions.js b/erpnext/utilities/page/questions/questions.js
index 33e0853422e..048ed54bb62 100644
--- a/erpnext/utilities/page/questions/questions.js
+++ b/erpnext/utilities/page/questions/questions.js
@@ -14,8 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-pscript.onload_questions = function(wrapper) {
- console.log(1);
+pscript.onload_questions = function(wrapper) {
body = $(wrapper).find('.layout-main-section').get(0);
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.layout-appframe'));
diff --git a/erpnext/utilities/page/todo/todo.css b/erpnext/utilities/page/todo/todo.css
index ee9b4f1f37b..7c7dcaf23d4 100644
--- a/erpnext/utilities/page/todo/todo.css
+++ b/erpnext/utilities/page/todo/todo.css
@@ -47,4 +47,9 @@
.todo-content {
padding-right: 15px;
+}
+
+.layout-main {
+ background-color: #FFFDC9;
+ min-height: 300px;
}
\ No newline at end of file
diff --git a/erpnext/utilities/page/todo/todo.html b/erpnext/utilities/page/todo/todo.html
index d49fc23011e..88dcbf37591 100644
--- a/erpnext/utilities/page/todo/todo.html
+++ b/erpnext/utilities/page/todo/todo.html
@@ -1,9 +1,6 @@
-