|
@ -19,6 +19,9 @@ class LoanEndOfYearOperation(models.TransientModel): |
|
|
string="Ongoing fiscal year", |
|
|
string="Ongoing fiscal year", |
|
|
required=True |
|
|
required=True |
|
|
) |
|
|
) |
|
|
|
|
|
due_date = fields.Date( |
|
|
|
|
|
string="Due date" |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
@api.multi |
|
|
@api.multi |
|
|
def run(self): |
|
|
def run(self): |
|
@ -55,9 +58,20 @@ class LoanEndOfYearOperation(models.TransientModel): |
|
|
|
|
|
|
|
|
interest_lines.generate_interest_move_lines_fy(last_fy_day, |
|
|
interest_lines.generate_interest_move_lines_fy(last_fy_day, |
|
|
next_fy) |
|
|
next_fy) |
|
|
|
|
|
# interest_lines.write({"state": "scheduled"}) |
|
|
|
|
|
# interest_lines_loan.write({"state": "scheduled"}) |
|
|
|
|
|
(interest_lines + interest_lines_loan).write({"state": |
|
|
|
|
|
"scheduled"}) |
|
|
if not interest_lines_loan and not interest_lines: |
|
|
if not interest_lines_loan and not interest_lines: |
|
|
raise UserError("There is no end of year account move" |
|
|
raise UserError("There is no end of year account move" |
|
|
" lines to generate for the selected loan" |
|
|
" lines to generate for the selected loan" |
|
|
" issue") |
|
|
" issue") |
|
|
elif self.ongoing_fy_id == "loan_due": |
|
|
elif self.ongoing_fy_id == "loan_due": |
|
|
print("lol") |
|
|
|
|
|
|
|
|
interest_lines = interest_line_obj.search([ |
|
|
|
|
|
("due_date", ">=", next_fy.date_from), |
|
|
|
|
|
("due_date", "<=", next_fy.date_to), |
|
|
|
|
|
("interest", ">", 0), |
|
|
|
|
|
("loan_issue_id", "in", loan_issues.ids), |
|
|
|
|
|
("interest_closing_fy", "=", False), |
|
|
|
|
|
("interest_opening_fy", "=", False) |
|
|
|
|
|
]) |