From 5a3e2619e348de07f70b507bb80cefa273addc49 Mon Sep 17 00:00:00 2001 From: Nils Coenen <74965194+NICO-SOLUTIONS@users.noreply.github.com> Date: Mon, 8 Apr 2024 22:25:31 +0200 Subject: [PATCH] [MIG] partner_invoicing_mode_at_shipping: Migration to 17.0 --- partner_invoicing_mode_at_shipping/README.rst | 2 ++ partner_invoicing_mode_at_shipping/__manifest__.py | 2 +- .../models/stock_picking.py | 7 ++++--- .../readme/CONTRIBUTORS.md | 1 + .../static/description/index.html | 14 +++++++++----- .../tests/test_invoice_mode_at_shipping.py | 14 ++++++-------- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/partner_invoicing_mode_at_shipping/README.rst b/partner_invoicing_mode_at_shipping/README.rst index 856645b6f98..5781f90a379 100644 --- a/partner_invoicing_mode_at_shipping/README.rst +++ b/partner_invoicing_mode_at_shipping/README.rst @@ -65,6 +65,8 @@ Contributors - Phuc (Tran Thanh) +- Nils Coenen + Other credits ------------- diff --git a/partner_invoicing_mode_at_shipping/__manifest__.py b/partner_invoicing_mode_at_shipping/__manifest__.py index b91a21ced78..2c6f0ea51fe 100644 --- a/partner_invoicing_mode_at_shipping/__manifest__.py +++ b/partner_invoicing_mode_at_shipping/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Partner Invoicing Mode At Shipping", - "version": "16.0.1.0.1", + "version": "17.0.1.0.0", "summary": "Create invoices automatically when goods are shipped.", "author": "Camptocamp, Odoo Community Association (OCA)", "website": "https://github.com/OCA/account-invoicing", diff --git a/partner_invoicing_mode_at_shipping/models/stock_picking.py b/partner_invoicing_mode_at_shipping/models/stock_picking.py index da62d0fbd7c..92cab94703e 100644 --- a/partner_invoicing_mode_at_shipping/models/stock_picking.py +++ b/partner_invoicing_mode_at_shipping/models/stock_picking.py @@ -1,7 +1,7 @@ # Copyright 2020 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) -from odoo import _, models +from odoo import _, api, models class StockPicking(models.Model): @@ -11,7 +11,7 @@ def _action_done(self): res = super()._action_done() for picking in self: if picking._invoice_at_shipping(): - picking.with_delay()._invoicing_at_shipping() + picking._invoicing_at_shipping() return res def _invoice_at_shipping(self): @@ -22,6 +22,7 @@ def _invoice_at_shipping(self): and self.sale_id.partner_invoice_id.invoicing_mode == "at_shipping" ) + @api.model def _invoicing_at_shipping(self): self.ensure_one() sales = self._get_sales_order_to_invoice() @@ -36,7 +37,7 @@ def _invoicing_at_shipping(self): if sales_many_invoice_per_order: invoices |= sales_many_invoice_per_order._create_invoices(grouped=False) for invoice in invoices: - invoice.with_delay()._validate_invoice() + invoice._validate_invoice() return invoices or _("Nothing to invoice.") def _get_sales_order_to_invoice(self): diff --git a/partner_invoicing_mode_at_shipping/readme/CONTRIBUTORS.md b/partner_invoicing_mode_at_shipping/readme/CONTRIBUTORS.md index 7d04f82d381..232de87a9bb 100644 --- a/partner_invoicing_mode_at_shipping/readme/CONTRIBUTORS.md +++ b/partner_invoicing_mode_at_shipping/readme/CONTRIBUTORS.md @@ -3,3 +3,4 @@ > - Thierry Ducrest \<\> - Phuc (Tran Thanh) \<\> +- Nils Coenen \<\> diff --git a/partner_invoicing_mode_at_shipping/static/description/index.html b/partner_invoicing_mode_at_shipping/static/description/index.html index 9628056b61d..8987434f276 100644 --- a/partner_invoicing_mode_at_shipping/static/description/index.html +++ b/partner_invoicing_mode_at_shipping/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 { @@ -415,6 +415,8 @@

