Browse Source

[FIX] emc_loan: bypass rules cof computed fields

pull/51/head^2
robin.keunen 5 years ago
parent
commit
ae245cdae9
  1. 6
      easy_my_coop_loan/models/partner.py

6
easy_my_coop_loan/models/partner.py

@ -1,5 +1,6 @@
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine BAKKALI <houssine@coopiteasy.be>
# Robin Keunen <robin@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models, api
@ -23,7 +24,8 @@ class ResPartner(models.Model):
@api.depends("loan_line_ids", "loan_line_ids.state")
def _compute_is_loaner(self):
for partner in self:
loans = partner.loan_line_ids.filtered(
sudo_partner = partner.sudo()
loans = sudo_partner.loan_line_ids.filtered(
lambda l: l.state in ["subscribed", "waiting", "paid"]
)
partner.is_loaner = bool(loans)
sudo_partner.is_loaner = bool(loans)
Loading…
Cancel
Save