Skip to content

Commit

Permalink
[MIG] sale_order_type: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasperalta1 committed Oct 22, 2024
1 parent 9a0cfb5 commit c7d0f65
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 34 deletions.
10 changes: 5 additions & 5 deletions sale_order_type/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -66,7 +66,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/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 <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_order_type%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_order_type%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -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 <https://github.com/OCA/sale-workflow/tree/17.0/sale_order_type>`_ project on GitHub.
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/18.0/sale_order_type>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion sale_order_type/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,"
Expand Down
5 changes: 4 additions & 1 deletion sale_order_type/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions sale_order_type/reports/account_invoice_report.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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())
2 changes: 0 additions & 2 deletions sale_order_type/reports/account_invoice_report_view.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<odoo>

<record id="view_account_invoice_report_search" model="ir.ui.view">
<field name="inherit_id" ref="account.view_account_invoice_report_search" />
<field name="model">account.invoice.report</field>
Expand All @@ -13,5 +12,4 @@
</filter>
</field>
</record>

</odoo>
2 changes: 0 additions & 2 deletions sale_order_type/reports/sale_report_view.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<odoo>

<record id="view_order_product_search" model="ir.ui.view">
<field name="inherit_id" ref="sale.view_order_product_search" />
<field name="model">sale.report</field>
Expand All @@ -13,5 +12,4 @@
</filter>
</field>
</record>

</odoo>
6 changes: 3 additions & 3 deletions sale_order_type/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Sale Order Type</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:35eef2045330b1b2db1adcba827947358c532224207eb8f1356dd6a120795769
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-workflow/tree/17.0/sale_order_type"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_order_type"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-workflow/tree/18.0/sale_order_type"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_order_type"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>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
Expand Down Expand Up @@ -414,7 +414,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/sale-workflow/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_order_type%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_order_type%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -488,7 +488,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/17.0/sale_order_type">OCA/sale-workflow</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/18.0/sale_order_type">OCA/sale-workflow</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
7 changes: 4 additions & 3 deletions sale_order_type/tests/test_account_invoice_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[
{
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions sale_order_type/tests/test_sale_order_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[
Expand Down
2 changes: 1 addition & 1 deletion sale_order_type/tests/test_sale_order_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,5 +263,5 @@ def test_sequence_default(self):
self.assertEqual(name, order.name, "The sequence shouldn't change!")

def test_res_partner_copy_data(self):
new_partner = self.partner.copy()
new_partner = self.partner.copy({"sale_type": self.partner.sale_type.id})
self.assertEqual(self.partner.sale_type, new_partner.sale_type)
2 changes: 1 addition & 1 deletion sale_order_type/views/account_move_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
readonly="state != 'draft'"
/>
</label>
<xpath expr="//notebook//tree//field[@name='sequence']" position="before">
<xpath expr="//notebook//list//field[@name='sequence']" position="before">
<field name="account_id" column_invisible="True" />
</xpath>
</field>
Expand Down
10 changes: 5 additions & 5 deletions sale_order_type/views/sale_order_type_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
</field>
</record>
<record id="sot_sale_order_type_tree_view" model="ir.ui.view">
<field name="name">sale.order.type.tree.view</field>
<field name="name">sale.order.type.list.view</field>
<field name="model">sale.order.type</field>
<field name="arch" type="xml">
<tree>
<list>
<field name="name" />
<field
name="warehouse_id"
Expand All @@ -81,7 +81,7 @@
<field name="incoterm_id" />
<field name="company_id" groups="base.group_multi_company" />
<field name="description" />
</tree>
</list>
</field>
</record>
<record id="sot_sale_order_type_search_view" model="ir.ui.view">
Expand Down Expand Up @@ -154,7 +154,7 @@
<record id="sot_sale_order_type_action" model="ir.actions.act_window">
<field name="name">Sales Order Types</field>
<field name="res_model">sale.order.type</field>
<field name="view_mode">form,tree</field>
<field name="view_mode">form,list</field>
<field name="view_id" ref="sot_sale_order_type_tree_view" />
<field name="help" type="html">
<p
Expand All @@ -170,7 +170,7 @@
</record>
<record id="sot_sale_order_type_action_tree" model="ir.actions.act_window.view">
<field name="sequence" eval="1" />
<field name="view_mode">tree</field>
<field name="view_mode">list</field>
<field name="view_id" ref="sot_sale_order_type_tree_view" />
<field name="act_window_id" ref="sot_sale_order_type_action" />
</record>
Expand Down
2 changes: 1 addition & 1 deletion sale_order_type/views/sale_order_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_sales_order_filter" />
<field name="arch" type="xml">
<field name="analytic_account_id" position="after">
<field name="order_line" position="after">
<field name="type_id" />
</field>
<filter name="order_month" position="after">
Expand Down
4 changes: 2 additions & 2 deletions sale_order_type/wizards/sale_make_invoice_advance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c7d0f65

Please sign in to comment.