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

[18.0][MIG] purchase_all_shipments: Migration to 18.0 #2488

Open
wants to merge 34 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
faaa775
new module purchase_all_shipments
lepistone Feb 11, 2015
5cfd257
fix view, and replace existing button
lepistone Feb 12, 2015
d433017
doc
lepistone Feb 12, 2015
eba696c
pass compute methods as strings
lepistone Feb 13, 2015
f93d244
add a test: 3-step reception gives 3 pickings
lepistone Feb 13, 2015
7aeff1a
fix typo in readme
lepistone Feb 18, 2015
abf456f
refactor: mapped joins recordsets
lepistone Feb 18, 2015
b39f17d
another clever use of mapped()
lepistone Feb 18, 2015
12beea6
refactor .mapped('id') -> .ids
lepistone Feb 19, 2015
692c25c
Add OCA as author of OCA addons
gurneyalex Mar 2, 2015
a5e1d33
Add missing default oca icons
yvaucher Aug 18, 2015
42e96ec
[UPD] prefix versions with 8.0
sbidoul Oct 9, 2015
3ecba00
Fix 9.0 version
sbidoul Dec 13, 2015
b103e37
purchase_all_shipment is unported
sbidoul Dec 14, 2015
df9b99d
[MIG] Rename manifest files
pedrobaeza Oct 6, 2016
1b8d3ff
[IMP] purchase_all_shipments : black, isort, prettier
nicomacr Aug 25, 2020
d3da0f9
[MIG] purchase_all_shipments: migrate to v13
nicomacr Aug 25, 2020
1c116fd
[UPD] Update purchase_all_shipments.pot
oca-travis Dec 9, 2020
b1e1693
[UPD] README.rst
OCA-git-bot Dec 9, 2020
77b02ba
[IMP] *: pre-commit execution
joao-p-marques Aug 5, 2021
3b6c0d2
[IMP] purchase_all_shipments: pre-commit execution
augusto-weiss Jan 12, 2023
5d504f3
[MIG] purchase_all_shipments: Migration to 16.0
augusto-weiss Jan 12, 2023
27964d3
[UPD] Update purchase_all_shipments.pot
Mar 23, 2023
c1163d7
[UPD] README.rst
OCA-git-bot Mar 23, 2023
e945113
Update translation files
weblate Mar 23, 2023
050cade
Translated using Weblate (Spanish)
Ivorra78 Jul 20, 2023
e100ddd
[UPD] README.rst
OCA-git-bot Sep 3, 2023
2e3bd68
Added translation using Weblate (Italian)
mymage Dec 24, 2023
ccf0b8d
Translated using Weblate (Italian)
mymage Dec 24, 2023
54d9bbc
[IMP] purchase_all_shipments: pre-commit execution
mav-adhoc Jun 11, 2024
cda42f9
[MIG] purchase_all_shipments: Migration to 17.0
mav-adhoc Jun 11, 2024
8862187
[UPD] Update purchase_all_shipments.pot
Oct 8, 2024
3e2ff81
[BOT] post-merge updates
OCA-git-bot Oct 8, 2024
6d4b58e
[MIG] purchase_all_shipments: Migration to 18.0
HeliconiaSolutions Dec 16, 2024
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
93 changes: 93 additions & 0 deletions purchase_all_shipments/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
======================
Purchase All Shipments
======================

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

.. |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/18.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-18-0/purchase-workflow-18-0-purchase_all_shipments
: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=18.0
:alt: Try me on Runboat

|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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_all_shipments%0Aversion:%2018.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 <[email protected]>
- Nicolas Mac Rouillon <[email protected]>
- ``Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>``\ \_

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/18.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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
13 changes: 13 additions & 0 deletions purchase_all_shipments/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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": "18.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"],
}
39 changes: 39 additions & 0 deletions purchase_all_shipments/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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: 2023-07-20 10:15+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\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_picking_count
msgid "All Pickings Count"
msgstr "Contador de todas las recepciones"

#. 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"
38 changes: 38 additions & 0 deletions purchase_all_shipments/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_all_shipments
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-24 15:34+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\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 "Tutti i prelievi"

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

#. 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 "Tutti i prelievi, inclusi i concatenati"

#. module: purchase_all_shipments
#: model:ir.model,name:purchase_all_shipments.model_purchase_order
msgid "Purchase Order"
msgstr "Ordine di acquisto"
35 changes: 35 additions & 0 deletions purchase_all_shipments/i18n/purchase_all_shipments.pot
Original file line number Diff line number Diff line change
@@ -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 17.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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import purchase_order
51 changes: 51 additions & 0 deletions purchase_all_shipments/models/purchase_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 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):
return self._get_action_view_all_pickings(self.all_picking_ids)

def _get_action_view_all_pickings(self, picking_ids):
"""Similar to the _get_action_view_picking method in the purchase module"""
self.ensure_one()
result = self.env["ir.actions.actions"]._for_xml_id(
"stock.action_picking_tree_all"
)
# override the context to get rid of the default filtering on picking type
result["context"] = {}

if not picking_ids or len(picking_ids) > 1:
result["domain"] = [("id", "in", picking_ids.ids)]
elif len(picking_ids) == 1:
res = self.env.ref("stock.view_picking_form", False)
form_view = [(res and res.id or False, "form")]
result["views"] = form_view + [
(state, view)
for state, view in result.get("views", [])
if view != "form"
]
result["res_id"] = picking_ids.id
return result
3 changes: 3 additions & 0 deletions purchase_all_shipments/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
3 changes: 3 additions & 0 deletions purchase_all_shipments/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Leonardo Pistone \<<[email protected]>\>
- Nicolas Mac Rouillon \<<[email protected]>\>
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`_
16 changes: 16 additions & 0 deletions purchase_all_shipments/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading