Reputation: 557
I need to get the module name where a model is defined
When I ran env['res.partner']._module
inside an odoo shell, the output is snailmail_account_followup
, but I expected it to report base
In odoo.models.BaseModel
it says this about the _module
attribute:
_module = None #: the model's module (in the Odoo sense)
Is this the expected behaviour? What's the correct way to get the module where a model is originally defined (not inherited)?
Upvotes: 2
Views: 56
Reputation: 557
I did a bit more digging and I found the solution, so I'll document it here for future reference
Apparently,Model._module
is the last module that inherited the model. To get the original module use Model._original_module
instead
Upvotes: 2