Skip to content

Commit

Permalink
[ADD] ak-odoo-incubator : code_tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
syera94 committed May 23, 2023
1 parent 453e58d commit 49e7ebe
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions code_tracker/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

import logging
import traceback
from functools import wraps

from odoo import fields

_logger = logging.getLogger(__name__)

from functools import wraps
# the decorator to know which function is called or not


# the decorator to know which function is called or not
def tracker_code(func):
@wraps(func)
def tracker_code_information(cls):
Expand Down
2 changes: 1 addition & 1 deletion code_tracker/models/tracker_code_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from odoo import fields, models


class tracker_code_info(models.Model):
class TrackerCodeInfo(models.Model):
_name = "tracker.code.info"
_description = "see if a function is used"

Expand Down
8 changes: 4 additions & 4 deletions code_tracker/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
To be able to see what functions is called or not you should when you install this module :
- install this module in the manifest
- Install this module in the manifest
- Add at the beginning of the model from odoo.addons.code_tracker.decorators import tracker_code
- add the decorator above the called function
- Add the decorator above the called function

to see the list of the called functions :
- go to settings --> technical --> tracker trace
To see the list of the called functions :
- Go to settings --> technical --> tracker trace
8 changes: 3 additions & 5 deletions code_tracker/tests/test_tracker_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ def tearDownClass(cls):

def test_tracker_trace(self):

method_tracker = "fonction_tracker_test" #'name of the method called by the _onchange_method'
method_onchange = "_onchange_state" #'name of the _onchange_method'
log = self.env["tracker.code.info"].search(
[("log_trace", "=", method_onchange)]
)
# Name of the _onchange_method and on the method called by the _onchange_method
method_tracker = "fonction_tracker_test"
method_onchange = "_onchange_state"

function = self.env["tracker.code.info"].search(
[("function_name", "=", method_tracker)], order="id desc", limit=1
Expand Down
1 change: 1 addition & 0 deletions setup/code_tracker/odoo/addons/code_tracker
6 changes: 6 additions & 0 deletions setup/code_tracker/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit 49e7ebe

Please sign in to comment.