diff --git a/product_net_weight/README.rst b/product_net_weight/README.rst new file mode 100644 index 00000000000..8b13e993d6b --- /dev/null +++ b/product_net_weight/README.rst @@ -0,0 +1,102 @@ +===================== +Products - Net Weight +===================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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_net_weight + :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_net_weight + :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 extends the functionality of stock module to support net weight. (container excluded) + + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +* Go to 'Inventory > Master Data > Product' and edit items. + +* Go to 'Inventory' tab, and fill the "Net Weight" value. + +.. figure:: https://raw.githubusercontent.com/OCA/product-attribute/12.0/product_net_weight/static/description/product_form.png + +**Note**: The original weight field is renamed to "Gross Weight", to be more explicit. + +Known issues / Roadmap +====================== + +In futur version (> 12.0), allow to compute Weight Price +(Net weight / Price). +For that purpose, refactor with ``product_logistics_uom``. + +Ref : https://github.com/OCA/product-attribute/pull/894#issuecomment-895930887 + +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 +~~~~~~~ + +* GRAP + +Contributors +~~~~~~~~~~~~ + +* Sylvain LE GAL (https://www.twitter.com/legalsylvain) + +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-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px + :target: https://github.com/legalsylvain + :alt: legalsylvain + +Current `maintainer `__: + +|maintainer-legalsylvain| + +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_net_weight/__init__.py b/product_net_weight/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/product_net_weight/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_net_weight/__manifest__.py b/product_net_weight/__manifest__.py new file mode 100644 index 00000000000..8a86725dc65 --- /dev/null +++ b/product_net_weight/__manifest__.py @@ -0,0 +1,25 @@ +# Copyright (C) 2021 - Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Products - Net Weight", + "summary": "Add 'Net Weight' on product models", + "version": "12.0.1.0.1", + "category": "Product", + "author": "GRAP,Odoo Community Association (OCA)", + "maintainers": ["legalsylvain"], + "website": "https://github.com/OCA/product-attribute", + "license": "AGPL-3", + "depends": ["product"], + "data": [ + "views/view_product_product.xml", + "views/view_product_template.xml", + ], + "demo": [ + "demo/product_product.xml", + ], + "images": [ + "static/description/product_product_form.png", + ], + "installable": True, +} diff --git a/product_net_weight/demo/product_product.xml b/product_net_weight/demo/product_product.xml new file mode 100644 index 00000000000..03f5afc7897 --- /dev/null +++ b/product_net_weight/demo/product_product.xml @@ -0,0 +1,19 @@ + + + + + + Strawberry Jam (Jar of 250 grams) + + + 0.250 + 0.410 + 1.97 + 2.70 + + + diff --git a/product_net_weight/i18n/fr.po b/product_net_weight/i18n/fr.po new file mode 100644 index 00000000000..1d0976ea708 --- /dev/null +++ b/product_net_weight/i18n/fr.po @@ -0,0 +1,84 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_net_weight +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-08-13 18:38+0000\n" +"PO-Revision-Date: 2021-08-13 18:38+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: product_net_weight +#: model:ir.model.fields,field_description:product_net_weight.field_product_product__weight +#: model:ir.model.fields,field_description:product_net_weight.field_product_template__weight +msgid "Gross Weight" +msgstr "Poids brut" + +#. module: product_net_weight +#: model:product.product,volume_uom_name:product_net_weight.product_strawberry_jam +#: model:product.template,volume_uom_name:product_net_weight.product_strawberry_jam_product_template +msgid "Liter(s)" +msgstr "" + +#. module: product_net_weight +#: model:ir.model.fields,field_description:product_net_weight.field_product_product__net_weight +#: model:ir.model.fields,field_description:product_net_weight.field_product_template__net_weight +msgid "Net Weight" +msgstr "Poids net" + +#. module: product_net_weight +#: model:ir.model.fields,help:product_net_weight.field_product_product__net_weight +#: model:ir.model.fields,help:product_net_weight.field_product_template__net_weight +msgid "Net Weight of the product, container excluded." +msgstr "Poids net du produit, contenant exclus." + +#. module: product_net_weight +#: model:ir.model,name:product_net_weight.model_product_product +msgid "Product" +msgstr "Article" + +#. module: product_net_weight +#: model:ir.model,name:product_net_weight.model_product_template +msgid "Product Template" +msgstr "Modèle d'article" + +#. module: product_net_weight +#: model:product.product,name:product_net_weight.product_strawberry_jam +#: model:product.template,name:product_net_weight.product_strawberry_jam_product_template +msgid "Strawberry Jam (Jar of 250 grams)" +msgstr "Confiture de fraise (Pot de 250 grammes)" + +#. module: product_net_weight +#: model:ir.model.fields,help:product_net_weight.field_product_template__weight +#, fuzzy +msgid "The weight of the contents, not including any packaging, etc." +msgstr "Le poids du contenu en kilogrammes, sans compter tout emballage, etc." + +#. module: product_net_weight +#: model:product.product,uom_name:product_net_weight.product_strawberry_jam +#: model:product.template,uom_name:product_net_weight.product_strawberry_jam_product_template +msgid "Unit(s)" +msgstr "Unité(s)" + +#. module: product_net_weight +#: model:ir.model.fields,help:product_net_weight.field_product_product__weight +msgid "" +"Weight of the product, packaging not included. The unit of measure can be " +"changed in the general settings" +msgstr "" +"Poids du produit, sans le conditionnement. L'unité de mesure peut être " +"changée dans les paramètres généraux." + +#. module: product_net_weight +#: model:product.product,weight_uom_name:product_net_weight.product_strawberry_jam +#: model:product.template,weight_uom_name:product_net_weight.product_strawberry_jam_product_template +msgid "kg" +msgstr "" diff --git a/product_net_weight/i18n/product_net_weight.pot b/product_net_weight/i18n/product_net_weight.pot new file mode 100644 index 00000000000..d8707098b42 --- /dev/null +++ b/product_net_weight/i18n/product_net_weight.pot @@ -0,0 +1,77 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_net_weight +# +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_net_weight +#: model:ir.model.fields,field_description:product_net_weight.field_product_product__weight +#: model:ir.model.fields,field_description:product_net_weight.field_product_template__weight +msgid "Gross Weight" +msgstr "" + +#. module: product_net_weight +#: model:product.product,volume_uom_name:product_net_weight.product_strawberry_jam +#: model:product.template,volume_uom_name:product_net_weight.product_strawberry_jam_product_template +msgid "Liter(s)" +msgstr "" + +#. module: product_net_weight +#: model:ir.model.fields,field_description:product_net_weight.field_product_product__net_weight +#: model:ir.model.fields,field_description:product_net_weight.field_product_template__net_weight +msgid "Net Weight" +msgstr "" + +#. module: product_net_weight +#: model:ir.model.fields,help:product_net_weight.field_product_product__net_weight +#: model:ir.model.fields,help:product_net_weight.field_product_template__net_weight +msgid "Net Weight of the product, container excluded." +msgstr "" + +#. module: product_net_weight +#: model:ir.model,name:product_net_weight.model_product_product +msgid "Product" +msgstr "" + +#. module: product_net_weight +#: model:ir.model,name:product_net_weight.model_product_template +msgid "Product Template" +msgstr "" + +#. module: product_net_weight +#: model:product.product,name:product_net_weight.product_strawberry_jam +#: model:product.template,name:product_net_weight.product_strawberry_jam_product_template +msgid "Strawberry Jam (Jar of 250 grams)" +msgstr "" + +#. module: product_net_weight +#: model:ir.model.fields,help:product_net_weight.field_product_template__weight +msgid "The weight of the contents, not including any packaging, etc." +msgstr "" + +#. module: product_net_weight +#: model:product.product,uom_name:product_net_weight.product_strawberry_jam +#: model:product.template,uom_name:product_net_weight.product_strawberry_jam_product_template +msgid "Unit(s)" +msgstr "" + +#. module: product_net_weight +#: model:ir.model.fields,help:product_net_weight.field_product_product__weight +msgid "Weight of the product, packaging not included. The unit of measure can be changed in the general settings" +msgstr "" + +#. module: product_net_weight +#: model:product.product,weight_uom_name:product_net_weight.product_strawberry_jam +#: model:product.template,weight_uom_name:product_net_weight.product_strawberry_jam_product_template +msgid "kg" +msgstr "" + diff --git a/product_net_weight/models/__init__.py b/product_net_weight/models/__init__.py new file mode 100644 index 00000000000..18b37e85320 --- /dev/null +++ b/product_net_weight/models/__init__.py @@ -0,0 +1,2 @@ +from . import product_product +from . import product_template diff --git a/product_net_weight/models/product_product.py b/product_net_weight/models/product_product.py new file mode 100644 index 00000000000..f3a7696b9e9 --- /dev/null +++ b/product_net_weight/models/product_product.py @@ -0,0 +1,19 @@ +# Copyright (C) 2021 - Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models +from odoo.addons import decimal_precision as dp + + +class ProductProduct(models.Model): + _inherit = "product.product" + + net_weight = fields.Float( + string="Net Weight", + digits=dp.get_precision("Stock Weight"), + help="Net Weight of the product, container excluded.", + ) + + # Explicit field, renaming it + weight = fields.Float(string="Gross Weight") diff --git a/product_net_weight/models/product_template.py b/product_net_weight/models/product_template.py new file mode 100644 index 00000000000..120e30fa1e2 --- /dev/null +++ b/product_net_weight/models/product_template.py @@ -0,0 +1,21 @@ +# Copyright (C) 2021 - Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models +from odoo.addons import decimal_precision as dp + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + net_weight = fields.Float( + string="Net Weight", + related="product_variant_ids.net_weight", + digits=dp.get_precision("Stock Weight"), + help="Net Weight of the product, container excluded.", + readonly=False, + ) + + # Explicit field, renaming it + weight = fields.Float(string="Gross Weight") diff --git a/product_net_weight/readme/CONTRIBUTORS.rst b/product_net_weight/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..e1525ce042b --- /dev/null +++ b/product_net_weight/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Sylvain LE GAL (https://www.twitter.com/legalsylvain) diff --git a/product_net_weight/readme/DESCRIPTION.rst b/product_net_weight/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..43cb00103e2 --- /dev/null +++ b/product_net_weight/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module extends the functionality of stock module to support net weight. (container excluded) + diff --git a/product_net_weight/readme/ROADMAP.rst b/product_net_weight/readme/ROADMAP.rst new file mode 100644 index 00000000000..e14be535544 --- /dev/null +++ b/product_net_weight/readme/ROADMAP.rst @@ -0,0 +1,5 @@ +In futur version (> 12.0), allow to compute Weight Price +(Net weight / Price). +For that purpose, refactor with ``product_logistics_uom``. + +Ref : https://github.com/OCA/product-attribute/pull/894#issuecomment-895930887 diff --git a/product_net_weight/readme/USAGE.rst b/product_net_weight/readme/USAGE.rst new file mode 100644 index 00000000000..4dfa73c47c5 --- /dev/null +++ b/product_net_weight/readme/USAGE.rst @@ -0,0 +1,7 @@ +* Go to 'Inventory > Master Data > Product' and edit items. + +* Go to 'Inventory' tab, and fill the "Net Weight" value. + +.. figure:: ../static/description/product_form.png + +**Note**: The original weight field is renamed to "Gross Weight", to be more explicit. diff --git a/product_net_weight/static/description/index.html b/product_net_weight/static/description/index.html new file mode 100644 index 00000000000..9f8f206f32f --- /dev/null +++ b/product_net_weight/static/description/index.html @@ -0,0 +1,441 @@ + + + + + + +Products - Net Weight + + + +
+

