From e4a481f6457c035e83f907bcc4942a9ecbb783a5 Mon Sep 17 00:00:00 2001 From: hparfr Date: Tue, 28 Apr 2020 15:12:00 +0200 Subject: [PATCH 01/32] Add module product_logistics_uom --- product_logistics_uom/README.rst | 114 +++++ product_logistics_uom/__init__.py | 1 + product_logistics_uom/__manifest__.py | 21 + .../i18n/product_logistics_uom.pot | 106 ++++ product_logistics_uom/models/__init__.py | 3 + .../models/product_product.py | 13 + .../models/product_template.py | 64 +++ .../models/res_config_settings.py | 25 + product_logistics_uom/readme/CONFIGURE.rst | 8 + product_logistics_uom/readme/CONTRIBUTORS.rst | 1 + product_logistics_uom/readme/CREDITS.rst | 4 + product_logistics_uom/readme/DESCRIPTION.rst | 7 + product_logistics_uom/readme/INSTALL.rst | 3 + .../static/description/icon.png | Bin 0 -> 9455 bytes .../static/description/index.html | 453 ++++++++++++++++++ product_logistics_uom/views/product.xml | 42 ++ .../views/res_config_settings.xml | 27 ++ 17 files changed, 892 insertions(+) create mode 100644 product_logistics_uom/README.rst create mode 100644 product_logistics_uom/__init__.py create mode 100644 product_logistics_uom/__manifest__.py create mode 100644 product_logistics_uom/i18n/product_logistics_uom.pot create mode 100644 product_logistics_uom/models/__init__.py create mode 100644 product_logistics_uom/models/product_product.py create mode 100644 product_logistics_uom/models/product_template.py create mode 100644 product_logistics_uom/models/res_config_settings.py create mode 100644 product_logistics_uom/readme/CONFIGURE.rst create mode 100644 product_logistics_uom/readme/CONTRIBUTORS.rst create mode 100644 product_logistics_uom/readme/CREDITS.rst create mode 100644 product_logistics_uom/readme/DESCRIPTION.rst create mode 100644 product_logistics_uom/readme/INSTALL.rst create mode 100644 product_logistics_uom/static/description/icon.png create mode 100644 product_logistics_uom/static/description/index.html create mode 100644 product_logistics_uom/views/product.xml create mode 100644 product_logistics_uom/views/res_config_settings.xml diff --git a/product_logistics_uom/README.rst b/product_logistics_uom/README.rst new file mode 100644 index 00000000000..b9ec130a34d --- /dev/null +++ b/product_logistics_uom/README.rst @@ -0,0 +1,114 @@ +===================== +Product logistics UoM +===================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github + :target: https://github.com/OCA/product-attribute/tree/12.0/product_logistics_uom + :alt: OCA/product-attribute +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/product-attribute-12-0/product-attribute-12-0-product_logistics_uom + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/135/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to choose an Unit Of Measure (UoM) for products weight and volume. +It can be set product per product. + +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³. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +Be aware, that this module only change the UoM but not the value. + +It's the same behavior as base Odoo when you change from Metric System to Imperial System. + +Configuration +============= + +To change the default UoM + +#. Go "General Settings", then in "Products" +#. you have to select a default unit of measure for weights and volumes. + +To change on a specific product + +#. Go the product form you can change the UoM directly. + +Bug Tracker +=========== + +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. + +Credits +======= + +Authors +~~~~~~~ + +* Akretion + +Contributors +~~~~~~~~~~~~ + +* Raphaël Reverdy + +Other credits +~~~~~~~~~~~~~ + +The development of this module has been financially supported by: + +* Akretion +* La Base + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +.. |maintainer-hparfr| image:: https://github.com/hparfr.png?size=40px + :target: https://github.com/hparfr + :alt: hparfr + +Current `maintainer `__: + +|maintainer-hparfr| + +This module is part of the `OCA/product-attribute `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/product_logistics_uom/__init__.py b/product_logistics_uom/__init__.py new file mode 100644 index 00000000000..9a7e03eded3 --- /dev/null +++ b/product_logistics_uom/__init__.py @@ -0,0 +1 @@ +from . import models \ No newline at end of file diff --git a/product_logistics_uom/__manifest__.py b/product_logistics_uom/__manifest__.py new file mode 100644 index 00000000000..74912c1c77a --- /dev/null +++ b/product_logistics_uom/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2020 Akretion (https://www.akretion.com). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Product logistics UoM", + "summary": "Configure product weights and volume UoM", + "version": "12.0.1.0.1", + "development_status": "Beta", + "category": "Product", + "website": "https://github.com/OCA/product-attribute", + "author": " Akretion, Odoo Community Association (OCA)", + "maintainers": ["hparfr"], + "license": "AGPL-3", + "installable": True, + "depends": [ + "product", + ], + "data": [ + "views/res_config_settings.xml", + "views/product.xml", + ], +} diff --git a/product_logistics_uom/i18n/product_logistics_uom.pot b/product_logistics_uom/i18n/product_logistics_uom.pot new file mode 100644 index 00000000000..c2b993765ca --- /dev/null +++ b/product_logistics_uom/i18n/product_logistics_uom.pot @@ -0,0 +1,106 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_logistics_uom +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: product_logistics_uom +#: model_terms:ir.ui.view,arch_db:product_logistics_uom.res_config_settings_view_form +msgid "Choose the unit to measure volume" +msgstr "" + +#. 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_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_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_product +msgid "Product" +msgstr "" + +#. module: product_logistics_uom +#: model:ir.model,name:product_logistics_uom.model_product_template +msgid "Product Template" +msgstr "" + +#. module: product_logistics_uom +#: model:ir.model.fields,help:product_logistics_uom.field_product_product__volume +#: model:ir.model.fields,help:product_logistics_uom.field_product_template__volume +msgid "The volume of the contents, not including any packaging, etc." +msgstr "" + +#. module: product_logistics_uom +#: model:ir.model.fields,help:product_logistics_uom.field_product_template__weight +msgid "The weight of the contents, not including any packaging, etc." +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 +msgid "Volume" +msgstr "" + +#. module: product_logistics_uom +#: model_terms:ir.ui.view,arch_db:product_logistics_uom.res_config_settings_view_form +msgid "Volume Measurement" +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_template__weight +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__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 "" + diff --git a/product_logistics_uom/models/__init__.py b/product_logistics_uom/models/__init__.py new file mode 100644 index 00000000000..6c8edfda3d1 --- /dev/null +++ b/product_logistics_uom/models/__init__.py @@ -0,0 +1,3 @@ +from . import product_product +from . import product_template +from . import res_config_settings \ No newline at end of file diff --git a/product_logistics_uom/models/product_product.py b/product_logistics_uom/models/product_product.py new file mode 100644 index 00000000000..f2429794d8c --- /dev/null +++ b/product_logistics_uom/models/product_product.py @@ -0,0 +1,13 @@ +# Copyright 2020 Akretion (https://www.akretion.com). +# @author Raphaël Reverdy +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ProductProduct(models.Model): + _inherit = "product.product" + + volume = fields.Float( + help="The volume of the contents, not including any packaging, etc." + ) diff --git a/product_logistics_uom/models/product_template.py b/product_logistics_uom/models/product_template.py new file mode 100644 index 00000000000..a5a964ef4fc --- /dev/null +++ b/product_logistics_uom/models/product_template.py @@ -0,0 +1,64 @@ +# Copyright 2020 Akretion (https://www.akretion.com). +# @author Raphaël Reverdy +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + volume = fields.Float( + help="The volume of the contents, not including any packaging, etc." + ) + volume_uom_id = fields.Many2one( + "uom.uom", + string="Volume Unit of Measure", + domain="[('measure_type', '=', 'volume')]", + default=lambda x: x._get_volume_uom_id_from_ir_config_parameter(), + ) + volume_uom_name = fields.Char( + string="Volume unit of measure label", + related="volume_uom_id.name", + readonly=True, + ) + + weight = fields.Float( + help="The weight of the contents, not including any packaging, etc." + ) + + weight_uom_id = fields.Many2one( + "uom.uom", + string="Weight Unit of Measure", + domain="[('measure_type', '=', 'weight')]", + compute=False, + default=lambda x: x._get_weight_uom_id_from_ir_config_parameter(), + ) + + weight_uom_name = fields.Char( + string="Weight unit of measure label", + related="weight_uom_id.name", + readonly=True, + ) + + @api.model + def _get_volume_uom_id_from_ir_config_parameter(self): + get_param = self.env["ir.config_parameter"].sudo().get_param + default_uom = get_param("product_default_volume_uom_id") + if default_uom: + return self.env["uom.uom"].browse(int(default_uom)) + else: + # no super available in v12 + return self.env["uom.uom"].search( + [("measure_type", "=", "volume"), ("uom_type", "=", "reference")], + limit=1, + ) + + @api.model + def _get_weight_uom_id_from_ir_config_parameter(self): + get_param = self.env["ir.config_parameter"].sudo().get_param + default_uom = get_param("product_default_weight_uom_id") + if default_uom: + return self.env["uom.uom"].browse(int(default_uom)) + else: + return super()._get_weight_uom_id_from_ir_config_parameter() diff --git a/product_logistics_uom/models/res_config_settings.py b/product_logistics_uom/models/res_config_settings.py new file mode 100644 index 00000000000..51d3a7070fc --- /dev/null +++ b/product_logistics_uom/models/res_config_settings.py @@ -0,0 +1,25 @@ +# Copyright 2020 Akretion (https://www.akretion.com). +# @author Raphaël Reverdy +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + product_default_weight_uom_id = fields.Many2one( + "uom.uom", + "Default Weight Unit of Measure", + domain="[('measure_type', '=', 'weight')]", + config_parameter='product_default_weight_uom_id', + help="Default unit of measure to express product weight", + ) + + product_default_volume_uom_id = fields.Many2one( + "uom.uom", + "Default Volume Unit of Measure", + domain="[('measure_type', '=', 'volume')]", + config_parameter='product_default_volume_uom_id', + help="Default unit of measure to express product volume", + ) diff --git a/product_logistics_uom/readme/CONFIGURE.rst b/product_logistics_uom/readme/CONFIGURE.rst new file mode 100644 index 00000000000..813a0576f44 --- /dev/null +++ b/product_logistics_uom/readme/CONFIGURE.rst @@ -0,0 +1,8 @@ +To change the default UoM + +#. Go "General Settings", then in "Products" +#. you have to select a default unit of measure for weights and volumes. + +To change on a specific product + +#. Go the product form you can change the UoM directly. diff --git a/product_logistics_uom/readme/CONTRIBUTORS.rst b/product_logistics_uom/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..289a0817a2f --- /dev/null +++ b/product_logistics_uom/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Raphaël Reverdy \ No newline at end of file diff --git a/product_logistics_uom/readme/CREDITS.rst b/product_logistics_uom/readme/CREDITS.rst new file mode 100644 index 00000000000..bd7b4fde6c4 --- /dev/null +++ b/product_logistics_uom/readme/CREDITS.rst @@ -0,0 +1,4 @@ +The development of this module has been financially supported by: + +* Akretion +* La Base \ No newline at end of file diff --git a/product_logistics_uom/readme/DESCRIPTION.rst b/product_logistics_uom/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..6c02df3f9fd --- /dev/null +++ b/product_logistics_uom/readme/DESCRIPTION.rst @@ -0,0 +1,7 @@ +This module allows to choose an Unit Of Measure (UoM) for products weight and volume. +It can be set product per product. + +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³. diff --git a/product_logistics_uom/readme/INSTALL.rst b/product_logistics_uom/readme/INSTALL.rst new file mode 100644 index 00000000000..c1582360233 --- /dev/null +++ b/product_logistics_uom/readme/INSTALL.rst @@ -0,0 +1,3 @@ +Be aware, that this module only change the UoM but not the value. + +It's the same behavior as base Odoo when you change from Metric System to Imperial System. \ No newline at end of file diff --git a/product_logistics_uom/static/description/icon.png b/product_logistics_uom/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)( z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(#B1j35xPnPW z*bMSSOauW>o;*=kO8ojw91VX!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IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/product_logistics_uom/static/description/index.html b/product_logistics_uom/static/description/index.html new file mode 100644 index 00000000000..f5453d95b7f --- /dev/null +++ b/product_logistics_uom/static/description/index.html @@ -0,0 +1,453 @@ + + + + + + +Product logistics UoM + + + +
+

