Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Syncing from upstream OCA/stock-logistics-warehouse (18.0) #1619

Merged
merged 14 commits into from
Feb 5, 2025
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ addon | version | maintainers | summary
[stock_demand_estimate](stock_demand_estimate/) | 18.0.1.0.0 | | Allows to create demand estimates.
[stock_location_empty](stock_location_empty/) | 18.0.1.0.0 | | Adds a filter for empty stock location
[stock_location_zone](stock_location_zone/) | 18.0.1.0.0 | | Classify locations with zones.
[stock_move_common_dest](stock_move_common_dest/) | 18.0.1.0.0 | | Adds field for common destination moves
[stock_packaging_calculator](stock_packaging_calculator/) | 18.0.1.0.0 | | Compute product quantity to pick by packaging
[stock_quant_cost_info](stock_quant_cost_info/) | 18.0.1.0.0 | | Shows the cost of the quants
[stock_warehouse_calendar](stock_warehouse_calendar/) | 18.0.1.0.1 | [![JordiBForgeFlow](https://github.com/JordiBForgeFlow.png?size=30px)](https://github.com/JordiBForgeFlow) | Adds a calendar to the Warehouse
Expand Down
3 changes: 2 additions & 1 deletion setup/_metapackage/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[project]
name = "odoo-addons-oca-stock-logistics-warehouse"
version = "18.0.20250203.0"
version = "18.0.20250204.0"
dependencies = [
"odoo-addon-account_move_line_stock_info==18.0.*",
"odoo-addon-stock_archive_constraint==18.0.*",
"odoo-addon-stock_demand_estimate==18.0.*",
"odoo-addon-stock_location_empty==18.0.*",
"odoo-addon-stock_location_zone==18.0.*",
"odoo-addon-stock_move_common_dest==18.0.*",
"odoo-addon-stock_packaging_calculator==18.0.*",
"odoo-addon-stock_quant_cost_info==18.0.*",
"odoo-addon-stock_warehouse_calendar==18.0.*",
Expand Down
79 changes: 79 additions & 0 deletions stock_move_common_dest/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
=============================
Stock Move Common Destination
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:8ae775e2580e771eec4de492030c46f20043e9019dd9bb300f7c9e4d324278f4
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Fstock--logistics--warehouse-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-warehouse/tree/18.0/stock_move_common_dest
: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-18-0/stock-logistics-warehouse-18-0-stock_move_common_dest
: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/stock-logistics-warehouse&target_branch=18.0
:alt: Try me on Runboat

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

This module adds a M2m field common_dest_move_ids on stock.move in order
to compute all the moves having a chained destination move sharing the
same picking as the actual move's destination move.

**Table of contents**

.. contents::
:local:

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_move_common_dest%0Aversion:%2018.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
-------

* Camptocamp

Contributors
------------

- Akim Juillerat <[email protected]>
- Hughes Damry <[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/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/18.0/stock_move_common_dest>`_ 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_move_common_dest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions stock_move_common_dest/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2020 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
{
"name": "Stock Move Common Destination",
"summary": "Adds field for common destination moves",
"version": "18.0.1.0.0",
"category": "Warehouse Management",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["stock"],
"data": ["views/stock_move.xml"],
}
42 changes: 42 additions & 0 deletions stock_move_common_dest/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_move_common_dest
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-05-05 16:33+0000\n"
"Last-Translator: Hughes Damry <[email protected]>\n"
"Language-Team: none\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.14.1\n"

#. module: stock_move_common_dest
#: model:ir.model.fields,help:stock_move_common_dest.field_stock_move__common_dest_move_ids
msgid ""
"All the stock moves having a chained destination move sharing the same "
"picking as the actual move's destination move"
msgstr ""
"Tous les mouvements de stock ayant un mouvement de destination chaîné "
"partageant le même transfert que le mouvement de destination du mouvement "
"courant"

#. module: stock_move_common_dest
#: model:ir.model.fields,field_description:stock_move_common_dest.field_stock_move__common_dest_move_ids
msgid "Common Dest Move"
msgstr "Mouv. Dst. commun"

#. module: stock_move_common_dest
#: model_terms:ir.ui.view,arch_db:stock_move_common_dest.view_move_form_inherit
msgid "Common destination moves"
msgstr "Mouvements de destination communs"

#. module: stock_move_common_dest
#: model:ir.model,name:stock_move_common_dest.model_stock_move
msgid "Stock Move"
msgstr "Mouvement de stock"
42 changes: 42 additions & 0 deletions stock_move_common_dest/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_move_common_dest
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-21 13:33+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: stock_move_common_dest
#: model:ir.model.fields,help:stock_move_common_dest.field_stock_move__common_dest_move_ids
msgid ""
"All the stock moves having a chained destination move sharing the same "
"picking as the actual move's destination move"
msgstr ""
"Tutti i movimenti che hanno un movimento di destinazione collegato, che "
"condividono lo stesso prelievo del movimento di destinazione di questo "
"movimento"

#. module: stock_move_common_dest
#: model:ir.model.fields,field_description:stock_move_common_dest.field_stock_move__common_dest_move_ids
msgid "Common Dest Move"
msgstr "Movimento di destinazione comune"

#. module: stock_move_common_dest
#: model_terms:ir.ui.view,arch_db:stock_move_common_dest.view_move_form_inherit
msgid "Common destination moves"
msgstr "Movimenti con destinazione comune"

#. module: stock_move_common_dest
#: model:ir.model,name:stock_move_common_dest.model_stock_move
msgid "Stock Move"
msgstr "Movimento di magazzino"
36 changes: 36 additions & 0 deletions stock_move_common_dest/i18n/stock_move_common_dest.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_move_common_dest
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.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: stock_move_common_dest
#: model:ir.model.fields,help:stock_move_common_dest.field_stock_move__common_dest_move_ids
msgid ""
"All the stock moves having a chained destination move sharing the same "
"picking as the actual move's destination move"
msgstr ""

#. module: stock_move_common_dest
#: model:ir.model.fields,field_description:stock_move_common_dest.field_stock_move__common_dest_move_ids
msgid "Common Dest Move"
msgstr ""

#. module: stock_move_common_dest
#: model_terms:ir.ui.view,arch_db:stock_move_common_dest.view_move_form_inherit
msgid "Common destination moves"
msgstr ""

#. module: stock_move_common_dest
#: model:ir.model,name:stock_move_common_dest.model_stock_move
msgid "Stock Move"
msgstr ""
1 change: 1 addition & 0 deletions stock_move_common_dest/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_move
73 changes: 73 additions & 0 deletions stock_move_common_dest/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Copyright 2020 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import api, fields, models
from odoo.osv.expression import FALSE_DOMAIN


class StockMove(models.Model):
_inherit = "stock.move"

common_dest_move_ids = fields.Many2many(
"stock.move",
compute="_compute_common_dest_move_ids",
search="_search_compute_dest_move_ids",
help="All the stock moves having a chained destination move sharing the"
" same picking as the actual move's destination move",
)

def _flush_common_dest_move_query(self):
# flush is necessary before a SELECT
self.flush_recordset(["move_orig_ids", "move_dest_ids"])

def _common_dest_move_query(self):
sql = """SELECT smmr.move_orig_id move_id
, array_agg(smmr2.move_orig_id) common_move_dest_ids
FROM stock_move_move_rel smmr
, stock_move sm_dest
, stock_picking sp
, stock_move sm_pick
, stock_move_move_rel smmr2
WHERE smmr.move_dest_id = sm_dest.id
AND sm_dest.picking_id = sp.id
AND sp.id = sm_pick.picking_id
AND sm_pick.id = smmr2.move_dest_id
AND smmr.move_orig_id != smmr2.move_orig_id
AND smmr.move_orig_id IN %s
GROUP BY smmr.move_orig_id;
"""
return sql

@api.depends(
"move_dest_ids",
"move_dest_ids.picking_id",
"move_dest_ids.picking_id.move_ids",
"move_dest_ids.picking_id.move_ids.move_orig_ids",
)
def _compute_common_dest_move_ids(self):
self._flush_common_dest_move_query()
sql = self._common_dest_move_query()
self.env.cr.execute(sql, (tuple(self.ids),))
res = {
row.get("move_id"): row.get("common_move_dest_ids")
for row in self.env.cr.dictfetchall()
}
for move in self:
common_move_ids = res.get(move.id)
if common_move_ids:
move.common_dest_move_ids = [(6, 0, common_move_ids)]
else:
move.common_dest_move_ids = [(5, 0, 0)]

def _search_compute_dest_move_ids(self, operator, value):
moves = self.search([("id", operator, value)])
if not moves:
return FALSE_DOMAIN
self._flush_common_dest_move_query()
sql = self._common_dest_move_query()
self.env.cr.execute(sql, (tuple(moves.ids),))
res = [
move_dest_id
for row in self.env.cr.dictfetchall()
for move_dest_id in row.get("common_move_dest_ids") or []
]
return [("id", "in", res)]
3 changes: 3 additions & 0 deletions stock_move_common_dest/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions stock_move_common_dest/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Akim Juillerat \<<[email protected]>\>
- Hughes Damry \<<[email protected]>\>
3 changes: 3 additions & 0 deletions stock_move_common_dest/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module adds a M2m field common_dest_move_ids on stock.move in order
to compute all the moves having a chained destination move sharing the
same picking as the actual move's destination move.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading