Skip to content

Commit

Permalink
[MIG] component_event: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenminhchien committed Dec 8, 2023
1 parent 23fd3aa commit 4f7836d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion component_event/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Components Events",
"version": "16.0.1.0.1",
"version": "17.0.1.0.0",
"author": "Camptocamp," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/connector",
"license": "LGPL-3",
Expand Down
4 changes: 2 additions & 2 deletions component_event/components/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class EventCollecter(Component):
@classmethod
def _complete_component_build(cls):
"""Create a cache on the class when the component is built"""
super(EventCollecter, cls)._complete_component_build()
super()._complete_component_build()
# the _cache being on the component class, which is
# dynamically rebuild when odoo registry is rebuild, we
# are sure that the result is always the same for a lookup
Expand Down Expand Up @@ -293,6 +293,6 @@ def _build_event_listener_component(cls):

@classmethod
def _complete_component_build(cls):
super(EventListener, cls)._complete_component_build()
super()._complete_component_build()
cls._build_event_listener_component()
return
4 changes: 2 additions & 2 deletions component_event/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(
raise ValueError("collection and env cannot both be provided")

self.env = env
super(EventWorkContext, self).__init__(
super().__init__(
model_name=model_name,
collection=collection,
components_registry=components_registry,
Expand All @@ -67,7 +67,7 @@ def env(self):
"""Return the current Odoo env"""
if self._env:
return self._env
return super(EventWorkContext, self).env
return super().env

@env.setter
def env(self, value):
Expand Down
6 changes: 3 additions & 3 deletions component_event/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ def button_do_something(self):

@api.model_create_multi
def create(self, vals_list):
records = super(Base, self).create(vals_list)
records = super().create(vals_list)
for idx, vals in enumerate(vals_list):
fields = list(vals.keys())
self._event("on_record_create").notify(records[idx], fields=fields)
return records

def write(self, vals):
result = super(Base, self).write(vals)
result = super().write(vals)
fields = list(vals.keys())
for record in self:
self._event("on_record_write").notify(record, fields=fields)
Expand All @@ -115,5 +115,5 @@ def write(self, vals):
def unlink(self):
for record in self:
self._event("on_record_unlink").notify(record)
result = super(Base, self).unlink()
result = super().unlink()
return result

Check warning on line 119 in component_event/models/base.py

View check run for this annotation

Codecov / codecov/patch

component_event/models/base.py#L117-L119

Added lines #L117 - L119 were not covered by tests
8 changes: 4 additions & 4 deletions component_event/tests/test_event.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright 2017 Camptocamp SA
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html)

import unittest
from unittest import mock

from odoo.tests.case import TestCase
from odoo.tests.common import MetaCase, tagged

from odoo.addons.component.core import Component
Expand All @@ -16,7 +16,7 @@


@tagged("standard", "at_install")
class TestEventWorkContext(unittest.TestCase, MetaCase("DummyCase", (), {})):
class TestEventWorkContext(TestCase, MetaCase("DummyCase", (), {})):
"""Test Events Components"""

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -137,7 +137,7 @@ class TestEvent(ComponentRegistryCase):
"""Test Events Components"""

def setUp(self):
super(TestEvent, self).setUp()
super().setUp()
self._setup_registry(self)
self._load_module_components("component_event")

Check warning on line 142 in component_event/tests/test_event.py

View check run for this annotation

Codecov / codecov/patch

component_event/tests/test_event.py#L140-L142

Added lines #L140 - L142 were not covered by tests

Expand Down Expand Up @@ -367,7 +367,7 @@ class TestEventFromModel(TransactionComponentRegistryCase):
"""Test Events Components from Models"""

def setUp(self):
super(TestEventFromModel, self).setUp()
super().setUp()
self._setup_registry(self)
self._load_module_components("component_event")

Expand Down

0 comments on commit 4f7836d

Please sign in to comment.