Skip to content

Commit

Permalink
Merge commit 'refs/pull/1448/head' of https://github.com/oca/purchase…
Browse files Browse the repository at this point in the history
…-workflow into 15.0-1490
  • Loading branch information
docker-odoo committed Feb 18, 2023
2 parents 22af842 + 2de32d6 commit 2769dd6
Show file tree
Hide file tree
Showing 16 changed files with 722 additions and 0 deletions.
80 changes: 80 additions & 0 deletions purchase_all_shipments/README.rst
@@ -0,0 +1,80 @@
======================
Purchase All Shipments
======================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/13.0/purchase_all_shipments
: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-13-0/purchase-workflow-13-0-purchase_all_shipments
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/142/13.0
:alt: Try me on Runbot

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

With the core "purchase" module, in a purchase order a button "In Shipments" lets the user see the picking that was generated by the order itself.

With this module, that button is replaced by an "All Shipments" button that shows the original picking, and all others that are grouped with it. This should include pickings associated to the procurements that generated the purchase, and also pickings that have been chained with push rules.

This is consistent with the "sale" module, where from the sale order the user can access the generated delivery and all chained ones.

The implementation uses the procurement group of the moves in the generated picking. The procurement group is always present in purchases, also when there is no procurement.

**Table of contents**

.. contents::
:local:

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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_all_shipments%0Aversion:%2013.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
~~~~~~~

* Camptocamp

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

* Leonardo Pistone <leonardo.pistone@camptocamp.com>
* Nicolas Mac Rouillon <nmr@adhoc.com.ar>

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/13.0/purchase_all_shipments>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions purchase_all_shipments/__init__.py
@@ -0,0 +1 @@
from . import models
13 changes: 13 additions & 0 deletions purchase_all_shipments/__manifest__.py
@@ -0,0 +1,13 @@
# Copyright 2018 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
{
"name": "Purchase All Shipments",
"version": "15.0.1.0.0",
"author": "Camptocamp,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/purchase-workflow",
"category": "Purchases",
"license": "AGPL-3",
"depends": ["purchase_stock"],
"installable": True,
"data": ["views/purchase_order_views.xml"],
}
37 changes: 37 additions & 0 deletions purchase_all_shipments/i18n/es.po
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_all_shipments
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-25 19:03+0000\n"
"PO-Revision-Date: 2020-08-25 19:03+0000\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_all_shipments
#: model:ir.model.fields,field_description:purchase_all_shipments.field_purchase_order__all_picking_ids
#: model_terms:ir.ui.view,arch_db:purchase_all_shipments.purchase_order_view_form_inherit
msgid "All Pickings"
msgstr "En recepciones"

#. module: purchase_all_shipments
#: model:ir.model.fields,field_description:purchase_all_shipments.field_purchase_order__all_shipment_count
msgid "All Pickings Count"
msgstr ""

#. module: purchase_all_shipments
#: model_terms:ir.ui.view,arch_db:purchase_all_shipments.purchase_order_view_form_inherit
msgid "All Pickings, including chained"
msgstr "Todas las recepciones, incluidos encadenados"

#. module: purchase_all_shipments
#: model:ir.model,name:purchase_all_shipments.model_purchase_order
msgid "Purchase Order"
msgstr "Línea orden de compra"
35 changes: 35 additions & 0 deletions purchase_all_shipments/i18n/purchase_all_shipments.pot
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_all_shipments
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.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_all_shipments
#: model:ir.model.fields,field_description:purchase_all_shipments.field_purchase_order__all_picking_ids
#: model_terms:ir.ui.view,arch_db:purchase_all_shipments.purchase_order_view_form_inherit
msgid "All Pickings"
msgstr ""

#. module: purchase_all_shipments
#: model:ir.model.fields,field_description:purchase_all_shipments.field_purchase_order__all_picking_count
msgid "All Pickings Count"
msgstr ""

#. module: purchase_all_shipments
#: model_terms:ir.ui.view,arch_db:purchase_all_shipments.purchase_order_view_form_inherit
msgid "All Pickings, including chained"
msgstr ""

#. module: purchase_all_shipments
#: model:ir.model,name:purchase_all_shipments.model_purchase_order
msgid "Purchase Order"
msgstr ""
1 change: 1 addition & 0 deletions purchase_all_shipments/models/__init__.py
@@ -0,0 +1 @@
from . import purchase_order
44 changes: 44 additions & 0 deletions purchase_all_shipments/models/purchase_order.py
@@ -0,0 +1,44 @@
# Copyright 2018 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from odoo import fields, models


class PurchaseOrder(models.Model):
_inherit = "purchase.order"

all_picking_ids = fields.One2many(
"stock.picking", string="All Pickings", compute="_compute_all_pickings"
)
all_picking_count = fields.Integer(
"All Pickings Count", compute="_compute_all_picking_count"
)

def _compute_all_picking_count(self):
for rec in self:
rec.all_picking_count = len(rec.all_picking_ids)

def _compute_all_pickings(self):
for rec in self:
groups = rec.mapped("picking_ids.group_id")
all_picking_ids = self.env["stock.picking"].search(
[("group_id", "in", groups.ids)]
)
rec.all_picking_ids = all_picking_ids

def action_view_all_pickings(self):
"""Similar to the view_picking method in the purchase module"""
action_data = self.env.ref("stock.action_picking_tree_all").read()[0]
pickings = self.mapped("all_picking_ids")

# override the context to get rid of the default filtering on
# picking type
action_data["context"] = {}

# choose the view_mode accordingly
if len(pickings) > 1:
action_data["domain"] = [("id", "in", pickings.ids)]
else:
form_view = self.env.ref("stock.view_picking_form")
action_data["views"] = [(form_view.id, "form")]
action_data["res_id"] = pickings.id
return action_data
2 changes: 2 additions & 0 deletions purchase_all_shipments/readme/CONTRIBUTORS.rst
@@ -0,0 +1,2 @@
* Leonardo Pistone <leonardo.pistone@camptocamp.com>
* Nicolas Mac Rouillon <nmr@adhoc.com.ar>
7 changes: 7 additions & 0 deletions purchase_all_shipments/readme/DESCRIPTION.rst
@@ -0,0 +1,7 @@
With the core "purchase" module, in a purchase order a button "In Shipments" lets the user see the picking that was generated by the order itself.

With this module, that button is replaced by an "All Shipments" button that shows the original picking, and all others that are grouped with it. This should include pickings associated to the procurements that generated the purchase, and also pickings that have been chained with push rules.

This is consistent with the "sale" module, where from the sale order the user can access the generated delivery and all chained ones.

The implementation uses the procurement group of the moves in the generated picking. The procurement group is always present in purchases, also when there is no procurement.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2769dd6

Please sign in to comment.