Skip to content

Commit

Permalink
[MIG] base_substate: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gaelTorrecillas committed Jan 22, 2025
1 parent e045807 commit 790d96a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 18 deletions.
6 changes: 5 additions & 1 deletion base_substate/models/base_substate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ class BaseSubstateType(models.Model):
_order = "name asc, model asc"

name = fields.Char(required=True, translate=True)
model = fields.Selection(selection=[], string="Apply on", required=True)
model = fields.Selection(
selection=[("base.substate.test.sale", "Sale Order")],
string="Apply on",
required=True,
)
target_state_field = fields.Char(
required=True,
help="Technical target state field name."
Expand Down
2 changes: 1 addition & 1 deletion base_substate/models/base_substate_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ def _get_substate_type(
string="Sub State",
ondelete="restrict",
default=lambda self: self._get_default_substate_id(),
tracking=5,
index=True,
domain=lambda self: [("model", "=", self._name)],
copy=False,
# tracking=True,
)

@api.constrains("substate_id")
Expand Down
7 changes: 3 additions & 4 deletions base_substate/tests/test_base_substate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from .sale_test import LineTest, SaleTest


@common.tagged("post_install", "-at_install")
class TestBaseSubstate(common.TransactionCase):
@classmethod
def setUpClass(cls):
Expand All @@ -24,7 +23,7 @@ def setUpClass(cls):
("base.substate.test.sale", "Sale Order")
)

cls.substate_type = cls.env["base.substate.type"].create(
cls.substate_type_state = cls.substate_type.create(
{
"name": "Sale",
"model": "base.substate.test.sale",
Expand All @@ -35,15 +34,15 @@ def setUpClass(cls):
cls.substate_val_quotation = cls.env["target.state.value"].create(
{
"name": "Quotation",
"base_substate_type_id": cls.substate_type.id,
"base_substate_type_id": cls.substate_type_state.id,
"target_state_value": "draft",
}
)

cls.substate_val_sale = cls.env["target.state.value"].create(
{
"name": "Sale order",
"base_substate_type_id": cls.substate_type.id,
"base_substate_type_id": cls.substate_type_state.id,
"target_state_value": "sale",
}
)
Expand Down
12 changes: 0 additions & 12 deletions base_substate/views/base_substate_type_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@
<!-- Copyright 2020 Akretion
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="product_uom_tree_view" model="ir.ui.view">
<field name="name">uom.uom.list</field>
<field name="model">uom.uom</field>
<field name="arch" type="xml">
<list string="Units of Measure" create="false">
<field name="name"/>
<field name="category_id"/>
<field name="uom_type"/>
</list>
</field>
</record>

<record id="base_substate_type_view_tree" model="ir.ui.view">
<field name="name">base.substate.type.list</field>
<field name="model">base.substate.type</field>
Expand Down

0 comments on commit 790d96a

Please sign in to comment.