Products - Net Weight

+ + +

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

+

This module extends the functionality of stock module to support net weight. (container excluded)

+

Table of contents

+ +
+

Usage

+
    +
  • Go to ‘Inventory > Master Data > Product’ and edit items.
  • +
  • Go to ‘Inventory’ tab, and fill the “Net Weight” value.
  • +
+
+https://raw.githubusercontent.com/OCA/product-attribute/12.0/product_net_weight/static/description/product_form.png +
+

Note: The original weight field is renamed to “Gross Weight”, to be more explicit.

+
+
+

Known issues / Roadmap

+

In futur version (> 12.0), allow to compute Weight Price +(Net weight / Price). +For that purpose, refactor with product_logistics_uom.

+

Ref : https://github.com/OCA/product-attribute/pull/894#issuecomment-895930887

+
+
+

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

+
    +
  • GRAP
  • +
+
+ +
+

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:

+

legalsylvain

+

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_net_weight/static/description/product_form.png b/product_net_weight/static/description/product_form.png new file mode 100644 index 00000000000..f50a84dac09 Binary files /dev/null and b/product_net_weight/static/description/product_form.png differ diff --git a/product_net_weight/views/view_product_product.xml b/product_net_weight/views/view_product_product.xml new file mode 100644 index 00000000000..42e25e1b472 --- /dev/null +++ b/product_net_weight/views/view_product_product.xml @@ -0,0 +1,23 @@ + + + + + + product.product + + + + + + + + diff --git a/product_net_weight/views/view_product_template.xml b/product_net_weight/views/view_product_template.xml new file mode 100644 index 00000000000..40f56dee8c4 --- /dev/null +++ b/product_net_weight/views/view_product_template.xml @@ -0,0 +1,23 @@ + + + + + + product.template + + + + + + + +