Skip to content

Commit

Permalink
[FIX] partner_tier_validation: Allow to open view_partner_simple_form
Browse files Browse the repository at this point in the history
Caused by: EvalError: Can not evaluate python expression: (bool(bool(review_ids)))
    Error: Name 'review_ids' is not defined
    EvalError: Can not evaluate python expression: (bool(bool(review_ids)))
    Error: Name 'review_ids' is not defined
  • Loading branch information
rven committed Sep 4, 2024
1 parent 271a8bc commit dcc4dd3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions partner_tier_validation/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,8 @@ def write(self, vals):
if "stage_id" in vals and vals.get("stage_id") in self._state_from:
self.restart_validation()
return res

def _get_tier_validation_readonly_domain(self):
if self.env.context.get("form_view_ref") == "base.view_partner_simple_form":
return ""
return super()._get_tier_validation_readonly_domain()
9 changes: 8 additions & 1 deletion partner_tier_validation/tests/test_tier_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo.exceptions import ValidationError
from odoo.tests import common, tagged
from odoo.tests import Form, common, tagged


@tagged("-at_install", "post_install")
Expand Down Expand Up @@ -82,6 +82,13 @@ def test_validation_res_partner(self):
self.assertEqual(
contact.state, "draft", "Change company type sets back to draft"
)
with Form(contact) as c:
c.name = "Company for test - Update"
with Form(
contact.with_context(form_view_ref="base.view_partner_simple_form"),
view="base.view_partner_simple_form",
) as c:
c.email = "test@company.test"

def test_no_validation_res_partner(self):
"""
Expand Down

0 comments on commit dcc4dd3

Please sign in to comment.