Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions edi_notification_oca/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
================
EDI Notification
================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:d8651cf2a0e90d542e65ce8083a2bccffd0b1a3549867bb7a8e91843bd62a770
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi--framework-lightgray.png?logo=github
:target: https://github.com/OCA/edi-framework/tree/18.0/edi_notification_oca
:alt: OCA/edi-framework
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/edi-framework-18-0/edi-framework-18-0-edi_notification_oca
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/edi-framework&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module provides sending notification feature when exchange record.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/edi-framework/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 <https://github.com/OCA/edi-framework/issues/new?body=module:%20edi_notification_oca%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* Camptocamp

Contributors
------------

- Duong (Tran Quoc) <duontq@troz.com>
- Simone Orsi <simone.orsi@camptocamp.com>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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 <https://github.com/OCA/edi-framework/tree/18.0/edi_notification_oca>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions edi_notification_oca/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import components
from . import models
15 changes: 15 additions & 0 deletions edi_notification_oca/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024 Camptocamp SA
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
"name": "EDI Notification",
"summary": """Define notification activities on exchange records.""",
"version": "18.0.1.0.0",
"development_status": "Alpha",
"license": "LGPL-3",
"website": "https://github.com/OCA/edi-framework",
"author": "Camptocamp,Odoo Community Association (OCA)",
"depends": ["edi_oca"],
"data": ["data/mail_activity_type.xml", "views/edi_exchange_type.xml"],
"installable": True,
}
1 change: 1 addition & 0 deletions edi_notification_oca/components/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import listener
44 changes: 44 additions & 0 deletions edi_notification_oca/components/listener.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2024 Camptocamp SA
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo.addons.component.core import Component


class EdiNotificationListener(Component):
_name = "edi.notification.component.listener"
_inherit = "base.event.listener"

def on_edi_exchange_error(self, record):
exc_type = record.type_id
notify_on_process_error = exc_type.notify_on_process_error
activity_type = exc_type.notify_on_process_error_activity_type_id
if (
not notify_on_process_error
or not activity_type
or not (
exc_type.notify_on_process_error_groups_ids
or exc_type.notify_on_process_error_users_ids
)
):
return True
users = self._get_users_to_notify(exc_type)
# Send notification to defined users
for user in users:
record.activity_schedule(
activity_type_id=activity_type.id,
summary=self.env._(
"EDI: Process error on record '%(identifier)s'.",
identifier=record.identifier,
),
note=record.exchange_error,
user_id=user.id,
automated=True,
)
return True

def _get_users_to_notify(self, exc_type):
exc_type.ensure_one()
return (
exc_type.notify_on_process_error_groups_ids.users
| exc_type.notify_on_process_error_users_ids
)
12 changes: 12 additions & 0 deletions edi_notification_oca/data/mail_activity_type.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record
id="mail_activity_failed_exchange_record_warning"
model="mail.activity.type"
>
<field name="name">EDI Exchange Record: Failed</field>
<field name="icon">fa-warning</field>
<field name="res_model">edi.exchange.record</field>
<field name="decoration_type">warning</field>
</record>
</odoo>
150 changes: 150 additions & 0 deletions edi_notification_oca/i18n/edi_notification_oca.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * edi_notification_oca
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: edi_notification_oca
#: model:ir.model.fields,field_description:edi_notification_oca.field_edi_exchange_record__activity_ids
msgid "Activities"
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,field_description:edi_notification_oca.field_edi_exchange_record__activity_exception_decoration
msgid "Activity Exception Decoration"
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,field_description:edi_notification_oca.field_edi_exchange_record__activity_state
msgid "Activity State"
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,field_description:edi_notification_oca.field_edi_exchange_record__activity_type_icon
msgid "Activity Type Icon"
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,field_description:edi_notification_oca.field_edi_exchange_type__notify_on_process_error_activity_type_id
msgid "Activity Type Used When Notify On Process Error"
msgstr ""

#. module: edi_notification_oca
#: model:mail.activity.type,name:edi_notification_oca.mail_activity_failed_exchange_record_warning
msgid "EDI Exchange Record: Failed"
msgstr ""

#. module: edi_notification_oca
#: model:ir.model,name:edi_notification_oca.model_edi_exchange_type
msgid "EDI Exchange Type"
msgstr ""

#. module: edi_notification_oca
#: model:ir.model,name:edi_notification_oca.model_edi_exchange_record
msgid "EDI exchange Record"
msgstr ""

#. module: edi_notification_oca
#. odoo-python
#: code:addons/edi_notification_oca/components/listener.py:0
#, python-format
msgid "EDI: Process error on record '%(identifier)s'."
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,help:edi_notification_oca.field_edi_exchange_record__activity_type_icon
msgid "Font awesome icon e.g. fa-tasks"
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,field_description:edi_notification_oca.field_edi_exchange_record__activity_exception_icon
msgid "Icon"
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,help:edi_notification_oca.field_edi_exchange_record__activity_exception_icon
msgid "Icon to indicate an exception activity."
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,help:edi_notification_oca.field_edi_exchange_type__notify_on_process_error
msgid ""
"If an error happens on process, a notification will be sent to all selected "
"users. If active, please select the specific groups and specific users in "
"the 'Notifications' page."
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,field_description:edi_notification_oca.field_edi_exchange_record__my_activity_date_deadline
msgid "My Activity Deadline"
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,field_description:edi_notification_oca.field_edi_exchange_record__activity_date_deadline
msgid "Next Activity Deadline"
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,field_description:edi_notification_oca.field_edi_exchange_record__activity_summary
msgid "Next Activity Summary"
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,field_description:edi_notification_oca.field_edi_exchange_record__activity_type_id
msgid "Next Activity Type"
msgstr ""

#. module: edi_notification_oca
#: model_terms:ir.ui.view,arch_db:edi_notification_oca.edi_exchange_type_view_form
msgid "Notification"
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,field_description:edi_notification_oca.field_edi_exchange_type__notify_on_process_error_groups_ids
msgid "Notify Groups On Process Error"
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,field_description:edi_notification_oca.field_edi_exchange_type__notify_on_process_error
msgid "Notify On Process Error"
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,field_description:edi_notification_oca.field_edi_exchange_type__notify_on_process_error_users_ids
msgid "Notify Users On Process Error"
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,field_description:edi_notification_oca.field_edi_exchange_record__activity_user_id
msgid "Responsible User"
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,help:edi_notification_oca.field_edi_exchange_type__notify_on_process_error_users_ids
msgid ""
"Select users to send notifications to. If 'Notification Groups' have been "
"selected, notifications will also be sent to users selected in here."
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,help:edi_notification_oca.field_edi_exchange_record__activity_state
msgid ""
"Status based on activities\n"
"Overdue: Due date is already passed\n"
"Today: Activity date is today\n"
"Planned: Future activities."
msgstr ""

#. module: edi_notification_oca
#: model:ir.model.fields,help:edi_notification_oca.field_edi_exchange_record__activity_exception_decoration
msgid "Type of the exception activity on record."
msgstr ""
Loading
Loading