1

I'm very new at Odoo addon development, yet i'm trying to create a simple Odoo 16 plugin that will just override a few methods from the built-in addons and skip their functionality. The plugin installs succesfully, but won't override the code or actually log anything.

In particular, i'm trying to override the action_notify function in addons/mail/models/mail_activity.py model and add some extra code to the existing one, by fully replacing the method. My plugin structure is the following:

.
├── __init__.py
├── __manifest__.py
├── models
│   ├── __init__.py
│   ├── mail_message.py
│   └── task.py
└── security
└── ir.model.access.csv

my ./__init__.py file:

from . import models

my models/__init__.py file:

from . import task, mail_activity

my models/mail_activity.py file:

from odoo import models
import logging
_logger = logging.getLogger(__name__)

class MailActivity(models.Model):
    _inherit = 'mail.activity'

    def action_notify(self):
        _logger.info("LOG: _task_message_auto_subscribe_notify method invoked")
        return

at this point i tried:

  • to use the pass command as the only content of the new action_notify() method
  • to use the logger
  • to just add some arbitrary code

but nothing seems to work, yet editing the main odoo code. Could please someone help me find the correct way to override the base addon function?

Thanks in advance

Fed C
  • 143
  • 1
  • 13

0 Answers0