You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB

  1. # Copyright 2019 Coop IT Easy SCRL fs
  2. # Houssine BAKKALI <houssine@coopiteasy.be>
  3. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
  4. from odoo import api, fields, models
  5. class AccountMove(models.Model):
  6. _inherit = "account.move"
  7. loan_issue_line = fields.One2many(
  8. "loan.issue.line",
  9. "awaiting_move_id",
  10. string="Loan issue line",
  11. readonly=True,
  12. )
  13. class AccountMoveLine(models.Model):
  14. _inherit = "account.move.line"
  15. loan_issue_line = fields.One2many(
  16. "loan.issue.line",
  17. related="move_id.loan_issue_line",
  18. )
  19. @api.multi
  20. def check_full_reconcile(self):
  21. super(AccountMoveLine, self).check_full_reconcile()
  22. full_reconcile_id = self.mapped("full_reconcile_id")
  23. loan_issue_line = self.mapped("loan_issue_line")
  24. if full_reconcile_id and loan_issue_line:
  25. for move_line in self:
  26. if move_line.statement_id:
  27. loan_issue_line.payment_date = move_line.date
  28. loan_issue_line.with_context(
  29. {"paid_by_bank_statement": True}
  30. ).action_paid()
  31. print(full_reconcile_id)