diff --git a/partner_tier_validation/models/res_partner.py b/partner_tier_validation/models/res_partner.py index 3b303bf4b4e..2d50cbedf05 100644 --- a/partner_tier_validation/models/res_partner.py +++ b/partner_tier_validation/models/res_partner.py @@ -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() diff --git a/partner_tier_validation/tests/test_tier_validation.py b/partner_tier_validation/tests/test_tier_validation.py index 17cbd5e4e68..c707ac43b94 100644 --- a/partner_tier_validation/tests/test_tier_validation.py +++ b/partner_tier_validation/tests/test_tier_validation.py @@ -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") @@ -77,11 +77,16 @@ def test_validation_res_partner(self): ) self.assertEqual(contact.state, "confirmed") - # Change company type to retrigger validation + # Change company type to trigger validation contact.write({"company_type": "person"}) self.assertEqual( contact.state, "draft", "Change company type sets back to draft" ) + 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): """