diff --git a/product_logistics_uom/README.rst b/product_logistics_uom/README.rst new file mode 100644 index 000000000000..0ece842f12ef --- /dev/null +++ b/product_logistics_uom/README.rst @@ -0,0 +1,117 @@ +===================== +Product logistics UoM +===================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:c428d55c5ca2fbed7e7f053b5642620dc5ddfdcce5e67fe6c2154b1735799523 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/14.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 + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=14.0 + :alt: Try me on Runboat + +|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 for users in group_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³. + +**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 to smash 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 000000000000..0650744f6bc6 --- /dev/null +++ b/product_logistics_uom/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_logistics_uom/__manifest__.py b/product_logistics_uom/__manifest__.py new file mode 100644 index 000000000000..2734f4ec2243 --- /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": "17.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/es.po b/product_logistics_uom/i18n/es.po new file mode 100644 index 000000000000..0e6aed7cb816 --- /dev/null +++ b/product_logistics_uom/i18n/es.po @@ -0,0 +1,126 @@ +# 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" +"PO-Revision-Date: 2024-01-15 16:36+0000\n" +"Last-Translator: Ivorra78 \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 4.17\n" + +#. 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 "Unidad de Medida de Longitud por Defecto" + +#. 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 "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 "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 "Unidad de medida por defecto para expresar la longitud del producto" + +#. 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 "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 "Unidad de medida del peso del producto predeterminada" + +#. 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 "Mostrar Nombre" + +#. 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 "ID" + +#. 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 "Última Modificación el" + +#. 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,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 "Udm Producto Solo Lectura" + +#. module: product_logistics_uom +#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_id +#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume_uom_id +msgid "Volume Unit of Measure" +msgstr "Unidad de medida de volumen" + +#. module: product_logistics_uom +#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__volume_uom_name +#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__volume_uom_name +msgid "Volume unit of measure label" +msgstr "Etiqueta de unidad de medida de volumen" + +#. module: product_logistics_uom +#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__weight_uom_id +#: model:ir.model.fields,field_description:product_logistics_uom.field_product_template__weight_uom_id +msgid "Weight Unit of Measure" +msgstr "Unidad de medida del peso" + +#. module: product_logistics_uom +#: model:ir.model.fields,field_description:product_logistics_uom.field_product_product__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 "Etiqueta de unidad de medida del peso" + +#~ msgid "Choose the unit to measure volume" +#~ msgstr "Escoja la unidad para medir el volumen" + +#~ msgid "Product" +#~ msgstr "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/it.po b/product_logistics_uom/i18n/it.po new file mode 100644 index 000000000000..188abc8dc056 --- /dev/null +++ b/product_logistics_uom/i18n/it.po @@ -0,0 +1,105 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_logistics_uom +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-06-07 13:36+0000\n" +"Last-Translator: mymage \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.17\n" + +#. module: product_logistics_uom +#: model:ir.model,name:product_logistics_uom.model_res_config_settings +msgid "Config Settings" +msgstr "Impostazioni 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 "Unità di misura lunghezza predefinita" + +#. 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 "Unità di misura volume predefinito" + +#. 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 "Unità di misura peso predefinito" + +#. 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 "Unità di misura predefiita 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 "Unità di misura predefiita 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 "Unità di misura predefinita per esprimere il peso di prodotto" + +#. 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 "Nome visualizzato" + +#. 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 "ID" + +#. 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 "Ultima modifica il" + +#. module: product_logistics_uom +#: model:ir.model,name:product_logistics_uom.model_product_template +msgid "Product Template" +msgstr "Modello 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 "UdM prodotto solo 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 "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 "Etichetta unità di misura 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 "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 "Etichetta unità di misura del peso" 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 000000000000..42e493971a8b --- /dev/null +++ b/product_logistics_uom/i18n/product_logistics_uom.pot @@ -0,0 +1,102 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_logistics_uom +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.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: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.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" +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 "" diff --git a/product_logistics_uom/models/__init__.py b/product_logistics_uom/models/__init__.py new file mode 100644 index 000000000000..1fb0593809a7 --- /dev/null +++ b/product_logistics_uom/models/__init__.py @@ -0,0 +1,2 @@ +from . import product_template +from . import res_config_settings diff --git a/product_logistics_uom/models/product_template.py b/product_logistics_uom/models/product_template.py new file mode 100644 index 000000000000..4be5bdd4014b --- /dev/null +++ b/product_logistics_uom/models/product_template.py @@ -0,0 +1,72 @@ +# 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_uom_id = fields.Many2one( + "uom.uom", + string="Volume Unit of Measure", + 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(), + ) + volume_uom_name = fields.Char( + string="Volume unit of measure label", + related="volume_uom_id.name", + readonly=True, + ) + + weight_uom_id = fields.Many2one( + "uom.uom", + string="Weight Unit of Measure", + domain=lambda self: [ + ("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(), + ) + + weight_uom_name = fields.Char( + string="Weight unit of measure label", + related="weight_uom_id.name", + readonly=True, + ) + + product_uom_readonly = fields.Boolean(compute="_compute_product_uom_readonly") + + def _compute_product_uom_readonly(self): + # helper for view form + self.product_uom_readonly = not self.env.user.has_group("uom.group_uom") + + @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: + return super()._get_volume_uom_id_from_ir_config_parameter() + + @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() + + @api.model + def _get_length_uom_id_from_ir_config_parameter(self): + get_param = self.env["ir.config_parameter"].sudo().get_param + default_uom = get_param("product_default_length_uom_id") + if default_uom: + return self.env["uom.uom"].browse(int(default_uom)) + else: + return super()._get_length_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 000000000000..10ffb95fc54a --- /dev/null +++ b/product_logistics_uom/models/res_config_settings.py @@ -0,0 +1,39 @@ +# 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=lambda self: [ + ("category_id", "=", self.env.ref("uom.product_uom_categ_kgm").id) + ], + 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=lambda self: [ + ("category_id", "=", self.env.ref("uom.product_uom_categ_vol").id) + ], + config_parameter="product_default_volume_uom_id", + help="Default unit of measure to express product volume", + ) + + product_default_length_uom_id = fields.Many2one( + "uom.uom", + "Default Length Unit of Measure", + domain=lambda self: [ + ("category_id", "=", self.env.ref("uom.uom_categ_length").id) + ], + config_parameter="product_default_length_uom_id", + help="Default unit of measure to express product length", + ) diff --git a/product_logistics_uom/readme/CONFIGURE.rst b/product_logistics_uom/readme/CONFIGURE.rst new file mode 100644 index 000000000000..813a0576f449 --- /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 000000000000..dc3bfce89cac --- /dev/null +++ b/product_logistics_uom/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Raphaël Reverdy diff --git a/product_logistics_uom/readme/CREDITS.rst b/product_logistics_uom/readme/CREDITS.rst new file mode 100644 index 000000000000..e1247a94ed8d --- /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 diff --git a/product_logistics_uom/readme/DESCRIPTION.rst b/product_logistics_uom/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..a76e4845e6fe --- /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 for users in group_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³. diff --git a/product_logistics_uom/readme/INSTALL.rst b/product_logistics_uom/readme/INSTALL.rst new file mode 100644 index 000000000000..a6e90911519a --- /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. diff --git a/product_logistics_uom/static/description/icon.png b/product_logistics_uom/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/product_logistics_uom/static/description/icon.png differ diff --git a/product_logistics_uom/static/description/index.html b/product_logistics_uom/static/description/index.html new file mode 100644 index 000000000000..6ed6b85f23a0 --- /dev/null +++ b/product_logistics_uom/static/description/index.html @@ -0,0 +1,455 @@ + + + + + + +Product logistics UoM + + + +
+

