Bugs are tracked on GitHub Issues.
+In case of trouble, please check there if your issue has already been reported.
+If you spotted it first, help us smashing it by providing a detailed and welcomed
+feedback.
+
Do not contact contributors directly about support or help with technical issues.
OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback.
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback.
diff --git a/product_logistics_uom/views/res_config_settings.xml b/product_logistics_uom/views/res_config_settings.xml
index 02da028540a..fdbeab05683 100644
--- a/product_logistics_uom/views/res_config_settings.xml
+++ b/product_logistics_uom/views/res_config_settings.xml
@@ -14,7 +14,7 @@
1
-
+
From 5f2643c0347ecc3bf457de6447c149e5992fa40a Mon Sep 17 00:00:00 2001
From: Maria Sparenberg
Date: Fri, 4 Nov 2022 12:12:05 +0000
Subject: [PATCH 08/32] Added translation using Weblate (German)
---
product_logistics_uom/i18n/de.po | 85 ++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
create mode 100644 product_logistics_uom/i18n/de.po
diff --git a/product_logistics_uom/i18n/de.po b/product_logistics_uom/i18n/de.po
new file mode 100644
index 00000000000..e4b7314bc8c
--- /dev/null
+++ b/product_logistics_uom/i18n/de.po
@@ -0,0 +1,85 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * product_logistics_uom
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 16.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: de\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+
+#. module: product_logistics_uom
+#: model:ir.model,name:product_logistics_uom.model_res_config_settings
+msgid "Config Settings"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_res_config_settings__product_default_length_uom_id
+msgid "Default Length Unit of Measure"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_res_config_settings__product_default_volume_uom_id
+msgid "Default Volume Unit of Measure"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_res_config_settings__product_default_weight_uom_id
+msgid "Default Weight Unit of Measure"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_res_config_settings__product_default_length_uom_id
+msgid "Default unit of measure to express product length"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_res_config_settings__product_default_volume_uom_id
+msgid "Default unit of measure to express product volume"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_res_config_settings__product_default_weight_uom_id
+msgid "Default unit of measure to express product weight"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model,name:product_logistics_uom.model_product_template
+msgid "Product"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__product_uom_readonly
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__product_uom_readonly
+msgid "Product Uom Readonly"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_id
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume_uom_id
+msgid "Volume Unit of Measure"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_name
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume_uom_name
+msgid "Volume unit of measure label"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_id
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_id
+msgid "Weight Unit of Measure"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_name
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_name
+msgid "Weight unit of measure label"
+msgstr ""
From 53c20e5d7afd35f525c924fdccdd1edd73b2d8d3 Mon Sep 17 00:00:00 2001
From: Maria Sparenberg
Date: Fri, 4 Nov 2022 12:12:14 +0000
Subject: [PATCH 09/32] Translated using Weblate (German)
Currently translated at 76.9% (10 of 13 strings)
Translation: product-attribute-16.0/product-attribute-16.0-product_logistics_uom
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_logistics_uom/de/
---
product_logistics_uom/i18n/de.po | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/product_logistics_uom/i18n/de.po b/product_logistics_uom/i18n/de.po
index e4b7314bc8c..178a0c3210d 100644
--- a/product_logistics_uom/i18n/de.po
+++ b/product_logistics_uom/i18n/de.po
@@ -6,53 +6,55 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
-"Last-Translator: Automatically generated\n"
+"PO-Revision-Date: 2022-11-04 14:44+0000\n"
+"Last-Translator: Maria Sparenberg \n"
"Language-Team: none\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Generator: Weblate 4.14.1\n"
#. module: product_logistics_uom
#: model:ir.model,name:product_logistics_uom.model_res_config_settings
msgid "Config Settings"
-msgstr ""
+msgstr "Konfigurationseinstellungen"
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_res_config_settings__product_default_length_uom_id
msgid "Default Length Unit of Measure"
-msgstr ""
+msgstr "Standard-ME für Längen"
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_res_config_settings__product_default_volume_uom_id
msgid "Default Volume Unit of Measure"
-msgstr ""
+msgstr "Standard-ME für Volumen"
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_res_config_settings__product_default_weight_uom_id
msgid "Default Weight Unit of Measure"
-msgstr ""
+msgstr "Standard-ME für Gewicht"
#. module: product_logistics_uom
#: model:ir.model.fields,help:product_logistics_uom.field_res_config_settings__product_default_length_uom_id
msgid "Default unit of measure to express product length"
-msgstr ""
+msgstr "Dies ist die Standard-Mengeneinheit für Produktlängen."
#. module: product_logistics_uom
#: model:ir.model.fields,help:product_logistics_uom.field_res_config_settings__product_default_volume_uom_id
msgid "Default unit of measure to express product volume"
-msgstr ""
+msgstr "Dies ist die Standard-Mengeneinheit für Produktvolumen."
#. module: product_logistics_uom
#: model:ir.model.fields,help:product_logistics_uom.field_res_config_settings__product_default_weight_uom_id
msgid "Default unit of measure to express product weight"
-msgstr ""
+msgstr "Dies ist die Standard-Mengeneinheit für Produktgewichte."
#. module: product_logistics_uom
#: model:ir.model,name:product_logistics_uom.model_product_template
msgid "Product"
-msgstr ""
+msgstr "Produkt"
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__product_uom_readonly
@@ -64,7 +66,7 @@ msgstr ""
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_id
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume_uom_id
msgid "Volume Unit of Measure"
-msgstr ""
+msgstr "Volumen-ME"
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_name
@@ -76,7 +78,7 @@ msgstr ""
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_id
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_id
msgid "Weight Unit of Measure"
-msgstr ""
+msgstr "Gewicht-ME"
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_name
From eef8f7a602944f1982c331c617acbfe81735f557 Mon Sep 17 00:00:00 2001
From: Sebastiano Picchi
Date: Thu, 27 Apr 2023 09:50:03 +0000
Subject: [PATCH 10/32] Added translation using Weblate (Italian)
---
product_logistics_uom/i18n/it.po | 85 ++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
create mode 100644 product_logistics_uom/i18n/it.po
diff --git a/product_logistics_uom/i18n/it.po b/product_logistics_uom/i18n/it.po
new file mode 100644
index 00000000000..f9de110a826
--- /dev/null
+++ b/product_logistics_uom/i18n/it.po
@@ -0,0 +1,85 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * product_logistics_uom
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 16.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: it\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+
+#. module: product_logistics_uom
+#: model:ir.model,name:product_logistics_uom.model_res_config_settings
+msgid "Config Settings"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_res_config_settings__product_default_length_uom_id
+msgid "Default Length Unit of Measure"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_res_config_settings__product_default_volume_uom_id
+msgid "Default Volume Unit of Measure"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_res_config_settings__product_default_weight_uom_id
+msgid "Default Weight Unit of Measure"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_res_config_settings__product_default_length_uom_id
+msgid "Default unit of measure to express product length"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_res_config_settings__product_default_volume_uom_id
+msgid "Default unit of measure to express product volume"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_res_config_settings__product_default_weight_uom_id
+msgid "Default unit of measure to express product weight"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model,name:product_logistics_uom.model_product_template
+msgid "Product"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__product_uom_readonly
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__product_uom_readonly
+msgid "Product Uom Readonly"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_id
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume_uom_id
+msgid "Volume Unit of Measure"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_name
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume_uom_name
+msgid "Volume unit of measure label"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_id
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_id
+msgid "Weight Unit of Measure"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_name
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_name
+msgid "Weight unit of measure label"
+msgstr ""
From f615481d6f9c3ddaa1bc72e22e7a8143e490cf26 Mon Sep 17 00:00:00 2001
From: Sebastiano Picchi
Date: Thu, 27 Apr 2023 09:50:16 +0000
Subject: [PATCH 11/32] Translated using Weblate (Italian)
Currently translated at 100.0% (13 of 13 strings)
Translation: product-attribute-16.0/product-attribute-16.0-product_logistics_uom
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_logistics_uom/it/
---
product_logistics_uom/i18n/it.po | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/product_logistics_uom/i18n/it.po b/product_logistics_uom/i18n/it.po
index f9de110a826..6dc921fed8e 100644
--- a/product_logistics_uom/i18n/it.po
+++ b/product_logistics_uom/i18n/it.po
@@ -6,80 +6,82 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
-"Last-Translator: Automatically generated\n"
+"PO-Revision-Date: 2023-04-27 10:06+0000\n"
+"Last-Translator: Sebastiano Picchi \n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Generator: Weblate 4.14.1\n"
#. module: product_logistics_uom
#: model:ir.model,name:product_logistics_uom.model_res_config_settings
msgid "Config Settings"
-msgstr ""
+msgstr "Impostazioni di configurazione"
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_res_config_settings__product_default_length_uom_id
msgid "Default Length Unit of Measure"
-msgstr ""
+msgstr "Lunghezza di default Unità di Misura"
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_res_config_settings__product_default_volume_uom_id
msgid "Default Volume Unit of Measure"
-msgstr ""
+msgstr "Volume di default Unità di Misura"
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_res_config_settings__product_default_weight_uom_id
msgid "Default Weight Unit of Measure"
-msgstr ""
+msgstr "Peso di default Unità di Misura"
#. module: product_logistics_uom
#: model:ir.model.fields,help:product_logistics_uom.field_res_config_settings__product_default_length_uom_id
msgid "Default unit of measure to express product length"
-msgstr ""
+msgstr "Unità di misura di default per esprimere la lunghezza di prodotto"
#. module: product_logistics_uom
#: model:ir.model.fields,help:product_logistics_uom.field_res_config_settings__product_default_volume_uom_id
msgid "Default unit of measure to express product volume"
-msgstr ""
+msgstr "Unità di misura di default per esprimere il volume di prodotto"
#. module: product_logistics_uom
#: model:ir.model.fields,help:product_logistics_uom.field_res_config_settings__product_default_weight_uom_id
msgid "Default unit of measure to express product weight"
-msgstr ""
+msgstr "Unità di misura di default per esprimere il peso di prodotto"
#. module: product_logistics_uom
#: model:ir.model,name:product_logistics_uom.model_product_template
msgid "Product"
-msgstr ""
+msgstr "Prodotto"
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__product_uom_readonly
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__product_uom_readonly
msgid "Product Uom Readonly"
-msgstr ""
+msgstr "Prodotto Udm sola lettura"
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_id
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume_uom_id
msgid "Volume Unit of Measure"
-msgstr ""
+msgstr "Unità di misura del volume"
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_name
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume_uom_name
msgid "Volume unit of measure label"
-msgstr ""
+msgstr "Sigla per l'unità di misura del volume"
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_id
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_id
msgid "Weight Unit of Measure"
-msgstr ""
+msgstr "Unità di misura del peso"
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_name
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_name
msgid "Weight unit of measure label"
-msgstr ""
+msgstr "Sigla per l'unità di misura del peso"
From e715cc91474ff8b661ad456c4d06320744760f3e Mon Sep 17 00:00:00 2001
From: mymage
Date: Tue, 9 May 2023 11:32:34 +0000
Subject: [PATCH 12/32] Translated using Weblate (Italian)
Currently translated at 100.0% (13 of 13 strings)
Translation: product-attribute-16.0/product-attribute-16.0-product_logistics_uom
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_logistics_uom/it/
---
product_logistics_uom/i18n/it.po | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/product_logistics_uom/i18n/it.po b/product_logistics_uom/i18n/it.po
index 6dc921fed8e..7f499be7325 100644
--- a/product_logistics_uom/i18n/it.po
+++ b/product_logistics_uom/i18n/it.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
-"PO-Revision-Date: 2023-04-27 10:06+0000\n"
-"Last-Translator: Sebastiano Picchi \n"
+"PO-Revision-Date: 2023-05-09 13:37+0000\n"
+"Last-Translator: mymage \n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
@@ -72,7 +72,7 @@ msgstr "Unità di misura del volume"
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_name
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume_uom_name
msgid "Volume unit of measure label"
-msgstr "Sigla per l'unità di misura del volume"
+msgstr "Etichetta unità di misura volume"
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_id
@@ -84,4 +84,4 @@ msgstr "Unità di misura del peso"
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_name
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_name
msgid "Weight unit of measure label"
-msgstr "Sigla per l'unità di misura del peso"
+msgstr "Etichetta unità di misura peso"
From cb0f6674b393d5aed5c321ec91336b5e6fd36337 Mon Sep 17 00:00:00 2001
From: "Laurent Mignon (ACSONE)"
Date: Fri, 31 Mar 2023 19:45:39 +0200
Subject: [PATCH 13/32] [FIX] product_logistics_uom: Store value in system UOM
Before this change, the volume and weight values on product were no more stored into the expected kg and m3 uoms. To know the effective value you had to convert the value using the specified uom on the record. As side effect the arithmetic operations done on these fields in others addon as for exemple in 'delivery' were not correct.
This change restore the default behavior by always storing the values into the default uoms whatever the uom specified on the product. 2 new fields are added on the product to allows the user to see and managed these values in the specified uom. When values are updated through an update of these new fields, the new values are converted into the default uoms and the result stored into the original fields.
fixes #1312
---
product_logistics_uom/README.rst | 27 ++++
product_logistics_uom/__init__.py | 1 +
product_logistics_uom/__manifest__.py | 5 +-
product_logistics_uom/hooks.py | 119 +++++++++++++++++
product_logistics_uom/i18n/de.po | 115 ++++++++++++++++-
product_logistics_uom/i18n/es.po | 121 ++++++++++++++++--
product_logistics_uom/i18n/it.po | 120 ++++++++++++++++-
.../i18n/product_logistics_uom.pot | 105 ++++++++++++++-
.../migrations/16.0.2.0.0/post-migrate.py | 10 ++
product_logistics_uom/models/__init__.py | 1 +
.../models/product_product.py | 117 +++++++++++++++++
.../models/product_template.py | 97 +++++++++++++-
product_logistics_uom/readme/CONTRIBUTORS.rst | 1 +
product_logistics_uom/readme/DESCRIPTION.rst | 13 ++
product_logistics_uom/readme/USAGE.rst | 8 ++
.../static/description/index.html | 48 +++++--
product_logistics_uom/tests/__init__.py | 1 +
.../tests/test_product_logistics_uom.py | 113 ++++++++++++++++
product_logistics_uom/views/product.xml | 85 ++++++++++--
19 files changed, 1058 insertions(+), 49 deletions(-)
create mode 100644 product_logistics_uom/hooks.py
create mode 100644 product_logistics_uom/migrations/16.0.2.0.0/post-migrate.py
create mode 100644 product_logistics_uom/models/product_product.py
create mode 100644 product_logistics_uom/readme/USAGE.rst
create mode 100644 product_logistics_uom/tests/__init__.py
create mode 100644 product_logistics_uom/tests/test_product_logistics_uom.py
diff --git a/product_logistics_uom/README.rst b/product_logistics_uom/README.rst
index 4a298ac9962..5fa02164e20 100644
--- a/product_logistics_uom/README.rst
+++ b/product_logistics_uom/README.rst
@@ -33,6 +33,19 @@ Without this module, you only have the choice between Kg or Lb(s) and m³ for al
For some business cases, you need to express in more precise UoM than default ones like Liters
instead of M³.
+Even if you choose another UoM for the weight or volume, the system will still
+store the value for these fields in the Odoo default UoM (Kg or Lb(s) and m³).
+This ensures that the arithmetic operations on these fields are correct and
+consistent with the rest of the addons.
+
+Once this addon is installed values stored into the initial Volume and Weight fields
+on the product and product template models are no more rounded to the decimal
+precision defined for these fields. This could lead to some side effects into
+reportss where these fields are used. You can replace the fields by the new
+ones provided by this addon to avoid this problem (product_volume and product_weight).
+In any cases, since you use different UoM by product, you should most probably
+modify your reportss to display the right UoM.
+
**Table of contents**
.. contents::
@@ -57,6 +70,18 @@ To change on a specific product
#. Go the product form you can change the UoM directly.
+Usage
+=====
+
+Once installed and the 'Sell and purchase products in different units of measure'
+option is enabled, the 'Unit of Measure' field will become updatable on the
+'Product' form for users with the permission 'Manage Multiple Units of Measure'.
+
+If the displayed value is 0.00 and a warning icon is displayed in front of the
+unit of measure, it means that the value is too small to be displayed in the
+current unit of measure. You should change the unit of measure to a larger one
+to see the value.
+
Bug Tracker
===========
@@ -74,12 +99,14 @@ Authors
~~~~~~~
* Akretion
+* ACSONE SA/NV
Contributors
~~~~~~~~~~~~
* Raphaël Reverdy
* Fernando La Chica
+* Laurent Mignon
Other credits
~~~~~~~~~~~~~
diff --git a/product_logistics_uom/__init__.py b/product_logistics_uom/__init__.py
index 0650744f6bc..6d58305f5dd 100644
--- a/product_logistics_uom/__init__.py
+++ b/product_logistics_uom/__init__.py
@@ -1 +1,2 @@
from . import models
+from .hooks import pre_init_hook
diff --git a/product_logistics_uom/__manifest__.py b/product_logistics_uom/__manifest__.py
index 7cb7d00ff12..608c50d5f49 100644
--- a/product_logistics_uom/__manifest__.py
+++ b/product_logistics_uom/__manifest__.py
@@ -3,11 +3,11 @@
{
"name": "Product logistics UoM",
"summary": "Configure product weights and volume UoM",
- "version": "16.0.1.0.0",
+ "version": "16.0.3.0.0",
"development_status": "Beta",
"category": "Product",
"website": "https://github.com/OCA/product-attribute",
- "author": " Akretion, Odoo Community Association (OCA)",
+ "author": " Akretion, ACSONE SA/NV, Odoo Community Association (OCA)",
"maintainers": ["hparfr"],
"license": "AGPL-3",
"installable": True,
@@ -18,4 +18,5 @@
"views/res_config_settings.xml",
"views/product.xml",
],
+ "pre_init_hook": "pre_init_hook",
}
diff --git a/product_logistics_uom/hooks.py b/product_logistics_uom/hooks.py
new file mode 100644
index 00000000000..109611130ea
--- /dev/null
+++ b/product_logistics_uom/hooks.py
@@ -0,0 +1,119 @@
+# Copyright 2023 ACSONE SA
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
+
+import logging
+
+from odoo.tools import sql
+
+_logger = logging.getLogger(__name__)
+
+
+def pre_init_hook(cr): # pragma: nocover
+ """Recompute the volume and weight column on product and template
+ by converting the value from the uom defined on the product to the default uom
+ """
+ if sql.column_exists(cr, "product_template", "volume_uom_id"):
+ _logger.info("Recompute volume on product.product")
+ # get default m3 uom
+ cr.execute(
+ """
+ SELECT res_id
+ FROM ir_model_data
+ WHERE module = 'uom' AND name = 'product_uom_cubic_meter'
+ """
+ )
+ m3_uom_id = cr.fetchone()[0]
+ # get uom factor
+ cr.execute(
+ """
+ SELECT factor
+ FROM uom_uom
+ WHERE id = %s
+ """,
+ (m3_uom_id,),
+ )
+ m3_uom_factor = cr.fetchone()[0]
+ # update volume where volume_uom_id is not null and not m3
+ cr.execute(
+ """
+ UPDATE product_product
+ SET volume = product_product.volume / product_uom.factor * %s
+ FROM uom_uom product_uom,
+ product_template pt
+ WHERE product_uom.id = volume_uom_id
+ AND pt.id = product_product.product_tmpl_id
+ AND volume_uom_id IS NOT NULL AND pt.volume_uom_id != %s
+ """,
+ (m3_uom_factor, m3_uom_id),
+ )
+ _logger.info(f"{cr.rowcount} product_product rows updated")
+ # update product_template with 1 product_product
+ cr.execute(
+ """
+ UPDATE product_template
+ SET Volume = unique_product.volume
+ FROM (
+ SELECT product_tmpl_id, volume
+ FROM product_product
+ WHERE volume is not null
+ GROUP BY product_tmpl_id, volume
+ HAVING COUNT(*) = 1
+ ) unique_product
+ WHERE product_template.id = unique_product.product_tmpl_id
+ AND product_template.volume_uom_id != %s
+ """,
+ (m3_uom_id,),
+ )
+ _logger.info(f"{cr.rowcount} product_template rows updated")
+ if sql.column_exists(cr, "product_template", "weight_uom_id"):
+ _logger.info("Recompute weight on product.product")
+ # get default kg uom
+ cr.execute(
+ """
+ SELECT res_id
+ FROM ir_model_data
+ WHERE module = 'uom' AND name = 'product_uom_kgm'
+ """
+ )
+ kg_uom_id = cr.fetchone()[0]
+ # get uom factor
+ cr.execute(
+ """
+ SELECT factor
+ FROM uom_uom
+ WHERE id = %s
+ """,
+ (kg_uom_id,),
+ )
+ kg_uom_factor = cr.fetchone()[0]
+ # update weight where weight_uom_id is not null and not kg
+ cr.execute(
+ """
+ UPDATE product_product
+ SET weight = product_product.weight / product_uom.factor * %s
+ FROM uom_uom product_uom, product_template pt
+ WHERE product_uom.id = weight_uom_id
+ AND pt.id = product_product.product_tmpl_id
+ AND weight_uom_id IS NOT NULL AND pt.weight_uom_id != %s
+ """,
+ (kg_uom_factor, kg_uom_id),
+ )
+ _logger.info(f"{cr.rowcount} product_product rows updated")
+ # update product_template with 1 product_product
+ cr.execute(
+ """
+ UPDATE product_template
+ SET weight = unique_product.weight
+ FROM (
+ SELECT product_tmpl_id, weight
+ FROM product_product
+ WHERE volume is not null
+ GROUP BY product_tmpl_id, weight
+ HAVING COUNT(*) = 1
+ ) unique_product
+ WHERE product_template.id = unique_product.product_tmpl_id
+ AND product_template.weight_uom_id != %s
+ """,
+ (kg_uom_id,),
+ )
+ _logger.info(f"{cr.rowcount} product_template rows updated")
diff --git a/product_logistics_uom/i18n/de.po b/product_logistics_uom/i18n/de.po
index 178a0c3210d..9311a396d9a 100644
--- a/product_logistics_uom/i18n/de.po
+++ b/product_logistics_uom/i18n/de.po
@@ -16,6 +16,48 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.14.1\n"
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid ""
+"\n"
+" \n"
+" "
+msgstr ""
+
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid ""
+"\n"
+" \n"
+" "
+msgstr ""
+
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid ""
+"\n"
+" \n"
+" "
+msgstr ""
+
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid ""
+"\n"
+" \n"
+" "
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model,name:product_logistics_uom.model_res_config_settings
msgid "Config Settings"
@@ -51,15 +93,65 @@ msgstr "Dies ist die Standard-Mengeneinheit für Produktvolumen."
msgid "Default unit of measure to express product weight"
msgstr "Dies ist die Standard-Mengeneinheit für Produktgewichte."
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight
+msgid "Gross Weight"
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model,name:product_logistics_uom.model_product_template
msgid "Product"
msgstr "Produkt"
#. module: product_logistics_uom
-#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__product_uom_readonly
-#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__product_uom_readonly
-msgid "Product Uom Readonly"
+#: model:ir.model,name:product_logistics_uom.model_product_product
+msgid "Product Variant"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__show_volume_uom_warning
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__show_volume_uom_warning
+msgid "Show Volume Uom Warning"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__show_weight_uom_warning
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__show_weight_uom_warning
+msgid "Show Weight Uom Warning"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_product_product__show_volume_uom_warning
+#: model:ir.model.fields,help:product_logistics_uom.field_product_template__show_volume_uom_warning
+msgid ""
+"Technical field used to warn the user to change the volumeuom since the "
+"value for product_volume is too small and has beenrounded."
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_product_product__show_weight_uom_warning
+#: model:ir.model.fields,help:product_logistics_uom.field_product_template__show_weight_uom_warning
+msgid ""
+"Technical field used to warn the user to change the weightuom since the "
+"value for product_weight is too small and has beenrounded."
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_product_product__product_volume
+msgid "The volume in the product's volume UOM."
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_product_product__product_weight
+msgid "The weight in the product's weight UOM."
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid "Volume"
msgstr ""
#. module: product_logistics_uom
@@ -68,18 +160,35 @@ msgstr ""
msgid "Volume Unit of Measure"
msgstr "Volumen-ME"
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__product_volume
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__product_volume
+msgid "Volume in product UOM"
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_name
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume_uom_name
msgid "Volume unit of measure label"
msgstr ""
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid "Weight"
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_id
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_id
msgid "Weight Unit of Measure"
msgstr "Gewicht-ME"
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__product_weight
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__product_weight
+msgid "Weight in product UOM"
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_name
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_name
diff --git a/product_logistics_uom/i18n/es.po b/product_logistics_uom/i18n/es.po
index fbdfc542191..65dd030b724 100644
--- a/product_logistics_uom/i18n/es.po
+++ b/product_logistics_uom/i18n/es.po
@@ -16,6 +16,48 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.10\n"
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid ""
+"\n"
+" \n"
+" "
+msgstr ""
+
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid ""
+"\n"
+" \n"
+" "
+msgstr ""
+
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid ""
+"\n"
+" \n"
+" "
+msgstr ""
+
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid ""
+"\n"
+" \n"
+" "
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model,name:product_logistics_uom.model_res_config_settings
msgid "Config Settings"
@@ -51,35 +93,102 @@ msgstr "Unidad de medida del volumen del producto predeterminada"
msgid "Default unit of measure to express product weight"
msgstr "Unidad de medida del peso del producto predeterminada"
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight
+msgid "Gross Weight"
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model,name:product_logistics_uom.model_product_template
msgid "Product"
msgstr "Producto"
#. module: product_logistics_uom
-#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__product_uom_readonly
-#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__product_uom_readonly
-msgid "Product Uom Readonly"
+#: model:ir.model,name:product_logistics_uom.model_product_product
+msgid "Product Variant"
msgstr ""
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__show_volume_uom_warning
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__show_volume_uom_warning
+msgid "Show Volume Uom Warning"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__show_weight_uom_warning
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__show_weight_uom_warning
+msgid "Show Weight Uom Warning"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_product_product__show_volume_uom_warning
+#: model:ir.model.fields,help:product_logistics_uom.field_product_template__show_volume_uom_warning
+msgid ""
+"Technical field used to warn the user to change the volumeuom since the "
+"value for product_volume is too small and has beenrounded."
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_product_product__show_weight_uom_warning
+#: model:ir.model.fields,help:product_logistics_uom.field_product_template__show_weight_uom_warning
+msgid ""
+"Technical field used to warn the user to change the weightuom since the "
+"value for product_weight is too small and has beenrounded."
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_product_product__product_volume
+msgid "The volume in the product's volume UOM."
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_product_product__product_weight
+msgid "The weight in the product's weight UOM."
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid "Volume"
+msgstr "Volumen"
+
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_id
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume_uom_id
msgid "Volume Unit of Measure"
msgstr "Unidad de medida de volumen"
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__product_volume
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__product_volume
+msgid "Volume in product UOM"
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_name
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume_uom_name
msgid "Volume unit of measure label"
msgstr "Etiqueta de unidad de medida de volumen"
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid "Weight"
+msgstr "Peso"
+
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_id
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_id
msgid "Weight Unit of Measure"
msgstr "Unidad de medida del peso"
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__product_weight
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__product_weight
+msgid "Weight in product UOM"
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_name
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_name
@@ -98,11 +207,5 @@ msgstr "Etiqueta de unidad de medida del peso"
#~ msgid "The weight of the contents, not including any packaging, etc."
#~ msgstr "El peso de los contenidos, sin incluir ningún embalaje, etc."
-#~ msgid "Volume"
-#~ msgstr "Volumen"
-
#~ msgid "Volume Measurement"
#~ msgstr "Medición de volumen"
-
-#~ msgid "Weight"
-#~ msgstr "Peso"
diff --git a/product_logistics_uom/i18n/it.po b/product_logistics_uom/i18n/it.po
index 7f499be7325..7b5588aa9f1 100644
--- a/product_logistics_uom/i18n/it.po
+++ b/product_logistics_uom/i18n/it.po
@@ -16,6 +16,48 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.14.1\n"
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid ""
+"\n"
+" \n"
+" "
+msgstr ""
+
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid ""
+"\n"
+" \n"
+" "
+msgstr ""
+
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid ""
+"\n"
+" \n"
+" "
+msgstr ""
+
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid ""
+"\n"
+" \n"
+" "
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model,name:product_logistics_uom.model_res_config_settings
msgid "Config Settings"
@@ -51,16 +93,66 @@ msgstr "Unità di misura di default per esprimere il volume di prodotto"
msgid "Default unit of measure to express product weight"
msgstr "Unità di misura di default per esprimere il peso di prodotto"
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight
+msgid "Gross Weight"
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model,name:product_logistics_uom.model_product_template
msgid "Product"
msgstr "Prodotto"
#. module: product_logistics_uom
-#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__product_uom_readonly
-#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__product_uom_readonly
-msgid "Product Uom Readonly"
-msgstr "Prodotto Udm sola lettura"
+#: model:ir.model,name:product_logistics_uom.model_product_product
+msgid "Product Variant"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__show_volume_uom_warning
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__show_volume_uom_warning
+msgid "Show Volume Uom Warning"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__show_weight_uom_warning
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__show_weight_uom_warning
+msgid "Show Weight Uom Warning"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_product_product__show_volume_uom_warning
+#: model:ir.model.fields,help:product_logistics_uom.field_product_template__show_volume_uom_warning
+msgid ""
+"Technical field used to warn the user to change the volumeuom since the "
+"value for product_volume is too small and has beenrounded."
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_product_product__show_weight_uom_warning
+#: model:ir.model.fields,help:product_logistics_uom.field_product_template__show_weight_uom_warning
+msgid ""
+"Technical field used to warn the user to change the weightuom since the "
+"value for product_weight is too small and has beenrounded."
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_product_product__product_volume
+msgid "The volume in the product's volume UOM."
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_product_product__product_weight
+msgid "The weight in the product's weight UOM."
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid "Volume"
+msgstr ""
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_id
@@ -68,20 +160,40 @@ msgstr "Prodotto Udm sola lettura"
msgid "Volume Unit of Measure"
msgstr "Unità di misura del volume"
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__product_volume
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__product_volume
+msgid "Volume in product UOM"
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_name
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume_uom_name
msgid "Volume unit of measure label"
msgstr "Etichetta unità di misura volume"
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid "Weight"
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_id
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_id
msgid "Weight Unit of Measure"
msgstr "Unità di misura del peso"
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__product_weight
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__product_weight
+msgid "Weight in product UOM"
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_name
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_name
msgid "Weight unit of measure label"
msgstr "Etichetta unità di misura peso"
+
+#~ msgid "Product Uom Readonly"
+#~ msgstr "Prodotto Udm sola lettura"
diff --git a/product_logistics_uom/i18n/product_logistics_uom.pot b/product_logistics_uom/i18n/product_logistics_uom.pot
index 9a0c30e4a8c..69897a26617 100644
--- a/product_logistics_uom/i18n/product_logistics_uom.pot
+++ b/product_logistics_uom/i18n/product_logistics_uom.pot
@@ -13,6 +13,38 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid ""
+"\n"
+" \n"
+" "
+msgstr ""
+
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid ""
+"\n"
+" \n"
+" "
+msgstr ""
+
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid ""
+"\n"
+" \n"
+" "
+msgstr ""
+
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid ""
+"\n"
+" \n"
+" "
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model,name:product_logistics_uom.model_res_config_settings
msgid "Config Settings"
@@ -48,15 +80,65 @@ msgstr ""
msgid "Default unit of measure to express product weight"
msgstr ""
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight
+msgid "Gross Weight"
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model,name:product_logistics_uom.model_product_template
msgid "Product"
msgstr ""
#. module: product_logistics_uom
-#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__product_uom_readonly
-#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__product_uom_readonly
-msgid "Product Uom Readonly"
+#: model:ir.model,name:product_logistics_uom.model_product_product
+msgid "Product Variant"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__show_volume_uom_warning
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__show_volume_uom_warning
+msgid "Show Volume Uom Warning"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__show_weight_uom_warning
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__show_weight_uom_warning
+msgid "Show Weight Uom Warning"
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_product_product__show_volume_uom_warning
+#: model:ir.model.fields,help:product_logistics_uom.field_product_template__show_volume_uom_warning
+msgid ""
+"Technical field used to warn the user to change the volumeuom since the "
+"value for product_volume is too small and has beenrounded."
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_product_product__show_weight_uom_warning
+#: model:ir.model.fields,help:product_logistics_uom.field_product_template__show_weight_uom_warning
+msgid ""
+"Technical field used to warn the user to change the weightuom since the "
+"value for product_weight is too small and has beenrounded."
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_product_product__product_volume
+msgid "The volume in the product's volume UOM."
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,help:product_logistics_uom.field_product_product__product_weight
+msgid "The weight in the product's weight UOM."
+msgstr ""
+
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid "Volume"
msgstr ""
#. module: product_logistics_uom
@@ -65,18 +147,35 @@ msgstr ""
msgid "Volume Unit of Measure"
msgstr ""
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__product_volume
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__product_volume
+msgid "Volume in product UOM"
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_name
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume_uom_name
msgid "Volume unit of measure label"
msgstr ""
+#. module: product_logistics_uom
+#: model_terms:ir.ui.view,arch_db:product_logistics_uom.product_template_form_view
+msgid "Weight"
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_id
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_id
msgid "Weight Unit of Measure"
msgstr ""
+#. module: product_logistics_uom
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__product_weight
+#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__product_weight
+msgid "Weight in product UOM"
+msgstr ""
+
#. module: product_logistics_uom
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_name
#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_name
diff --git a/product_logistics_uom/migrations/16.0.2.0.0/post-migrate.py b/product_logistics_uom/migrations/16.0.2.0.0/post-migrate.py
new file mode 100644
index 00000000000..c0cd68c5f88
--- /dev/null
+++ b/product_logistics_uom/migrations/16.0.2.0.0/post-migrate.py
@@ -0,0 +1,10 @@
+# Copyright 2023 ACSONE SA
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
+
+# pylint: disable=odoo-addons-relative-import
+from odoo.addons.product_logistics_uom.hooks import pre_init_hook
+
+
+def migrate(cr, version):
+ """Migrate data from product_logistics_uom module."""
+ pre_init_hook(cr)
diff --git a/product_logistics_uom/models/__init__.py b/product_logistics_uom/models/__init__.py
index 1fb0593809a..d15bee9b9cc 100644
--- a/product_logistics_uom/models/__init__.py
+++ b/product_logistics_uom/models/__init__.py
@@ -1,2 +1,3 @@
+from . import product_product
from . import product_template
from . import res_config_settings
diff --git a/product_logistics_uom/models/product_product.py b/product_logistics_uom/models/product_product.py
new file mode 100644
index 00000000000..33a44614aca
--- /dev/null
+++ b/product_logistics_uom/models/product_product.py
@@ -0,0 +1,117 @@
+# Copyright 2023 ACSONE SA
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
+
+from odoo import api, fields, models
+from odoo.tools import float_is_zero
+
+
+class ProductProduct(models.Model):
+ _inherit = "product.product"
+
+ # remove rounding from volume and weight
+ # this is needed to avoid rounding errors when converting between units
+ # and is safe since we display the volume and weight in the product's
+ # volume and weight UOM. In the same time, we need to keep the volume
+ # we ensure that no information is lost by storing the volume and weight
+ # without rounding.
+ volume = fields.Float(digits=False)
+ weight = fields.Float(digits=False)
+
+ product_volume = fields.Float(
+ "Volume in product UOM",
+ digits="Volume",
+ help="The volume in the product's volume UOM.",
+ compute="_compute_product_volume",
+ inverse="_inverse_product_volume",
+ )
+ product_weight = fields.Float(
+ "Weight in product UOM",
+ digits="Stock Weight",
+ help="The weight in the product's weight UOM.",
+ compute="_compute_product_weight",
+ inverse="_inverse_product_weight",
+ )
+
+ show_volume_uom_warning = fields.Boolean(
+ help="Technical field used to warn the user to change the volume"
+ "uom since the value for product_volume is too small and has been"
+ "rounded.",
+ compute="_compute_show_volume_uom_warning",
+ )
+
+ show_weight_uom_warning = fields.Boolean(
+ help="Technical field used to warn the user to change the weight"
+ "uom since the value for product_weight is too small and has been"
+ "rounded.",
+ compute="_compute_show_weight_uom_warning",
+ )
+
+ @api.depends("product_volume", "product_tmpl_id.volume_uom_id")
+ def _compute_product_volume(self):
+ odoo_volume_uom = (
+ self.product_tmpl_id._get_volume_uom_id_from_ir_config_parameter()
+ )
+ for product in self:
+ product.product_volume = odoo_volume_uom._compute_quantity(
+ qty=product.volume,
+ to_unit=product.volume_uom_id,
+ round=False, # avoid losing information
+ )
+
+ def _inverse_product_volume(self):
+ odoo_volume_uom = (
+ self.product_tmpl_id._get_volume_uom_id_from_ir_config_parameter()
+ )
+ for product in self:
+ product.volume = product.volume_uom_id._compute_quantity(
+ qty=product.product_volume,
+ to_unit=odoo_volume_uom,
+ round=False, # avoid losing information
+ )
+
+ @api.depends("product_weight", "product_tmpl_id.weight_uom_id")
+ def _compute_product_weight(self):
+ odoo_weight_uom = (
+ self.product_tmpl_id._get_weight_uom_id_from_ir_config_parameter()
+ )
+ for product in self:
+ product.product_weight = odoo_weight_uom._compute_quantity(
+ qty=product.weight,
+ to_unit=product.weight_uom_id,
+ round=False, # avoid losing information
+ )
+
+ def _inverse_product_weight(self):
+ odoo_weight_uom = (
+ self.product_tmpl_id._get_weight_uom_id_from_ir_config_parameter()
+ )
+ for product in self:
+ product.weight = product.weight_uom_id._compute_quantity(
+ qty=product.product_weight, to_unit=odoo_weight_uom, round=False
+ )
+
+ @api.depends("product_volume", "product_tmpl_id.volume_uom_id", "volume")
+ def _compute_show_volume_uom_warning(self):
+ odoo_volume_uom = (
+ self.product_tmpl_id._get_volume_uom_id_from_ir_config_parameter()
+ )
+ for product in self:
+ product.show_volume_uom_warning = (
+ float_is_zero(
+ product.product_volume, precision_rounding=odoo_volume_uom.rounding
+ )
+ and product.volume != 0.0
+ )
+
+ @api.depends("product_weight", "product_tmpl_id.weight_uom_id", "weight")
+ def _compute_show_weight_uom_warning(self):
+ odoo_weight_uom = (
+ self.product_tmpl_id._get_weight_uom_id_from_ir_config_parameter()
+ )
+ for product in self:
+ product.show_weight_uom_warning = (
+ float_is_zero(
+ product.product_weight, precision_rounding=odoo_weight_uom.rounding
+ )
+ and product.weight != 0.0
+ )
diff --git a/product_logistics_uom/models/product_template.py b/product_logistics_uom/models/product_template.py
index 99d25d7ecd3..24b8cd4b259 100644
--- a/product_logistics_uom/models/product_template.py
+++ b/product_logistics_uom/models/product_template.py
@@ -8,6 +8,28 @@
class ProductTemplate(models.Model):
_inherit = "product.template"
+ product_volume = fields.Float(
+ "Volume in product UOM",
+ compute="_compute_product_volume",
+ inverse="_inverse_product_volume",
+ digits="Volume",
+ )
+ product_weight = fields.Float(
+ "Weight in product UOM",
+ compute="_compute_product_weight",
+ digits="Stock Weight",
+ inverse="_inverse_product_weight",
+ store=True,
+ )
+
+ # remove rounding from volume and weight
+ # this is needed to avoid rounding errors when converting between units
+ # and is safe since we display the volume and weight in the product's
+ # volume and weight UOM. In the same time, we need to keep the volume
+ # we ensure that no information is lost by storing the volume and weight
+ # without rounding.
+ volume = fields.Float(digits=False)
+ weight = fields.Float(digits=False)
volume_uom_id = fields.Many2one(
"uom.uom",
string="Volume Unit of Measure",
@@ -38,11 +60,19 @@ class ProductTemplate(models.Model):
readonly=True,
)
- product_uom_readonly = fields.Boolean(compute="_compute_product_uom_readonly")
+ show_volume_uom_warning = fields.Boolean(
+ help="Technical field used to warn the user to change the volume"
+ "uom since the value for product_volume is too small and has been"
+ "rounded.",
+ compute="_compute_show_volume_uom_warning",
+ )
- def _compute_product_uom_readonly(self):
- # helper for view form
- self.product_uom_readonly = not self.env.user.has_group("uom.group_uom")
+ show_weight_uom_warning = fields.Boolean(
+ help="Technical field used to warn the user to change the weight"
+ "uom since the value for product_weight is too small and has been"
+ "rounded.",
+ compute="_compute_show_weight_uom_warning",
+ )
@api.model
def _get_volume_uom_id_from_ir_config_parameter(self):
@@ -70,3 +100,62 @@ def _get_length_uom_id_from_ir_config_parameter(self):
return self.env["uom.uom"].browse(int(default_uom))
else:
return super()._get_length_uom_id_from_ir_config_parameter()
+
+ @api.depends(
+ "product_variant_ids",
+ "product_variant_ids.product_volume",
+ "volume",
+ "volume_uom_id",
+ )
+ def _compute_product_volume(self):
+ unique_variants = self.filtered(
+ lambda template: len(template.product_variant_ids) == 1
+ )
+ for template in unique_variants:
+ template.product_volume = template.product_variant_ids.product_volume
+ for template in self - unique_variants:
+ template.product_volume = 0.0
+
+ def _inverse_product_volume(self):
+ for template in self:
+ if len(template.product_variant_ids) == 1:
+ template.product_variant_ids.product_volume = template.product_volume
+
+ @api.depends("weight", "weight_uom_id")
+ def _compute_product_weight(self):
+ unique_variants = self.filtered(
+ lambda template: len(template.product_variant_ids) == 1
+ )
+ for template in unique_variants:
+ template.product_weight = template.product_variant_ids.product_weight
+ for template in self - unique_variants:
+ template.product_weight = 0.0
+
+ def _inverse_product_weight(self):
+ for template in self:
+ if len(template.product_variant_ids) == 1:
+ template.product_variant_ids.product_weight = template.product_weight
+
+ @api.depends("volume", "volume_uom_id")
+ def _compute_show_volume_uom_warning(self):
+ unique_variants = self.filtered(
+ lambda template: len(template.product_variant_ids) == 1
+ )
+ for template in unique_variants:
+ template.show_volume_uom_warning = (
+ template.product_variant_ids.show_volume_uom_warning
+ )
+ for template in self - unique_variants:
+ template.show_volume_uom_warning = False
+
+ @api.depends("weight", "weight_uom_id")
+ def _compute_show_weight_uom_warning(self):
+ unique_variants = self.filtered(
+ lambda template: len(template.product_variant_ids) == 1
+ )
+ for template in unique_variants:
+ template.show_weight_uom_warning = (
+ template.product_variant_ids.show_weight_uom_warning
+ )
+ for template in self - unique_variants:
+ template.show_weight_uom_warning = False
diff --git a/product_logistics_uom/readme/CONTRIBUTORS.rst b/product_logistics_uom/readme/CONTRIBUTORS.rst
index 7e956f44b01..d3ef08925b6 100644
--- a/product_logistics_uom/readme/CONTRIBUTORS.rst
+++ b/product_logistics_uom/readme/CONTRIBUTORS.rst
@@ -1,2 +1,3 @@
* Raphaël Reverdy
* Fernando La Chica
+* Laurent Mignon
diff --git a/product_logistics_uom/readme/DESCRIPTION.rst b/product_logistics_uom/readme/DESCRIPTION.rst
index a76e4845e6f..d1ac6394099 100644
--- a/product_logistics_uom/readme/DESCRIPTION.rst
+++ b/product_logistics_uom/readme/DESCRIPTION.rst
@@ -5,3 +5,16 @@ Without this module, you only have the choice between Kg or Lb(s) and m³ for al
For some business cases, you need to express in more precise UoM than default ones like Liters
instead of M³.
+
+Even if you choose another UoM for the weight or volume, the system will still
+store the value for these fields in the Odoo default UoM (Kg or Lb(s) and m³).
+This ensures that the arithmetic operations on these fields are correct and
+consistent with the rest of the addons.
+
+Once this addon is installed values stored into the initial Volume and Weight fields
+on the product and product template models are no more rounded to the decimal
+precision defined for these fields. This could lead to some side effects into
+reportss where these fields are used. You can replace the fields by the new
+ones provided by this addon to avoid this problem (product_volume and product_weight).
+In any cases, since you use different UoM by product, you should most probably
+modify your reportss to display the right UoM.
diff --git a/product_logistics_uom/readme/USAGE.rst b/product_logistics_uom/readme/USAGE.rst
new file mode 100644
index 00000000000..dd6c5b4bd9a
--- /dev/null
+++ b/product_logistics_uom/readme/USAGE.rst
@@ -0,0 +1,8 @@
+Once installed and the 'Sell and purchase products in different units of measure'
+option is enabled, the 'Unit of Measure' field will become updatable on the
+'Product' form for users with the permission 'Manage Multiple Units of Measure'.
+
+If the displayed value is 0.00 and a warning icon is displayed in front of the
+unit of measure, it means that the value is too small to be displayed in the
+current unit of measure. You should change the unit of measure to a larger one
+to see the value.
diff --git a/product_logistics_uom/static/description/index.html b/product_logistics_uom/static/description/index.html
index dede0f45227..7c78248e855 100644
--- a/product_logistics_uom/static/description/index.html
+++ b/product_logistics_uom/static/description/index.html
@@ -373,17 +373,29 @@
Product logistics UoM
Without this module, you only have the choice between Kg or Lb(s) and m³ for all the products.
For some business cases, you need to express in more precise UoM than default ones like Liters
instead of M³.
+
Even if you choose another UoM for the weight or volume, the system will still
+store the value for these fields in the Odoo default UoM (Kg or Lb(s) and m³).
+This ensures that the arithmetic operations on these fields are correct and
+consistent with the rest of the addons.
+
Once this addon is installed values stored into the initial Volume and Weight fields
+on the product and product template models are no more rounded to the decimal
+precision defined for these fields. This could lead to some side effects into
+reportss where these fields are used. You can replace the fields by the new
+ones provided by this addon to avoid this problem (product_volume and product_weight).
+In any cases, since you use different UoM by product, you should most probably
+modify your reportss to display the right UoM.
Once installed and the ‘Sell and purchase products in different units of measure’
+option is enabled, the ‘Unit of Measure’ field will become updatable on the
+‘Product’ form for users with the permission ‘Manage Multiple Units of Measure’.
+
If the displayed value is 0.00 and a warning icon is displayed in front of the
+unit of measure, it means that the value is too small to be displayed in the
+current unit of measure. You should change the unit of measure to a larger one
+to see the value.
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
@@ -414,22 +436,24 @@
Once installed and the ‘Sell and purchase products in different units of
measure’ option is enabled, the ‘Unit of Measure’ field will become
updatable on the ‘Product’ form for users with the permission ‘Manage
@@ -435,33 +440,37 @@
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
-feedback.