Skip to content

Commit

Permalink
[ADD] stock_release_channel_show_weight
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaudoux committed Mar 19, 2024
1 parent 84dd526 commit 63725d2
Show file tree
Hide file tree
Showing 14 changed files with 927 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/stock_release_channel_show_weight/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
79 changes: 79 additions & 0 deletions stock_release_channel_show_weight/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
==================================
Stock Release Channels show Weight
==================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6d21986b669c172ec403d968cfeaf164789c75dc3e6e73553e2f49dd5c1ca26d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fwms-lightgray.png?logo=github
:target: https://github.com/OCA/wms/tree/16.0/stock_release_channel_show_weight
:alt: OCA/wms
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/wms-16-0/wms-16-0-stock_release_channel_show_weight
: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/wms&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Show the volume on the release channels

Note: The weight computation is based on the estimated weight and not on the
measured shipping weight

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/wms/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 <https://github.com/OCA/wms/issues/new?body=module:%20stock_release_channel_show_weight%0Aversion:%2016.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
~~~~~~~

* BCIM

Contributors
~~~~~~~~~~~~

* Jacques-Etienne Baudoux (BCIM) <[email protected]>

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/wms <https://github.com/OCA/wms/tree/16.0/stock_release_channel_show_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 stock_release_channel_show_weight/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions stock_release_channel_show_weight/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2023 Jacques-Etienne Baudoux (BCIM) <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

{
"name": "Stock Release Channels show Weight",
"summary": "Display weights of stock release channels",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "BCIM, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/wms",
"depends": [
"delivery",
"stock_release_channel",
],
"data": [
"views/release_channel.xml",
"data/decimal_precision.xml",
],
"installable": True,
}
6 changes: 6 additions & 0 deletions stock_release_channel_show_weight/data/decimal_precision.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<odoo noupdate="1">
<record id="decimal_product_uom" model="decimal.precision" forcecreate="True">
<field name="name">Release Channel Weight</field>
<field name="digits" eval="0" />
</record>
</odoo>
1 change: 1 addition & 0 deletions stock_release_channel_show_weight/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_release_channel
127 changes: 127 additions & 0 deletions stock_release_channel_show_weight/models/stock_release_channel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Copyright 2024 Jacques-Etienne Baudoux (BCIM) <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from odoo import api, fields, models


class StockReleaseChannel(models.Model):
_inherit = "stock.release.channel"

weight_uom_name = fields.Char(
string="Weight Unit of Measure label", compute="_compute_weight_uom_name"
)

def _compute_weight_uom_name(self):
self.weight_uom_name = self.env[

Check warning on line 15 in stock_release_channel_show_weight/models/stock_release_channel.py

View check run for this annotation

Codecov / codecov/patch

stock_release_channel_show_weight/models/stock_release_channel.py#L15

Added line #L15 was not covered by tests
"product.template"
]._get_weight_uom_name_from_ir_config_parameter()

weight_picking_all = fields.Float(
string="All Transfers Weight",
compute="_compute_picking_count",
digits="Release Channel Weight",
)
weight_picking_release_ready = fields.Float(
string="Release Ready Transfers Weight",
compute="_compute_picking_count",
digits="Release Channel Weight",
)
weight_picking_released = fields.Float(
string="Released Transfers Weight",
compute="_compute_picking_count",
digits="Release Channel Weight",
)
weight_picking_assigned = fields.Float(
string="Available Transfers Weight",
compute="_compute_picking_count",
digits="Release Channel Weight",
)
weight_picking_waiting = fields.Float(
string="Waiting Transfers Weight",
compute="_compute_picking_count",
digits="Release Channel Weight",
)
weight_picking_late = fields.Float(
string="Late Transfers Weight",
compute="_compute_picking_count",
digits="Release Channel Weight",
)
weight_picking_priority = fields.Float(
string="Priority Transfers Weight",
compute="_compute_picking_count",
digits="Release Channel Weight",
)
weight_picking_done = fields.Float(
string="Transfers Done WeightToday",
compute="_compute_picking_count",
digits="Release Channel Weight",
)
weight_picking_full_progress = fields.Float(
string="Full Progress Weight",
compute="_compute_picking_count",
digits="Release Channel Weight",
)
weight_move_all = fields.Float(
string="All Moves (Estimate) Weight",
compute="_compute_picking_count",
digits="Release Channel Weight",
)
weight_move_release_ready = fields.Float(
string="Release Ready Moves (Estimate) Weight",
compute="_compute_picking_count",
digits="Release Channel Weight",
)
weight_move_released = fields.Float(
string="Released Moves (Estimate) Weight",
compute="_compute_picking_count",
digits="Release Channel Weight",
)
weight_move_assigned = fields.Float(
string="Available Moves (Estimate) Weight",
compute="_compute_picking_count",
digits="Release Channel Weight",
)
weight_move_waiting = fields.Float(
string="Waiting Moves (Estimate) Weight",
compute="_compute_picking_count",
digits="Release Channel Weight",
)
weight_move_late = fields.Float(
string="Late Moves (Estimate) Weight",
compute="_compute_picking_count",
digits="Release Channel Weight",
)
weight_move_priority = fields.Float(
string="Priority Moves (Estimate) Weight",
compute="_compute_picking_count",
digits="Release Channel Weight",
)
weight_move_done = fields.Float(
string="Moves Done Today (Estimate) Weight",
compute="_compute_picking_count",
digits="Release Channel Weight",
)

@api.model
def _get_picking_read_group_fields(self):
res = super()._get_picking_read_group_fields()
res += ["weight"]
return res

@api.model
def _get_move_read_group_fields(self):
res = super()._get_move_read_group_fields()
res += ["weight"]
return res

@api.model
def _get_picking_compute_fields(self):
res = super()._get_picking_compute_fields()
res += [("weight", "weight")]
return res

@api.model
def _get_move_compute_fields(self):
res = super()._get_move_compute_fields()
res += [("weight", "weight")]
return res
1 change: 1 addition & 0 deletions stock_release_channel_show_weight/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Jacques-Etienne Baudoux (BCIM) <[email protected]>
4 changes: 4 additions & 0 deletions stock_release_channel_show_weight/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Show the weight on the release channels

Note: The weight computation is based on the estimated weight and not on the
measured shipping weight
Loading

0 comments on commit 63725d2

Please sign in to comment.