[MIG] stock_removal_location_by_priority: Migration to 16.0

This commit is contained in:
Aritz Olea
2023-11-21 10:36:20 +01:00
parent c283c8e629
commit a29c7edce6
7 changed files with 21 additions and 20 deletions

View File

@@ -7,7 +7,7 @@ Stock Removal Location by Priority
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:778ff616ca9d089ad75e8bccc6ad8d85999534733f7e90988533944d1ce95d12 !! source digest: sha256:5a11cbda4c26dfde12e89780b1ad4f8e74cf6e5f821e80c759c837dc0772a814
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -17,13 +17,13 @@ Stock Removal Location by Priority
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github .. |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/14.0/stock_removal_location_by_priority :target: https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_removal_location_by_priority
:alt: OCA/stock-logistics-warehouse :alt: OCA/stock-logistics-warehouse
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-14-0/stock-logistics-warehouse-14-0-stock_removal_location_by_priority :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_removal_location_by_priority
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=14.0 :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=16.0
:alt: Try me on Runboat :alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@@ -68,7 +68,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/issues>`_. 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. 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 If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_removal_location_by_priority%0Aversion:%2014.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_removal_location_by_priority%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. Do not contact contributors directly about support or help with technical issues.
@@ -86,6 +86,7 @@ Contributors
* Miquel Raïch <miquel.raich@forgeflow.com> * Miquel Raïch <miquel.raich@forgeflow.com>
* Lois Rilo <lois.rilo@forgeflow.com> * Lois Rilo <lois.rilo@forgeflow.com>
* Pimolnat Suntian <pimolnats@ecosoft.co.th> * Pimolnat Suntian <pimolnats@ecosoft.co.th>
* Aritz Olea <aritz.olea@factorlibre.com>
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@@ -100,6 +101,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_removal_location_by_priority>`_ project on GitHub. This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_removal_location_by_priority>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -4,7 +4,7 @@
{ {
"name": "Stock Removal Location by Priority", "name": "Stock Removal Location by Priority",
"summary": "Establish a removal priority on stock locations.", "summary": "Establish a removal priority on stock locations.",
"version": "14.0.1.0.0", "version": "16.0.1.0.0",
"author": "ForgeFlow, " "Odoo Community Association (OCA)", "author": "ForgeFlow, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse", "website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse", "category": "Warehouse",

View File

@@ -9,7 +9,6 @@ class StockLocation(models.Model):
_inherit = "stock.location" _inherit = "stock.location"
removal_priority = fields.Integer( removal_priority = fields.Integer(
string="Removal Priority",
default=10, default=10,
help="This priority applies when removing stock and incoming dates are equal.", help="This priority applies when removing stock and incoming dates are equal.",
) )

View File

@@ -19,9 +19,9 @@ class StockQuant(models.Model):
"stock_removal_location_by_priority.group_removal_priority" "stock_removal_location_by_priority.group_removal_priority"
): ):
if removal_strategy == "fifo": if removal_strategy == "fifo":
return "in_date ASC NULLS FIRST, removal_priority ASC, id" return "in_date ASC, removal_priority ASC, id"
elif removal_strategy == "lifo": elif removal_strategy == "lifo":
return "in_date DESC NULLS LAST, removal_priority ASC, id desc" return "in_date DESC, removal_priority ASC, id desc"
raise UserError( raise UserError(
_("Removal strategy %s not implemented.") % (removal_strategy,) _("Removal strategy %s not implemented.") % (removal_strategy,)
) )

View File

@@ -1,3 +1,4 @@
* Miquel Raïch <miquel.raich@forgeflow.com> * Miquel Raïch <miquel.raich@forgeflow.com>
* Lois Rilo <lois.rilo@forgeflow.com> * Lois Rilo <lois.rilo@forgeflow.com>
* Pimolnat Suntian <pimolnats@ecosoft.co.th> * Pimolnat Suntian <pimolnats@ecosoft.co.th>
* Aritz Olea <aritz.olea@factorlibre.com>

View File

@@ -367,9 +367,9 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:778ff616ca9d089ad75e8bccc6ad8d85999534733f7e90988533944d1ce95d12 !! source digest: sha256:5a11cbda4c26dfde12e89780b1ad4f8e74cf6e5f821e80c759c837dc0772a814
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_removal_location_by_priority"><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 image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-14-0/stock-logistics-warehouse-14-0-stock_removal_location_by_priority"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p> <p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_removal_location_by_priority"><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 image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_removal_location_by_priority"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds a removal priority field on stock locations. <p>This module adds a removal priority field on stock locations.
This priority applies when removing a product from different stock locations This priority applies when removing a product from different stock locations
and the incoming dates are equal in both locations.</p> and the incoming dates are equal in both locations.</p>
@@ -417,7 +417,7 @@ use FIFO or LIFO removal strategy.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues">GitHub Issues</a>. <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. 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 If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_removal_location_by_priority%0Aversion:%2014.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_removal_location_by_priority%0Aversion:%2016.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> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@@ -434,6 +434,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<li>Miquel Raïch &lt;<a class="reference external" href="mailto:miquel.raich&#64;forgeflow.com">miquel.raich&#64;forgeflow.com</a>&gt;</li> <li>Miquel Raïch &lt;<a class="reference external" href="mailto:miquel.raich&#64;forgeflow.com">miquel.raich&#64;forgeflow.com</a>&gt;</li>
<li>Lois Rilo &lt;<a class="reference external" href="mailto:lois.rilo&#64;forgeflow.com">lois.rilo&#64;forgeflow.com</a>&gt;</li> <li>Lois Rilo &lt;<a class="reference external" href="mailto:lois.rilo&#64;forgeflow.com">lois.rilo&#64;forgeflow.com</a>&gt;</li>
<li>Pimolnat Suntian &lt;<a class="reference external" href="mailto:pimolnats&#64;ecosoft.co.th">pimolnats&#64;ecosoft.co.th</a>&gt;</li> <li>Pimolnat Suntian &lt;<a class="reference external" href="mailto:pimolnats&#64;ecosoft.co.th">pimolnats&#64;ecosoft.co.th</a>&gt;</li>
<li>Aritz Olea &lt;<a class="reference external" href="mailto:aritz.olea&#64;factorlibre.com">aritz.olea&#64;factorlibre.com</a>&gt;</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
@@ -443,7 +444,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_removal_location_by_priority">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/16.0/stock_removal_location_by_priority">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> <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>
</div> </div>

View File

@@ -4,6 +4,7 @@
from datetime import date from datetime import date
from odoo import Command
from odoo.tests.common import TransactionCase from odoo.tests.common import TransactionCase
@@ -93,10 +94,8 @@ class TestStockRemovalLocationByPriority(TransactionCase):
"picking_type_id": picking_type.id, "picking_type_id": picking_type.id,
"location_id": location.id, "location_id": location.id,
"location_dest_id": location_dest.id, "location_dest_id": location_dest.id,
"move_lines": [ "move_ids": [
( Command.create(
0,
0,
{ {
"name": "Test move", "name": "Test move",
"product_id": self.product_1.id, "product_id": self.product_1.id,
@@ -126,7 +125,7 @@ class TestStockRemovalLocationByPriority(TransactionCase):
picking_1 = self._create_picking( picking_1 = self._create_picking(
self.picking_internal, self.stock, self.stock_2, 5 self.picking_internal, self.stock, self.stock_2, 5
) )
picking_1.flush() picking_1.flush_model()
picking_1.action_confirm() picking_1.action_confirm()
picking_1.action_assign() picking_1.action_assign()
@@ -151,7 +150,7 @@ class TestStockRemovalLocationByPriority(TransactionCase):
picking_1 = self._create_picking( picking_1 = self._create_picking(
self.picking_internal, self.stock, self.stock_2, 5 self.picking_internal, self.stock, self.stock_2, 5
) )
picking_1.flush() picking_1.flush_model()
picking_1.action_confirm() picking_1.action_confirm()
picking_1.action_assign() picking_1.action_assign()