Skip to content

Commit 55a49cf

Browse files
committed
[ADD] sale_order_revision_replace: new Sale Order revisions replace previous ones and keep Invoicing info
1 parent da166f9 commit 55a49cf

15 files changed

Lines changed: 669 additions & 0 deletions

File tree

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
================================================
2+
Sale Order Revisions replacing previous versions
3+
================================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:5bc7486756a1ae3a95fd37611ee62fe7993aa13c8e673744a91e45ac62eca91f
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
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
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+
Create new revisions or versions for Sales Orders,
32+
keeping the history of previous revisions.
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Usage
40+
=====
41+
42+
On Sales Orders, click on the "New Revision" button.
43+
This creates a new revision of the quotation,
44+
with the same base number and a revision number appended.
45+
46+
A message is added in the chatter saying that a new
47+
revision was created.
48+
49+
The linked Invoices are re-linked from the previous revision to the new one.
50+
51+
In the form view, a new tab is added that lists the previous revisions, with
52+
the date they were made obsolete and the user who performed the action.
53+
54+
The old revisions of a sale order are flagged as inactive, so they don't
55+
clutter up searches.
56+
57+
Bug Tracker
58+
===========
59+
60+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
61+
In case of trouble, please check there if your issue has already been reported.
62+
If you spotted it first, help us to smash it by providing a detailed and welcomed
63+
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_order_revision_replace%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
64+
65+
Do not contact contributors directly about support or help with technical issues.
66+
67+
Credits
68+
=======
69+
70+
Authors
71+
~~~~~~~
72+
73+
* Open Source Integrators
74+
75+
Contributors
76+
~~~~~~~~~~~~
77+
78+
* Daniel Reis <dreis@opensourceintegrators.com>
79+
80+
Maintainers
81+
~~~~~~~~~~~
82+
83+
This module is maintained by the OCA.
84+
85+
.. image:: https://odoo-community.org/logo.png
86+
:alt: Odoo Community Association
87+
:target: https://odoo-community.org
88+
89+
OCA, or the Odoo Community Association, is a nonprofit organization whose
90+
mission is to support the collaborative development of Odoo features and
91+
promote its widespread use.
92+
93+
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/14.0/sale_order_revision_replace>`_ project on GitHub.
94+
95+
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 2024 Open Source Integrators
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
{
5+
"name": "Sale Order Revisions replacing previous versions",
6+
"summary": "New sales order revisions replace the copied order",
7+
"version": "14.0.0.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"],
13+
"data": ["view/sale_order.xml"],
14+
"installable": True,
15+
}
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 sale_order
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright 2024 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 Invoices on the new Sale Order
14+
old_lines = self.order_line
15+
new_lines = self.current_revision_id.order_line
16+
for old_line, new_line in zip(old_lines, new_lines):
17+
new_line.invoice_lines = old_line.invoice_lines
18+
return action
19+
20+
def action_cancel_create_revision(self):
21+
# Button to create new revison
22+
# Cancels the original order before creating the new revision
23+
for sale in self:
24+
sale.action_cancel()
25+
action = sale.create_revision()
26+
if len(self) == 1:
27+
return action
28+
return {}
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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Create new revisions or versions for Sales Orders,
2+
keeping the history of previous revisions.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
On Sales Orders, click on the "New Revision" button.
2+
This creates a new revision of the quotation,
3+
with the same base number and a revision number appended.
4+
5+
A message is added in the chatter saying that a new
6+
revision was created.
7+
8+
The linked Invoices are re-linked from the previous revision to the new one.
9+
10+
In the form view, a new tab is added that lists the previous revisions, with
11+
the date they were made obsolete and the user who performed the action.
12+
13+
The old revisions of a sale order are flagged as inactive, so they don't
14+
clutter up searches.
9.23 KB
Loading

0 commit comments

Comments
 (0)