Skip to content
Snippets Groups Projects
Commit e92bbec3 authored by Touati Djamel (otd)'s avatar Touati Djamel (otd)
Browse files

[FIX] mrp: allow overviewing of bom with decimal quantity


Steps to reproduce the bug:
- Create a storable product with BoM:
    - add any product as component
    - save
    - Click on the BoM overview widget
    - Change the quantity of a BOM with a number that has a decimal
        value.

Problem:
The quantity is converted to an integer because this input does not
accept a decimal value.

opw-3288403

closes odoo/odoo#121801

Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
parent 1bd871f8
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,9 @@
changeWarehouse.bind="onChangeWarehouse"
changeVariant.bind="onChangeVariant"
changeBomQuantity.bind="onChangeBomQuantity"
changeDisplay.bind="onChangeDisplay"/>
changeDisplay.bind="onChangeDisplay"
precision="state.precision"
/>
<BomOverviewTable
uomName="uomName"
......
......@@ -4,6 +4,7 @@ import { ControlPanel } from "@web/search/control_panel/control_panel";
import { BomOverviewDisplayFilter } from "../bom_overview_display_filter/mrp_bom_overview_display_filter";
import { Dropdown } from "@web/core/dropdown/dropdown";
import { DropdownItem } from "@web/core/dropdown/dropdown_item";
import { formatFloat } from "@web/views/fields/formatters";
const { Component } = owl;
......@@ -17,7 +18,7 @@ export class BomOverviewControlPanel extends Component {
//---- Handlers ----
updateQuantity(ev) {
const newVal = isNaN(ev.target.value) ? 1 : parseInt(ev.target.value);
const newVal = isNaN(ev.target.value) ? 1 : parseFloat(formatFloat(parseFloat(ev.target.value), { digits: [false, this.precision] }));
this.props.changeBomQuantity(newVal);
}
......@@ -31,6 +32,10 @@ export class BomOverviewControlPanel extends Component {
clickUnfold() {
this.env.overviewBus.trigger("unfold-all");
}
get precision() {
return this.props.precision;
}
}
BomOverviewControlPanel.template = "mrp.BomOverviewControlPanel";
......@@ -54,6 +59,7 @@ BomOverviewControlPanel.props = {
changeVariant: Function,
changeBomQuantity: Function,
changeDisplay: Function,
precision: Number,
};
BomOverviewControlPanel.defaultProps = {
variants: {},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment