Skip to content

Commit

Permalink
[NEW]base_exception_ux: adds time module
Browse files Browse the repository at this point in the history
closes #142

Signed-off-by: Juan José Scarafía <jjs@adhoc.com.ar>
  • Loading branch information
jok-adhoc committed Jan 11, 2024
1 parent de31982 commit 277af0a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions base_exception_ux/__init__.py
@@ -0,0 +1 @@
from . import models
39 changes: 39 additions & 0 deletions base_exception_ux/__manifest__.py
@@ -0,0 +1,39 @@
##############################################################################
#
# Copyright (C) 2019 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Base Exception UX',
'version': "16.0.1.0.0",
'category': 'Base',
'sequence': 14,
'summary': '',
'author': 'ADHOC SA',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'depends': [
'base_exception',
],
'data': [
],
'demo': [
],
'installable': True,
'auto_install': True,
'application': False,
}
1 change: 1 addition & 0 deletions base_exception_ux/models/__init__.py
@@ -0,0 +1 @@
from . import base_exception_method
14 changes: 14 additions & 0 deletions base_exception_ux/models/base_exception_method.py
@@ -0,0 +1,14 @@
from odoo import models
from odoo.tools.safe_eval import wrap_module


class BaseExceptionMethod(models.AbstractModel):
_inherit = "base.exception.method"

def _exception_rule_eval_context(self, rec):
time = wrap_module(__import__('time'), ['time', 'strptime', 'strftime', 'sleep', 'gmtime'])
eval_context = super()._exception_rule_eval_context(rec)
eval_context.update({
'time': time,
})
return eval_context

0 comments on commit 277af0a

Please sign in to comment.