From 408ce7dda62979c51cc8b27d67c8c983130c5281 Mon Sep 17 00:00:00 2001
From: Matias Peralta
Date: Thu, 10 Oct 2024 15:27:30 -0300
Subject: [PATCH] [MIG] sale_order_type: Migration to 18.0
---
sale_order_type/README.rst | 10 +++++-----
sale_order_type/__manifest__.py | 2 +-
sale_order_type/models/res_partner.py | 5 ++++-
sale_order_type/models/sale.py | 5 ++++-
sale_order_type/reports/account_invoice_report.py | 7 ++-----
.../reports/account_invoice_report_view.xml | 2 --
sale_order_type/reports/sale_report_view.xml | 2 --
sale_order_type/static/description/index.html | 6 +++---
sale_order_type/tests/test_account_invoice_report.py | 7 ++++---
sale_order_type/tests/test_sale_order_report.py | 4 ++--
sale_order_type/views/account_move_views.xml | 2 +-
sale_order_type/views/sale_order_type_view.xml | 10 +++++-----
sale_order_type/views/sale_order_view.xml | 2 +-
sale_order_type/wizards/sale_make_invoice_advance.py | 4 ++--
14 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/sale_order_type/README.rst b/sale_order_type/README.rst
index b6077664241..a9a29e31aa3 100644
--- a/sale_order_type/README.rst
+++ b/sale_order_type/README.rst
@@ -17,13 +17,13 @@ Sale Order Type
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
- :target: https://github.com/OCA/sale-workflow/tree/17.0/sale_order_type
+ :target: https://github.com/OCA/sale-workflow/tree/18.0/sale_order_type
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_order_type
+ :target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_order_type
: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/sale-workflow&target_branch=17.0
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=18.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -66,7 +66,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.
@@ -145,6 +145,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/sale-workflow `_ project on GitHub.
+This module is part of the `OCA/sale-workflow `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/sale_order_type/__manifest__.py b/sale_order_type/__manifest__.py
index 61f3d101595..853bc3614ee 100644
--- a/sale_order_type/__manifest__.py
+++ b/sale_order_type/__manifest__.py
@@ -8,7 +8,7 @@
{
"name": "Sale Order Type",
- "version": "17.0.1.0.2",
+ "version": "18.0.1.0.0",
"category": "Sales Management",
"author": "Grupo Vermon,"
"AvanzOSC,"
diff --git a/sale_order_type/models/res_partner.py b/sale_order_type/models/res_partner.py
index 727816df3de..ee6360a70ba 100644
--- a/sale_order_type/models/res_partner.py
+++ b/sale_order_type/models/res_partner.py
@@ -7,7 +7,10 @@ class ResPartner(models.Model):
_inherit = "res.partner"
sale_type = fields.Many2one(
- comodel_name="sale.order.type", string="Sale Order Type", company_dependent=True
+ comodel_name="sale.order.type",
+ string="Sale Order Type",
+ company_dependent=True,
+ copy=True,
)
def copy_data(self, default=None):
diff --git a/sale_order_type/models/sale.py b/sale_order_type/models/sale.py
index 9af6a525dfb..b8f25e10006 100644
--- a/sale_order_type/models/sale.py
+++ b/sale_order_type/models/sale.py
@@ -27,7 +27,10 @@ class SaleOrder(models.Model):
)
incoterm = fields.Many2one(compute="_compute_incoterm", store=True, readonly=False)
analytic_account_id = fields.Many2one(
- compute="_compute_analytic_account_id", store=True, readonly=False
+ "account.analytic.account",
+ compute="_compute_analytic_account_id",
+ store=True,
+ readonly=False,
)
@api.model
diff --git a/sale_order_type/reports/account_invoice_report.py b/sale_order_type/reports/account_invoice_report.py
index 70570261db9..2260816a596 100644
--- a/sale_order_type/reports/account_invoice_report.py
+++ b/sale_order_type/reports/account_invoice_report.py
@@ -1,6 +1,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
+from odoo.tools import SQL
class AccountInvoiceReport(models.Model):
@@ -12,8 +13,4 @@ class AccountInvoiceReport(models.Model):
)
def _select(self):
- select_str = super()._select()
- select_str += """
- , move.sale_type_id as sale_type_id
- """
- return select_str
+ return SQL("%s, move.sale_type_id as sale_type_id", super()._select())
diff --git a/sale_order_type/reports/account_invoice_report_view.xml b/sale_order_type/reports/account_invoice_report_view.xml
index bcf8ef498f3..1317ba4c061 100644
--- a/sale_order_type/reports/account_invoice_report_view.xml
+++ b/sale_order_type/reports/account_invoice_report_view.xml
@@ -1,5 +1,4 @@
-
account.invoice.report
@@ -13,5 +12,4 @@
-
diff --git a/sale_order_type/reports/sale_report_view.xml b/sale_order_type/reports/sale_report_view.xml
index 41cbd39efd5..8591abb4304 100644
--- a/sale_order_type/reports/sale_report_view.xml
+++ b/sale_order_type/reports/sale_report_view.xml
@@ -1,5 +1,4 @@
-
sale.report
@@ -13,5 +12,4 @@
-
diff --git a/sale_order_type/static/description/index.html b/sale_order_type/static/description/index.html
index dc3b5c2f377..00485033030 100644
--- a/sale_order_type/static/description/index.html
+++ b/sale_order_type/static/description/index.html
@@ -369,7 +369,7 @@ Sale Order Type
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:35eef2045330b1b2db1adcba827947358c532224207eb8f1356dd6a120795769
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
This module adds a typology for the sales orders. In each different
type, you can define, invoicing and refunding journal, a warehouse, a
stock route, a sequence, the shipping policy, the invoicing policy, a
@@ -414,7 +414,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.
@@ -488,7 +488,7 @@
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/sale-workflow project on GitHub.
+
This module is part of the OCA/sale-workflow project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/sale_order_type/tests/test_account_invoice_report.py b/sale_order_type/tests/test_account_invoice_report.py
index f8026624546..f9eed1058ee 100644
--- a/sale_order_type/tests/test_account_invoice_report.py
+++ b/sale_order_type/tests/test_account_invoice_report.py
@@ -7,9 +7,10 @@
@tagged("post_install", "-at_install")
class TestAccountInvoiceReport(AccountTestInvoicingCommon):
@classmethod
- def setUpClass(cls, chart_template_ref=None):
- super().setUpClass(chart_template_ref=chart_template_ref)
+ def setUpClass(cls):
+ super().setUpClass()
+ cls.other_currency = cls.setup_other_currency("ARS")
cls.sale_order_types = cls.env["sale.order.type"].create(
[
{
@@ -27,7 +28,7 @@ def setUpClass(cls, chart_template_ref=None):
"partner_id": cls.partner_a.id,
"invoice_date": fields.Date.from_string("2021-01-01"),
"sale_type_id": cls.sale_order_types[0].id, # Normal Order
- "currency_id": cls.currency_data["currency"].id,
+ "currency_id": cls.other_currency.id,
"invoice_line_ids": [
(
0,
diff --git a/sale_order_type/tests/test_sale_order_report.py b/sale_order_type/tests/test_sale_order_report.py
index 0a1eb7e04dd..7e2c3c72f63 100644
--- a/sale_order_type/tests/test_sale_order_report.py
+++ b/sale_order_type/tests/test_sale_order_report.py
@@ -6,8 +6,8 @@
@tagged("post_install", "-at_install")
class TestSaleReport(TestSaleCommon):
@classmethod
- def setUpClass(cls, chart_template_ref=None):
- super().setUpClass(chart_template_ref=chart_template_ref)
+ def setUpClass(cls):
+ super().setUpClass()
cls.sale_order_types = cls.env["sale.order.type"].create(
[
diff --git a/sale_order_type/views/account_move_views.xml b/sale_order_type/views/account_move_views.xml
index 7021d734436..c59f11283c2 100644
--- a/sale_order_type/views/account_move_views.xml
+++ b/sale_order_type/views/account_move_views.xml
@@ -11,7 +11,7 @@
readonly="state != 'draft'"
/>
-
+
diff --git a/sale_order_type/views/sale_order_type_view.xml b/sale_order_type/views/sale_order_type_view.xml
index a510c30cfd4..d2822cc00fd 100644
--- a/sale_order_type/views/sale_order_type_view.xml
+++ b/sale_order_type/views/sale_order_type_view.xml
@@ -63,10 +63,10 @@
- sale.order.type.tree.view
+ sale.order.type.list.view
sale.order.type
-
+
-
+
@@ -154,7 +154,7 @@
Sales Order Types
sale.order.type
- form,tree
+ form,list
- tree
+ list
diff --git a/sale_order_type/views/sale_order_view.xml b/sale_order_type/views/sale_order_view.xml
index 3cd6036a5f0..e9e9a663922 100644
--- a/sale_order_type/views/sale_order_view.xml
+++ b/sale_order_type/views/sale_order_view.xml
@@ -18,7 +18,7 @@
sale.order
-
+
diff --git a/sale_order_type/wizards/sale_make_invoice_advance.py b/sale_order_type/wizards/sale_make_invoice_advance.py
index 4cabc8ef766..05459eabfd9 100644
--- a/sale_order_type/wizards/sale_make_invoice_advance.py
+++ b/sale_order_type/wizards/sale_make_invoice_advance.py
@@ -7,8 +7,8 @@
class SaleAdvancePaymentInv(models.TransientModel):
_inherit = "sale.advance.payment.inv"
- def _prepare_invoice_values(self, order, so_line):
- res = super()._prepare_invoice_values(order, so_line)
+ def _prepare_invoice_values(self, order, so_line, accounts):
+ res = super()._prepare_invoice_values(order, so_line, accounts)
if order.type_id.journal_id:
res["journal_id"] = order.type_id.journal_id.id
if order.type_id: