[FIX] portal: allow portal user to change their contact details
A Portal User (PU) cannot edit his contact details once they are logged in. Step to reproduce the issue: - Go to the Contact module - Create a new contact (as an individual) and link him with a company - From the newly created contact, click on Action > Grant Portal Access - Retrieve the registration link of the newly created user by going to Settings > Users & Companies > Users. You will find the new user when removing the default Internal Users filter. - From the Portal main page, go to the contact details and update some field (e.g. the phone number). Upon submission, you will get an error related to the edition of the company_name while no change was done. Solution: In a previous commit [1], a change was done on the `company_name` input. This modification changed the JSON that was sent upon form submission. Indeed, previously the `company_name` field was not sent (thanks to a <p>) but now this field is sent, causing an error. To mimic the <p> behavior and keeping the idea of the first change, the attribute "disabled" was used in the input, allowing to not send this field upon form submission. [1]: https://github.com/odoo/odoo/commit/beb50e8047f4dbe148933edd52cceadb2d5cccde opw-2754584 closes odoo/odoo#89740 X-original-commit: d3912aad67e5a519df3b355e962ce9d2e7894133 Signed-off-by: Romain Derie (rde) <rde@odoo.com> Signed-off-by: Desausoi Laurent (lade) <lade@odoo.com>
This commit is contained in:
committed by
Romain Derie
parent
948ce9a1f5
commit
c8eb6615d4
@@ -376,17 +376,20 @@
|
||||
<div class="clearfix" />
|
||||
<div t-attf-class="form-group mb-1 #{error.get('company_name') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label label-optional" for="company_name">Company Name</label>
|
||||
<!-- The <input> is replace by a <p> to avoid sending an unauthorized value on form submit.
|
||||
<!-- The <input> use "disabled" attribute to avoid sending an unauthorized value on form submit.
|
||||
The user might not have rights to change company_name but should still be able to see it.
|
||||
-->
|
||||
<input type="text" name="company_name" t-attf-class="form-control #{error.get('company_name') and 'is-invalid' or ''}" t-att-value="company_name or partner.commercial_company_name" t-att-readonly="None if partner_can_edit_vat else '1'" />
|
||||
<input type="text" name="company_name" t-attf-class="form-control #{error.get('company_name') and 'is-invalid' or ''}" t-att-value="company_name or partner.commercial_company_name" t-att-disabled="None if partner_can_edit_vat else '1'" />
|
||||
<small t-if="not partner_can_edit_vat" class="form-text text-muted d-block d-xl-none">
|
||||
Changing company name is not allowed once document(s) have been issued for your account. Please contact us directly for this operation.
|
||||
</small>
|
||||
</div>
|
||||
<div t-attf-class="form-group mb-1 #{error.get('vat') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label label-optional" for="vat">VAT Number</label>
|
||||
<input type="text" name="vat" t-attf-class="form-control #{error.get('vat') and 'is-invalid' or ''}" t-att-value="vat or partner.vat" t-att-readonly="None if partner_can_edit_vat else '1'" />
|
||||
<!-- The <input> use "disabled" attribute to avoid sending an unauthorized value on form submit.
|
||||
The user might not have rights to change company_name but should still be able to see it.
|
||||
-->
|
||||
<input type="text" name="vat" t-attf-class="form-control #{error.get('vat') and 'is-invalid' or ''}" t-att-value="vat or partner.vat" t-att-disabled="None if partner_can_edit_vat else '1'" />
|
||||
<small t-if="not partner_can_edit_vat" class="form-text text-muted d-block d-xl-none">Changing VAT number is not allowed once document(s) have been issued for your account. Please contact us directly for this operation.</small>
|
||||
</div>
|
||||
<div t-if="not partner_can_edit_vat" class="col-12 d-none d-xl-block">
|
||||
|
||||
Reference in New Issue
Block a user