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.

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