Product logistics UoM

+ + +

Beta License: AGPL-3 OCA/product-attribute Translate me on Weblate Try me on Runbot

+

This module allows to choose an Unit Of Measure (UoM) for products weight and volume. +It can be set product per product.

+

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³.

+

Table of contents

+ +
+

Installation

+

Be aware, that this module only change the UoM but not the value.

+

It’s the same behavior as base Odoo when you change from Metric System to Imperial System.

+
+
+

Configuration

+

To change the default UoM

+
    +
  1. Go “General Settings”, then in “Products”
  2. +
  3. you have to select a default unit of measure for weights and volumes.
  4. +
+

To change on a specific product

+
    +
  1. Go the product form you can change the UoM directly.
  2. +
+
+
+

Bug Tracker

+

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.

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The development of this module has been financially supported by:

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

Current maintainer:

+

hparfr

+

This module is part of the OCA/product-attribute project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/product_logistics_uom/views/product.xml b/product_logistics_uom/views/product.xml new file mode 100644 index 00000000000..d53a7266af8 --- /dev/null +++ b/product_logistics_uom/views/product.xml @@ -0,0 +1,42 @@ + + + + product.template.common.form + product.template + + + + + + + + + + 1 + + + 1 + + + + + + product.product.view.form.easy + product.product + + + + + + + + + + 1 + + + 1 + + + + diff --git a/product_logistics_uom/views/res_config_settings.xml b/product_logistics_uom/views/res_config_settings.xml new file mode 100644 index 00000000000..043f49492fd --- /dev/null +++ b/product_logistics_uom/views/res_config_settings.xml @@ -0,0 +1,27 @@ + + + + res.config.settings.view.form.inherit.product + res.config.settings + + + + 1 + + + + + + + + + From 997cfa82e9391073b0c37b3326d9a6a2fc065d47 Mon Sep 17 00:00:00 2001 From: claudiagn Date: Tue, 13 Oct 2020 10:47:19 +0000 Subject: [PATCH 02/32] Added translation using Weblate (Spanish) --- product_logistics_uom/i18n/es.po | 106 +++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 product_logistics_uom/i18n/es.po diff --git a/product_logistics_uom/i18n/es.po b/product_logistics_uom/i18n/es.po new file mode 100644 index 00000000000..c1427380d62 --- /dev/null +++ b/product_logistics_uom/i18n/es.po @@ -0,0 +1,106 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_logistics_uom +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: es\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_terms:ir.ui.view,arch_db:product_logistics_uom.res_config_settings_view_form +msgid "Choose the unit to measure volume" +msgstr "" + +#. 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_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_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_product +msgid "Product" +msgstr "" + +#. module: product_logistics_uom +#: model:ir.model,name:product_logistics_uom.model_product_template +msgid "Product Template" +msgstr "" + +#. module: product_logistics_uom +#: model:ir.model.fields,help:product_logistics_uom.field_product_product__volume +#: model:ir.model.fields,help:product_logistics_uom.field_product_template__volume +msgid "The volume of the contents, not including any packaging, etc." +msgstr "" + +#. module: product_logistics_uom +#: model:ir.model.fields,help:product_logistics_uom.field_product_template__weight +msgid "The weight of the contents, not including any packaging, etc." +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 +msgid "Volume" +msgstr "" + +#. module: product_logistics_uom +#: model_terms:ir.ui.view,arch_db:product_logistics_uom.res_config_settings_view_form +msgid "Volume Measurement" +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_template__weight +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__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 7b1c29942e953bec17fd7815f8f2b6d3add5b0cb Mon Sep 17 00:00:00 2001 From: claudiagn Date: Tue, 13 Oct 2020 10:48:33 +0000 Subject: [PATCH 03/32] Translated using Weblate (Spanish) Currently translated at 100.0% (17 of 17 strings) Translation: product-attribute-12.0/product-attribute-12.0-product_logistics_uom Translate-URL: https://translation.odoo-community.org/projects/product-attribute-12-0/product-attribute-12-0-product_logistics_uom/es/ --- product_logistics_uom/i18n/es.po | 38 +++++++++++++++++--------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/product_logistics_uom/i18n/es.po b/product_logistics_uom/i18n/es.po index c1427380d62..39b18bb4722 100644 --- a/product_logistics_uom/i18n/es.po +++ b/product_logistics_uom/i18n/es.po @@ -6,101 +6,103 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2020-10-13 13:08+0000\n" +"Last-Translator: claudiagn \n" "Language-Team: none\n" "Language: es\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 3.10\n" #. module: product_logistics_uom #: model_terms:ir.ui.view,arch_db:product_logistics_uom.res_config_settings_view_form msgid "Choose the unit to measure volume" -msgstr "" +msgstr "Escoja la unidad para medir el volumen" #. module: product_logistics_uom #: model:ir.model,name:product_logistics_uom.model_res_config_settings msgid "Config Settings" -msgstr "" +msgstr "Ajustes de configuración" #. 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 "Unidad de medida de volumen predeterminada" #. 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 "Unidad de medida de peso predeterminada" #. 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 "Unidad de medida del volumen del producto predeterminada" #. 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 "Unidad de medida del peso del producto predeterminada" #. module: product_logistics_uom #: model:ir.model,name:product_logistics_uom.model_product_product msgid "Product" -msgstr "" +msgstr "Producto" #. module: product_logistics_uom #: model:ir.model,name:product_logistics_uom.model_product_template msgid "Product Template" -msgstr "" +msgstr "Plantilla de producto" #. module: product_logistics_uom #: model:ir.model.fields,help:product_logistics_uom.field_product_product__volume #: model:ir.model.fields,help:product_logistics_uom.field_product_template__volume msgid "The volume of the contents, not including any packaging, etc." -msgstr "" +msgstr "El volumen de los contenidos, sin incluir ningún embalaje, etc." #. module: product_logistics_uom #: model:ir.model.fields,help:product_logistics_uom.field_product_template__weight msgid "The weight of the contents, not including any packaging, etc." -msgstr "" +msgstr "El peso de los contenidos, sin incluir ningún embalaje, etc." #. 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 msgid "Volume" -msgstr "" +msgstr "Volumen" #. module: product_logistics_uom #: model_terms:ir.ui.view,arch_db:product_logistics_uom.res_config_settings_view_form msgid "Volume Measurement" -msgstr "" +msgstr "Medición de 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 "" +msgstr "Unidad de medida de volumen" #. 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 "Etiqueta de unidad de medida de volumen" #. module: product_logistics_uom #: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight msgid "Weight" -msgstr "" +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 "" +msgstr "Unidad de medida 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 "Etiqueta de unidad de medida del peso" From f82f84cb21025423dfef2b8f15ca4da61f35e09a Mon Sep 17 00:00:00 2001 From: hparfr Date: Mon, 11 Jan 2021 11:22:24 +0100 Subject: [PATCH 04/32] [IMP] product_logistics_uom: black, isort, prettier --- product_logistics_uom/__init__.py | 2 +- product_logistics_uom/models/__init__.py | 2 +- .../models/res_config_settings.py | 4 ++-- product_logistics_uom/readme/CONTRIBUTORS.rst | 2 +- product_logistics_uom/readme/CREDITS.rst | 2 +- product_logistics_uom/readme/INSTALL.rst | 2 +- product_logistics_uom/views/product.xml | 6 +++--- .../views/res_config_settings.xml | 14 ++++++++++---- 8 files changed, 20 insertions(+), 14 deletions(-) diff --git a/product_logistics_uom/__init__.py b/product_logistics_uom/__init__.py index 9a7e03eded3..0650744f6bc 100644 --- a/product_logistics_uom/__init__.py +++ b/product_logistics_uom/__init__.py @@ -1 +1 @@ -from . import models \ No newline at end of file +from . import models diff --git a/product_logistics_uom/models/__init__.py b/product_logistics_uom/models/__init__.py index 6c8edfda3d1..d15bee9b9cc 100644 --- a/product_logistics_uom/models/__init__.py +++ b/product_logistics_uom/models/__init__.py @@ -1,3 +1,3 @@ from . import product_product from . import product_template -from . import res_config_settings \ No newline at end of file +from . import res_config_settings diff --git a/product_logistics_uom/models/res_config_settings.py b/product_logistics_uom/models/res_config_settings.py index 51d3a7070fc..30b1a282cc4 100644 --- a/product_logistics_uom/models/res_config_settings.py +++ b/product_logistics_uom/models/res_config_settings.py @@ -12,7 +12,7 @@ class ResConfigSettings(models.TransientModel): "uom.uom", "Default Weight Unit of Measure", domain="[('measure_type', '=', 'weight')]", - config_parameter='product_default_weight_uom_id', + config_parameter="product_default_weight_uom_id", help="Default unit of measure to express product weight", ) @@ -20,6 +20,6 @@ class ResConfigSettings(models.TransientModel): "uom.uom", "Default Volume Unit of Measure", domain="[('measure_type', '=', 'volume')]", - config_parameter='product_default_volume_uom_id', + config_parameter="product_default_volume_uom_id", help="Default unit of measure to express product volume", ) diff --git a/product_logistics_uom/readme/CONTRIBUTORS.rst b/product_logistics_uom/readme/CONTRIBUTORS.rst index 289a0817a2f..dc3bfce89ca 100644 --- a/product_logistics_uom/readme/CONTRIBUTORS.rst +++ b/product_logistics_uom/readme/CONTRIBUTORS.rst @@ -1 +1 @@ -* Raphaël Reverdy \ No newline at end of file +* Raphaël Reverdy diff --git a/product_logistics_uom/readme/CREDITS.rst b/product_logistics_uom/readme/CREDITS.rst index bd7b4fde6c4..e1247a94ed8 100644 --- a/product_logistics_uom/readme/CREDITS.rst +++ b/product_logistics_uom/readme/CREDITS.rst @@ -1,4 +1,4 @@ The development of this module has been financially supported by: * Akretion -* La Base \ No newline at end of file +* La Base diff --git a/product_logistics_uom/readme/INSTALL.rst b/product_logistics_uom/readme/INSTALL.rst index c1582360233..a6e90911519 100644 --- a/product_logistics_uom/readme/INSTALL.rst +++ b/product_logistics_uom/readme/INSTALL.rst @@ -1,3 +1,3 @@ Be aware, that this module only change the UoM but not the value. -It's the same behavior as base Odoo when you change from Metric System to Imperial System. \ No newline at end of file +It's the same behavior as base Odoo when you change from Metric System to Imperial System. diff --git a/product_logistics_uom/views/product.xml b/product_logistics_uom/views/product.xml index d53a7266af8..5699b82c828 100644 --- a/product_logistics_uom/views/product.xml +++ b/product_logistics_uom/views/product.xml @@ -1,9 +1,9 @@ - + product.template.common.form product.template - + @@ -23,7 +23,7 @@ product.product.view.form.easy product.product - + diff --git a/product_logistics_uom/views/res_config_settings.xml b/product_logistics_uom/views/res_config_settings.xml index 043f49492fd..06743dbe210 100644 --- a/product_logistics_uom/views/res_config_settings.xml +++ b/product_logistics_uom/views/res_config_settings.xml @@ -1,9 +1,9 @@ - + res.config.settings.view.form.inherit.product res.config.settings - + 1 @@ -11,8 +11,14 @@ - - - - - product.product.view.form.easy - product.product - - - - - - - - - - 1 + + {'invisible': [('product_uom_readonly', '=', False)]} - - 1 - diff --git a/product_logistics_uom/views/res_config_settings.xml b/product_logistics_uom/views/res_config_settings.xml index 06743dbe210..02da028540a 100644 --- a/product_logistics_uom/views/res_config_settings.xml +++ b/product_logistics_uom/views/res_config_settings.xml @@ -11,23 +11,12 @@ - - + + 1 + + + + From d8243cfc9e14f6a0cc2c54baccefb51a9636527a Mon Sep 17 00:00:00 2001 From: Fernando La Chica Date: Thu, 29 Sep 2022 09:31:51 +0200 Subject: [PATCH 06/32] [MIG] product_logistics_uom: 15.0 --- product_logistics_uom/__manifest__.py | 2 +- product_logistics_uom/readme/CONTRIBUTORS.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/product_logistics_uom/__manifest__.py b/product_logistics_uom/__manifest__.py index c272113eab2..76c822d6c99 100644 --- a/product_logistics_uom/__manifest__.py +++ b/product_logistics_uom/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Product logistics UoM", "summary": "Configure product weights and volume UoM", - "version": "14.0.1.0.1", + "version": "15.0.1.0.0", "development_status": "Beta", "category": "Product", "website": "https://github.com/OCA/product-attribute", diff --git a/product_logistics_uom/readme/CONTRIBUTORS.rst b/product_logistics_uom/readme/CONTRIBUTORS.rst index dc3bfce89ca..7e956f44b01 100644 --- a/product_logistics_uom/readme/CONTRIBUTORS.rst +++ b/product_logistics_uom/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ * Raphaël Reverdy +* Fernando La Chica From 3431494672b81d45bedc77e6e85d89b1b300a775 Mon Sep 17 00:00:00 2001 From: mle Date: Fri, 7 Oct 2022 10:14:56 +0200 Subject: [PATCH 07/32] [MIG] product_logistics_uom: Migration to 16.0 --- product_logistics_uom/README.rst | 11 +-- product_logistics_uom/__manifest__.py | 2 +- product_logistics_uom/i18n/es.po | 74 +++++++++---------- .../i18n/product_logistics_uom.pot | 22 +----- .../models/product_template.py | 4 +- .../static/description/index.html | 7 +- .../views/res_config_settings.xml | 2 +- 7 files changed, 53 insertions(+), 69 deletions(-) diff --git a/product_logistics_uom/README.rst b/product_logistics_uom/README.rst index a79549551f9..4a298ac9962 100644 --- a/product_logistics_uom/README.rst +++ b/product_logistics_uom/README.rst @@ -14,13 +14,13 @@ Product logistics UoM :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github - :target: https://github.com/OCA/product-attribute/tree/14.0/product_logistics_uom + :target: https://github.com/OCA/product-attribute/tree/16.0/product_logistics_uom :alt: OCA/product-attribute .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/product-attribute-14-0/product-attribute-14-0-product_logistics_uom + :target: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_logistics_uom :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/135/14.0 + :target: https://runbot.odoo-community.org/runbot/135/16.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -63,7 +63,7 @@ Bug Tracker 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -79,6 +79,7 @@ Contributors ~~~~~~~~~~~~ * Raphaël Reverdy +* Fernando La Chica Other credits ~~~~~~~~~~~~~ @@ -109,6 +110,6 @@ Current `maintainer `__: |maintainer-hparfr| -This module is part of the `OCA/product-attribute `_ project on GitHub. +This module is part of the `OCA/product-attribute `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/product_logistics_uom/__manifest__.py b/product_logistics_uom/__manifest__.py index 76c822d6c99..7cb7d00ff12 100644 --- a/product_logistics_uom/__manifest__.py +++ b/product_logistics_uom/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Product logistics UoM", "summary": "Configure product weights and volume UoM", - "version": "15.0.1.0.0", + "version": "16.0.1.0.0", "development_status": "Beta", "category": "Product", "website": "https://github.com/OCA/product-attribute", diff --git a/product_logistics_uom/i18n/es.po b/product_logistics_uom/i18n/es.po index 39b18bb4722..fbdfc542191 100644 --- a/product_logistics_uom/i18n/es.po +++ b/product_logistics_uom/i18n/es.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * product_logistics_uom +# * product_logistics_uom # msgid "" msgstr "" @@ -16,16 +16,16 @@ 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.res_config_settings_view_form -msgid "Choose the unit to measure volume" -msgstr "Escoja la unidad para medir el volumen" - #. module: product_logistics_uom #: model:ir.model,name:product_logistics_uom.model_res_config_settings msgid "Config Settings" msgstr "Ajustes de configuración" +#. 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" @@ -36,6 +36,11 @@ msgstr "Unidad de medida de volumen predeterminada" msgid "Default Weight Unit of Measure" msgstr "Unidad de medida de peso predeterminada" +#. 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" @@ -47,36 +52,15 @@ 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,name:product_logistics_uom.model_product_product +#: model:ir.model,name:product_logistics_uom.model_product_template msgid "Product" msgstr "Producto" #. module: product_logistics_uom -#: model:ir.model,name:product_logistics_uom.model_product_template -msgid "Product Template" -msgstr "Plantilla de producto" - -#. module: product_logistics_uom -#: model:ir.model.fields,help:product_logistics_uom.field_product_product__volume -#: model:ir.model.fields,help:product_logistics_uom.field_product_template__volume -msgid "The volume of the contents, not including any packaging, etc." -msgstr "El volumen de los contenidos, sin incluir ningún embalaje, etc." - -#. module: product_logistics_uom -#: model:ir.model.fields,help:product_logistics_uom.field_product_template__weight -msgid "The weight of the contents, not including any packaging, etc." -msgstr "El peso de los contenidos, sin incluir ningún embalaje, etc." - -#. 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 -msgid "Volume" -msgstr "Volumen" - -#. module: product_logistics_uom -#: model_terms:ir.ui.view,arch_db:product_logistics_uom.res_config_settings_view_form -msgid "Volume Measurement" -msgstr "Medición de volumen" +#: 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 @@ -90,11 +74,6 @@ msgstr "Unidad de medida de volumen" msgid "Volume unit of measure label" msgstr "Etiqueta de unidad de medida de volumen" -#. module: product_logistics_uom -#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight -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 @@ -106,3 +85,24 @@ msgstr "Unidad de medida del peso" #: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_name msgid "Weight unit of measure label" msgstr "Etiqueta de unidad de medida del peso" + +#~ msgid "Choose the unit to measure volume" +#~ msgstr "Escoja la unidad para medir el volumen" + +#~ msgid "Product Template" +#~ msgstr "Plantilla de producto" + +#~ msgid "The volume of the contents, not including any packaging, etc." +#~ msgstr "El volumen de los contenidos, sin incluir ningún embalaje, etc." + +#~ 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/product_logistics_uom.pot b/product_logistics_uom/i18n/product_logistics_uom.pot index 42e493971a8..9a0c30e4a8c 100644 --- a/product_logistics_uom/i18n/product_logistics_uom.pot +++ b/product_logistics_uom/i18n/product_logistics_uom.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -48,27 +48,9 @@ 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_template__display_name -#: model:ir.model.fields,field_description:product_logistics_uom.field_res_config_settings__display_name -msgid "Display Name" -msgstr "" - -#. module: product_logistics_uom -#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__id -#: model:ir.model.fields,field_description:product_logistics_uom.field_res_config_settings__id -msgid "ID" -msgstr "" - -#. module: product_logistics_uom -#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template____last_update -#: model:ir.model.fields,field_description:product_logistics_uom.field_res_config_settings____last_update -msgid "Last Modified on" -msgstr "" - #. module: product_logistics_uom #: model:ir.model,name:product_logistics_uom.model_product_template -msgid "Product Template" +msgid "Product" msgstr "" #. module: product_logistics_uom diff --git a/product_logistics_uom/models/product_template.py b/product_logistics_uom/models/product_template.py index 4be5bdd4014..99d25d7ecd3 100644 --- a/product_logistics_uom/models/product_template.py +++ b/product_logistics_uom/models/product_template.py @@ -14,7 +14,7 @@ class ProductTemplate(models.Model): domain=lambda self: [ ("category_id", "=", self.env.ref("uom.product_uom_categ_vol").id) ], - default=lambda x: x._get_volume_uom_id_from_ir_config_parameter(), + default=lambda self: self._get_volume_uom_id_from_ir_config_parameter(), ) volume_uom_name = fields.Char( string="Volume unit of measure label", @@ -29,7 +29,7 @@ class ProductTemplate(models.Model): ("category_id", "=", self.env.ref("uom.product_uom_categ_kgm").id) ], compute=False, - default=lambda x: x._get_weight_uom_id_from_ir_config_parameter(), + default=lambda self: self._get_weight_uom_id_from_ir_config_parameter(), ) weight_uom_name = fields.Char( diff --git a/product_logistics_uom/static/description/index.html b/product_logistics_uom/static/description/index.html index 47ed3e5269c..dede0f45227 100644 --- a/product_logistics_uom/static/description/index.html +++ b/product_logistics_uom/static/description/index.html @@ -367,7 +367,7 @@

