diff --git a/addons/portal/controllers/portal.py b/addons/portal/controllers/portal.py index dee90bfe88a..b85cb534360 100644 --- a/addons/portal/controllers/portal.py +++ b/addons/portal/controllers/portal.py @@ -186,6 +186,9 @@ class CustomerPortal(Controller): }) if post and request.httprequest.method == 'POST': + if not partner.can_edit_vat(): + post['country_id'] = str(partner.country_id.id) + error, error_message = self.details_form_validate(post) values.update({'error': error, 'error_message': error_message}) values.update(post) diff --git a/addons/portal/static/tests/tours/portal.js b/addons/portal/static/tests/tours/portal.js index b2ef4fbc0e3..8da1a1b0330 100644 --- a/addons/portal/static/tests/tours/portal.js +++ b/addons/portal/static/tests/tours/portal.js @@ -14,6 +14,20 @@ registry.category("web_tour.tours").add('portal_load_homepage', { content: "Load my account details", trigger: 'input[value="Joel Willis"]', isCheck: true, + }, + { + content: 'type a different phone number', + trigger: 'input[name="phone"]', + run: 'text +1 555 666 7788', + }, + { + content: "Submit the form", + trigger: 'button[type=submit]', + }, + { + content: "Check that we are back on the portal", + trigger: 'a[href*="/my/account"]:contains("Edit"):first', + isCheck: true, } ] }); diff --git a/addons/portal/tests/test_tours.py b/addons/portal/tests/test_tours.py index 5f9d9802aa1..522921e2576 100644 --- a/addons/portal/tests/test_tours.py +++ b/addons/portal/tests/test_tours.py @@ -9,3 +9,9 @@ from odoo.tests import tagged class TestUi(HttpCaseWithUserPortal): def test_01_portal_load_tour(self): self.start_tour("/", 'portal_load_homepage', login="portal") + + def test_02_portal_load_tour_cant_edit_vat(self): + willis = self.env.ref('base.demo_user0') + willis.parent_id = self.env.ref('base.partner_demo').id + self.start_tour("/", 'portal_load_homepage', login="portal") + self.assertEqual(willis.phone, "+1 555 666 7788")