Skip to main content

Define EDI Configuration for Projects and Tasks

Project description

Beta License: LGPL-3 OCA/edi-framework Translate me on Weblate Try me on Runboat

This module intends to create a base to be extended by local EDI rules for project management.

In order to add customizations for projects, create a listener:

from odoo.addons.component.core import Component


class ProjectEventListenerExample(Component):
    _name = "project.project.event.listener.example"
    _inherit = "base.event.listener"
    _apply_on = ["project.project"]

    def on_record_create(self, record, fields=None):
        """Do stuff after the project has been created"""

    def on_record_write(self, record, fields=None):
        """Do stuff after the project has been updated"""

    def on_record_unlink(self, record):
        """Do stuff before the project gets deleted"""

In order to add customizations for tasks, create a listener:

from odoo.addons.component.core import Component


class ProjectTaskEventListenerExample(Component):
    _name = "project.task.event.listener.example"
    _inherit = "base.event.listener"
    _apply_on = ["project.task"]

    def on_record_create(self, record, fields=None):
      """Do stuff after the task has been created"""

    def on_record_write(self, record, fields=None):
      """Do stuff after the task has been updated"""

    def on_record_unlink(self, record):
      """Do stuff before the task gets deleted"""

Use @skip_if() decorator to avoid triggering a listener’s method if necessary:

from odoo.addons.component.core import Component
from odoo.addons.component_event import skip_if


class ProjectTaskEventListenerExample(Component):
    _name = "project.task.event.listener.example"
    _inherit = "base.event.listener"
    _apply_on = ["project.task"]

    @skip_if(lambda self, task: not task.stage_id)  # Do nothing if the task has no stage
    def on_record_update(self, record, fields=None):
        """Do stuff after the task has been created"""

Table of contents

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • Camptocamp

Contributors

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

This module is part of the OCA/edi-framework project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file odoo_addon_edi_project_oca-17.0.1.0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for odoo_addon_edi_project_oca-17.0.1.0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f7950ecd7a7a6063badb753d7b1c433b9ce62aa7b75f9d59a7b707c78b73a78f
MD5 b712d223bf5ea2913d8622c941ee704f
BLAKE2b-256 9318200847c4a6501a60120397e69464212908446ebc50445cda271eba8c2350

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page