[FIX] portal: fix submitting /my/account when can't edit VAT
Since 1be6866b15, when VAT can't be
edited, the country_id select field is disabled.
Disabled fields aren't submitted in the POST query, which causes an
error `Some required fields are empty`, with the Country field being
highlighted even if a value is selected.
With this commit, when the user cannot edit their country, the value is
forced into the POST data so that it is found.
closes odoo/odoo#150909
Signed-off-by: Paul Morelle (pmo) <pmo@odoo.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user