19 lines
804 B
Python
19 lines
804 B
Python
from odoo import models, fields
|
|
class LoanInterestPolicy(models.Model):
|
|
_name = 'loan.interest.policy'
|
|
_description = 'Loan Interest Policy'
|
|
|
|
loan_type_id = fields.Many2one('loan.type1', string='Loại khoản vay', required=True)
|
|
repayment_type = fields.Selection([
|
|
('fixed_principal', 'Gốc đều, lãi giảm dần'),
|
|
('annuity', 'Trả góp cố định'),
|
|
('interest_only', 'Chỉ trả lãi'),
|
|
('lump_sum', 'Trả 1 lần cuối kỳ'),
|
|
], string='Kiểu trả nợ', required=True)
|
|
|
|
interest_rate = fields.Float(string='Lãi suất (%)', required=True)
|
|
|
|
_sql_constraints = [
|
|
('unique_policy', 'unique(loan_type_id, repayment_type)', 'Chính sách lãi suất đã tồn tại cho loại vay và kiểu trả nợ này.')
|
|
]
|