Merge branch 'master' of git://github.com/webnotes/erpnext
diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt
index 497c99f..c194e7c 100644
--- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt
+++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt
@@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:18',
'docstatus': 0,
- 'modified': '2011-12-20 18:23:36',
+ 'modified': '2011-12-22 19:04:07',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -34,13 +34,12 @@
'server_code_error': ' ',
'show_in_menu': 0,
'subject': 'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding',
- 'version': 391
+ 'version': 392
},
# These values are common for all DocFormat
{
'doctype': 'DocFormat',
- 'format': 'POS Invoice',
'name': '__common__',
'parent': 'Receivable Voucher',
'parentfield': 'formats',
@@ -126,7 +125,32 @@
# DocFormat
{
- 'doctype': 'DocFormat'
+ 'doctype': 'DocFormat',
+ 'format': 'POS Invoice'
+ },
+
+ # DocFormat
+ {
+ 'doctype': 'DocFormat',
+ 'format': 'POS Invoice'
+ },
+
+ # DocFormat
+ {
+ 'doctype': 'DocFormat',
+ 'format': 'Sales Invoice Classic'
+ },
+
+ # DocFormat
+ {
+ 'doctype': 'DocFormat',
+ 'format': 'Sales Invoice Modern'
+ },
+
+ # DocFormat
+ {
+ 'doctype': 'DocFormat',
+ 'format': 'Sales Invoice Spartan'
},
# DocField
@@ -477,6 +501,7 @@
'label': 'Price List Currency',
'options': 'link:Currency',
'permlevel': 0,
+ 'print_hide': 1,
'reqd': 1
},
@@ -489,6 +514,7 @@
'fieldtype': 'Currency',
'label': 'Price List Currency Conversion Rate',
'permlevel': 0,
+ 'print_hide': 1,
'reqd': 1
},
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py
index 7612c19..84bfffb 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.py
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.py
@@ -248,7 +248,7 @@
raise Exception
# list criteria that should not repeat if item is stock item
- e = [d.schedule_date, d.item_code, d.warehouse, d.uom, d.fields.has_key('prevdoc_docname') and d.prevdoc_docname or '', d.fields.has_key('prevdoc_detail_docname') and d.prevdoc_detail_docname or '', d.fields.has_key('batch_no') and d.batch_no or '']
+ e = [d.schedule_date, d.item_code, d.description, d.warehouse, d.uom, d.fields.has_key('prevdoc_docname') and d.prevdoc_docname or '', d.fields.has_key('prevdoc_detail_docname') and d.prevdoc_detail_docname or '', d.fields.has_key('batch_no') and d.batch_no or '']
# if is not stock item
f = [d.schedule_date, d.item_code, d.description]
@@ -258,16 +258,16 @@
if ch and ch[0][0] == 'Yes':
# check for same items
if e in check_list:
- msgprint("Item %s has been entered more than once with same schedule date, warehouse and uom." % d.item_code)
- raise Exception
+ msgprint("""Item %s has been entered more than once with same description, schedule date, warehouse and uom.\n
+ Please change any of the field value to enter the item twice""" % d.item_code, raise_exception = 1)
else:
check_list.append(e)
elif ch and ch[0][0] == 'No':
# check for same items
if f in chk_dupl_itm:
- msgprint("Item %s has been entered more than once." % d.item_code)
- raise Exception
+ msgprint("""Item %s has been entered more than once with same description, schedule date.\n
+ Please change any of the field value to enter the item twice.""" % d.item_code, raise_exception = 1)
else:
chk_dupl_itm.append(f)
diff --git a/erpnext/patches/edigest_enable_income_year_to_date.py b/erpnext/patches/edigest_enable_income_year_to_date.py
new file mode 100644
index 0000000..380de83
--- /dev/null
+++ b/erpnext/patches/edigest_enable_income_year_to_date.py
@@ -0,0 +1,11 @@
+import webnotes
+from webnotes.model.doc import Document
+
+def execute():
+ companies_list = webnotes.conn.sql("SELECT company_name FROM `tabCompany`", as_list=1)
+ for company in companies_list:
+ if company and company[0]:
+ edigest = Document('Email Digest', "Default Weekly Digest - " + company[0])
+ if edigest:
+ edigest.income_year_to_date = 1
+ edigest.save()
diff --git a/erpnext/patches/print_hide_price_list.py b/erpnext/patches/print_hide_price_list.py
new file mode 100644
index 0000000..833ab98
--- /dev/null
+++ b/erpnext/patches/print_hide_price_list.py
@@ -0,0 +1,3 @@
+def execute():
+ import webnotes
+ webnotes.conn.sql("update `tabDocField` set print_hide = 1 where fieldname in ('price_list_currency', 'plc_conversion_rate')")
diff --git a/erpnext/selling/doctype/quotation/quotation.txt b/erpnext/selling/doctype/quotation/quotation.txt
index 86b7b5f..ac58dc4 100644
--- a/erpnext/selling/doctype/quotation/quotation.txt
+++ b/erpnext/selling/doctype/quotation/quotation.txt
@@ -5,11 +5,20 @@
{
'creation': '2010-08-08 17:09:17',
'docstatus': 0,
- 'modified': '2011-12-20 14:01:09',
+ 'modified': '2011-12-22 19:03:04',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'Quotation',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType'
+ },
+
# These values are common for all DocType
{
'_last_update': '1322549700',
@@ -32,15 +41,15 @@
'show_in_menu': 0,
'subject': 'To %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s',
'tag_fields': 'status',
- 'version': 597
+ 'version': 598
},
- # These values are common for all DocField
+ # These values are common for all DocFormat
{
- 'doctype': 'DocField',
+ 'doctype': 'DocFormat',
'name': '__common__',
'parent': 'Quotation',
- 'parentfield': 'fields',
+ 'parentfield': 'formats',
'parenttype': 'DocType'
},
@@ -169,6 +178,24 @@
'role': 'Maintenance User'
},
+ # DocFormat
+ {
+ 'doctype': 'DocFormat',
+ 'format': 'Quotation Classic'
+ },
+
+ # DocFormat
+ {
+ 'doctype': 'DocFormat',
+ 'format': 'Quotation Modern'
+ },
+
+ # DocFormat
+ {
+ 'doctype': 'DocFormat',
+ 'format': 'Quotation Spartan'
+ },
+
# DocField
{
'colour': 'White:FFF',
@@ -568,6 +595,7 @@
'label': 'Price List Currency',
'options': 'link:Currency',
'permlevel': 0,
+ 'print_hide': 1,
'reqd': 1
},
@@ -580,6 +608,7 @@
'fieldtype': 'Currency',
'label': 'Price List Currency Conversion Rate',
'permlevel': 0,
+ 'print_hide': 1,
'reqd': 1
},
diff --git a/erpnext/selling/doctype/sales_order/sales_order.txt b/erpnext/selling/doctype/sales_order/sales_order.txt
index d59f236..2e6ea99 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.txt
+++ b/erpnext/selling/doctype/sales_order/sales_order.txt
@@ -5,11 +5,20 @@
{
'creation': '2010-08-08 17:09:21',
'docstatus': 0,
- 'modified': '2011-12-20 12:55:02',
+ 'modified': '2011-12-22 19:03:25',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'Sales Order',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType'
+ },
+
# These values are common for all DocType
{
'_last_update': '1324295218',
@@ -29,15 +38,15 @@
'show_in_menu': 0,
'subject': 'From %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s | %(per_delivered)s% delivered | %(per_billed)s% billed',
'tag_fields': 'delivery_status,billing_status',
- 'version': 608
+ 'version': 609
},
- # These values are common for all DocField
+ # These values are common for all DocFormat
{
- 'doctype': 'DocField',
+ 'doctype': 'DocFormat',
'name': '__common__',
'parent': 'Sales Order',
- 'parentfield': 'fields',
+ 'parentfield': 'formats',
'parenttype': 'DocType'
},
@@ -166,6 +175,24 @@
'role': 'Maintenance User'
},
+ # DocFormat
+ {
+ 'doctype': 'DocFormat',
+ 'format': 'Sales Order Classic'
+ },
+
+ # DocFormat
+ {
+ 'doctype': 'DocFormat',
+ 'format': 'Sales Order Modern'
+ },
+
+ # DocFormat
+ {
+ 'doctype': 'DocFormat',
+ 'format': 'Sales Order Spartan'
+ },
+
# DocField
{
'colour': 'White:FFF',
@@ -581,6 +608,7 @@
'label': 'Price List Currency',
'options': 'link:Currency',
'permlevel': 0,
+ 'print_hide': 1,
'reqd': 1
},
@@ -593,6 +621,7 @@
'fieldtype': 'Currency',
'label': 'Price List Currency Conversion Rate',
'permlevel': 0,
+ 'print_hide': 1,
'reqd': 1
},
diff --git a/erpnext/setup/doctype/email_digest/email_digest.js b/erpnext/setup/doctype/email_digest/email_digest.js
index 728c8b4..81b37e4 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.js
+++ b/erpnext/setup/doctype/email_digest/email_digest.js
@@ -4,6 +4,7 @@
var err_msg = "There was an error. One probable reason could be that you haven't saved the form. Please contact support@erpnext.com if the problem persists."
cur_frm.add_custom_button('View Now', function() {
+ doc = locals[dt][dn];
if(doc.__unsaved != 1) {
$c_obj(make_doclist(dt, dn), 'get', '', function(r, rt) {
if(r.exc) {
@@ -26,6 +27,7 @@
}
}, 1);
cur_frm.add_custom_button('Send Now', function() {
+ doc = locals[dt][dn];
if(doc.__unsaved != 1) {
$c_obj(make_doclist(dt, dn), 'send', '', function(r, rt) {
if(r.exc) {
diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py
index 3498a7f..e599e7b 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.py
+++ b/erpnext/setup/doctype/email_digest/email_digest.py
@@ -1,4 +1,5 @@
import webnotes
+import webnotes.utils
class DocType:
def __init__(self, doc, doclist=[]):
@@ -61,6 +62,11 @@
'debit_or_credit': 'Credit'
}),
+ 'income_year_to_date': self.generate_gle_query({
+ 'type': 'income_year_to_date',
+ 'debit_or_credit': 'Credit'
+ }),
+
'expenses_booked': self.generate_gle_query({
'type': 'expenses_booked',
'debit_or_credit': 'Debit'
@@ -112,7 +118,7 @@
if self.doc.fields[query] and query_dict[query]:
#webnotes.msgprint(query)
res = webnotes.conn.sql(query_dict[query], as_dict=1)
- if query == 'income':
+ if query in ['income', 'income_year_to_date']:
for r in res:
r['value'] = float(r['credit'] - r['debit'])
elif query in ['expenses_booked', 'bank_balance']:
@@ -179,6 +185,21 @@
%(start_date_condition)s AND
%(end_date_condition)s""" % args
+ elif args['type'] == 'income_year_to_date':
+ query = """
+ SELECT
+ IFNULL(SUM(IFNULL(gle.debit, 0)), 0) AS 'debit',
+ IFNULL(SUM(IFNULL(gle.credit, 0)), 0) AS 'credit',
+ %(common_select)s
+ FROM
+ %(common_from)s
+ WHERE
+ %(common_where)s AND
+ ac.is_pl_account = 'Yes' AND
+ ac.debit_or_credit = '%(debit_or_credit)s' AND
+ %(fiscal_start_date_condition)s AND
+ %(end_date_condition)s""" % args
+
elif args['type'] == 'bank_balance':
query = """
SELECT
@@ -203,6 +224,7 @@
Adds common conditions in dictionary "args"
"""
start_date, end_date = self.get_start_end_dates()
+ fiscal_start_date = webnotes.utils.get_defaults()['year_start_date']
if 'new' in args['type']:
args.update({
@@ -233,7 +255,9 @@
'start_date_condition': "gle.posting_date >= '%s'" % start_date,
- 'end_date_condition': "gle.posting_date <= '%s'" % end_date
+ 'end_date_condition': "gle.posting_date <= '%s'" % end_date,
+
+ 'fiscal_start_date_condition': "gle.posting_date >= '%s'" % fiscal_start_date
})
@@ -393,7 +417,6 @@
sch = Scheduler()
sch.connect()
-
if self.doc.enabled == 1:
# Create scheduler entry
res = sch.conn.sql("""
@@ -405,15 +428,21 @@
if not (res and res[0]):
args['next_execution'] = self.get_next_execution()
-
+ sch.conn.begin()
sch.conn.sql("""
INSERT INTO Event (db_name, event, `interval`, next_execution, recurring)
VALUES (%(db_name)s, %(event)s, 86400, %(next_execution)s, 1)
""", args)
+ sch.conn.commit()
else:
- # delete scheduler entry
- sch.clear(args['db_name'], args['event'])
+ # delete scheduler entry if no other email digest is enabled
+ res = webnotes.conn.sql("""
+ SELECT * FROM `tabEmail Digest`
+ WHERE enabled=1
+ """)
+ if not (res and res[0]):
+ sch.clear(args['db_name'], args['event'])
#print "after on update"
@@ -578,6 +607,15 @@
'idx': 302
},
+ 'income_year_to_date': {
+ 'table': 'income_year_to_date' in result and table({
+ 'head': 'Income Year To Date',
+ 'body': currency_amount_str \
+ % (currency, fmt_money(result['income_year_to_date']['value']))
+ }),
+ 'idx': 303
+ },
+
'expenses_booked': {
'table': 'expenses_booked' in result and table({
'head': 'Expenses Booked',
diff --git a/erpnext/setup/doctype/email_digest/email_digest.txt b/erpnext/setup/doctype/email_digest/email_digest.txt
index 3d8de7b..897adad 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.txt
+++ b/erpnext/setup/doctype/email_digest/email_digest.txt
@@ -3,16 +3,16 @@
# These values are common in all dictionaries
{
- 'creation': '2011-12-12 10:41:40',
+ 'creation': '2011-12-14 12:15:09',
'docstatus': 0,
- 'modified': '2011-12-15 13:53:08',
+ 'modified': '2011-12-22 19:01:33',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
- '_last_update': '1323353260',
+ '_last_update': '1324556758',
'autoname': 'Prompt',
'colour': 'White:FFF',
'doctype': 'DocType',
@@ -21,7 +21,7 @@
'name': '__common__',
'section_style': 'Simple',
'show_in_menu': 0,
- 'version': 79
+ 'version': 81
},
# These values are common for all DocField
@@ -294,6 +294,16 @@
{
'depends_on': 'eval:doc.use_standard',
'doctype': 'DocField',
+ 'fieldname': 'income_year_to_date',
+ 'fieldtype': 'Check',
+ 'label': 'Income Year to Date',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'depends_on': 'eval:doc.use_standard',
+ 'doctype': 'DocField',
'fieldname': 'bank_balance',
'fieldtype': 'Check',
'label': 'Bank Balance',
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.txt b/erpnext/stock/doctype/delivery_note/delivery_note.txt
index dc905f5..5340955 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': '2011-12-20 13:23:33',
+ 'modified': '2011-12-22 19:03:44',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -37,13 +37,12 @@
'show_in_menu': 0,
'subject': 'To %(customer_name)s on %(transaction_date)s | %(per_billed)s% billed',
'tag_fields': 'billing_status',
- 'version': 459
+ 'version': 460
},
# These values are common for all DocFormat
{
'doctype': 'DocFormat',
- 'format': 'Delivery Note Packing List Wise',
'name': '__common__',
'parent': 'Delivery Note',
'parentfield': 'formats',
@@ -143,7 +142,26 @@
# DocFormat
{
- 'doctype': 'DocFormat'
+ 'doctype': 'DocFormat',
+ 'format': 'Delivery Note Packing List Wise'
+ },
+
+ # DocFormat
+ {
+ 'doctype': 'DocFormat',
+ 'format': 'Delivery Note Classic'
+ },
+
+ # DocFormat
+ {
+ 'doctype': 'DocFormat',
+ 'format': 'Delivery Note Modern'
+ },
+
+ # DocFormat
+ {
+ 'doctype': 'DocFormat',
+ 'format': 'Delivery Note Spartan'
},
# DocField
@@ -567,6 +585,7 @@
'label': 'Price List Currency',
'options': 'link:Currency',
'permlevel': 0,
+ 'print_hide': 1,
'reqd': 1
},
@@ -579,6 +598,7 @@
'fieldtype': 'Currency',
'label': 'Price List Currency Conversion Rate',
'permlevel': 0,
+ 'print_hide': 1,
'reqd': 1
},