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.

107 lines
2.9 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(
  9. string="Year",
  10. required=True
  11. )
  12. loan_issue_id = fields.Many2one(
  13. related="issue_line.loan_issue_id",
  14. store=True,
  15. readlonly=True)
  16. issue_line = fields.Many2one(
  17. "loan.issue.line",
  18. string="Subscribed loan",
  19. required=True
  20. )
  21. partner_id = fields.Many2one(
  22. related="issue_line.partner_id",
  23. store=True,
  24. readlonly=True
  25. )
  26. amount = fields.Monetary(
  27. related="issue_line.amount",
  28. string="Subscribed amount",
  29. currency_field="company_currency_id",
  30. readonly=True,
  31. )
  32. interest = fields.Monetary(
  33. string="Gross interest amount",
  34. currency_field="company_currency_id",
  35. readonly=True,
  36. )
  37. net_interest = fields.Monetary(
  38. string="Net interest amount",
  39. currency_field="company_currency_id",
  40. readonly=True,
  41. )
  42. taxes_rate = fields.Float(
  43. string="Taxes on interest",
  44. required=True
  45. )
  46. taxes_amount = fields.Monetary(
  47. string="Taxes amount",
  48. currency_field="company_currency_id",
  49. readonly=True,
  50. )
  51. accrued_amount = fields.Monetary(
  52. string="Accrued amount",
  53. currency_field="company_currency_id",
  54. readonly=True,
  55. )
  56. accrued_interest = fields.Monetary(
  57. string="Accrued gross interest",
  58. currency_field="company_currency_id",
  59. readonly=True,
  60. )
  61. accrued_net_interest = fields.Monetary(
  62. string="Accrued net interest",
  63. currency_field="company_currency_id",
  64. readonly=True,
  65. )
  66. accrued_taxes = fields.Monetary(
  67. string="Accrued taxes to pay",
  68. currency_field="company_currency_id",
  69. readonly=True,
  70. )
  71. due_loan_amount = fields.Monetary(
  72. string="Due loan amount",
  73. currency_field="company_currency_id"
  74. )
  75. due_amount = fields.Monetary(
  76. string="Total due amount",
  77. currency_field="company_currency_id"
  78. )
  79. due_date = fields.Date(string="Due date")
  80. company_currency_id = fields.Many2one(
  81. "res.currency",
  82. related="company_id.currency_id",
  83. string="Company Currency",
  84. readonly=True,
  85. )
  86. company_id = fields.Many2one(
  87. "res.company",
  88. related="issue_line.company_id",
  89. string="Company",
  90. readonly=True,
  91. )
  92. state = fields.Selection(
  93. [
  94. ("draft", "Draft"),
  95. ("due_fy", "Due in the year"),
  96. ("due", "Due"),
  97. ("scheduled", "Payment scheduled"),
  98. ("donation", "Donation"),
  99. ("paid", "Paid"),
  100. ],
  101. string="State",
  102. default="draft",
  103. )