Skip to content

Commit

Permalink
Merge pull request #1640 from OCA/15.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/purchase-workflow (15.0)
  • Loading branch information
bt-admin authored Jan 9, 2025
2 parents c0c70bb + b292a87 commit cb7d95f
Show file tree
Hide file tree
Showing 37 changed files with 1,624 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ addon | version | maintainers | summary
[purchase_order_product_recommendation_xlsx](purchase_order_product_recommendation_xlsx/) | 15.0.1.0.1 | | Add a way to print recommended products for supplier
[purchase_order_qty_by_product_category](purchase_order_qty_by_product_category/) | 15.0.1.0.0 | | Purchase - Order Qty By Product Category
[purchase_order_qty_change_no_recompute](purchase_order_qty_change_no_recompute/) | 15.0.1.0.2 | [![victoralmau](https://github.com/victoralmau.png?size=30px)](https://github.com/victoralmau) | Prevent recompute if only quantity has changed in purchase order line
[purchase_order_revision](purchase_order_revision/) | 15.0.0.0.0 | | Keep track of revised quotations
[purchase_order_secondary_unit](purchase_order_secondary_unit/) | 15.0.1.4.1 | | Purchase product in a secondary unit
[purchase_order_supplierinfo_update](purchase_order_supplierinfo_update/) | 15.0.1.0.1 | [![ernestotejeda](https://github.com/ernestotejeda.png?size=30px)](https://github.com/ernestotejeda) | Update product supplierinfo with the last purchase price
[purchase_order_type](purchase_order_type/) | 15.0.1.0.2 | | Purchase Order Type
Expand All @@ -86,6 +87,7 @@ addon | version | maintainers | summary
[purchase_receipt_percentage](purchase_receipt_percentage/) | 15.0.1.0.0 | | Purchase - Receipt Percentage
[purchase_reception_notify](purchase_reception_notify/) | 15.0.1.0.0 | | Purchase Reception Notify
[purchase_reception_status](purchase_reception_status/) | 15.0.1.0.0 | [![alexis-via](https://github.com/alexis-via.png?size=30px)](https://github.com/alexis-via) | Add reception status on purchase orders
[purchase_reception_status_line](purchase_reception_status_line/) | 15.0.1.0.0 | [![DavidJForgeFlow](https://github.com/DavidJForgeFlow.png?size=30px)](https://github.com/DavidJForgeFlow) | Add reception status on purchase order lines
[purchase_representative](purchase_representative/) | 15.0.1.0.0 | | Purchase Representatives will be the point of contact for RFQ's and PO's
[purchase_request](purchase_request/) | 15.0.1.2.1 | | Use this module to have notification of requirements of materials and/or external services and keep track of such requirements.
[purchase_request_cancel_confirm](purchase_request_cancel_confirm/) | 15.0.1.0.0 | [![kittiu](https://github.com/kittiu.png?size=30px)](https://github.com/kittiu) | Purchase Request Cancel Confirm
Expand Down
94 changes: 94 additions & 0 deletions purchase_order_revision/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
========================
Purchase order revisions
========================

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

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

Inspired on OCA module sale_order_revision, this module was rebuilt to implement
purchase_order_revision.

On Cancelled or RFQ Sent requests for quotation/purchase orders, you can click on New Revision. This
will create a new revision of the RFQ, with the same base number and a
'-revno' suffix appended. A message is added in the chatter saying that a new
revision was created.

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

**Table of contents**

.. contents::
:local:

Installation
============

Pre-Requirement

You need to install OCA's base_revision and purchase modules for this module to work.

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

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

* Open Source Integrators

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

* Diogo Cordeiro <[email protected]>
* Benedito Monteiro <[email protected]>
* Daniel Reis <[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/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/15.0/purchase_order_revision>`_ project on GitHub.

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


def populate_unrevisioned_name(cr, registry):
cr.execute(
"UPDATE purchase_order "
"SET unrevisioned_name = name "
"WHERE unrevisioned_name is NULL"
)
15 changes: 15 additions & 0 deletions purchase_order_revision/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Purchase order revisions",
"summary": "Keep track of revised quotations",
"version": "15.0.0.0.0",
"category": "Purchase",
"author": "Open Source Integrators," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/purchase-workflow",
"license": "AGPL-3",
"depends": ["base_revision", "purchase"],
"data": ["view/purchase_order.xml"],
"installable": True,
"post_init_hook": "populate_unrevisioned_name",
}
69 changes: 69 additions & 0 deletions purchase_order_revision/i18n/purchase_order_revision.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_order_revision
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: purchase_order_revision
#: model:ir.model.fields,field_description:purchase_order_revision.field_purchase_order__active
msgid "Active"
msgstr ""

#. module: purchase_order_revision
#: model:ir.model.fields,field_description:purchase_order_revision.field_purchase_order__current_revision_id
msgid "Current revision"
msgstr ""

#. module: purchase_order_revision
#: model:ir.model.fields,field_description:purchase_order_revision.field_purchase_order__has_old_revisions
msgid "Has Old Revisions"
msgstr ""

#. module: purchase_order_revision
#: model_terms:ir.ui.view,arch_db:purchase_order_revision.view_purchase_order_form
msgid "New Revision"
msgstr ""

#. module: purchase_order_revision
#: model:ir.model.fields,field_description:purchase_order_revision.field_purchase_order__old_revision_ids
msgid "Old revisions"
msgstr ""

#. module: purchase_order_revision
#: model:ir.model.constraint,message:purchase_order_revision.constraint_purchase_order_revision_unique
msgid "Order Reference and revision must be unique per Company."
msgstr ""

#. module: purchase_order_revision
#: model:ir.model.fields,field_description:purchase_order_revision.field_purchase_order__unrevisioned_name
msgid "Original Reference"
msgstr ""

#. module: purchase_order_revision
#: model_terms:ir.ui.view,arch_db:purchase_order_revision.view_purchase_order_form
msgid "Prev. revisions"
msgstr ""

#. module: purchase_order_revision
#: model:ir.model.fields,field_description:purchase_order_revision.field_purchase_order__revision_count
msgid "Previous versions count"
msgstr ""

#. module: purchase_order_revision
#: model:ir.model,name:purchase_order_revision.model_purchase_order
msgid "Purchase Order"
msgstr ""

#. module: purchase_order_revision
#: model:ir.model.fields,field_description:purchase_order_revision.field_purchase_order__revision_number
msgid "Revision"
msgstr ""
3 changes: 3 additions & 0 deletions purchase_order_revision/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 purchase_order
41 changes: 41 additions & 0 deletions purchase_order_revision/models/purchase_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class PurchaseOrder(models.Model):
_name = "purchase.order"
_inherit = ["purchase.order", "base.revision"]

current_revision_id = fields.Many2one(
comodel_name="purchase.order",
)
old_revision_ids = fields.One2many(
comodel_name="purchase.order",
)

# Overwrite as purchase.order can be multi-company
_sql_constraints = [
(
"revision_unique",
"unique(unrevisioned_name, revision_number, company_id)",
"Order Reference and revision must be unique per Company.",
)
]

def _prepare_revision_data(self, new_revision):
vals = super()._prepare_revision_data(new_revision)
vals.update({"state": "cancel"})
return vals

def action_view_revisions(self):
self.ensure_one()
action = self.env.ref("purchase.purchase_rfq")
result = action.read()[0]
result["domain"] = ["|", ("active", "=", False), ("active", "=", True)]
result["context"] = {
"active_test": 0,
"search_default_current_revision_id": self.id,
"default_current_revision_id": self.id,
}
return result
3 changes: 3 additions & 0 deletions purchase_order_revision/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Diogo Cordeiro <[email protected]>
* Benedito Monteiro <[email protected]>
* Daniel Reis <[email protected]>
10 changes: 10 additions & 0 deletions purchase_order_revision/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Inspired on OCA module sale_order_revision, this module was rebuilt to implement
purchase_order_revision.

On Cancelled or RFQ Sent requests for quotation/purchase orders, you can click on New Revision. This
will create a new revision of the RFQ, with the same base number and a
'-revno' suffix appended. A message is added in the chatter saying that a new
revision was created.

The old revisions of a purchase order are flagged as inactive, so they don't
clutter up searches.
3 changes: 3 additions & 0 deletions purchase_order_revision/readme/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Pre-Requirement

You need to install OCA's base_revision and purchase modules for this module to work.
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 cb7d95f

Please sign in to comment.