Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
e323ef20b0
11
erpnext/patches/edigest_enable_income_year_to_date.py
Normal file
11
erpnext/patches/edigest_enable_income_year_to_date.py
Normal file
@ -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()
|
6
erpnext/patches/remove_previous_field_property_setter.py
Normal file
6
erpnext/patches/remove_previous_field_property_setter.py
Normal file
@ -0,0 +1,6 @@
|
||||
import webnotes
|
||||
def execute():
|
||||
webnotes.conn.sql("""\
|
||||
DELETE FROM `tabProperty Setter`
|
||||
WHERE property='previous_field'
|
||||
""")
|
9
erpnext/patches/update_0_idx.py
Normal file
9
erpnext/patches/update_0_idx.py
Normal file
@ -0,0 +1,9 @@
|
||||
import webnotes
|
||||
def execute():
|
||||
doc_type_list = webnotes.conn.sql("""SELECT DISTINCT parent FROM `tabDocField` where idx=0""")
|
||||
for doc_type in doc_type_list:
|
||||
if doc_type and doc_type[0]:
|
||||
webnotes.conn.sql("""\
|
||||
UPDATE `tabDocField` SET idx=idx+1
|
||||
WHERE parent=%s
|
||||
""", doc_type[0])
|
@ -4,6 +4,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
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 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
}
|
||||
}, 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) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import webnotes
|
||||
import webnotes.utils
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
@ -61,6 +62,11 @@ class DocType:
|
||||
'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 @@ class DocType:
|
||||
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']:
|
||||
@ -121,6 +127,8 @@ class DocType:
|
||||
#webnotes.msgprint(query)
|
||||
#webnotes.msgprint(res)
|
||||
result[query] = (res and len(res)==1) and res[0] or (res and res or None)
|
||||
if result[query] is None:
|
||||
del result[query]
|
||||
|
||||
return result
|
||||
|
||||
@ -177,6 +185,21 @@ class DocType:
|
||||
%(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
|
||||
@ -201,6 +224,7 @@ class DocType:
|
||||
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({
|
||||
@ -231,7 +255,9 @@ class DocType:
|
||||
|
||||
'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
|
||||
})
|
||||
|
||||
|
||||
@ -576,6 +602,15 @@ class DocType:
|
||||
'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',
|
||||
@ -586,7 +621,7 @@ class DocType:
|
||||
},
|
||||
|
||||
'bank_balance': {
|
||||
'table': 'bank_balance' in result and table({
|
||||
'table': 'bank_balance' in result and result['bank_balance'] and table({
|
||||
'head': 'Bank Balance',
|
||||
'body': [
|
||||
[
|
||||
@ -662,8 +697,15 @@ class DocType:
|
||||
table_list.append(\
|
||||
"<div style='font-size: 16px; color: grey'>[" + \
|
||||
k.capitalize() + \
|
||||
"]<br />Missing: Ledger of type 'Bank or Cash'\
|
||||
"]<br />Missing: Account of type 'Bank or Cash'\
|
||||
</div>")
|
||||
elif k=='bank_balance':
|
||||
table_list.append(\
|
||||
"<div style='font-size: 16px; color: grey'>[" + \
|
||||
"Bank Balance" + \
|
||||
"]<br />Alert: GL Entry not found for Account of type 'Bank or Cash'\
|
||||
</div>")
|
||||
|
||||
|
||||
i = 0
|
||||
result = []
|
||||
|
@ -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
|
||||
@ -290,6 +290,16 @@
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'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',
|
||||
|
Loading…
x
Reference in New Issue
Block a user