Product logistics UoM

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/product-attribute Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/product-attribute Translate me on Weblate Try me on Runbot

This module allows to choose an Unit Of Measure (UoM) for products weight and volume. It can be set product per product for users in group_uom.

Without this module, you only have the choice between Kg or Lb(s) and m³ for all the products.

@@ -410,7 +410,7 @@

Bug Tracker

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.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -425,6 +425,7 @@

Authors

Contributors

@@ -444,7 +445,7 @@

Maintainers

promote its widespread use.

Current maintainer:

hparfr

-

This module is part of the OCA/product-attribute project on GitHub.

+

This module is part of the OCA/product-attribute project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

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 "" +" * 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.

Table of contents

+
+

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

+

Bug Tracker

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 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Akretion
  • +
  • ACSONE SA/NV
-

Other credits

+

Other credits

The development of this module has been financially supported by:

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose diff --git a/product_logistics_uom/tests/__init__.py b/product_logistics_uom/tests/__init__.py new file mode 100644 index 00000000000..7e1a54050dc --- /dev/null +++ b/product_logistics_uom/tests/__init__.py @@ -0,0 +1 @@ +from . import test_product_logistics_uom diff --git a/product_logistics_uom/tests/test_product_logistics_uom.py b/product_logistics_uom/tests/test_product_logistics_uom.py new file mode 100644 index 00000000000..986f702057a --- /dev/null +++ b/product_logistics_uom/tests/test_product_logistics_uom.py @@ -0,0 +1,113 @@ +# Copyright 2023 ACSONE SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) + + +from odoo.tests.common import TransactionCase + + +class TestProductLogisticsUom(TransactionCase): + @classmethod + def setUpClass(cls): + super(TestProductLogisticsUom, cls).setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + cls.product = cls.env["product.product"].create( + { + "name": "Test Product", + } + ) + cls.weigh_uom_kg = cls.env.ref("uom.product_uom_kgm") + cls.weigh_uom_g = cls.env.ref("uom.product_uom_gram") + cls.volume_uom_m3 = cls.env.ref("uom.product_uom_cubic_meter") + cls.volume_uom_l = cls.env.ref("uom.product_uom_litre") + # set volume in m3 and weight in kg + cls.env["ir.config_parameter"].set_param("product.weight_in_lbs", "0") + cls.env["ir.config_parameter"].set_param("product.volume_in_cubic_feet", "0") + + def test_product_volume(self): + self.product.volume_uom_id = self.volume_uom_l + self.product.volume = 1 + self.assertEqual(self.product.product_volume, 1000) + self.product.product_volume = 10 + self.assertEqual(self.product.volume, 0.01) + self.product.volume_uom_id = self.volume_uom_m3 + self.assertEqual(self.product.product_volume, self.product.volume) + + def test_product_show_product_uom_warning(self): + self.product.volume_uom_id = self.volume_uom_m3 + self.product.volume = 0.0001 + self.assertTrue(self.product.show_volume_uom_warning) + self.product.volume_uom_id = self.volume_uom_l + self.assertFalse(self.product.show_volume_uom_warning) + + def test_product_weight(self): + self.product.weight_uom_id = self.weigh_uom_g + self.product.weight = 1 + self.assertEqual(self.product.product_weight, 1000) + self.product.product_weight = 10 + self.assertEqual(self.product.weight, 0.01) + self.product.weight_uom_id = self.weigh_uom_kg + self.assertEqual(self.product.product_weight, self.product.weight) + + def test_product_show_product_weight_warning(self): + self.product.weight_uom_id = self.weigh_uom_kg + self.product.weight = 0.0001 + self.assertTrue(self.product.show_weight_uom_warning) + self.product.weight_uom_id = self.weigh_uom_g + self.assertFalse(self.product.show_weight_uom_warning) + + def test_template_volume(self): + template = self.product.product_tmpl_id + template.volume_uom_id = self.volume_uom_l + template.volume = 1 + self.assertEqual(template.product_volume, 1000) + template.product_volume = 10 + self.assertEqual(template.volume, 0.01) + template.volume_uom_id = self.volume_uom_m3 + self.assertEqual(template.product_volume, template.volume) + + def test_template_show_volume_uom_warning(self): + template = self.product.product_tmpl_id + template.volume_uom_id = self.volume_uom_m3 + template.volume = 0.0001 + self.assertTrue(template.show_volume_uom_warning) + template.volume_uom_id = self.volume_uom_l + self.assertFalse(template.show_volume_uom_warning) + + def test_template_weight(self): + template = self.product.product_tmpl_id + template.weight_uom_id = self.weigh_uom_g + template.weight = 1 + self.assertEqual(template.product_weight, 1000) + template.product_weight = 10 + self.assertEqual(template.weight, 0.01) + template.weight_uom_id = self.weigh_uom_kg + self.assertEqual(template.product_weight, template.weight) + + def test_template_show_weight_uom_warning(self): + template = self.product.product_tmpl_id + template.weight_uom_id = self.weigh_uom_kg + template.weight = 0.0001 + self.assertTrue(template.show_weight_uom_warning) + template.weight_uom_id = self.weigh_uom_g + self.assertFalse(template.show_weight_uom_warning) + + def test_template_with_variant(self): + variant = self.product.create( + {"name": "Test Variant", "product_tmpl_id": self.product.product_tmpl_id.id} + ) + template = self.product.product_tmpl_id + variant.product_volume = 10 + variant.product_weight = 10 + self.product.product_volume = 10 + self.product.product_weight = 10 + self.assertEqual(template.volume, 0.0) + self.assertEqual(template.volume, 0.0) + self.assertEqual(template.product_volume, 0.0) + self.assertEqual(template.product_weight, 0.0) + self.assertFalse(template.show_volume_uom_warning) # for coverage + self.assertFalse(template.show_weight_uom_warning) # for coverage + variant.unlink() + self.assertEqual(template.volume, 10.0) + self.assertEqual(template.weight, 10.0) + self.assertEqual(template.product_volume, 10.0) + self.assertEqual(template.product_weight, 10.0) diff --git a/product_logistics_uom/views/product.xml b/product_logistics_uom/views/product.xml index f41438bdbd3..61cb9079fc6 100644 --- a/product_logistics_uom/views/product.xml +++ b/product_logistics_uom/views/product.xml @@ -5,30 +5,91 @@ product.template - - + + + 1 + + +

