add to holiday list sorted by idx
This commit is contained in:
parent
a1716543c2
commit
9985699247
@ -42,10 +42,13 @@ class DocType:
|
|||||||
self.validate_values()
|
self.validate_values()
|
||||||
yr_start_date, yr_end_date = self.get_fy_start_end_dates()
|
yr_start_date, yr_end_date = self.get_fy_start_end_dates()
|
||||||
date_list = self.get_weekly_off_date_list(yr_start_date, yr_end_date)
|
date_list = self.get_weekly_off_date_list(yr_start_date, yr_end_date)
|
||||||
for d in date_list:
|
last_idx = max([cint(d.idx) for d in self.doclist.get(
|
||||||
|
{"parentfield": "holiday_list_details"})] or [0,])
|
||||||
|
for i, d in enumerate(date_list):
|
||||||
ch = addchild(self.doc, 'holiday_list_details', 'Holiday', self.doclist)
|
ch = addchild(self.doc, 'holiday_list_details', 'Holiday', self.doclist)
|
||||||
ch.description = self.doc.weekly_off
|
ch.description = self.doc.weekly_off
|
||||||
ch.holiday_date = d
|
ch.holiday_date = d
|
||||||
|
ch.idx = last_idx + i + 1
|
||||||
|
|
||||||
def validate_values(self):
|
def validate_values(self):
|
||||||
if not self.doc.fiscal_year:
|
if not self.doc.fiscal_year:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user