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.

64 lines
3.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 fields, models
  5. class LoanInterestLine(models.Model):
  6. _name = 'loan.interest.line'
  7. _description = "Loan Interest Line"
  8. name = fields.Integer(string="Year",
  9. required=True)
  10. issue_line = fields.Many2one('loan.issue.line',
  11. string="Subscribed loan",
  12. required=True)
  13. partner_id = fields.Many2one(related='issue_line.partner_id',
  14. store=True,
  15. readlonly=True)
  16. amount = fields.Monetary(related='issue_line.amount',
  17. string="Subscribed amount",
  18. currency_field='company_currency_id',
  19. readonly=True)
  20. interest = fields.Monetary(string="Gross interest amount",
  21. currency_field='company_currency_id',
  22. readonly=True)
  23. net_interest = fields.Monetary(string="Net interest amount",
  24. currency_field='company_currency_id',
  25. readonly=True)
  26. taxes_rate = fields.Float(string="Taxes on interest",
  27. required=True)
  28. taxes_amount = fields.Monetary(string="Taxes amount",
  29. currency_field='company_currency_id',
  30. readonly=True)
  31. accrued_amount = fields.Monetary(string="Accrued amount",
  32. currency_field='company_currency_id',
  33. readonly=True)
  34. accrued_interest = fields.Monetary(string="Accrued gross interest",
  35. currency_field='company_currency_id',
  36. readonly=True)
  37. accrued_net_interest = fields.Monetary(
  38. string="Accrued net interest",
  39. currency_field='company_currency_id',
  40. readonly=True)
  41. accrued_taxes = fields.Monetary(string="Accrued taxes to pay",
  42. currency_field='company_currency_id',
  43. readonly=True)
  44. due_date = fields.Date(string="Due date")
  45. company_currency_id = fields.Many2one('res.currency',
  46. related='company_id.currency_id',
  47. string="Company Currency",
  48. readonly=True)
  49. company_id = fields.Many2one('res.company',
  50. related='issue_line.company_id',
  51. string="Company",
  52. readonly=True)
  53. state = fields.Selection([('draft', 'Draft'),
  54. ('due', 'Due'),
  55. ('requested', 'Payment requested'),
  56. ('donation', 'Donation'),
  57. ('paid', 'Paid')
  58. ],
  59. string="State",
  60. default="draft")