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

[14.0][ADD] sale_order_revision_replace[_stock] #3275

Open
wants to merge 2 commits into
base: 14.0
Choose a base branch
from
Open
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
95 changes: 95 additions & 0 deletions sale_order_revision_replace/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
================================================
Sale Order Revisions replacing previous versions
================================================

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

.. |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
: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
: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|

Create new revisions or versions for Sales Orders,
keeping the history of previous revisions.

**Table of contents**

.. contents::
:local:

Usage
=====

On Sales Orders, click on the "New Revision" button.
This creates a new revision of the quotation,
with the same base number and a revision number appended.

A message is added in the chatter saying that a new
revision was created.

The linked Invoices are re-linked from the previous revision to the new one.

In the form view, a new tab is added that lists the previous revisions, with
the date they were made obsolete and the user who performed the action.

The old revisions of a sale order are flagged as inactive, so they don't
clutter up searches.

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%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>`_ 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/__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/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Sale Order Revisions replacing previous versions",
"summary": "New sales order revisions replace the copied order",
"version": "14.0.0.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"],
"data": ["view/sale_order.xml"],
"installable": True,
}
2 changes: 2 additions & 0 deletions sale_order_revision_replace/models/__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 sale_order
28 changes: 28 additions & 0 deletions sale_order_revision_replace/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2024 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 Invoices on the new Sale Order
old_lines = self.order_line
new_lines = self.current_revision_id.order_line
for old_line, new_line in zip(old_lines, new_lines):
new_line.invoice_lines = old_line.invoice_lines
return action

def action_cancel_create_revision(self):
# Button to create new revison
# Cancels the original order before creating the new revision
for sale in self:
sale.action_cancel()
action = sale.create_revision()
if len(self) == 1:
return action
return {}

Check warning on line 28 in sale_order_revision_replace/models/sale_order.py

View check run for this annotation

Codecov / codecov/patch

sale_order_revision_replace/models/sale_order.py#L28

Added line #L28 was not covered by tests
1 change: 1 addition & 0 deletions sale_order_revision_replace/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Daniel Reis <dreis@opensourceintegrators.com>
2 changes: 2 additions & 0 deletions sale_order_revision_replace/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Create new revisions or versions for Sales Orders,
keeping the history of previous revisions.
14 changes: 14 additions & 0 deletions sale_order_revision_replace/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
On Sales Orders, click on the "New Revision" button.
This creates a new revision of the quotation,
with the same base number and a revision number appended.

A message is added in the chatter saying that a new
revision was created.

The linked Invoices are re-linked from the previous revision to the new one.

In the form view, a new tab is added that lists the previous revisions, with
the date they were made obsolete and the user who performed the action.

The old revisions of a sale order are flagged as inactive, so they don't
clutter up searches.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading