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
141 changes: 141 additions & 0 deletions mail_message_destiny_link_template/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==================================
Mail Message Destiny Link Template
==================================

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

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-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%2Fserver--ux-lightgray.png?logo=github
:target: https://github.com/OCA/server-ux/tree/19.0/mail_message_destiny_link_template
:alt: OCA/server-ux
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-ux-19-0/server-ux-19-0-mail_message_destiny_link_template
: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/server-ux&target_branch=19.0
:alt: Try me on Runboat

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

This module provides an email template to show which target records have
been modified by a source record.

Example: When a purchase order generates an invoice, the invoice
contains a message indicating its origin with a link to the purchase
order. However, the purchase order does not log any message stating that
it has generated an invoice. This module allows developers to implement
that functionality by providing a ready-to-use template.

⚠️ This module does not add functionality by itself. It is part of the
server-ux repository and is intended for developers, who can implement
the provided template as needed. The module includes an example code
snippet to illustrate how to use it.

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

This module has been created to obtain a reverse template of
``message_origin_link`` (which allows you to link the origin record in
the chatter).

Usage
=====

To use this module, make sure that the template you are going to write
the message inherits from ``mail.thread``.

You can call the template like this:

.. code:: python

def custom_function(self):
"""Adds a chatter message to origin and destiny records"""
for record in self:
destiny_records = record._create_destiny_records() # A bunch of Destiny Records
mt_note_subtype_id = self.env['ir.model.data']._xmlid_to_res_id('mail.mt_note')

# Add note to chatter that indicates destiny records
record.message_post_with_view(
'mail_message_destiny_link_template.message_destiny_link',
values={'self': record, 'destiny': destiny_records, "edit": False or True},
subtype_id=mt_note_subtype_id,
)

# Origin Link common usage to show differences
for destiny_record in destiny_records:
destiny_record.message_post_with_view(
'mail.message_origin_link',
values={'self': destiny_record, 'origin': record, "edit": False or True},
subtype_id=mt_note_subtype_id,
)

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-ux/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/server-ux/issues/new?body=module:%20mail_message_destiny_link_template%0Aversion:%2019.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
-------

* Moduon

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

- Eduardo de Miguel (``Moduon <https://www.moduon.team/>``\ \_\_)

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.

.. |maintainer-Shide| image:: https://github.com/Shide.png?size=40px
:target: https://github.com/Shide
:alt: Shide
.. |maintainer-rafaelbn| image:: https://github.com/rafaelbn.png?size=40px
:target: https://github.com/rafaelbn
:alt: rafaelbn

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-Shide| |maintainer-rafaelbn|

This module is part of the `OCA/server-ux <https://github.com/OCA/server-ux/tree/19.0/mail_message_destiny_link_template>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Empty file.
17 changes: 17 additions & 0 deletions mail_message_destiny_link_template/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 Moduon Team S.L. <info@moduon.team>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
{
"name": "Mail Message Destiny Link Template",
"summary": "Mail template to show destiny records in chatter.",
"version": "19.0.1.0.0",
"author": "Moduon, Odoo Community Association (OCA)",
"license": "LGPL-3",
"category": "Tools",
"website": "https://github.com/OCA/server-ux",
"depends": ["mail"],
"data": [
"data/mail_templates_chatter.xml",
],
"maintainers": ["Shide", "rafaelbn"],
"installable": True,
}
21 changes: 21 additions & 0 deletions mail_message_destiny_link_template/data/mail_templates_chatter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2024 Moduon Team S.L. <info@moduon.team>
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). -->
<odoo>
<template id="message_destiny_link">
<p>
<t t-if="edit">This <t
t-esc="self.env['ir.model']._get(self._name).name.lower()"
/> has modified:</t>
<t t-else="">This <t
t-esc="self.env['ir.model']._get(self._name).name.lower()"
/> has created:</t>
<t t-foreach="destiny" t-as="o">
<a href="#" t-att-data-oe-model="o._name" t-att-data-oe-id="o.id">
<t t-esc="o.display_name" />
</a>
<span t-if="destiny.ids[-1:] != o.ids">, </span>
</t>
</p>
</template>
</odoo>
33 changes: 33 additions & 0 deletions mail_message_destiny_link_template/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_message_destiny_link_template
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-06-28 07:46+0000\n"
"PO-Revision-Date: 2024-06-28 09:46+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.4.4\n"

#. module: mail_message_destiny_link_template
#: model_terms:ir.ui.view,arch_db:mail_message_destiny_link_template.message_destiny_link
msgid "This"
msgstr "Este"

#. module: mail_message_destiny_link_template
#: model_terms:ir.ui.view,arch_db:mail_message_destiny_link_template.message_destiny_link
msgid "has created:"
msgstr "ha creado:"

#. module: mail_message_destiny_link_template
#: model_terms:ir.ui.view,arch_db:mail_message_destiny_link_template.message_destiny_link
msgid "has modified:"
msgstr "ha modificado:"
32 changes: 32 additions & 0 deletions mail_message_destiny_link_template/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_message_destiny_link_template
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-07-08 08:59+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.6.2\n"

#. module: mail_message_destiny_link_template
#: model_terms:ir.ui.view,arch_db:mail_message_destiny_link_template.message_destiny_link
msgid "This"
msgstr "Questo"

#. module: mail_message_destiny_link_template
#: model_terms:ir.ui.view,arch_db:mail_message_destiny_link_template.message_destiny_link
msgid "has created:"
msgstr "ha creato:"

#. module: mail_message_destiny_link_template
#: model_terms:ir.ui.view,arch_db:mail_message_destiny_link_template.message_destiny_link
msgid "has modified:"
msgstr "ha modificato:"
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_message_destiny_link_template
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.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: mail_message_destiny_link_template
#: model_terms:ir.ui.view,arch_db:mail_message_destiny_link_template.message_destiny_link
msgid "This"
msgstr ""

#. module: mail_message_destiny_link_template
#: model_terms:ir.ui.view,arch_db:mail_message_destiny_link_template.message_destiny_link
msgid "has created:"
msgstr ""

#. module: mail_message_destiny_link_template
#: model_terms:ir.ui.view,arch_db:mail_message_destiny_link_template.message_destiny_link
msgid "has modified:"
msgstr ""
3 changes: 3 additions & 0 deletions mail_message_destiny_link_template/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions mail_message_destiny_link_template/readme/CONTEXT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module has been created to obtain a reverse template of `message_origin_link`
(which allows you to link the origin record in the chatter).
1 change: 1 addition & 0 deletions mail_message_destiny_link_template/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Eduardo de Miguel (`Moduon <https://www.moduon.team/>`__)
5 changes: 5 additions & 0 deletions mail_message_destiny_link_template/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This module provides an email template to show which target records have been modified by a source record.

Example: When a purchase order generates an invoice, the invoice contains a message indicating its origin with a link to the purchase order. However, the purchase order does not log any message stating that it has generated an invoice. This module allows developers to implement that functionality by providing a ready-to-use template.

⚠️ This module does not add functionality by itself. It is part of the server-ux repository and is intended for developers, who can implement the provided template as needed. The module includes an example code snippet to illustrate how to use it.
26 changes: 26 additions & 0 deletions mail_message_destiny_link_template/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
To use this module, make sure that the template you are going to write the message inherits from `mail.thread`.

You can call the template like this:

```python
def custom_function(self):
"""Adds a chatter message to origin and destiny records"""
for record in self:
destiny_records = record._create_destiny_records() # A bunch of Destiny Records
mt_note_subtype_id = self.env['ir.model.data']._xmlid_to_res_id('mail.mt_note')

# Add note to chatter that indicates destiny records
record.message_post_with_view(
'mail_message_destiny_link_template.message_destiny_link',
values={'self': record, 'destiny': destiny_records, "edit": False or True},
subtype_id=mt_note_subtype_id,
)

# Origin Link common usage to show differences
for destiny_record in destiny_records:
destiny_record.message_post_with_view(
'mail.message_origin_link',
values={'self': destiny_record, 'origin': record, "edit": False or True},
subtype_id=mt_note_subtype_id,
)
```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading