[IMP] switch workflows to standard logging (silenced by default), remove wkf_logs
bzr revid: xmo@openerp.com-20130319163133-3n1k1hgooddzxntz
This commit is contained in:
parent
5f956523d4
commit
db6b6480f7
|
@ -131,6 +131,7 @@ def init_logger():
|
||||||
|
|
||||||
# Configure handlers
|
# Configure handlers
|
||||||
default_config = [
|
default_config = [
|
||||||
|
'openerp.workflow.workitem:WARNING',
|
||||||
'openerp.netsvc.rpc.request:INFO',
|
'openerp.netsvc.rpc.request:INFO',
|
||||||
'openerp.netsvc.rpc.response:INFO',
|
'openerp.netsvc.rpc.response:INFO',
|
||||||
'openerp.addons.web.http:INFO',
|
'openerp.addons.web.http:INFO',
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
##############################################################################
|
|
||||||
#
|
|
||||||
# OpenERP, Open Source Management Solution
|
|
||||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
|
||||||
#
|
|
||||||
# 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/>.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
#
|
|
||||||
# May be uncommented to logs workflows modifications
|
|
||||||
#
|
|
||||||
|
|
||||||
def log(cr,ident,act_id,info=''):
|
|
||||||
return
|
|
||||||
# msg = """
|
|
||||||
#res_type: %r
|
|
||||||
#res_id: %d
|
|
||||||
#uid: %d
|
|
||||||
#act_id: %d
|
|
||||||
#info: %s
|
|
||||||
#""" % (ident[1], ident[2], ident[0], act_id, info)
|
|
||||||
|
|
||||||
#cr.execute('insert into wkf_logs (res_type, res_id, uid, act_id, time, info) values (%s,%s,%s,%s,current_time,%s)', (ident[1],int(ident[2]),int(ident[0]),int(act_id),info))
|
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
||||||
|
|
|
@ -23,11 +23,13 @@
|
||||||
# TODO:
|
# TODO:
|
||||||
# cr.execute('delete from wkf_triggers where model=%s and res_id=%s', (res_type,res_id))
|
# cr.execute('delete from wkf_triggers where model=%s and res_id=%s', (res_type,res_id))
|
||||||
#
|
#
|
||||||
|
import logging
|
||||||
|
|
||||||
import instance
|
import instance
|
||||||
|
|
||||||
import wkf_expr
|
import wkf_expr
|
||||||
import wkf_logs
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
def create(cr, act_datas, inst_id, ident, stack):
|
def create(cr, act_datas, inst_id, ident, stack):
|
||||||
for act in act_datas:
|
for act in act_datas:
|
||||||
|
@ -36,7 +38,8 @@ def create(cr, act_datas, inst_id, ident, stack):
|
||||||
cr.execute("insert into wkf_workitem (id,act_id,inst_id,state) values (%s,%s,%s,'active')", (id_new, act['id'], inst_id))
|
cr.execute("insert into wkf_workitem (id,act_id,inst_id,state) values (%s,%s,%s,'active')", (id_new, act['id'], inst_id))
|
||||||
cr.execute('select * from wkf_workitem where id=%s',(id_new,))
|
cr.execute('select * from wkf_workitem where id=%s',(id_new,))
|
||||||
res = cr.dictfetchone()
|
res = cr.dictfetchone()
|
||||||
wkf_logs.log(cr,ident,act['id'],'active')
|
logger.info('Created workflow item in activity %s',
|
||||||
|
act['id'], extra={'ident': ident})
|
||||||
process(cr, res, ident, stack=stack)
|
process(cr, res, ident, stack=stack)
|
||||||
|
|
||||||
def process(cr, workitem, ident, signal=None, force_running=False, stack=None):
|
def process(cr, workitem, ident, signal=None, force_running=False, stack=None):
|
||||||
|
@ -75,7 +78,8 @@ def process(cr, workitem, ident, signal=None, force_running=False, stack=None):
|
||||||
def _state_set(cr, workitem, activity, state, ident):
|
def _state_set(cr, workitem, activity, state, ident):
|
||||||
cr.execute('update wkf_workitem set state=%s where id=%s', (state,workitem['id']))
|
cr.execute('update wkf_workitem set state=%s where id=%s', (state,workitem['id']))
|
||||||
workitem['state'] = state
|
workitem['state'] = state
|
||||||
wkf_logs.log(cr,ident,activity['id'],state)
|
logger.info("Changed state of work item %s to \"%s\" in activity %s",
|
||||||
|
workitem['id'], state, activity['id'], extra={'ident': ident})
|
||||||
|
|
||||||
def _execute(cr, workitem, activity, ident, stack):
|
def _execute(cr, workitem, activity, ident, stack):
|
||||||
result = True
|
result = True
|
||||||
|
|
Loading…
Reference in New Issue