Skip to content

Commit

Permalink
Merge PR OCA#1582 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by dreispt
  • Loading branch information
OCA-git-bot committed May 18, 2024
2 parents ca60d59 + cc31ce2 commit 6c7f69c
Show file tree
Hide file tree
Showing 13 changed files with 765 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/stock_picking_propagate_scheduled_date/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,
)
80 changes: 80 additions & 0 deletions stock_picking_propagate_scheduled_date/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
======================================
Stock Picking Propagate Scheduled Date
======================================

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

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

Allows changes on the scheduled date of the pickings to be propagated when picking moves are chained.

Propagate the date delta between the new date and the old date to the ``move_dest_ids`` of the stock move being updated.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/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-workflow/issues/new?body=module:%20stock_picking_propagate_scheduled_date%0Aversion:%2015.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 SA

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

* `Camptocamp <https://www.camptocamp.com>`_

* Vincent Van Rossem <[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-workflow <https://github.com/OCA/stock-logistics-workflow/tree/15.0/stock_picking_propagate_scheduled_date>`_ 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_picking_propagate_scheduled_date/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
13 changes: 13 additions & 0 deletions stock_picking_propagate_scheduled_date/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2024 Camptocamp SA (https://www.camptocamp.com).
# @author Vincent Van Rossem <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Stock Picking Propagate Scheduled Date",
"summary": "Propagate Stock Picking Scheduled Date",
"version": "15.0.1.0.0",
"license": "AGPL-3",
"author": "Camptocamp SA, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-workflow",
"depends": ["stock"],
}
1 change: 1 addition & 0 deletions stock_picking_propagate_scheduled_date/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_move
33 changes: 33 additions & 0 deletions stock_picking_propagate_scheduled_date/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2024 Camptocamp SA (https://www.camptocamp.com).
# @author Vincent Van Rossem <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


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

def _propagate_date(self, new_date):
"""Propagate the date of a move to its destination."""
already_propagated_ids = self.env.context.get(
"date_propagation_ids", set()
) | set(self.ids)
self = self.with_context(date_propagation_ids=already_propagated_ids)
for move in self:
if move.date:
delta = move.date - fields.Datetime.to_datetime(new_date)
else:
delta = 0
for move_dest in move.move_dest_ids:
if move_dest.state in ("done", "cancel"):
continue
if move_dest.id in already_propagated_ids:
continue
move_dest.date -= delta

def write(self, vals):
# propagate date changes in the stock move chain
if "date" in vals:
self._propagate_date(vals.get("date"))
return super().write(vals)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Camptocamp <https://www.camptocamp.com>`_

* Vincent Van Rossem <[email protected]>
3 changes: 3 additions & 0 deletions stock_picking_propagate_scheduled_date/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Allows changes on the scheduled date of the pickings to be propagated when picking moves are chained.

Propagate the date delta between the new date and the old date to the ``move_dest_ids`` of the stock move being updated.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6c7f69c

Please sign in to comment.