Product logistics UoM

+ + +

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.

+

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 to smash 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 000000000000..c726c820346a --- /dev/null +++ b/product_logistics_uom/views/product.xml @@ -0,0 +1,31 @@ + + + + product.template.common.form + product.template + + + + + + + + + + + product_uom_readonly == False + + + product_uom_readonly == False + + + + 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 000000000000..fdbeab056835 --- /dev/null +++ b/product_logistics_uom/views/res_config_settings.xml @@ -0,0 +1,22 @@ + + + + res.config.settings.view.form.inherit.product + res.config.settings + + + + 1 + + + + + + 1 + + + + + + + diff --git a/product_packaging_dimension/README.rst b/product_packaging_dimension/README.rst new file mode 100644 index 000000000000..630624b353b7 --- /dev/null +++ b/product_packaging_dimension/README.rst @@ -0,0 +1,85 @@ +=========================== +Product Packaging Dimension +=========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:9a5b6058ea9a98e11b0b97e9f65df964f328a34d17c38a07b23895a1121726a6 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/14.0/product_packaging_dimension + :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_packaging_dimension + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=14.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to store dimensions (length, width, height), weight and +volume of product packagings. + +**Table of contents** + +.. contents:: + :local: + +Known issues / Roadmap +====================== + +* Resolve conflict with delivery module + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Camptocamp +* Akretion + +Contributors +~~~~~~~~~~~~ + +* Patrick Tombez +* Akim Juillerat +* Kévin Roche + +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. + +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_packaging_dimension/__init__.py b/product_packaging_dimension/__init__.py new file mode 100644 index 000000000000..0650744f6bc6 --- /dev/null +++ b/product_packaging_dimension/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_packaging_dimension/__manifest__.py b/product_packaging_dimension/__manifest__.py new file mode 100644 index 000000000000..e783534feda9 --- /dev/null +++ b/product_packaging_dimension/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) +{ + "name": "Product Packaging Dimension", + "summary": "Manage packaging dimensions and weight", + "version": "17.0.1.0.1", + "category": "Product", + "author": "Camptocamp, Akretion, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": [ + "product", + "product_logistics_uom", + ], + "website": "https://github.com/OCA/product-attribute", + "data": [ + "views/product_packaging.xml", + ], + "installable": True, +} diff --git a/product_packaging_dimension/i18n/ca.po b/product_packaging_dimension/i18n/ca.po new file mode 100644 index 000000000000..6c66ce477eea --- /dev/null +++ b/product_packaging_dimension/i18n/ca.po @@ -0,0 +1,175 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_packaging_dimension +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-03-22 13:17+0000\n" +"Last-Translator: Noel estudillo \n" +"Language-Team: none\n" +"Language: ca\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.3.2\n" + +#. module: product_packaging_dimension +#: model_terms:ir.ui.view,arch_db:product_packaging_dimension.product_packaging_form_view_inherit +msgid "Dimensions" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__length_uom_id +msgid "Dimensions Units of Measure" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__display_name +msgid "Display Name" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__height +msgid "Height" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.constraint,message:product_packaging_dimension.constraint_product_packaging_positive_height +msgid "Height must be positive" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__id +msgid "ID" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging____last_update +msgid "Last Modified on" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__packaging_length +msgid "Length" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.constraint,message:product_packaging_dimension.constraint_product_packaging_positive_length +msgid "Length must be positive" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__length_uom_name +msgid "Length unit of measure label" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.constraint,message:product_packaging_dimension.constraint_product_packaging_positive_max_weight +msgid "Max Weight must be positive" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__max_weight +msgid "Maximum Weight" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,help:product_packaging_dimension.field_product_packaging__volume_uom_id +msgid "Packaging volume unit of measure" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model,name:product_packaging_dimension.model_product_packaging +msgid "Product Packaging" +msgstr "Empaquetat de producte" + +#. module: product_packaging_dimension +#: model:ir.model.fields,help:product_packaging_dimension.field_product_packaging__volume +msgid "The Packaging volume" +msgstr "" + +#. module: product_packaging_dimension +#: model_terms:ir.ui.view,arch_db:product_packaging_dimension.product_packaging_form_view_inherit +msgid "Units of Measure" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,help:product_packaging_dimension.field_product_packaging__length_uom_id +msgid "UoM for packaging length, height, width (based on lenght UoM)" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__volume +msgid "Volume" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__volume_uom_name +msgid "Volume Unit of Measure label" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__volume_uom_id +msgid "Volume Units of Measure" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__weight +#: model_terms:ir.ui.view,arch_db:product_packaging_dimension.product_packaging_form_view_inherit +msgid "Weight" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,help:product_packaging_dimension.field_product_packaging__weight_uom_id +msgid "Weight Unit of Measure" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__weight_uom_id +msgid "Weight Units of Measure" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__weight_uom_name +msgid "Weight unit of measure label" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__width +msgid "Width" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.constraint,message:product_packaging_dimension.constraint_product_packaging_positive_width +msgid "Width must be positive" +msgstr "" + +#~ msgid "Height (mm)" +#~ msgstr "Alçacada (mm)" + +#~ msgid "Length (mm)" +#~ msgstr "Longitud (mm)" + +#~ msgid "Volume (m³)" +#~ msgstr "Volum (m³)" + +#~ msgid "Weight (kg)" +#~ msgstr "Pes (kg)" + +#~ msgid "Width (mm)" +#~ msgstr "Amplada (mm)" + +#~ msgid "height in millimeters" +#~ msgstr "alçada en milímetres" + +#~ msgid "length in millimeters" +#~ msgstr "longitud en milímetres" + +#~ msgid "volume in cubic meters" +#~ msgstr "volum en metres cúbics" + +#~ msgid "width in millimeters" +#~ msgstr "amplada en milímetres" diff --git a/product_packaging_dimension/i18n/es.po b/product_packaging_dimension/i18n/es.po new file mode 100644 index 000000000000..224b9dadf0ad --- /dev/null +++ b/product_packaging_dimension/i18n/es.po @@ -0,0 +1,176 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_packaging_dimension +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-01-13 20:33+0000\n" +"Last-Translator: Ivorra78 \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 4.17\n" + +#. module: product_packaging_dimension +#: model_terms:ir.ui.view,arch_db:product_packaging_dimension.product_packaging_form_view_inherit +msgid "Dimensions" +msgstr "Dimensiones" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__length_uom_id +msgid "Dimensions Units of Measure" +msgstr "Dimensiones Unidades de Medida" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__height +msgid "Height" +msgstr "Alto" + +#. module: product_packaging_dimension +#: model:ir.model.constraint,message:product_packaging_dimension.constraint_product_packaging_positive_height +msgid "Height must be positive" +msgstr "La altura debe ser positiva" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__id +msgid "ID" +msgstr "ID" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__packaging_length +msgid "Length" +msgstr "Largo" + +#. module: product_packaging_dimension +#: model:ir.model.constraint,message:product_packaging_dimension.constraint_product_packaging_positive_length +msgid "Length must be positive" +msgstr "La longitud debe ser positiva" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__length_uom_name +msgid "Length unit of measure label" +msgstr "Etiqueta de unidad de medida de longitud" + +#. module: product_packaging_dimension +#: model:ir.model.constraint,message:product_packaging_dimension.constraint_product_packaging_positive_max_weight +msgid "Max Weight must be positive" +msgstr "El Peso Máximo debe ser positivo" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__max_weight +msgid "Maximum Weight" +msgstr "Peso Máximo" + +#. module: product_packaging_dimension +#: model:ir.model.fields,help:product_packaging_dimension.field_product_packaging__volume_uom_id +msgid "Packaging volume unit of measure" +msgstr "Unidad de medida del volumen del envase" + +#. module: product_packaging_dimension +#: model:ir.model,name:product_packaging_dimension.model_product_packaging +msgid "Product Packaging" +msgstr "Empaquetado de producto" + +#. module: product_packaging_dimension +#: model:ir.model.fields,help:product_packaging_dimension.field_product_packaging__volume +msgid "The Packaging volume" +msgstr "El Volumen de Embalaje" + +#. module: product_packaging_dimension +#: model_terms:ir.ui.view,arch_db:product_packaging_dimension.product_packaging_form_view_inherit +msgid "Units of Measure" +msgstr "Unidades de Medida" + +#. module: product_packaging_dimension +#: model:ir.model.fields,help:product_packaging_dimension.field_product_packaging__length_uom_id +msgid "UoM for packaging length, height, width (based on lenght UoM)" +msgstr "" +"UM de longitud, altura y anchura del envase (basada en la UM de longitud)" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__volume +msgid "Volume" +msgstr "Volumen" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__volume_uom_name +msgid "Volume Unit of Measure label" +msgstr "Etiqueta de Unidad de Medida de Volumen" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__volume_uom_id +msgid "Volume Units of Measure" +msgstr "Unidades de Medida de Volumen" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__weight +#: model_terms:ir.ui.view,arch_db:product_packaging_dimension.product_packaging_form_view_inherit +msgid "Weight" +msgstr "Peso" + +#. module: product_packaging_dimension +#: model:ir.model.fields,help:product_packaging_dimension.field_product_packaging__weight_uom_id +msgid "Weight Unit of Measure" +msgstr "Unidad de Medida del Peso" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__weight_uom_id +msgid "Weight Units of Measure" +msgstr "Unidades de Medida del Peso" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__weight_uom_name +msgid "Weight unit of measure label" +msgstr "Etiqueta de unidad de medida de peso" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__width +msgid "Width" +msgstr "Ancho" + +#. module: product_packaging_dimension +#: model:ir.model.constraint,message:product_packaging_dimension.constraint_product_packaging_positive_width +msgid "Width must be positive" +msgstr "La anchura debe ser positiva" + +#~ msgid "Height (mm)" +#~ msgstr "Altura (mm)" + +#~ msgid "Length (mm)" +#~ msgstr "Longitud(mm)" + +#~ msgid "Volume (m³)" +#~ msgstr "Volumen(m³)" + +#~ msgid "Weight (kg)" +#~ msgstr "Peso (kg)" + +#~ msgid "Width (mm)" +#~ msgstr "Amplitud (mm)" + +#~ msgid "height in millimeters" +#~ msgstr "altura en milímetros" + +#~ msgid "length in millimeters" +#~ msgstr "longitud en milímetros" + +#~ msgid "volume in cubic meters" +#~ msgstr "volumen en metros cúbicos" + +#~ msgid "width in millimeters" +#~ msgstr "amplitud en milímetros" diff --git a/product_packaging_dimension/i18n/it.po b/product_packaging_dimension/i18n/it.po new file mode 100644 index 000000000000..2f7cfc2cccf9 --- /dev/null +++ b/product_packaging_dimension/i18n/it.po @@ -0,0 +1,150 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_packaging_dimension +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-06-07 13:36+0000\n" +"Last-Translator: mymage \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.17\n" + +#. module: product_packaging_dimension +#: model_terms:ir.ui.view,arch_db:product_packaging_dimension.product_packaging_form_view_inherit +msgid "Dimensions" +msgstr "Dimensioni" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__length_uom_id +msgid "Dimensions Units of Measure" +msgstr "Unità di misura per le dimensioni" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__height +msgid "Height" +msgstr "Altezza" + +#. module: product_packaging_dimension +#: model:ir.model.constraint,message:product_packaging_dimension.constraint_product_packaging_positive_height +msgid "Height must be positive" +msgstr "L'altezza deve essere positiva" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__id +msgid "ID" +msgstr "ID" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__packaging_length +msgid "Length" +msgstr "Lunghezza" + +#. module: product_packaging_dimension +#: model:ir.model.constraint,message:product_packaging_dimension.constraint_product_packaging_positive_length +msgid "Length must be positive" +msgstr "La lunghezza deve essere positiva" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__length_uom_name +msgid "Length unit of measure label" +msgstr "Etichetta unità di misura lunghezza" + +#. module: product_packaging_dimension +#: model:ir.model.constraint,message:product_packaging_dimension.constraint_product_packaging_positive_max_weight +msgid "Max Weight must be positive" +msgstr "Il peso massimo deve essere positivo" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__max_weight +msgid "Maximum Weight" +msgstr "Peso massimo" + +#. module: product_packaging_dimension +#: model:ir.model.fields,help:product_packaging_dimension.field_product_packaging__volume_uom_id +msgid "Packaging volume unit of measure" +msgstr "Unità di misura per il volume dell'imballaggio" + +#. module: product_packaging_dimension +#: model:ir.model,name:product_packaging_dimension.model_product_packaging +msgid "Product Packaging" +msgstr "Imballaggio prodotto" + +#. module: product_packaging_dimension +#: model:ir.model.fields,help:product_packaging_dimension.field_product_packaging__volume +msgid "The Packaging volume" +msgstr "Volume dell'imballaggio" + +#. module: product_packaging_dimension +#: model_terms:ir.ui.view,arch_db:product_packaging_dimension.product_packaging_form_view_inherit +msgid "Units of Measure" +msgstr "Unità di misura" + +#. module: product_packaging_dimension +#: model:ir.model.fields,help:product_packaging_dimension.field_product_packaging__length_uom_id +msgid "UoM for packaging length, height, width (based on lenght UoM)" +msgstr "" +"UdM per lunghezza, altezza, larghezza (basato sull'UdM della lunghezza) " +"dell'imballaggio" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__volume +msgid "Volume" +msgstr "Volume" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__volume_uom_name +msgid "Volume Unit of Measure label" +msgstr "Etichetta unità di misura volume" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__volume_uom_id +msgid "Volume Units of Measure" +msgstr "Unità di misura del volume" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__weight +#: model_terms:ir.ui.view,arch_db:product_packaging_dimension.product_packaging_form_view_inherit +msgid "Weight" +msgstr "Peso" + +#. module: product_packaging_dimension +#: model:ir.model.fields,help:product_packaging_dimension.field_product_packaging__weight_uom_id +msgid "Weight Unit of Measure" +msgstr "Unità di misura del peso" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__weight_uom_id +msgid "Weight Units of Measure" +msgstr "Unità di misura del peso" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__weight_uom_name +msgid "Weight unit of measure label" +msgstr "Etichetta unità di misura del peso" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__width +msgid "Width" +msgstr "Larghezza" + +#. module: product_packaging_dimension +#: model:ir.model.constraint,message:product_packaging_dimension.constraint_product_packaging_positive_width +msgid "Width must be positive" +msgstr "La larghezza deve essere positiva" diff --git a/product_packaging_dimension/i18n/product_packaging_dimension.pot b/product_packaging_dimension/i18n/product_packaging_dimension.pot new file mode 100644 index 000000000000..47de5f073499 --- /dev/null +++ b/product_packaging_dimension/i18n/product_packaging_dimension.pot @@ -0,0 +1,145 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_packaging_dimension +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.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_packaging_dimension +#: model_terms:ir.ui.view,arch_db:product_packaging_dimension.product_packaging_form_view_inherit +msgid "Dimensions" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__length_uom_id +msgid "Dimensions Units of Measure" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__display_name +msgid "Display Name" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__height +msgid "Height" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.constraint,message:product_packaging_dimension.constraint_product_packaging_positive_height +msgid "Height must be positive" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__id +msgid "ID" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging____last_update +msgid "Last Modified on" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__packaging_length +msgid "Length" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.constraint,message:product_packaging_dimension.constraint_product_packaging_positive_length +msgid "Length must be positive" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__length_uom_name +msgid "Length unit of measure label" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.constraint,message:product_packaging_dimension.constraint_product_packaging_positive_max_weight +msgid "Max Weight must be positive" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__max_weight +msgid "Maximum Weight" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,help:product_packaging_dimension.field_product_packaging__volume_uom_id +msgid "Packaging volume unit of measure" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model,name:product_packaging_dimension.model_product_packaging +msgid "Product Packaging" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,help:product_packaging_dimension.field_product_packaging__volume +msgid "The Packaging volume" +msgstr "" + +#. module: product_packaging_dimension +#: model_terms:ir.ui.view,arch_db:product_packaging_dimension.product_packaging_form_view_inherit +msgid "Units of Measure" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,help:product_packaging_dimension.field_product_packaging__length_uom_id +msgid "UoM for packaging length, height, width (based on lenght UoM)" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__volume +msgid "Volume" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__volume_uom_name +msgid "Volume Unit of Measure label" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__volume_uom_id +msgid "Volume Units of Measure" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__weight +#: model_terms:ir.ui.view,arch_db:product_packaging_dimension.product_packaging_form_view_inherit +msgid "Weight" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,help:product_packaging_dimension.field_product_packaging__weight_uom_id +msgid "Weight Unit of Measure" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__weight_uom_id +msgid "Weight Units of Measure" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__weight_uom_name +msgid "Weight unit of measure label" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.fields,field_description:product_packaging_dimension.field_product_packaging__width +msgid "Width" +msgstr "" + +#. module: product_packaging_dimension +#: model:ir.model.constraint,message:product_packaging_dimension.constraint_product_packaging_positive_width +msgid "Width must be positive" +msgstr "" diff --git a/product_packaging_dimension/migrations/14.0.1.0.0/pre-migrate.py b/product_packaging_dimension/migrations/14.0.1.0.0/pre-migrate.py new file mode 100644 index 000000000000..b1c282b3da7e --- /dev/null +++ b/product_packaging_dimension/migrations/14.0.1.0.0/pre-migrate.py @@ -0,0 +1,13 @@ +# Copyright 2021 Akretion +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tools.sql import column_exists, rename_column + + +def migrate(cr, version): + + # Rename lngth into packaging_length + if column_exists(cr, "product_packaging", "packaging_length"): + cr.execute("UPDATE product_packaging SET packaging_length = lngth") + elif column_exists(cr, "product_packaging", "lngth"): + rename_column(cr, "product_packaging", "lngth", "packaging_length") diff --git a/product_packaging_dimension/models/__init__.py b/product_packaging_dimension/models/__init__.py new file mode 100644 index 000000000000..2c4d9a88a376 --- /dev/null +++ b/product_packaging_dimension/models/__init__.py @@ -0,0 +1 @@ +from . import product_packaging diff --git a/product_packaging_dimension/models/product_packaging.py b/product_packaging_dimension/models/product_packaging.py new file mode 100644 index 000000000000..42f64fb23bc8 --- /dev/null +++ b/product_packaging_dimension/models/product_packaging.py @@ -0,0 +1,130 @@ +# Copyright 2019-2021 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) +from odoo import api, fields, models + + +class ProductPackaging(models.Model): + _inherit = "product.packaging" + # Constraints and dimensional field names are identical + # to product_packaging.py in delivery. + # The redundancy here avoids unnecessary dependencies on sale modules. + + _sql_constraints = [ + ("positive_height", "CHECK(height>=0)", "Height must be positive"), + ("positive_width", "CHECK(width>=0)", "Width must be positive"), + ("positive_length", "CHECK(packaging_length>=0)", "Length must be positive"), + ( + "positive_max_weight", + "CHECK(max_weight>=0)", + "Max Weight must be positive", + ), + ] + height = fields.Integer("Height") + width = fields.Integer("Width") + packaging_length = fields.Integer("Length") + + length_uom_id = fields.Many2one( + "uom.uom", + "Dimensions Units of Measure", + domain=lambda self: [ + ("category_id", "=", self.env.ref("uom.uom_categ_length").id) + ], + help="UoM for packaging length, height, width (based on lenght UoM)", + default=lambda self: self.env[ + "product.template" + ]._get_length_uom_id_from_ir_config_parameter(), + ) + length_uom_name = fields.Char( + string="Length unit of measure label", + related="length_uom_id.name", + readonly=True, + ) + + weight = fields.Float("Weight") + max_weight = fields.Float("Maximum Weight") + weight_uom_id = fields.Many2one( + "uom.uom", + string="Weight Units of Measure", + domain=lambda self: [ + ("category_id", "=", self.env.ref("uom.product_uom_categ_kgm").id) + ], + help="Weight Unit of Measure", + compute=False, + default=lambda self: self.env[ + "product.template" + ]._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, + ) + + volume = fields.Float( + "Volume", + digits=(8, 4), + compute="_compute_volume", + readonly=True, + store=False, + help="The Packaging volume", + ) + + volume_uom_id = fields.Many2one( + "uom.uom", + string="Volume Units of Measure", + domain=lambda self: [ + ("category_id", "=", self.env.ref("uom.product_uom_categ_vol").id) + ], + help="Packaging volume unit of measure", + default=lambda self: self.env[ + "product.template" + ]._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, + ) + + @api.depends( + "packaging_length", "width", "height", "length_uom_id", "volume_uom_id" + ) + def _compute_volume(self): + for packaging in self: + packaging.volume = packaging._calculate_volume( + packaging.packaging_length, + packaging.height, + packaging.width, + packaging.length_uom_id, + packaging.volume_uom_id, + ) + + def _calculate_volume( + self, packaging_length, height, width, length_uom_id, volume_uom_id + ): + volume_m3 = 0 + if packaging_length and height and width and length_uom_id: + length_m = self.convert_to_meters(packaging_length, length_uom_id) + height_m = self.convert_to_meters(height, length_uom_id) + width_m = self.convert_to_meters(width, length_uom_id) + volume_m3 = length_m * height_m * width_m + volume_in_volume_uom = self.convert_to_volume_uom(volume_m3, volume_uom_id) + return volume_in_volume_uom + + def convert_to_meters(self, measure, length_uom_id): + uom_meters = self.env.ref("uom.product_uom_meter") + return length_uom_id._compute_quantity( + qty=measure, + to_unit=uom_meters, + round=False, + ) + + def convert_to_volume_uom(self, measure, volume_uom_id): + uom_m3 = self.env.ref("uom.product_uom_cubic_meter") + return uom_m3._compute_quantity( + qty=measure, + to_unit=volume_uom_id, + round=False, + ) diff --git a/product_packaging_dimension/readme/CONTRIBUTORS.rst b/product_packaging_dimension/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..409a54ad273b --- /dev/null +++ b/product_packaging_dimension/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Patrick Tombez +* Akim Juillerat +* Kévin Roche diff --git a/product_packaging_dimension/readme/DESCRIPTION.rst b/product_packaging_dimension/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..a59a6549a271 --- /dev/null +++ b/product_packaging_dimension/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows to store dimensions (length, width, height), weight and +volume of product packagings. diff --git a/product_packaging_dimension/readme/ROADMAP.rst b/product_packaging_dimension/readme/ROADMAP.rst new file mode 100644 index 000000000000..07abef0a88f9 --- /dev/null +++ b/product_packaging_dimension/readme/ROADMAP.rst @@ -0,0 +1 @@ +* Resolve conflict with delivery module diff --git a/product_packaging_dimension/static/description/icon.png b/product_packaging_dimension/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/product_packaging_dimension/static/description/icon.png differ diff --git a/product_packaging_dimension/static/description/index.html b/product_packaging_dimension/static/description/index.html new file mode 100644 index 000000000000..496e6cd54cdf --- /dev/null +++ b/product_packaging_dimension/static/description/index.html @@ -0,0 +1,432 @@ + + + + + + +Product Packaging Dimension + + + +
+

Product Packaging Dimension

+ + +

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

+

This module allows to store dimensions (length, width, height), weight and +volume of product packagings.

+

Table of contents

+ +
+

Known issues / Roadmap

+
    +
  • Resolve conflict with delivery module
  • +
+
+
+

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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
  • Akretion
  • +
+
+
+

Contributors

+ +
+
+

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.

+

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_packaging_dimension/tests/__init__.py b/product_packaging_dimension/tests/__init__.py new file mode 100644 index 000000000000..029b81441579 --- /dev/null +++ b/product_packaging_dimension/tests/__init__.py @@ -0,0 +1,2 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from . import test_packaging_volume diff --git a/product_packaging_dimension/tests/test_packaging_volume.py b/product_packaging_dimension/tests/test_packaging_volume.py new file mode 100644 index 000000000000..4a1d5c780305 --- /dev/null +++ b/product_packaging_dimension/tests/test_packaging_volume.py @@ -0,0 +1,107 @@ +# Copyright (C) 2021 Akretion (). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase + + +class TestPackagingVolumeCompute(TransactionCase): + def setUp(self): + super(TestPackagingVolumeCompute, self).setUp() + + self.packaging = self.env["product.packaging"].new() + self.packaging2 = self.env["product.packaging"].new() + self.packaging3 = self.env["product.packaging"].new() + + self.uom_m = self.env["uom.uom"].search([("name", "=", "m")]) + self.uom_cm = self.env["uom.uom"].search([("name", "=", "cm")]) + self.uom_L = self.env["uom.uom"].search([("name", "=", "L")]) + self.uom_m3 = self.env["uom.uom"].search([("name", "=", "m³")]) + self.uom_ft = self.env["uom.uom"].search([("name", "=", "ft")]) + self.uom_ft3 = self.env["uom.uom"].search([("name", "=", "ft³")]) + + def test_input_uom(self): + # Volume always in m3 (using default parameter), but with different initial UoM. + + # Initial dimensions in meter + self.packaging.packaging_length = 10.0 + self.packaging.height = 10.0 + self.packaging.width = 10.0 + self.packaging.length_uom_id = self.uom_m + self.packaging.volume_uom_id = self.uom_m3 + self.packaging._compute_volume() + self.assertEqual(1000, self.packaging.volume) + + # Initial dimensions in cm + self.packaging2.packaging_length = 10.0 + self.packaging2.height = 10.0 + self.packaging2.width = 10.0 + self.packaging2.length_uom_id = self.uom_cm + self.packaging2.volume_uom_id = self.uom_m3 + self.packaging2._compute_volume() + self.assertEqual(0.001, self.packaging2.volume) + + # Initial dimensions in feet + self.packaging3.packaging_length = 10.0 + self.packaging3.height = 10.0 + self.packaging3.width = 10.0 + self.packaging3.length_uom_id = self.uom_ft + self.packaging3.volume_uom_id = self.uom_m3 + self.packaging3._compute_volume() + self.assertEqual(28.3168, self.packaging3.volume) + + def test_compute_volume(self): + # initial UoM always in meters and Volume in m3, but with different dimensions. + + self.packaging.packaging_length = 10 + self.packaging.height = 8 + self.packaging.width = 10 + self.packaging.length_uom_id = self.uom_m + self.packaging.volume_uom_id = self.uom_m3 + self.packaging._compute_volume() + self.assertEqual(800, self.packaging.volume) + + self.packaging2.packaging_length = 6.0 + self.packaging2.height = 14.0 + self.packaging2.width = 1.0 + self.packaging2.length_uom_id = self.uom_m + self.packaging2.volume_uom_id = self.uom_m3 + self.packaging2._compute_volume() + self.assertEqual(84.0, self.packaging2.volume) + + self.packaging3.packaging_length = 100.0 + self.packaging3.height = 50 + self.packaging3.width = 80 + self.packaging3.length_uom_id = self.uom_m + self.packaging3.volume_uom_id = self.uom_m3 + self.packaging3._compute_volume() + self.assertEqual(400000, self.packaging3.volume) + + def test_output_uom(self): + # Tests with both different initial and volume UoMs. + + # feet to Liters + self.packaging.packaging_length = 10.0 + self.packaging.height = 10.0 + self.packaging.width = 10.0 + self.packaging.length_uom_id = self.uom_ft + self.packaging.volume_uom_id = self.uom_L + self.packaging._compute_volume() + self.assertAlmostEqual(28316.8439, self.packaging.volume) + + # cm to cubic feet + self.packaging2.packaging_length = 10.0 + self.packaging2.height = 10.0 + self.packaging2.width = 10.0 + self.packaging2.length_uom_id = self.uom_cm + self.packaging2.volume_uom_id = self.uom_ft3 + self.packaging2._compute_volume() + self.assertAlmostEqual(0.0353, self.packaging2.volume) + + # meters to cubic feet + self.packaging3.packaging_length = 10.0 + self.packaging3.height = 10.0 + self.packaging3.width = 10.0 + self.packaging3.length_uom_id = self.uom_m + self.packaging3.volume_uom_id = self.uom_ft3 + self.packaging3._compute_volume() + self.assertAlmostEqual(35314.7248, self.packaging3.volume) diff --git a/product_packaging_dimension/views/product_packaging.xml b/product_packaging_dimension/views/product_packaging.xml new file mode 100644 index 000000000000..98dcc210c42c --- /dev/null +++ b/product_packaging_dimension/views/product_packaging.xml @@ -0,0 +1,51 @@ + + + + product.packaging.form.view.inherit + product.packaging + + + + + + + + + + + + + + + +