I'm creating a log entry within a server action in Odoo 10. This is the server action Python code:
if record:
env['ir.logging'].create({
'type': 'server',
'name': 'test',
'level': record._name,
'path': 'test',
'line': 'test,
'func': '#',
'message': '#'
})
The line value for level
of record._name
gets me the name of the current model as a string, for example, product.product
, or sale.order
.
However, I don't think the _name
attribute is not meant to be part of the public API. Does anyone know of a public way to retrieve the name of the model?
The model
variable is also available in the server action, which returns product.product()
. However, want product.product
, without the parenthesis. I realize I could just use a string method to trim off the ()
, but I'm wondering if there is an intended way to get just the name of the model as a string.
Any ideas?