Browse Source

[LIC] add licensing

pull/48/head
houssine 5 years ago
committed by robin.keunen
parent
commit
3d8e84d380
  1. 9
      easy_my_coop_loan/models/__init__.py
  2. 124
      easy_my_coop_loan/models/interest_line.py
  3. 4
      easy_my_coop_loan/models/loan.py
  4. 3
      easy_my_coop_loan/models/loan_issue_line.py
  5. 59
      easy_my_coop_loan/models/partner.py

9
easy_my_coop_loan/models/__init__.py

@ -1,5 +1,4 @@
from . import loan
from . import loan_issue_line
from . import interest_line
from . import partner
from . import mail_template
from . import loan
from . import loan_issue_line
from . import interest_line
from . import partner

124
easy_my_coop_loan/models/interest_line.py

@ -1,60 +1,64 @@
from odoo import fields, models
class LoanInterestLine(models.Model):
_name = 'loan.interest.line'
_description = "Loan Interest Line"
name = fields.Integer(string="Year",
required=True)
issue_line = fields.Many2one('loan.issue.line',
string="Subscribed loan",
required=True)
partner_id = fields.Many2one(related='issue_line.partner_id',
store=True,
readlonly=True)
amount = fields.Monetary(related='issue_line.amount',
string="Subscribed amount",
currency_field='company_currency_id',
readonly=True)
interest = fields.Monetary(string="Gross interest amount",
currency_field='company_currency_id',
readonly=True)
net_interest = fields.Monetary(string="Net interest amount",
currency_field='company_currency_id',
readonly=True)
taxes_rate = fields.Float(string="Taxes on interest",
required=True)
taxes_amount = fields.Monetary(string="Taxes amount",
currency_field='company_currency_id',
readonly=True)
accrued_amount = fields.Monetary(string="Accrued amount",
currency_field='company_currency_id',
readonly=True)
accrued_interest = fields.Monetary(string="Accrued gross interest",
currency_field='company_currency_id',
readonly=True)
accrued_net_interest = fields.Monetary(
string="Accrued net interest",
currency_field='company_currency_id',
readonly=True)
accrued_taxes = fields.Monetary(string="Accrued taxes to pay",
currency_field='company_currency_id',
readonly=True)
due_date = fields.Date(string="Due date")
company_currency_id = fields.Many2one('res.currency',
related='company_id.currency_id',
string="Company Currency",
readonly=True)
company_id = fields.Many2one('res.company',
related='issue_line.company_id',
string="Company",
readonly=True)
state = fields.Selection([('draft', 'Draft'),
('due', 'Due'),
('requested', 'Payment requested'),
('donation', 'Donation'),
('paid', 'Paid')
],
string="State",
default="draft")
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine BAKKALI <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class LoanInterestLine(models.Model):
_name = 'loan.interest.line'
_description = "Loan Interest Line"
name = fields.Integer(string="Year",
required=True)
issue_line = fields.Many2one('loan.issue.line',
string="Subscribed loan",
required=True)
partner_id = fields.Many2one(related='issue_line.partner_id',
store=True,
readlonly=True)
amount = fields.Monetary(related='issue_line.amount',
string="Subscribed amount",
currency_field='company_currency_id',
readonly=True)
interest = fields.Monetary(string="Gross interest amount",
currency_field='company_currency_id',
readonly=True)
net_interest = fields.Monetary(string="Net interest amount",
currency_field='company_currency_id',
readonly=True)
taxes_rate = fields.Float(string="Taxes on interest",
required=True)
taxes_amount = fields.Monetary(string="Taxes amount",
currency_field='company_currency_id',
readonly=True)
accrued_amount = fields.Monetary(string="Accrued amount",
currency_field='company_currency_id',
readonly=True)
accrued_interest = fields.Monetary(string="Accrued gross interest",
currency_field='company_currency_id',
readonly=True)
accrued_net_interest = fields.Monetary(
string="Accrued net interest",
currency_field='company_currency_id',
readonly=True)
accrued_taxes = fields.Monetary(string="Accrued taxes to pay",
currency_field='company_currency_id',
readonly=True)
due_date = fields.Date(string="Due date")
company_currency_id = fields.Many2one('res.currency',
related='company_id.currency_id',
string="Company Currency",
readonly=True)
company_id = fields.Many2one('res.company',
related='issue_line.company_id',
string="Company",
readonly=True)
state = fields.Selection([('draft', 'Draft'),
('due', 'Due'),
('requested', 'Payment requested'),
('donation', 'Donation'),
('paid', 'Paid')
],
string="State",
default="draft")

4
easy_my_coop_loan/models/loan.py

@ -1,3 +1,7 @@
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine BAKKALI <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
import logging import logging
from odoo import api, fields, models, _ from odoo import api, fields, models, _

3
easy_my_coop_loan/models/loan_issue_line.py

@ -1,3 +1,6 @@
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine BAKKALI <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from datetime import datetime from datetime import datetime

59
easy_my_coop_loan/models/partner.py

@ -1,30 +1,29 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Coop IT Easy SCRL fs
# Robin Keunen <robin@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models, api
class ResPartner(models.Model):
_inherit = "res.partner"
loan_line_ids = fields.One2many(
comodel_name="loan.issue.line",
inverse_name="partner_id",
string="Loans",
)
is_loaner = fields.Boolean(
string="Loaner",
compute="_compute_is_loaner",
store=True,
)
@api.multi
@api.depends("loan_line_ids", "loan_line_ids.state")
def _compute_is_loaner(self):
for partner in self:
loans = partner.loan_line_ids.filtered(
lambda l: l.state in ["subscribed", "waiting", "paid"]
)
partner.is_loaner = bool(loans)
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine BAKKALI <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models, api
class ResPartner(models.Model):
_inherit = "res.partner"
loan_line_ids = fields.One2many(
comodel_name="loan.issue.line",
inverse_name="partner_id",
string="Loans",
)
is_loaner = fields.Boolean(
string="Loaner",
compute="_compute_is_loaner",
store=True,
)
@api.multi
@api.depends("loan_line_ids", "loan_line_ids.state")
def _compute_is_loaner(self):
for partner in self:
loans = partner.loan_line_ids.filtered(
lambda l: l.state in ["subscribed", "waiting", "paid"]
)
partner.is_loaner = bool(loans)
Loading…
Cancel
Save