Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[MIG] product_net_weight: Migration to 13.0 #1098

Merged
merged 6 commits into from
Nov 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions product_net_weight/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/OCA/product-attribute/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 <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_net_weight%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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 <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-legalsylvain|

This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/12.0/product_net_weight>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions product_net_weight/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions product_net_weight/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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": "13.0.1.0.0",
"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,
}
19 changes: 19 additions & 0 deletions product_net_weight/demo/product_product.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2021 - Today: GRAP (http://www.grap.coop)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
deLicense AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<record id="product_strawberry_jam" model="product.product">
<field name="name">Strawberry Jam (Jar of 250 grams)</field>
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="uom_po_id" ref="uom.product_uom_unit" />
<field name="net_weight">0.250</field>
<field name="weight">0.410</field>
<field name="standard_price">1.97</field>
<field name="list_price">2.70</field>
</record>

</odoo>
84 changes: 84 additions & 0 deletions product_net_weight/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -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 ""
77 changes: 77 additions & 0 deletions product_net_weight/i18n/product_net_weight.pot
Original file line number Diff line number Diff line change
@@ -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 ""

2 changes: 2 additions & 0 deletions product_net_weight/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import product_product
from . import product_template
18 changes: 18 additions & 0 deletions product_net_weight/models/product_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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


class ProductProduct(models.Model):
_inherit = "product.product"

net_weight = fields.Float(
string="Net Weight",
digits="Stock Weight",
help="Net Weight of the product, container excluded.",
)

# Explicit field, renaming it
weight = fields.Float(string="Gross Weight")
20 changes: 20 additions & 0 deletions product_net_weight/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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


class ProductTemplate(models.Model):
_inherit = "product.template"

net_weight = fields.Float(
string="Net Weight",
related="product_variant_ids.net_weight",
digits="Stock Weight",
help="Net Weight of the product, container excluded.",
readonly=False,
)

# Explicit field, renaming it
weight = fields.Float(string="Gross Weight")
5 changes: 5 additions & 0 deletions product_net_weight/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* Sylvain LE GAL (https://www.twitter.com/legalsylvain)

* `Trey Kilobytes de Soluciones SL <https://www.trey.es>`__:

* Vicent Cubells
1 change: 1 addition & 0 deletions product_net_weight/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module extends the functionality of stock module to support net weight. (container excluded)
5 changes: 5 additions & 0 deletions product_net_weight/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
In futur version (> 13.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
7 changes: 7 additions & 0 deletions product_net_weight/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -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.
Binary file added product_net_weight/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading