Skip to content

Commit

Permalink
[ADD] sale_order_revision_replace_stock: new Sale Order revisions rep…
Browse files Browse the repository at this point in the history
…lace previous ones and keep Delivery info
  • Loading branch information
dreispt committed Aug 20, 2024
1 parent 55a49cf commit 8cb3a3b
Show file tree
Hide file tree
Showing 13 changed files with 595 additions and 0 deletions.
81 changes: 81 additions & 0 deletions sale_order_revision_replace_stock/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
====================================
Sale order revisions keep Deliveries
====================================

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

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

The revision Sales Order preserves the link to the related Stock Moves.

**Table of contents**

.. contents::
:local:

Usage
=====

See instructions for the "Sale Order Revision" module.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-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/sale-workflow/issues/new?body=module:%20sale_order_revision_replace_stock%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.

Credits
=======

Authors
~~~~~~~

* Open Source Integrators

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

* Daniel Reis <dreis@opensourceintegrators.com>

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/sale-workflow <https://github.com/OCA/sale-workflow/tree/14.0/sale_order_revision_replace_stock>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions sale_order_revision_replace_stock/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models
15 changes: 15 additions & 0 deletions sale_order_revision_replace_stock/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2023 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Sale order revisions keep Deliveries",
"summary": "New revisions keep the link to Delivery Orders",
"version": "14.0.1.0.0",
"category": "Sale Management",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/sale-workflow",
"license": "AGPL-3",
"depends": ["sale_order_revision_replace", "stock"],
"installable": True,
"auto_install": True,
}
3 changes: 3 additions & 0 deletions sale_order_revision_replace_stock/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import sale_order
20 changes: 20 additions & 0 deletions sale_order_revision_replace_stock/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2023 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models


class SaleOrder(models.Model):
_inherit = "sale.order"

def create_revision(self):
# Extends base_revision module
action = super().create_revision()
# Keep links to Stock Moves on the new Sale Order
old_so = self
new_so = self.current_revision_id
new_so.procurement_group_id.sale_id = old_so
new_so.picking_ids = old_so.picking_ids
for old_line, new_line in zip(old_so.order_line, new_so.order_line):
new_line.move_ids = old_line.move_ids
return action
1 change: 1 addition & 0 deletions sale_order_revision_replace_stock/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Daniel Reis <dreis@opensourceintegrators.com>
1 change: 1 addition & 0 deletions sale_order_revision_replace_stock/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The revision Sales Order preserves the link to the related Stock Moves.
1 change: 1 addition & 0 deletions sale_order_revision_replace_stock/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See instructions for the "Sale Order Revision" module.
Loading

0 comments on commit 8cb3a3b

Please sign in to comment.