Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
Expand All @@ -36,6 +35,7 @@ coverage.xml

# Translations
*.mo
*.pot

# Pycharm
.idea
Expand Down
119 changes: 119 additions & 0 deletions cms_notification/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
.. image:: https://img.shields.io/badge/licence-lgpl--3-blue.svg
:target: http://www.gnu.org/licenses/LGPL-3.0-standalone.html
:alt: License: LGPL-3

CMS notification
=================

Features
--------

Manage notifications in your CMS. Provides:

* menu item for settings
* menu item for notifications listing
* flag `has_unread_notif` on user to highlight when the user has an unread notification
* flag `cms_type` on message subtype to enable/disable visibility in CMS


Depends on `mail_digest [WIP PR] <https://github.com/camptocamp/social/tree/add-mail_digest/mail_digest>`_
and `cms_form [WIP PR] <https://github.com/simahawk/website-cms/tree/add-cms_form-PR/cms_form>`_.


Default appearance
------------------

.. image:: ./images/cms_notif_menu.png
.. image:: ./images/cms_notif_settings.png
.. image:: ./images/cms_notif_listing.png


Customization
-------------

You can customize the form as specified in ``cms_form`` docs.
``cms_notification`` extends the form behavior allowing you to just
provide the fields you need and a mapping between fields and messages'
subtypes.

.. code:: python

class CMSNotificationPanel(models.AbstractModel):
_inherit = 'cms.notification.panel.form'

enable_my_type = fields.Boolean(
string='Enable my type notifications',
help=("If active, you will receive notifications "
"about this type.")
)
enable_my_type2 = fields.Boolean(
string='Enable my type 2 notifications',
help=("If active, you will receive notifications "
"about this type 2.")
)

@property
def _form_subtype_fields(self):
res = super(CMSNotificationPanel, self)._form_subtype_fields
res.update({
'enable_my_type': 'module.mt_mytype',
'enable_my_type2': 'module.mt_mytype2',
})
return res


Usage
-----


To bring the user to her/his panel:

.. code:: html

<a class="btn btn-default" href="/my/settings/notifications">Notifications</a>


To bring the user to her/his notifications:

.. code:: html

<a class="btn btn-default" href="/my/notifications">Notification settings</a>


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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/website-cms/issues>`_. In
case of trouble, please check there if your issue has already been
reported. If you spotted it first, help us smashing it by providing a
detailed and welcomed feedback.

Credits
=======

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

- Simone Orsi simone.orsi@camptocamp.com

Funders
-------

The development of this module has been financially supported by: `Fluxdock.io <https://fluxdock.io>`_.


Maintainer
----------


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

This module is maintained by the OCA.

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.

To contribute to this module, please visit https://odoo-community.org.
2 changes: 2 additions & 0 deletions cms_notification/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
26 changes: 26 additions & 0 deletions cms_notification/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Simone Orsi
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
'name': 'CMS notification',
'summary': """Basic notifications management for your CMS system""",
'version': '9.0.1.0.0',
'license': 'LGPL-3',
'author': 'Camptocamp,Odoo Community Association (OCA)',
'depends': [
'cms_form',
'mail_digest',
# We need latest fontawesome resources.
# Use server-tools/9.0/base_fontawesome
'base_fontawesome',
],
'data': [
'views/mail_message_subtype_views.xml',
'templates/assets.xml',
'templates/help_msg.xml',
'templates/widget.xml',
'templates/user_menu.xml',
'templates/notification_listing.xml',
],
}
1 change: 1 addition & 0 deletions cms_notification/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
41 changes: 41 additions & 0 deletions cms_notification/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Simone Orsi
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from openerp import http
from openerp.addons.cms_form.controllers.main \
import FormControllerMixin, SearchFormControllerMixin


class PanelFormController(http.Controller, FormControllerMixin):
"""Notification panel form controller."""

@http.route([
'/my/settings/notifications',
], type='http', auth='user', website=True)
def cms_form(self, **kw):
model = 'res.partner'
# get current user partner
model_id = http.request.env.user.partner_id.id
return self.make_response(
model, model_id=model_id, **kw)

def form_model_key(self, model):
return 'cms.notification.panel.form'


class MyNotificationsController(http.Controller, SearchFormControllerMixin):
"""Personal notifications controller."""

@http.route([
'/my/notifications',
], type='http', auth='user', website=True)
def cms_form(self, **kw):
model = 'res.partner'
# get current user partner
model_id = http.request.env.user.partner_id.id
return self.make_response(
model, model_id=model_id, **kw)

def form_model_key(self, model):
return 'cms.notification.listing'
138 changes: 138 additions & 0 deletions cms_notification/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * cms_notification
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-16 06:34+0000\n"
"PO-Revision-Date: 2017-05-16 06:34+0000\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: cms_notification
#: model:ir.model,name:cms_notification.model_cms_notification_listing
msgid "CMS notification"
msgstr "CMS notification"

#. module: cms_notification
#: model:ir.model,name:cms_notification.model_cms_notification_panel_form
msgid "CMS notification control panel"
msgstr "CMS notification control panel"

