-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add check_write_from_computed_field module
- Loading branch information
Showing
11 changed files
with
583 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
=============================== | ||
Check Write From Computed Field | ||
=============================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:fb310fe636d9a1d0445a2c6ae0b16f4730a2373aa5e39d451c4c028d4b365a52 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-akretion%2Fodoo--perf-lightgray.png?logo=github | ||
:target: https://github.com/akretion/odoo-perf/tree/16.0/check_write_from_computed_field | ||
:alt: akretion/odoo-perf | ||
|
||
|badge1| |badge2| |badge3| | ||
|
||
This module allows to check the write called by a computed field in the logs. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/akretion/odoo-perf/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/akretion/odoo-perf/issues/new?body=module:%20check_write_from_computed_field%0Aversion:%2016.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. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Akretion | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Kévin Roche <[email protected]> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
.. |maintainer-Kev-Roche| image:: https://github.com/Kev-Roche.png?size=40px | ||
:target: https://github.com/Kev-Roche | ||
:alt: Kev-Roche | ||
|
||
Current maintainer: | ||
|
||
|maintainer-Kev-Roche| | ||
|
||
This module is part of the `akretion/odoo-perf <https://github.com/akretion/odoo-perf/tree/16.0/check_write_from_computed_field>`_ project on GitHub. | ||
|
||
You are welcome to contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2024 Akretion (https://www.akretion.com). | ||
# @author Kévin Roche <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Check Write From Computed Field", | ||
"summary": "module to check write from computed field", | ||
"version": "16.0.1.0.0", | ||
"category": "TODO", | ||
"website": "https://github.com/akretion/odoo-perf", | ||
"author": "Akretion, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"maintainers": ["Kev-Roche"], | ||
"application": False, | ||
"installable": True, | ||
"depends": [ | ||
"base", | ||
], | ||
"data": [], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2024 Akretion (https://www.akretion.com). | ||
# @author Kévin Roche <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
import logging | ||
|
||
from odoo import api, models | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
class BaseModel(models.AbstractModel): | ||
_inherit = "base" | ||
|
||
@api.model | ||
def _compute_field_value(self, field): | ||
self = self.with_context(compute_field=field) | ||
return super(BaseModel, self)._compute_field_value(field) | ||
|
||
def write(self, vals): | ||
if self._context.get("compute_field"): | ||
_logger.warning( | ||
"Write operation triggered by computed field on model: " | ||
f"model :{self._name}, " | ||
f"field : {self._context.get('compute_field')}, " | ||
f"vals: {vals} " | ||
f"context: {self._context}, " | ||
) | ||
return super(BaseModel, self).write(vals) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Kévin Roche <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This module allows to check the write called by a computed field in the logs. |
Oops, something went wrong.