[setup] [fix] creation of fiscal year if start date is 1st Jan
This commit is contained in:
parent
8aaccf7269
commit
f4d8d23241
@ -112,7 +112,7 @@ test_records = [
|
|||||||
{
|
{
|
||||||
"doctype": "For Territory",
|
"doctype": "For Territory",
|
||||||
"parentfield": "valid_for_territories",
|
"parentfield": "valid_for_territories",
|
||||||
"territory": "India"
|
"territory": "_Test Territory India"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -84,6 +84,8 @@ $.extend(erpnext.complete_setup, {
|
|||||||
wn.container.wntoolbar.set_user_name();
|
wn.container.wntoolbar.set_user_name();
|
||||||
|
|
||||||
setTimeout(function() { window.location.reload(); }, 3000);
|
setTimeout(function() { window.location.reload(); }, 3000);
|
||||||
|
} else {
|
||||||
|
$(this).done_working();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -87,18 +87,20 @@ class DocType:
|
|||||||
self.curr_fiscal_year = curr_fiscal_year
|
self.curr_fiscal_year = curr_fiscal_year
|
||||||
|
|
||||||
def create_price_lists(self, args):
|
def create_price_lists(self, args):
|
||||||
webnotes.bean({
|
for pl_type in ["Selling", "Buying"]:
|
||||||
'doctype': 'Price List',
|
webnotes.bean([
|
||||||
'price_list_name': 'Standard Selling',
|
{
|
||||||
"buying_or_selling": "Selling",
|
"doctype": "Price List",
|
||||||
|
"price_list_name": "Standard " + pl_type,
|
||||||
|
"buying_or_selling": pl_type,
|
||||||
"currency": args["currency"]
|
"currency": args["currency"]
|
||||||
}).insert(),
|
},
|
||||||
webnotes.bean({
|
{
|
||||||
'doctype': 'Price List',
|
"doctype": "For Territory",
|
||||||
'price_list_name': 'Standard Buying',
|
"parentfield": "valid_for_territories",
|
||||||
"buying_or_selling": "Buying",
|
"territory": "All Territories"
|
||||||
"currency": args["currency"]
|
}
|
||||||
}).insert(),
|
]).insert()
|
||||||
|
|
||||||
def set_defaults(self, args):
|
def set_defaults(self, args):
|
||||||
# enable default currency
|
# enable default currency
|
||||||
@ -207,15 +209,18 @@ class DocType:
|
|||||||
# ------------------------
|
# ------------------------
|
||||||
def get_fy_details(self, fy_start, last_year=False):
|
def get_fy_details(self, fy_start, last_year=False):
|
||||||
st = {'1st Jan':'01-01','1st Apr':'04-01','1st Jul':'07-01', '1st Oct': '10-01'}
|
st = {'1st Jan':'01-01','1st Apr':'04-01','1st Jul':'07-01', '1st Oct': '10-01'}
|
||||||
curr_year = getdate(nowdate()).year
|
|
||||||
if last_year:
|
|
||||||
curr_year = curr_year - 1
|
|
||||||
if cint(getdate(nowdate()).month) < cint((st[fy_start].split('-'))[0]):
|
if cint(getdate(nowdate()).month) < cint((st[fy_start].split('-'))[0]):
|
||||||
curr_year = getdate(nowdate()).year - 1
|
curr_year = getdate(nowdate()).year - 1
|
||||||
|
else:
|
||||||
|
curr_year = getdate(nowdate()).year
|
||||||
|
|
||||||
|
if last_year:
|
||||||
|
curr_year = curr_year - 1
|
||||||
|
|
||||||
stdt = cstr(curr_year)+'-'+cstr(st[fy_start])
|
stdt = cstr(curr_year)+'-'+cstr(st[fy_start])
|
||||||
|
|
||||||
if(fy_start == '1st Jan'):
|
if(fy_start == '1st Jan'):
|
||||||
fy = cstr(getdate(nowdate()).year)
|
fy = cstr(curr_year)
|
||||||
abbr = cstr(fy)[-2:]
|
abbr = cstr(fy)[-2:]
|
||||||
else:
|
else:
|
||||||
fy = cstr(curr_year) + '-' + cstr(curr_year+1)
|
fy = cstr(curr_year) + '-' + cstr(curr_year+1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user