Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ ITthon: Prova de concepte per aconseguir estadística de l'ús dels menús i wizards #720

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions base_extended_som/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
import res_partner
import ir_actions
import ir_values
import som_action_logger
25 changes: 25 additions & 0 deletions base_extended_som/ir_actions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- encoding: utf-8 -*-

from __future__ import print_function
from osv import osv
from tools import isolation


class act_window(osv.osv):
_name = "ir.actions.act_window"
_inherit = "ir.actions.act_window"

@isolation(readonly=True, isolation_level='repeatable_read')
def read(self, cursor, uid, ids, fields=None, context=None,
load='_classic_read'):
# if fields is None:
# self.pool.get('som.action.menu.logger').create(cursor, uid, {
# 'act_window_id': ids[0],
# })

return super(act_window, self).read(
cursor, uid, ids, fields=fields, context=context, load=load
)


act_window()
35 changes: 35 additions & 0 deletions base_extended_som/ir_values.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -*- encoding: utf-8 -*-

from __future__ import print_function
from osv import osv
from tools import isolation


class ir_values(osv.osv):
_name = "ir.values"
_inherit = "ir.values"

@isolation(readonly=True, isolation_level='repeatable_read')
def get(
self, cr, uid, key, key2, models, meta=False, context={}, res_id_req=False,
without_user=True, key2_req=True
):
res = super(ir_values, self).get(
cr, uid, key, key2, models, meta=meta, context=context, res_id_req=res_id_req,
without_user=without_user, key2_req=key2_req
)

if key == 'default' and key2 is False and 'wiz' in models[0]:
self.pool.get('som.action.wzrd.logger').create(cr, uid, {
'model': models[0],
})

if key == 'action' and key2 == 'tree_but_open':
self.pool.get('som.action.menu.logger').create(cr, uid, {
'act_window_id': res[0][2]['id'],
})

return res


ir_values()
34 changes: 34 additions & 0 deletions base_extended_som/som_action_logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- encoding: utf-8 -*-

from __future__ import absolute_import
from osv import osv, fields

from pytz import timezone

LOCAL_TZ = timezone('Europe/Madrid')


class SomActionMenuLogger(osv.Timescale):
_name = 'som.action.menu.logger'
_time_column = 'create_date'

_columns = {
'create_date': fields.datetime('Creation date', required=True),
'act_window_id': fields.integer('Action Window', required=True),
}


SomActionMenuLogger()


class SomActionWzrdLogger(osv.Timescale):
_name = 'som.action.wzrd.logger' # we need to avoid the word "wizard" to escape recursion
_time_column = 'create_date'

_columns = {
'create_date': fields.datetime('Creation date', required=True),
'model': fields.char('Wizard model', size=128, required=True)
}


SomActionWzrdLogger()
Loading