From 0facfded68f94b43e40b58672db36c923bfa1a2e Mon Sep 17 00:00:00 2001 From: PicchiSeba Date: Mon, 8 Jan 2024 16:39:33 +0100 Subject: [PATCH] [FIX]l10n_it_delivery_note_batch: hide `Create DNs` button when all pickings have delivery note --- l10n_it_delivery_note_batch/README.rst | 13 +++++++++++-- l10n_it_delivery_note_batch/__manifest__.py | 9 ++++++++- .../models/stock_picking_batch.py | 9 +++++++++ .../static/description/index.html | 4 ++-- .../views/stock_picking_batch_views.xml | 9 ++++++++- 5 files changed, 38 insertions(+), 6 deletions(-) diff --git a/l10n_it_delivery_note_batch/README.rst b/l10n_it_delivery_note_batch/README.rst index 03447f431bff..3c9f443367b0 100644 --- a/l10n_it_delivery_note_batch/README.rst +++ b/l10n_it_delivery_note_batch/README.rst @@ -7,7 +7,7 @@ ITA - Documento di trasporto - Prelievo raggruppato !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:da84c4e3f2b1dd4e2cad2e8fd1ae8f735d8d9482b001d44e5232921ada784585 + !! source digest: sha256:18e79c58d25911c3da9c99aad726d0b1bcd4a9755a5bfa7adfe336deb223936c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -96,10 +96,19 @@ promote its widespread use. .. |maintainer-Borruso| image:: https://github.com/Borruso.png?size=40px :target: https://github.com/Borruso :alt: Borruso +.. |maintainer-aleuffre| image:: https://github.com/aleuffre.png?size=40px + :target: https://github.com/aleuffre + :alt: aleuffre +.. |maintainer-PicchiSeba| image:: https://github.com/PicchiSeba.png?size=40px + :target: https://github.com/PicchiSeba + :alt: PicchiSeba +.. |maintainer-renda-dev| image:: https://github.com/renda-dev.png?size=40px + :target: https://github.com/renda-dev + :alt: renda-dev Current `maintainers `__: -|maintainer-MarcoCalcagni| |maintainer-TheMule71| |maintainer-Borruso| +|maintainer-MarcoCalcagni| |maintainer-TheMule71| |maintainer-Borruso| |maintainer-aleuffre| |maintainer-PicchiSeba| |maintainer-renda-dev| This module is part of the `OCA/l10n-italy `_ project on GitHub. diff --git a/l10n_it_delivery_note_batch/__manifest__.py b/l10n_it_delivery_note_batch/__manifest__.py index 1ad3fc198433..5817ab1a7dbe 100644 --- a/l10n_it_delivery_note_batch/__manifest__.py +++ b/l10n_it_delivery_note_batch/__manifest__.py @@ -11,7 +11,14 @@ "version": "16.0.1.0.1", "category": "Localization/Italy", "license": "AGPL-3", - "maintainers": ["MarcoCalcagni", "TheMule71", "Borruso"], + "maintainers": [ + "MarcoCalcagni", + "TheMule71", + "Borruso", + "aleuffre", + "PicchiSeba", + "renda-dev", + ], "depends": [ "stock", "stock_picking_batch", diff --git a/l10n_it_delivery_note_batch/models/stock_picking_batch.py b/l10n_it_delivery_note_batch/models/stock_picking_batch.py index 7bccddbbf424..09b6acbd3f7e 100644 --- a/l10n_it_delivery_note_batch/models/stock_picking_batch.py +++ b/l10n_it_delivery_note_batch/models/stock_picking_batch.py @@ -14,11 +14,20 @@ class StockPickingBatch(models.Model): ) delivery_note_count = fields.Integer(compute="_compute_delivery_note_count") + all_pickings_have_delivery_note = fields.Boolean( + compute="_compute_all_pickings_have_delivery_note" + ) def _compute_delivery_note_count(self): for rec in self: rec.delivery_note_count = len(rec.delivery_note_ids) + def _compute_all_pickings_have_delivery_note(self): + for rec in self: + rec.all_pickings_have_delivery_note = all( + p.delivery_note_id for p in rec.picking_ids + ) + def create_delivery_notes(self, **kwargs): for rec in self: if rec.state != "done": diff --git a/l10n_it_delivery_note_batch/static/description/index.html b/l10n_it_delivery_note_batch/static/description/index.html index ee683f8afdb0..f2d61cf94b20 100644 --- a/l10n_it_delivery_note_batch/static/description/index.html +++ b/l10n_it_delivery_note_batch/static/description/index.html @@ -366,7 +366,7 @@

ITA - Documento di trasporto - Prelievo raggruppato

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:da84c4e3f2b1dd4e2cad2e8fd1ae8f735d8d9482b001d44e5232921ada784585 +!! source digest: sha256:18e79c58d25911c3da9c99aad726d0b1bcd4a9755a5bfa7adfe336deb223936c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runboat

Italiano

@@ -424,7 +424,7 @@

Maintainers

mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainers:

-

MarcoCalcagni TheMule71 Borruso

+

MarcoCalcagni TheMule71 Borruso aleuffre PicchiSeba renda-dev

This module is part of the OCA/l10n-italy project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/l10n_it_delivery_note_batch/views/stock_picking_batch_views.xml b/l10n_it_delivery_note_batch/views/stock_picking_batch_views.xml index 61dd1472db11..0032db2f6530 100644 --- a/l10n_it_delivery_note_batch/views/stock_picking_batch_views.xml +++ b/l10n_it_delivery_note_batch/views/stock_picking_batch_views.xml @@ -6,6 +6,9 @@ stock.picking.batch +
+ +