Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I want to print a debug message in a method. I override project.task.work.create method and i don't know if program use my method or the original.In java i print a simple message to see it. How do the same with OpenERP API? I use OpenERP 7 on debian linux.
To display a debug log, you can use the standard python
Basically, you need to get a logger and you can use it in your methods to output log messages.
Usually, in OpenERP, a _logger is get at the top of the python module, its name being the name of the python module.
import logging from openerp.osv import orm _logger = logging.getLogger(__name__) class project_task_work(orm.Model): _inherit = 'project.task.work' def create(self, cr, uid, vals, context=None): _logger.debug('Create a %s with vals %s', self._name, vals) return super(project_task_work, self).create(cr, uid, vals, context=context)
Note that you will need to start your server using the
--debug option to show debug logs.
Other options for logging at a higher level (that doesn't require the --debug option) are:
_logger.info('FYI: This is happening')
_logger.warning('WARNING: I don't think you want this to happen!')
_logger.error('ERROR: Something really bad happened!')
About This Community
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 2/12/13, 7:35 AM|
|Seen: 24580 times|
|Last updated: 10/6/16, 12:47 PM|