mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[MIG] stock_picking_volume: Migration to 14.0
This commit is contained in:
@@ -14,14 +14,14 @@ Stock Picking Volume
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_picking_volume
|
||||
:target: https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_picking_volume
|
||||
:alt: OCA/stock-logistics-warehouse
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_picking_volume
|
||||
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-14-0/stock-logistics-warehouse-14-0-stock_picking_volume
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||
:target: https://runbot.odoo-community.org/runbot/153/16.0
|
||||
:alt: Try me on Runbot
|
||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/stock-logistics-warehouse&target_branch=14.0
|
||||
:alt: Try me on Runboat
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
@@ -66,7 +66,7 @@ Bug Tracker
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/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/stock-logistics-warehouse/issues/new?body=module:%20stock_picking_volume%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_picking_volume%0Aversion:%2014.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.
|
||||
|
||||
@@ -82,6 +82,7 @@ Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* Laurent Mignon <laurent.mignon@acsone.eu> (https://www.acsone.eu/)
|
||||
* Michael Tietz (MT Software) <mtietz@mt-software.de>
|
||||
|
||||
Other credits
|
||||
~~~~~~~~~~~~~
|
||||
@@ -112,6 +113,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
||||
|
||||
|maintainer-lmignon|
|
||||
|
||||
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_picking_volume>`_ project on GitHub.
|
||||
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_picking_volume>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
# Copyright 2023 ACSONE SA/NV
|
||||
# Copyright 2023 Michael Tietz (MT Software) <mtietz@mt-software.de>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Stock Picking Volume",
|
||||
"summary": """
|
||||
Compute volume information on stock moves and pickings""",
|
||||
"version": "16.0.1.0.0",
|
||||
"version": "14.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# Copyright 2023 ACSONE SA/NV
|
||||
# Copyright 2023 Michael Tietz (MT Software) <mtietz@mt-software.de>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
@@ -16,7 +17,7 @@ class StockMove(models.Model):
|
||||
string="Volume unit of measure label", compute="_compute_volume_uom_name"
|
||||
)
|
||||
|
||||
@api.depends("product_id", "product_uom_qty", "state", "move_line_ids.reserved_qty")
|
||||
@api.depends("product_id", "product_uom_qty", "state", "move_line_ids.product_qty")
|
||||
def _compute_volume(self):
|
||||
for move in self:
|
||||
qty = move.product_uom_qty
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# Copyright 2023 ACSONE SA/NV
|
||||
# Copyright 2023 Michael Tietz (MT Software) <mtietz@mt-software.de>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
@@ -15,10 +16,10 @@ class StockPicking(models.Model):
|
||||
string="Volume unit of measure label", compute="_compute_volume_uom_name"
|
||||
)
|
||||
|
||||
@api.depends("move_ids", "move_ids.volume")
|
||||
@api.depends("move_lines", "move_lines.volume")
|
||||
def _compute_volume(self):
|
||||
for picking in self:
|
||||
new_volume = sum(picking.move_ids.mapped("volume"))
|
||||
new_volume = sum(picking.move_lines.mapped("volume"))
|
||||
if picking.volume != new_volume:
|
||||
picking.volume = new_volume
|
||||
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
* Laurent Mignon <laurent.mignon@acsone.eu> (https://www.acsone.eu/)
|
||||
* Michael Tietz (MT Software) <mtietz@mt-software.de>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
|
||||
<title>Stock Picking Volume</title>
|
||||
<style type="text/css">
|
||||
|
||||
@@ -367,7 +367,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_picking_volume"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_picking_volume"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/16.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_picking_volume"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-14-0/stock-logistics-warehouse-14-0-stock_picking_volume"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/webui/builds.html?repo=OCA/stock-logistics-warehouse&target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>For some processes, you need to know the volume of your stock picking. This could
|
||||
be useful for example to know the device to use to process it. An other use case
|
||||
could be to know how many trucks you need to deliver your products.</p>
|
||||
@@ -413,7 +413,7 @@ stock moves and pickings.</p>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues">GitHub Issues</a>.
|
||||
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
|
||||
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_picking_volume%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_picking_volume%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
@@ -428,6 +428,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Laurent Mignon <<a class="reference external" href="mailto:laurent.mignon@acsone.eu">laurent.mignon@acsone.eu</a>> (<a class="reference external" href="https://www.acsone.eu/">https://www.acsone.eu/</a>)</li>
|
||||
<li>Michael Tietz (MT Software) <<a class="reference external" href="mailto:mtietz@mt-software.de">mtietz@mt-software.de</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="other-credits">
|
||||
@@ -447,7 +448,7 @@ mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.</p>
|
||||
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
||||
<p><a class="reference external" href="https://github.com/lmignon"><img alt="lmignon" src="https://github.com/lmignon.png?size=40px" /></a></p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_picking_volume">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_picking_volume">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
# Copyright 2023 ACSONE SA/NV
|
||||
# Copyright 2023 Michael Tietz (MT Software) <mtietz@mt-software.de>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.tests.common import TransactionCase
|
||||
from odoo.tests.common import SavepointCase
|
||||
|
||||
|
||||
class TestStockPickingVolume(TransactionCase):
|
||||
class TestStockPickingVolume(SavepointCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
@@ -19,17 +20,18 @@ class TestStockPickingVolume(TransactionCase):
|
||||
)
|
||||
cls.loc_stock = cls.wh.lot_stock_id
|
||||
cls.loc_customer = cls.env.ref("stock.stock_location_customers")
|
||||
cls.product_template = cls.env["product.template"].create(
|
||||
cls.product = cls.env["product.product"].create(
|
||||
{
|
||||
"name": "Unittest P1",
|
||||
"product_length": 10.0,
|
||||
"product_width": 5.0,
|
||||
"product_height": 3.0,
|
||||
"uom_id": cls.env.ref("uom.product_uom_unit").id,
|
||||
"dimensional_uom_id": cls.env.ref("uom.product_uom_meter").id,
|
||||
"type": "product",
|
||||
}
|
||||
)
|
||||
cls.product = cls.product_template.product_variant_ids
|
||||
cls.product.onchange_calculate_volume()
|
||||
cls.picking_type_out = cls.env.ref("stock.picking_type_out")
|
||||
cls.picking = cls.env["stock.picking"].create(
|
||||
{
|
||||
@@ -37,13 +39,14 @@ class TestStockPickingVolume(TransactionCase):
|
||||
"location_id": cls.loc_stock.id,
|
||||
"location_dest_id": cls.loc_customer.id,
|
||||
"partner_id": cls.env.ref("base.res_partner_1").id,
|
||||
"move_ids": [
|
||||
"move_lines": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"name": cls.product.name,
|
||||
"product_id": cls.product.id,
|
||||
"product_uom": cls.product.uom_id.id,
|
||||
"product_uom_qty": 5.0,
|
||||
"location_id": cls.loc_stock.id,
|
||||
"location_dest_id": cls.loc_customer.id,
|
||||
@@ -82,6 +85,7 @@ class TestStockPickingVolume(TransactionCase):
|
||||
self._set_product_qty(self.product, 1)
|
||||
self.picking.action_confirm()
|
||||
self.picking.action_assign()
|
||||
self.picking.invalidate_cache()
|
||||
self.assertEqual(self.picking.volume, 150)
|
||||
|
||||
def test_picking_available_volume(self):
|
||||
@@ -98,6 +102,7 @@ class TestStockPickingVolume(TransactionCase):
|
||||
self._set_product_qty(self.product, 5)
|
||||
self.picking.action_confirm()
|
||||
self.picking.action_assign()
|
||||
self.picking.invalidate_cache()
|
||||
self.assertEqual(self.picking.volume, 750)
|
||||
|
||||
def test_picking_done_volume(self):
|
||||
|
||||
Reference in New Issue
Block a user