Contributors

  • Phuc (Tran Thanh) <phuc@trobz.com>

  • +
  • Nils Coenen <nils.coenen@nico-solutions.de>

    +
  • @@ -427,7 +429,9 @@

    Other credits

    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.

    diff --git a/partner_invoicing_mode_at_shipping/tests/test_invoice_mode_at_shipping.py b/partner_invoicing_mode_at_shipping/tests/test_invoice_mode_at_shipping.py index b83563d9415..3d485180771 100644 --- a/partner_invoicing_mode_at_shipping/tests/test_invoice_mode_at_shipping.py +++ b/partner_invoicing_mode_at_shipping/tests/test_invoice_mode_at_shipping.py @@ -9,7 +9,6 @@ class TestInvoiceModeAtShipping(TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() - cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) cls.partner = cls.env.ref("base.res_partner_1") cls.product = cls.env.ref("product.product_delivery_01") cls.so1 = cls.env["sale.order"].create( @@ -30,7 +29,6 @@ def setUpClass(cls): }, ) ], - "pricelist_id": cls.env.ref("product.list0").id, } ) @@ -40,7 +38,7 @@ def test_invoice_created_at_shipping(self): self.so1.action_confirm() for picking in self.so1.picking_ids: for move in picking.move_ids: - move.quantity_done = move.product_uom_qty + move.quantity = move.product_uom_qty picking.action_assign() with mute_logger("odoo.addons.queue_job.delay"): picking.with_context(test_queue_job_no_delay=True).button_validate() @@ -53,7 +51,7 @@ def test_invoice_not_created_at_shipping(self): self.so1.action_confirm() for picking in self.so1.picking_ids: for move in picking.move_ids: - move.quantity_done = move.product_uom_qty + move.quantity = move.product_uom_qty picking.action_assign() with mute_logger("odoo.addons.queue_job.delay"): picking.with_context(test_queue_job_no_delay=True).button_validate() @@ -71,7 +69,7 @@ def test_picking_multi_order_single_invoice(self): so2.picking_ids.move_ids.picking_id = picking # Transfer the remaining picking with moves for move in picking.move_ids: - move.quantity_done = move.product_uom_qty + move.quantity = move.product_uom_qty picking.action_assign() with mute_logger("odoo.addons.queue_job.delay"): picking.with_context(test_queue_job_no_delay=True).button_validate() @@ -91,7 +89,7 @@ def test_picking_multi_order_multi_invoice(self): so2.picking_ids.move_ids.picking_id = picking # Transfer the remaining picking with moves for move in picking.move_ids: - move.quantity_done = move.product_uom_qty + move.quantity = move.product_uom_qty picking.action_assign() with mute_logger("odoo.addons.queue_job.delay"): picking.with_context(test_queue_job_no_delay=True).button_validate() @@ -106,7 +104,7 @@ def test_picking_backorder(self): self.partner.invoicing_mode = "at_shipping" self.so1.action_confirm() picking = self.so1.picking_ids - picking.move_ids.quantity_done = 2 + picking.move_ids.quantity = 2 picking.action_assign() with mute_logger("odoo.addons.queue_job.delay"): picking.with_context( @@ -116,7 +114,7 @@ def test_picking_backorder(self): self.assertEqual(self.so1.invoice_ids.state, "posted") # Now process the backorder backorder = self.so1.picking_ids - picking - backorder.move_ids.quantity_done = 2 + backorder.move_ids.quantity = 2 backorder.action_assign() with mute_logger("odoo.addons.queue_job.delay"): backorder.with_context(test_queue_job_no_delay=True).button_validate()