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.

102 lines
2.8 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_amount = fields.Monetary(
  72. string="Due amount",
  73. currency_field="company_currency_id"
  74. )
  75. due_date = fields.Date(string="Due date")
  76. company_currency_id = fields.Many2one(
  77. "res.currency",
  78. related="company_id.currency_id",
  79. string="Company Currency",
  80. readonly=True,
  81. )
  82. company_id = fields.Many2one(
  83. "res.company",
  84. related="issue_line.company_id",
  85. string="Company",
  86. readonly=True,
  87. )
  88. state = fields.Selection(
  89. [
  90. ("draft", "Draft"),
  91. ("due", "Due"),
  92. ("requested", "Payment requested"),
  93. ("donation", "Donation"),
  94. ("paid", "Paid"),
  95. ],
  96. string="State",
  97. default="draft",
  98. )