[FIX] web: add missing input type in props

Before this commit, when the user edits a float time field a border
is displayed instead of having the same style then the others fields
(float, integer, etc). The reason is a style is added (`outline: none;`)
on input with `type="text"` but the type is missing on the input tag of
float time field component.

This commit adds a prop `inputType` and by default is `text` the others
fields component and this prop is used to define the type on the input
inside the template of float time component.

Issue found in task-3000757

closes odoo/odoo#116629

X-original-commit: 8ec5f7eb73844daf278b3f2aafa73dd0d65ec59c
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Xavier Bol (xbo)
2023-03-26 00:08:59 +01:00
parent 4b3a8b4f7a
commit dd77374b47
2 changed files with 7 additions and 2 deletions
@@ -14,8 +14,12 @@ export class FloatTimeField extends Component {
static template = "web.FloatTimeField";
static props = {
...standardFieldProps,
inputType: { type: String, optional: true },
placeholder: { type: String, optional: true },
};
static defaultProps = {
inputType: "text",
};
setup() {
useInputField({
@@ -36,7 +40,8 @@ export const floatTimeField = {
displayName: _lt("Time"),
supportedTypes: ["float"],
isEmpty: () => false,
extractProps: ({ attrs }) => ({
extractProps: ({ attrs, options }) => ({
inputType: options.type,
placeholder: attrs.placeholder,
}),
};
@@ -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-ref="numpadDecimal" t-att-placeholder="props.placeholder" inputmode="numeric" class="o_input" />
<input t-else="" t-att-id="props.id" t-att-type="props.inputType" t-ref="numpadDecimal" t-att-placeholder="props.placeholder" inputmode="numeric" class="o_input" />
</t>
</templates>