From 39991cba5c278a96b50a4dada1b5aac15002f57f Mon Sep 17 00:00:00 2001 From: Alessio Renda Date: Thu, 18 Jul 2024 12:43:54 +0200 Subject: [PATCH 1/3] [FIX] l10n_it_delivery_note: remove delivery note count from SO Since it's a not used anywhere, and it's a duplicate from l10n_it_delivery_note_order_link --- l10n_it_delivery_note/models/sale_order.py | 40 ------------------- .../wizard/sale_advance_payment_inv.py | 2 +- .../models/sale_order.py | 20 ++++++++++ 3 files changed, 21 insertions(+), 41 deletions(-) diff --git a/l10n_it_delivery_note/models/sale_order.py b/l10n_it_delivery_note/models/sale_order.py index e5cdfdc50473..c401f7885909 100644 --- a/l10n_it_delivery_note/models/sale_order.py +++ b/l10n_it_delivery_note/models/sale_order.py @@ -9,11 +9,6 @@ class SaleOrder(models.Model): _inherit = "sale.order" - delivery_note_ids = fields.Many2many( - "stock.delivery.note", compute="_compute_delivery_notes" - ) - delivery_note_count = fields.Integer(compute="_compute_delivery_notes") - default_transport_condition_id = fields.Many2one( "stock.picking.transport.condition", string="Condition of transport", @@ -57,15 +52,6 @@ def onchange_partner_id_shipping_info(self): self.update(values) - def _compute_delivery_notes(self): - for order in self: - delivery_notes = order.order_line.mapped( - "delivery_note_line_ids.delivery_note_id" - ) - - order.delivery_note_ids = delivery_notes - order.delivery_note_count = len(delivery_notes) - def _assign_delivery_notes_invoices(self, invoice_ids): order_lines = self.mapped("order_line").filtered( lambda l: l.is_invoiced and l.delivery_note_line_ids @@ -126,32 +112,6 @@ def _create_invoices(self, grouped=False, final=False, date=None): return invoice_ids - def goto_delivery_notes(self, **kwargs): - delivery_notes = self.mapped("delivery_note_ids") - action = self.env["ir.actions.act_window"]._for_xml_id( - "l10n_it_delivery_note.stock_delivery_note_action" - ) - action.update(kwargs) - - if len(delivery_notes) > 1: - action["domain"] = [("id", "in", delivery_notes.ids)] - - elif len(delivery_notes) == 1: - action["views"] = [ - ( - self.env.ref( - "l10n_it_delivery_note.stock_delivery_note_form_view" - ).id, - "form", - ) - ] - action["res_id"] = delivery_notes.id - - else: - action = {"type": "ir.actions.act_window_close"} - - return action - class SaleOrderLine(models.Model): _inherit = "sale.order.line" diff --git a/l10n_it_delivery_note/wizard/sale_advance_payment_inv.py b/l10n_it_delivery_note/wizard/sale_advance_payment_inv.py index 2a1c30a89b56..e8d03f6448e7 100644 --- a/l10n_it_delivery_note/wizard/sale_advance_payment_inv.py +++ b/l10n_it_delivery_note/wizard/sale_advance_payment_inv.py @@ -11,7 +11,7 @@ class SaleAdvancePaymentInv(models.TransientModel): _inherit = "sale.advance.payment.inv" def _default_step(self): - states = self.sale_order_ids.mapped("delivery_note_ids.state") + states = self.sale_order_ids.mapped("picking_ids.delivery_note_id.state") if any(s == "draft" for s in states): return DOMAIN_WIZARD_STEPS[1] diff --git a/l10n_it_delivery_note_order_link/models/sale_order.py b/l10n_it_delivery_note_order_link/models/sale_order.py index d81e72d81cdd..11a22822d774 100644 --- a/l10n_it_delivery_note_order_link/models/sale_order.py +++ b/l10n_it_delivery_note_order_link/models/sale_order.py @@ -20,3 +20,23 @@ def _compute_delivery_notes(self): order.delivery_note_ids = delivery_notes order.delivery_note_count = len(delivery_notes) + + def goto_delivery_notes(self, **kwargs): + delivery_notes = self.mapped("delivery_note_ids") + + action = self.env["ir.actions.act_window"]._for_xml_id( + "l10n_it_delivery_note.stock_delivery_note_action" + ) + action.update(kwargs) + if len(delivery_notes) > 1: + action["domain"] = [("id", "in", delivery_notes.ids)] + elif len(delivery_notes) == 1: + action["views"] = [ + ( + self.env.ref( + "l10n_it_delivery_note.stock_delivery_note_form_view" + ).id, + "form", + ) + ] + action["res_id"] = delivery_notes.id From a61e6f6a40add8ac9ba8e7a688f668f588b9dcb1 Mon Sep 17 00:00:00 2001 From: Alessio Renda Date: Thu, 18 Jul 2024 12:45:30 +0200 Subject: [PATCH 2/3] [FIX] l10n_it_delivery_note_order_link: get delivery notes from pickings In sale orders, instead of getting them from the order lines --- l10n_it_delivery_note_order_link/models/sale_order.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/l10n_it_delivery_note_order_link/models/sale_order.py b/l10n_it_delivery_note_order_link/models/sale_order.py index 11a22822d774..488fbafe19ac 100644 --- a/l10n_it_delivery_note_order_link/models/sale_order.py +++ b/l10n_it_delivery_note_order_link/models/sale_order.py @@ -14,9 +14,7 @@ class SaleOrder(models.Model): def _compute_delivery_notes(self): for order in self: - delivery_notes = order.order_line.mapped( - "delivery_note_line_ids.delivery_note_id" - ) + delivery_notes = order.picking_ids.mapped("delivery_note_id") order.delivery_note_ids = delivery_notes order.delivery_note_count = len(delivery_notes) @@ -40,3 +38,5 @@ def goto_delivery_notes(self, **kwargs): ) ] action["res_id"] = delivery_notes.id + + return action From 0fb7f1954ea3daaf926135e2db5b09f90e9c83c8 Mon Sep 17 00:00:00 2001 From: Alessio Renda Date: Mon, 22 Jul 2024 12:14:21 +0200 Subject: [PATCH 3/3] [IMP] l10n_it_delivery_note_order_link: add maintainers --- l10n_it_delivery_note_order_link/README.rst | 17 +++++++++++++---- .../__manifest__.py | 2 +- .../static/description/index.html | 16 +++++++++------- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/l10n_it_delivery_note_order_link/README.rst b/l10n_it_delivery_note_order_link/README.rst index 6db8bb51dbfb..57329efba6a9 100644 --- a/l10n_it_delivery_note_order_link/README.rst +++ b/l10n_it_delivery_note_order_link/README.rst @@ -103,10 +103,19 @@ promote its widespread use. .. |maintainer-andreampiovesana| image:: https://github.com/andreampiovesana.png?size=40px :target: https://github.com/andreampiovesana :alt: andreampiovesana - -Current `maintainer `__: - -|maintainer-andreampiovesana| +.. |maintainer-aleuffre| image:: https://github.com/aleuffre.png?size=40px + :target: https://github.com/aleuffre + :alt: aleuffre +.. |maintainer-renda-dev| image:: https://github.com/renda-dev.png?size=40px + :target: https://github.com/renda-dev + :alt: renda-dev +.. |maintainer-PicchiSeba| image:: https://github.com/PicchiSeba.png?size=40px + :target: https://github.com/PicchiSeba + :alt: PicchiSeba + +Current `maintainers `__: + +|maintainer-andreampiovesana| |maintainer-aleuffre| |maintainer-renda-dev| |maintainer-PicchiSeba| This module is part of the `OCA/l10n-italy `_ project on GitHub. diff --git a/l10n_it_delivery_note_order_link/__manifest__.py b/l10n_it_delivery_note_order_link/__manifest__.py index 62223d9d60da..6317c6a360d3 100644 --- a/l10n_it_delivery_note_order_link/__manifest__.py +++ b/l10n_it_delivery_note_order_link/__manifest__.py @@ -11,7 +11,7 @@ "website": "https://github.com/OCA/l10n-italy", "version": "14.0.1.0.1", "license": "AGPL-3", - "maintainers": ["andreampiovesana"], + "maintainers": ["andreampiovesana", "aleuffre", "renda-dev", "PicchiSeba"], "category": "Localization/Italy", "depends": [ "purchase_stock", diff --git a/l10n_it_delivery_note_order_link/static/description/index.html b/l10n_it_delivery_note_order_link/static/description/index.html index 559df468eb4d..ace2e0542536 100644 --- a/l10n_it_delivery_note_order_link/static/description/index.html +++ b/l10n_it_delivery_note_order_link/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -428,12 +428,14 @@

Contributors

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

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.

-

Current maintainer:

-

andreampiovesana

+

Current maintainers:

+

andreampiovesana aleuffre renda-dev PicchiSeba

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.