Skip to content

Commit

Permalink
[FIX] base: prevent iOS Safari schema parsing issue
Browse files Browse the repository at this point in the history
Versions
--------
- 16.0+

Steps
-----
For 17.0+:
1. Create a Sale Order for a new contact without phone number;
2. disable online signature;
3. add a deliverable product to the SO;
4. hit "Send by Email";
5. open the sent mail (e.g. via Mailhog);
6. copy the payment link;
7. open in Safari on iOS;
8. pay the sales order.

Issue
-----
> TypeError: Attempted to assign to readonly property.
>   extractFilteredSchemaValuesFromMicroData@https...
>   extractSchemaValuesFromSchemaOrg@https...
>   global code@https...

Cause
-----
`extractFilteredSchemaValuesFromMicroData` is a function internal to iOS
Safari. It is bugged in that it tries to reassign a `const` in some
scenarios where no elements with `itemprop="telephone"` attributes are
found.

Solution
--------
If the contact doesn't have a mobile or phone number, add an empty `div`
with `itemprop="telephone"`.

opw-4072838

closes odoo#187380

X-original-commit: f2406e2
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
Signed-off-by: Levi Siuzdak <sile@odoo.com>
  • Loading branch information
lvsz committed Nov 15, 2024
1 parent 2a5463e commit 95d8ab1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions odoo/addons/base/views/ir_qweb_widget_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
<div class="d-flex align-items-center gap-1" t-if="mobile and 'mobile' in fields">
<i t-if="not options.get('no_marker') or options.get('phone_icons')" class='fa fa-mobile fa-fw' role="img" aria-label="Mobile" title="Mobile"/> <span class="o_force_ltr" itemprop="telephone" t-esc="mobile"/>
</div>
<!-- Prevent issue with iOS Safari parsing of schema data without telephone itemprops -->
<div t-elif="not (phone and 'phone' in fields)" itemprop="telephone"/>
<div class="d-flex align-items-center gap-1" t-if="website and 'website' in fields">
<i t-if="not options.get('no_marker')" class='fa fa-globe fa-fw' role="img" aria-label="Website" title="Website"/>
<a t-att-href="website and '%s%s' % ('http://' if '://' not in website else '',website)"><span itemprop="website" t-esc="website"/></a>
Expand Down

0 comments on commit 95d8ab1

Please sign in to comment.