Browse Source
Merge branch '12.0' of https://github.com/coopiteasy/vertical-cooperative.git into 12.0
pull/32/head
Merge branch '12.0' of https://github.com/coopiteasy/vertical-cooperative.git into 12.0
pull/32/head
houssine
5 years ago
8 changed files with 76 additions and 18 deletions
-
2easy_my_coop/demo/coop.xml
-
22easy_my_coop/views/res_partner_view.xml
-
1easy_my_coop_document/__openerp__.py
-
31easy_my_coop_loan/models/partner.py
-
2easy_my_coop_loan/views/loan_view.xml
-
4easy_my_coop_loan/views/menus.xml
-
31easy_my_coop_loan/views/partner_view.xml
-
1easy_my_coop_taxshelter_report/__openerp__.py
@ -1,9 +1,30 @@ |
|||||
from odoo import fields, models |
|
||||
|
# -*- 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): |
class ResPartner(models.Model): |
||||
_inherit = 'res.partner' |
|
||||
|
_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, |
||||
|
) |
||||
|
|
||||
loan_line_ids = fields.One2many('loan.issue.line', |
|
||||
'partner_id', |
|
||||
string="Loans") |
|
||||
|
@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) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue