From 4fc04f4d000e19da696d984dec004217dce6a182 Mon Sep 17 00:00:00 2001
From: Carlos Lopez
Date: Thu, 31 Oct 2024 15:38:42 +0100
Subject: [PATCH] [MIG] stock_picking_invoice_link: Migration to 18.0
[MIG] stock_picking_invoice_link: Migration to 18.0
[MIG] stock_picking_invoice_link: Migration to 18.0
[MIG] stock_picking_invoice_link: Migration to 18.0
[MIG] stock_picking_invoice_link: Migration to 18.0
[MIG] stock_picking_invoice_link: Migration to 18.0
[MIG] stock_picking_invoice_link: Migration to 18.0
---
stock_picking_invoice_link/README.rst | 10 ++++----
stock_picking_invoice_link/__manifest__.py | 2 +-
.../models/account_move.py | 23 +++++++++----------
.../static/description/index.html | 6 ++---
.../tests/test_stock_picking_invoice_link.py | 11 +++++----
.../views/account_invoice_view.xml | 4 ++--
6 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/stock_picking_invoice_link/README.rst b/stock_picking_invoice_link/README.rst
index 2a9f175833ac..d88a4f867c01 100644
--- a/stock_picking_invoice_link/README.rst
+++ b/stock_picking_invoice_link/README.rst
@@ -17,13 +17,13 @@ Stock Picking Invoice Link
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github
- :target: https://github.com/OCA/stock-logistics-workflow/tree/17.0/stock_picking_invoice_link
+ :target: https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_picking_invoice_link
:alt: OCA/stock-logistics-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/stock-logistics-workflow-17-0/stock-logistics-workflow-17-0-stock_picking_invoice_link
+ :target: https://translation.odoo-community.org/projects/stock-logistics-workflow-18-0/stock-logistics-workflow-18-0-stock_picking_invoice_link
: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/stock-logistics-workflow&target_branch=17.0
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&target_branch=18.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -62,7 +62,7 @@ Bug Tracker
Bugs are tracked on `GitHub 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 `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -132,6 +132,6 @@ 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/stock-logistics-workflow `_ project on GitHub.
+This module is part of the `OCA/stock-logistics-workflow `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/stock_picking_invoice_link/__manifest__.py b/stock_picking_invoice_link/__manifest__.py
index 081675f514af..6264b221839f 100644
--- a/stock_picking_invoice_link/__manifest__.py
+++ b/stock_picking_invoice_link/__manifest__.py
@@ -7,7 +7,7 @@
{
"name": "Stock Picking Invoice Link",
- "version": "17.0.1.2.3",
+ "version": "18.0.1.0.0",
"category": "Warehouse Management",
"summary": "Adds link between pickings and invoices",
"author": "Agile Business Group, "
diff --git a/stock_picking_invoice_link/models/account_move.py b/stock_picking_invoice_link/models/account_move.py
index 09d105e35f91..3e7626d018c5 100644
--- a/stock_picking_invoice_link/models/account_move.py
+++ b/stock_picking_invoice_link/models/account_move.py
@@ -5,7 +5,7 @@
# Copyright 2020 Manuel Calero - Tecnativa
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
-from odoo import api, fields, models
+from odoo import Command, api, fields, models
class AccountMove(models.Model):
@@ -72,14 +72,13 @@ class AccountMoveLine(models.Model):
)
def copy_data(self, default=None):
- """Copy the move_line_ids in case of refund invoice creating a new invoice
- (refund_method="modify").
- """
- self.ensure_one()
- res = super().copy_data(default=default)
- if (
- self.env.context.get("force_copy_stock_moves")
- and "move_line_ids" not in res
- ):
- res[0]["move_line_ids"] = [(6, 0, self.move_line_ids.ids)]
- return res
+ """Copy the move_line_ids in case of refund invoice creating new invoices
+ (refund_method="modify") for multiple records."""
+ vals_list = super().copy_data(default)
+
+ if self.env.context.get("force_copy_stock_moves"):
+ for record, vals in zip(self, vals_list, strict=False):
+ if "move_line_ids" not in vals and record.move_line_ids:
+ vals["move_line_ids"] = [Command.set(record.move_line_ids.ids)]
+
+ return vals_list
diff --git a/stock_picking_invoice_link/static/description/index.html b/stock_picking_invoice_link/static/description/index.html
index 5135a3ae14ed..44becfb31d42 100644
--- a/stock_picking_invoice_link/static/description/index.html
+++ b/stock_picking_invoice_link/static/description/index.html
@@ -369,7 +369,7 @@ Stock Picking Invoice Link
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b84770438e83e728fc3e438a5542c07883adb15b786fff744733439c6992bcd4
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
This module adds a link between pickings and invoices as well as on the
lines. Invoices are generated from sales orders. With this module, you
can find back which deliveries an invoice relates to.
@@ -409,7 +409,7 @@
Bugs are tracked on GitHub 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.
+feedback.
Do not contact contributors directly about support or help with technical issues.
diff --git a/stock_picking_invoice_link/tests/test_stock_picking_invoice_link.py b/stock_picking_invoice_link/tests/test_stock_picking_invoice_link.py
index e060310f3b84..d4dc86e7aa7c 100644
--- a/stock_picking_invoice_link/tests/test_stock_picking_invoice_link.py
+++ b/stock_picking_invoice_link/tests/test_stock_picking_invoice_link.py
@@ -73,7 +73,8 @@ def _create_sale_order_and_confirm(cls):
@classmethod
def setUpClass(cls, chart_template_ref=None):
- super().setUpClass(chart_template_ref=chart_template_ref)
+ super().setUpClass()
+ cls.setup_chart_template(chart_template_ref)
for _, i in cls.company_data.items():
if "type" in i and i.type == "product":
cls._update_product_qty(i)
@@ -183,7 +184,7 @@ def test_00_sale_stock_invoice_link(self):
inv_3 = inv_1.copy()
inv_3.picking_ids |= pick_1
result = pick_1.action_view_invoice()
- self.assertEqual(result["views"][0][1], "tree")
+ self.assertEqual(result["views"][0][1], "list")
# Cancel invoice and invoice
inv_1.button_cancel()
@@ -236,7 +237,7 @@ def test_return_picking_to_refund(self):
).unlink()
return_wiz.product_return_moves.quantity = 1.0
return_wiz.product_return_moves.to_refund = True
- res = return_wiz.create_returns()
+ res = return_wiz.action_create_returns()
return_pick = self.env["stock.picking"].browse(res["res_id"])
# Validate picking
return_pick.move_ids.quantity = 1.0
@@ -365,7 +366,7 @@ def test_return_and_invoice_refund(self):
).unlink()
return_wiz.product_return_moves.quantity = 1.0
return_wiz.product_return_moves.to_refund = True
- res = return_wiz.create_returns()
+ res = return_wiz.action_create_returns()
return_pick = self.env["stock.picking"].browse(res["res_id"])
# Validate picking
return_pick.move_ids.quantity = 1.0
@@ -380,7 +381,7 @@ def test_return_and_invoice_refund(self):
}
)
)
- action = wiz_invoice_refund.reverse_moves()
+ action = wiz_invoice_refund.refund_moves()
invoice_refund = self.env["account.move"].browse(action["res_id"])
inv_line_prod_del_refund = invoice_refund.invoice_line_ids.filtered(
lambda line: line.product_id == self.prod_del
diff --git a/stock_picking_invoice_link/views/account_invoice_view.xml b/stock_picking_invoice_link/views/account_invoice_view.xml
index 4e23cf9d24e0..6ae38fbb231d 100644
--- a/stock_picking_invoice_link/views/account_invoice_view.xml
+++ b/stock_picking_invoice_link/views/account_invoice_view.xml
@@ -19,10 +19,10 @@
-
+
-
+