diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml
index 41a6360020d..2dd1d21b559 100644
--- a/addons/product/product_view.xml
+++ b/addons/product/product_view.xml
@@ -429,8 +429,8 @@
-
--
+
+-
diff --git a/addons/product/static/src/js/product.js b/addons/product/static/src/js/product.js
index 6cf2efe8da4..0b68f6290df 100644
--- a/addons/product/static/src/js/product.js
+++ b/addons/product/static/src/js/product.js
@@ -4,17 +4,16 @@ instance.web.form.FieldUOMFactor = instance.web.form.FieldFloat.extend({
template: "FieldUOMFactor",
init: function() {
this._super.apply(this, arguments);
- this.set({"category": false, 'name': false});
- if (this.options.category_field) {
- this.field_manager.on("field_changed:" + this.options.category_field, this, function() {
- this.set({"category": this.field_manager.get_field_value(this.options.category_field)});
- });
- }
- if (this.options.name_field) {
- this.field_manager.on("field_changed:" + this.options.name_field, this, function() {
- this.set({"name": this.field_manager.get_field_value(this.options.name_field)});
- });
- }
+ this.set({"category": false, 'name': false, 'uom_type': false});
+ this.field_manager.on("field_changed:category_id", this, function() {
+ this.set({"category": this.field_manager.get_field_value("category_id")});
+ });
+ this.field_manager.on("field_changed:name", this, function() {
+ this.set({"name": this.field_manager.get_field_value("name")});
+ });
+ this.field_manager.on("field_changed:uom_type", this, function() {
+ this.set({"uom_type": this.field_manager.get_field_value("uom_type")});
+ });
this.on("change:category", this, this.get_uom_reference);
this.get_uom_reference();
this.ci_dm = new instance.web.DropMisordered();
@@ -23,6 +22,7 @@ instance.web.form.FieldUOMFactor = instance.web.form.FieldFloat.extend({
var tmp = this._super();
this.on("change:uom_reference", this, this.reinitialize);
this.on("change:name", this, this.reinitialize);
+ this.on("change:uom_type", this, this.reinitialize);
return tmp;
},
get_uom_reference: function() {
@@ -39,8 +39,6 @@ instance.web.form.FieldUOMFactor = instance.web.form.FieldFloat.extend({
parse_value: function(val, def) {
return instance.web.parse_value(val, {type: "float"}, def);
},
- format_value: function(val, def) {
- return instance.web.format_value(val, {type: "float"}, def);
- },
+
});
}
diff --git a/addons/product/static/src/xml/product.xml b/addons/product/static/src/xml/product.xml
index 6eab4d9c899..8bfa6ee1b64 100644
--- a/addons/product/static/src/xml/product.xml
+++ b/addons/product/static/src/xml/product.xml
@@ -5,10 +5,17 @@
- 1 =
+
+ 1 =
+
+
+
+ = 1
+
+