-

Product logistics UoM

+
+ + +Odoo Community Association + +
+

Product logistics UoM

-

Beta License: AGPL-3 OCA/product-attribute Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/product-attribute Translate me on Weblate Try me on Runboat

This module allows to choose an Unit Of Measure (UoM) for products weight and volume. It can be set product per product for users in group_uom.

@@ -406,13 +411,13 @@

Product logistics UoM

-

Installation

+

Installation

Be aware, that this module only change the UoM but not the value.

It’s the same behavior as base Odoo when you change from Metric System to Imperial System.

-

Configuration

+

Configuration

To change the default UoM

  1. Go “General Settings”, then in “Products”
  2. @@ -424,7 +429,7 @@

    Configuration

-

Usage

+

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 @@ -435,33 +440,37 @@

Usage

measure to a larger one to see the value.

-

Bug Tracker

+

Bug Tracker

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.

+feedback.

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Akretion
  • ACSONE SA/NV
-

Contributors

+

Contributors

-

Other credits

+

Other credits

The development of this module has been financially supported by:

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -479,10 +488,11 @@

Maintainers

promote its widespread use.

Current maintainer:

hparfr

-

This module is part of the OCA/product-attribute project on GitHub.

+

This module is part of the OCA/product-attribute project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
diff --git a/product_logistics_uom/tests/test_product_logistics_uom.py b/product_logistics_uom/tests/test_product_logistics_uom.py index 975270b0f8b..8689bbd738b 100644 --- a/product_logistics_uom/tests/test_product_logistics_uom.py +++ b/product_logistics_uom/tests/test_product_logistics_uom.py @@ -24,6 +24,13 @@ def setUpClass(cls): # set volume in m3 and weight in kg cls.env["ir.config_parameter"].set_param("product.weight_in_lbs", "0") cls.env["ir.config_parameter"].set_param("product.volume_in_cubic_feet", "0") + cls.length_uom = cls.env["uom.uom"].create({"name": "Meter"}) + cls.env["ir.config_parameter"].set_param( + "product_default_length_uom_id", str(cls.length_uom.id) + ) + cls.product_template = cls.env["product.template"].create( + {"name": "Test Product Template"} + ) def test_product_volume(self): self.product.volume_uom_id = self.volume_uom_l @@ -128,3 +135,42 @@ def test_template_with_variant(self): self.assertEqual(template.weight, 10.0) self.assertEqual(template.product_volume, 10.0) self.assertEqual(template.product_weight, 10.0) + + def test_get_length_uom_id_from_ir_config_parameter(self): + uom = self.product_template._get_length_uom_id_from_ir_config_parameter() + self.assertEqual(uom.id, self.length_uom.id) + + def test_compute_product_volume_single_variant(self): + self.env["ir.config_parameter"].set_param( + "product_default_volume_uom_id", str(self.volume_uom_l.id) + ) + product_template = self.product_template + product_template.product_variant_ids.write( + {"volume": 7.5, "volume_uom_id": self.volume_uom_l.id} + ) + self.assertEqual(product_template.product_volume, 7.5) + + def test_inverse_product_volume_single_variant(self): + self.env["ir.config_parameter"].set_param( + "product_default_weight_uom_id", str(self.weigh_uom_kg.id) + ) + product_template = self.product_template + product_template.product_variant_ids.write( + {"weight": 5.0, "volume_uom_id": self.weigh_uom_kg.id} + ) + product_template.write({"weight": 12.0, "volume_uom_id": self.weigh_uom_kg.id}) + self.assertEqual(product_template.product_variant_ids.product_weight, 12.0) + + # def test_inverse_product_length_single_variant(self): + # # Línea 81: Al cambiar el volumen en el template, se actualiza en la variante + # self.env["ir.config_parameter"].set_param( + # "product_default_length_uom_id", str(self.length_uom.id) + # ) + # product_template = self.product_template + # product_template.product_variant_ids.write( + # {"volume": 5.0, "volume_uom_id": self.length_uom.id} + # ) + # product_template.write( + # {"volume": 12.0, "volume_uom_id": self.length_uom.id} + # ) + # self.assertEqual(product_template.product_variant_ids.product_volume, 12.0) From 172a04b5e6739f44fd8b9888f111a470132a5256 Mon Sep 17 00:00:00 2001 From: eugenio Date: Thu, 6 Nov 2025 08:36:58 +0100 Subject: [PATCH 32/32] [DON'T MERGE] test-requirements.txt --- test-requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 test-requirements.txt diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000000..61a904ec968 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +odoo-addon-product_dimension @ git+https://github.com/OCA/product-attribute.git@refs/pull/2089/head#subdirectory=product_dimension