#. module: cms_notification
#: code:addons/cms_notification/models/notification_panel_form.py:34
#: code:addons/odoo/external-src/website-cms/cms_notification/models/notification_panel_form.py:34
#, python-format
msgid "Changes applied."
msgstr "Änderungen wurden übernommen."

#. module: cms_notification
#: model:ir.model.fields,field_description:cms_notification.field_partner_notification_conf_create_uid
msgid "Created by"
msgstr "Angelegt von"

#. module: cms_notification
#: model:ir.model.fields,field_description:cms_notification.field_partner_notification_conf_create_date
msgid "Created on"
msgstr "Angelegt am"

#. module: cms_notification
#: model:ir.model.fields,field_description:cms_notification.field_cms_notification_listing_display_name
#: model:ir.model.fields,field_description:cms_notification.field_cms_notification_panel_form_display_name
#: model:ir.model.fields,field_description:cms_notification.field_partner_notification_conf_display_name
msgid "Display Name"
msgstr "Anzeigename"

#. module: cms_notification
#: model:ir.model.fields,field_description:cms_notification.field_partner_notification_conf_enabled
msgid "Enabled"
msgstr "Aktivieren"

#. module: cms_notification
#: model:ir.ui.view,arch_db:cms_notification.notify_email_help_none
msgid "I don't want to get notification emails."
msgstr "Ich möchte keine Benachrichtigungen erhalten."

#. module: cms_notification
#: model:ir.model.fields,field_description:cms_notification.field_cms_notification_listing_id
#: model:ir.model.fields,field_description:cms_notification.field_cms_notification_panel_form_id
#: model:ir.model.fields,field_description:cms_notification.field_partner_notification_conf_id
msgid "ID"
msgstr "ID"

#. module: cms_notification
#: model:ir.model.fields,help:cms_notification.field_mail_message_subtype_cms_type
msgid "If active, this message subtype will be visible in users' notifications control panel."
msgstr "If active, this message subtype will be visible in users' notifications control panel."

#. module: cms_notification
#: model:ir.model.fields,field_description:cms_notification.field_cms_notification_listing___last_update
#: model:ir.model.fields,field_description:cms_notification.field_cms_notification_panel_form___last_update
#: model:ir.model.fields,field_description:cms_notification.field_partner_notification_conf___last_update
msgid "Last Modified on"
msgstr "Zuletzt geändert am"

#. module: cms_notification
#: model:ir.model.fields,field_description:cms_notification.field_partner_notification_conf_write_uid
msgid "Last Updated by"
msgstr "Zuletzt aktualisiert durch"

#. module: cms_notification
#: model:ir.model.fields,field_description:cms_notification.field_partner_notification_conf_write_date
msgid "Last Updated on"
msgstr "Zuletzt aktualisiert am"

#. module: cms_notification
#: model:ir.model,name:cms_notification.model_mail_message_subtype
msgid "Message subtypes"
msgstr "Nachrichten-Subtyp"

#. module: cms_notification
#: code:addons/cms_notification/models/notification_listing.py:24
#: code:addons/odoo/external-src/website-cms/cms_notification/models/notification_listing.py:24
#, python-format
msgid "My notifications"
msgstr "Meine Benachrichtigungen"

#. module: cms_notification
#: code:addons/cms_notification/models/notification_panel_form.py:26
#: code:addons/odoo/external-src/website-cms/cms_notification/models/notification_panel_form.py:26
#, python-format
msgid "Notification settings."
msgstr "Benachrichtigungseinstellungen."

#. module: cms_notification
#: model:ir.model.fields,field_description:cms_notification.field_partner_notification_conf_subtype_id
msgid "Notification type"
msgstr "Notification type"

#. module: cms_notification
#: model:ir.model.fields,field_description:cms_notification.field_partner_notification_conf_partner_id
msgid "Partner"
msgstr "Partner"

#. module: cms_notification
#: model:ir.model,name:cms_notification.model_partner_notification_conf
msgid "Partner notification configuration"
msgstr "Partner notification configuration"

#. module: cms_notification
#: model:ir.model.fields,field_description:cms_notification.field_mail_message_subtype_cms_type
msgid "Visible in CMS control panel"
msgstr "Visible in CMS control panel"

#. module: cms_notification
#: model:ir.ui.view,arch_db:cms_notification.notify_email_help_digest
msgid "You will receive a summary of the notification in the chosen frequency."
msgstr "Sie erhalten eine Übersicht der Benachrichtigungen entsprechend der gewählten Häufigkeit."

#. module: cms_notification
#: model:ir.ui.view,arch_db:cms_notification.notify_email_help_always
msgid "You will receive an email for every notification."
msgstr "Sie erhalten eine Email für jede Benachrichtigung."
Binary file added cms_notification/images/cms_notif_listing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cms_notification/images/cms_notif_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cms_notification/images/cms_notif_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions cms_notification/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from . import mail_message
from . import mail_message_subtype
from . import notification_panel_form
from . import notification_listing
from . import res_users
from . import test_models
from . import widget
Loading