From 1b591a83caacbc8e697bee4d59353df64e366bfd Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 17 Feb 2015 11:31:39 +0100 Subject: [PATCH] Add logging on start/end of procurement scheduler --- procurement_usability/__init__.py | 1 + procurement_usability/__openerp__.py | 2 +- procurement_usability/procurement.py | 42 ++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 procurement_usability/procurement.py diff --git a/procurement_usability/__init__.py b/procurement_usability/__init__.py index 195e258..9b224b5 100644 --- a/procurement_usability/__init__.py +++ b/procurement_usability/__init__.py @@ -20,3 +20,4 @@ # ############################################################################## +from . import procurement diff --git a/procurement_usability/__openerp__.py b/procurement_usability/__openerp__.py index 4d5b54a..e2e20ad 100644 --- a/procurement_usability/__openerp__.py +++ b/procurement_usability/__openerp__.py @@ -37,7 +37,7 @@ This module has been written by Alexis de Lattre from Akretion +# +# 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 . +# +############################################################################## + +from openerp import models +import logging + +logger = logging.getLogger(__name__) + + +class ProcurementOrder(models.Model): + _inherit = 'procurement.order' + + def run_scheduler( + self, cr, uid, use_new_cursor=False, company_id=False, + context=None): + '''Inherit to add info logs''' + logger.info( + 'START procurement scheduler (company ID=%d)' % company_id) + res = super(ProcurementOrder, self).run_scheduler( + cr, uid, use_new_cursor=use_new_cursor, company_id=company_id, + context=context) + logger.info('END procurement scheduler (company ID=%d)' % company_id) + return res