mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 14:39:19 +00:00
Merge pull request #1100 from akhileshdarjee/master
[fix] [minor] patch for fixing report columns in defaults
This commit is contained in:
@@ -21,16 +21,8 @@ $.extend(cur_frm.cscript, {
|
||||
year_start_date: function(doc, dt, dn) {
|
||||
var me = this;
|
||||
|
||||
wn.call({
|
||||
method: 'controllers.trends.get_period_date_ranges',
|
||||
args: {
|
||||
period: "Yearly",
|
||||
year_start_date: this.frm.doc.year_start_date
|
||||
},
|
||||
callback: function(r) {
|
||||
if (!r.exc)
|
||||
me.frm.set_value("year_end_date", r.message[0][1])
|
||||
}
|
||||
});
|
||||
year_end_date =
|
||||
wn.datetime.add_days(wn.datetime.add_months(this.frm.doc.year_start_date, 12), -1);
|
||||
this.frm.set_value("year_end_date", year_end_date);
|
||||
},
|
||||
});
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import msgprint, _
|
||||
from webnotes.utils import getdate
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
@@ -19,9 +20,16 @@ class DocType:
|
||||
msgprint(self.doc.name + _(""" is now the default Fiscal Year. \
|
||||
Please refresh your browser for the change to take effect."""))
|
||||
|
||||
def on_update(self):
|
||||
from webnotes.utils import getdate
|
||||
def validate(self):
|
||||
year_start_end_dates = webnotes.conn.sql("""select year_start_date, year_end_date
|
||||
from `tabFiscal Year` where name=%s""", (self.doc.name))
|
||||
|
||||
if year_start_end_dates:
|
||||
if getdate(self.doc.year_start_date) != year_start_end_dates[0][0] or getdate(self.doc.year_end_date) != year_start_end_dates[0][1]:
|
||||
webnotes.throw(_("Cannot change Year Start Date and Year End Date \
|
||||
once the Fiscal Year is saved."))
|
||||
|
||||
def on_update(self):
|
||||
# validate year start date and year end date
|
||||
if getdate(self.doc.year_start_date) > getdate(self.doc.year_end_date):
|
||||
webnotes.throw(_("Year Start Date should not be greater than Year End Date"))
|
||||
|
||||
Reference in New Issue
Block a user