Browse Source

[IMP] add field and do a write on the recordset instead of the loop

pull/134/head
houssine 4 years ago
parent
commit
296c4e683b
  1. 3
      easy_my_coop_loan_account/models/interest_line.py
  2. 16
      easy_my_coop_loan_account/wizard/end_of_year_operation.py
  3. 1
      easy_my_coop_loan_account/wizard/end_of_year_operation.xml

3
easy_my_coop_loan_account/models/interest_line.py

@ -87,8 +87,7 @@ class LoanInterestLine(models.Model):
self.env["account.move.line"].create(vals_list)
line.write({"loan_reimbursment_move": move.id,
"state": "scheduled"})
line.write({"loan_reimbursment_move": move.id})
@api.multi
def generate_interest_move_lines_fy(self, date, next_fy):

16
easy_my_coop_loan_account/wizard/end_of_year_operation.py

@ -19,6 +19,9 @@ class LoanEndOfYearOperation(models.TransientModel):
string="Ongoing fiscal year",
required=True
)
due_date = fields.Date(
string="Due date"
)
@api.multi
def run(self):
@ -55,9 +58,20 @@ class LoanEndOfYearOperation(models.TransientModel):
interest_lines.generate_interest_move_lines_fy(last_fy_day,
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:
raise UserError("There is no end of year account move"
" lines to generate for the selected loan"
" issue")
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)
])

1
easy_my_coop_loan_account/wizard/end_of_year_operation.xml

@ -10,6 +10,7 @@
</p>
<group>
<field name="ongoing_fy_id"/>
<field name="due_date" attrs="{'invisible':[('ongoing_fy_id', '!=', 'loan_due')]}"/>
</group>
<footer>
<button name="run" string="Run" type="object"

Loading…
Cancel
Save