Skip to content

Commit d41fac8

Browse files
committed
[ADD] sale_order_revision_replace_stock: new Sale Order revisions replace previous ones and keep Delivery info
1 parent 55a49cf commit d41fac8

14 files changed

Lines changed: 1021 additions & 0 deletions

File tree

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
====================================
2+
Sale order revisions keep Deliveries
3+
====================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:a12522b262de379992417a0a378a6bf666ae335c6888e98d42afc6996a7392ae
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
20+
:target: https://github.com/OCA/sale-workflow/tree/14.0/sale_order_revision_replace_stock
21+
:alt: OCA/sale-workflow
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/sale-workflow-14-0/sale-workflow-14-0-sale_order_revision_replace_stock
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=14.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
The revision Sales Order preserves the link to the related Stock Moves.
32+
33+
**Table of contents**
34+
35+
.. contents::
36+
:local:
37+
38+
Usage
39+
=====
40+
41+
See instructions for the "Sale Order Revision" module.
42+
43+
Bug Tracker
44+
===========
45+
46+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
47+
In case of trouble, please check there if your issue has already been reported.
48+
If you spotted it first, help us to smash it by providing a detailed and welcomed
49+
`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**>`_.
50+
51+
Do not contact contributors directly about support or help with technical issues.
52+
53+
Credits
54+
=======
55+
56+
Authors
57+
~~~~~~~
58+
59+
* Open Source Integrators
60+
61+
Contributors
62+
~~~~~~~~~~~~
63+
64+
* Daniel Reis <dreis@opensourceintegrators.com>
65+
66+
Maintainers
67+
~~~~~~~~~~~
68+
69+
This module is maintained by the OCA.
70+
71+
.. image:: https://odoo-community.org/logo.png
72+
:alt: Odoo Community Association
73+
:target: https://odoo-community.org
74+
75+
OCA, or the Odoo Community Association, is a nonprofit organization whose
76+
mission is to support the collaborative development of Odoo features and
77+
promote its widespread use.
78+
79+
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.
80+
81+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
2+
from . import models
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2023 Open Source Integrators
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
{
5+
"name": "Sale order revisions keep Deliveries",
6+
"summary": "New revisions keep the link to Delivery Orders",
7+
"version": "14.0.1.0.0",
8+
"category": "Sale Management",
9+
"author": "Open Source Integrators, Odoo Community Association (OCA)",
10+
"website": "https://github.com/OCA/sale-workflow",
11+
"license": "AGPL-3",
12+
"depends": ["sale_order_revision_replace", "stock"],
13+
"installable": True,
14+
"auto_install": True,
15+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
2+
3+
from . import sale_order
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2023 Open Source Integrators
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
from odoo import models
5+
6+
7+
class SaleOrder(models.Model):
8+
_inherit = "sale.order"
9+
10+
def create_revision(self):
11+
# Extends base_revision module
12+
action = super().create_revision()
13+
# Keep links to Stock Moves on the new Sale Order
14+
old_so = self
15+
new_so = self.current_revision_id
16+
new_so.procurement_group_id.sale_id = old_so
17+
new_so.picking_ids = old_so.picking_ids
18+
for old_line, new_line in zip(old_so.order_line, new_so.order_line):
19+
new_line.move_ids = old_line.move_ids
20+
return action
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Daniel Reis <dreis@opensourceintegrators.com>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The revision Sales Order preserves the link to the related Stock Moves.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
See instructions for the "Sale Order Revision" module.

0 commit comments

Comments
 (0)