[FIX] web: allow to use the hour:minute on mobile for FloatTimeField

Steps to reproduce
==================

- Use an android phone
- Go to Timesheets
- Click on Add a line
- Click on the Hours Spent input

The keyboard is missing the colon `:` symbol

It is then only possible the enter a time in the float format.

Cause of the issue
==================

The inputmode=decimal attribute prevents a user from entering a `:`
symbol

Note that this doesn't happen on IOS, since the inputmode is ignored for
other reasons.

opw-3278089

closes odoo/odoo#120824

X-original-commit: 8b919ae51d7deb34169b7c6970964056ef2eb632
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
This commit is contained in:
Hubert Van de Walle (huvw)
2023-05-09 07:08:51 +02:00
parent 0bcd364def
commit 7d26f9e4b9
2 changed files with 16 additions and 1 deletions
@@ -3,7 +3,7 @@
<t t-name="web.FloatTimeField" owl="1">
<span t-if="props.readonly" t-esc="formattedValue" />
<input t-else="" t-att-id="props.id" t-att-type="props.inputType" t-ref="numpadDecimal" t-att-placeholder="props.placeholder" inputmode="decimal" class="o_input" />
<input t-else="" t-att-id="props.id" t-att-type="props.inputType" t-ref="numpadDecimal" t-att-placeholder="props.placeholder" class="o_input" />
</t>
</templates>
@@ -176,4 +176,19 @@ QUnit.module("Fields", (hooks) => {
"Placeholder"
);
});
QUnit.test("float_time field does not have an inputmode attribute", async function (assert) {
await makeView({
serverData,
type: "form",
resModel: "partner",
arch: `
<form>
<field name="qux" widget="float_time" placeholder="Placeholder"/>
</form>`,
});
const input = target.querySelector(".o_field_widget[name='qux'] input");
assert.notOk(input.attributes.inputMode);
});
});