Browse Source

[REF] compute method start with _compute

pull/84/head
robin.keunen 4 years ago
parent
commit
dbf1bf79db
  1. 4
      easy_my_coop/models/company.py
  2. 4
      easy_my_coop/models/coop.py
  3. 5
      easy_my_coop/tests/test_emc.py

4
easy_my_coop/models/company.py

@ -9,7 +9,7 @@ from odoo import api, fields, models
class ResCompany(models.Model):
_inherit = "res.company"
def _get_base_logo(self):
def _compute_base_logo(self):
base_url = (
self.env["ir.config_parameter"].sudo().get_param("web.base.url")
)
@ -58,7 +58,7 @@ class ResCompany(models.Model):
display_logo2 = fields.Boolean(string="Display logo 2")
bottom_logo1 = fields.Binary(string="Bottom logo 1")
bottom_logo2 = fields.Binary(string="Bottom logo 2")
logo_url = fields.Char(string="logo url", compute="_get_base_logo")
logo_url = fields.Char(string="logo url", compute="_compute_base_logo")
display_data_policy_approval = fields.Boolean(
help="Choose to display a data policy checkbox on the cooperator"
" website form."

4
easy_my_coop/models/coop.py

@ -126,7 +126,7 @@ class SubscriptionRequest(models.Model):
@api.multi
@api.depends("iban", "skip_control_ng")
def _validated_lines(self):
def _compute_validated_lines(self):
for sub_request in self:
validated = sub_request.skip_control_ng or self.check_iban(
sub_request.iban
@ -284,7 +284,7 @@ class SubscriptionRequest(models.Model):
user_id = fields.Many2one("res.users", string="Responsible", readonly=True)
# todo rename to valid_subscription_request
validated = fields.Boolean(
compute="_validated_lines",
compute="_compute_validated_lines",
string="Valid Subscription request?",
readonly=True,
)

5
easy_my_coop/tests/test_emc.py

@ -2,8 +2,9 @@
# Robin Keunen <robin@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo.fields import Date
from odoo.exceptions import AccessError
from odoo.fields import Date
from .test_base import EMCBaseCase
@ -174,7 +175,7 @@ class EMCCase(EMCBaseCase):
share_type.list_price = 30
share_type.unlink()
def test_validated_lines_on_subscription_request(self):
def test_compute_validated_lines_on_subscription_request(self):
request = self.request
request.skip_control_ng = False

Loading…
Cancel
Save