Skip to content

Commit

Permalink
TA#72138 [16.0][MIG] partner_key_date (#161)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Lanto R. <[email protected]>
  • Loading branch information
rivo2302 and lanto-razafindrabe authored Jan 29, 2025
1 parent 2750477 commit 184f233
Show file tree
Hide file tree
Showing 24 changed files with 891 additions and 0 deletions.
1 change: 1 addition & 0 deletions .docker_files/main/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"partner_autocomplete_disable",
"partner_edit_group",
"partner_firstname_before_lastname",
"partner_key_date",
],
"installable": True,
}
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ COPY contacts_config_menu_moved_right /mnt/extra-addons/contacts_config_menu_mov
COPY partner_autocomplete_disable /mnt/extra-addons/partner_autocomplete_disable
COPY partner_edit_group /mnt/extra-addons/partner_edit_group
COPY partner_firstname_before_lastname /mnt/extra-addons/partner_firstname_before_lastname
COPY partner_key_date /mnt/extra-addons/partner_key_date

COPY .docker_files/main /mnt/extra-addons/main
COPY .docker_files/odoo.conf /etc/odoo
42 changes: 42 additions & 0 deletions partner_key_date/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Partner Key Dates
=================
This module adds key dates to partners.

A key date is an important event in the timeline of a contact.

Key dates require a type, and these types are configurable.
To configure key date types, go to `Contacts / Configuration / Key Date Types`.

.. image:: static/description/key_date_types_tree_view.png

.. image:: static/description/key_date_types_form_view.png

Key dates can be accessed from Contacts / Dates.

.. image:: static/description/key_date.png

Age Calculation
---------------
The module includes a cron job to calculate and update the age associated with key dates.
This cron ensures that the age field is kept up-to-date.

.. image:: static/description/cron_compute_age.png

Anniversary Emails
------------------
The module also adds functionality to send emails on the anniversary of key dates.

In the list view of key dates, the column `Diffusion` allows you to specify which dates should trigger an email on their anniversary.

A scheduled action (cron) is responsible for sending these emails to the relevant contacts.

.. image:: static/description/cron_send_mail.png

Contributors
------------
* Numigi (tm) and all its contributors (https://bit.ly/numigiens)
* Savoir-faire Linux

More Information
-----------------
* Meet us at https://bit.ly/numigi-com
5 changes: 5 additions & 0 deletions partner_key_date/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2017 Savoir-faire Linux
# Copyright 2022-today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import models
26 changes: 26 additions & 0 deletions partner_key_date/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2017 Savoir-faire Linux
# Copyright 2022-today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
"name": "Partner Key Dates",
"version": "16.0.1.0.0",
"author": "Savoir-faire Linux",
"maintainer": "Numigi",
"website": "https://bit.ly/numigi-com",
"license": "LGPL-3",
"category": "Partner Management",
"depends": ["contacts"],
"data": [
"security/ir.model.access.csv",
"data/ir_cron_data.xml",
"data/mail_template_data.xml",
"views/res_partner_views.xml",
"views/res_partner_date_views.xml",
"views/res_partner_date_type_views.xml",
],
"installable": True,
"external_dependencies": {
"python": ["freezegun"],
},
}
28 changes: 28 additions & 0 deletions partner_key_date/data/ir_cron_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">

<record id="ir_cron_compute_age" model="ir.cron">
<field name="name">Compute Key Date Ages</field>
<field name="user_id" ref="base.user_root" />
<field name="model_id" ref="model_res_partner_date" />
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
<field name="code">model.update_age_for_all_dates()</field>
</record>

<record id="ir_cron_send_anniversary_email" model="ir.cron">
<field name="name">Send Key Date Anniversary Emails</field>
<field name="user_id" ref="base.user_root" />
<field name="model_id" ref="model_res_partner_date" />
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
<field name="code">model.send_anniversary_emails()</field>
</record>

</data>
</odoo>
25 changes: 25 additions & 0 deletions partner_key_date/data/mail_template_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data noupdate="1">

<record id="anniversary_email_template" model="mail.template">
<field name="name">Send Partner Anniversary Email</field>
<field name="model_id" ref="model_res_partner_date" />
<field name="auto_delete" eval="False" />
<field name="subject">Best Wishes</field>
<field name="body_html" type="html">
<div>
<p>Hello
<t t-out="object.partner_id.name or ''">Marc Demo</t>
</p>

<p>Occasion : <t t-out="object.date_type_id.name or ''">Date type name</t></p>
<p>
Anniversary message...
</p>
</div>
</field>
</record>

</data>
</odoo>
Loading

0 comments on commit 184f233

Please sign in to comment.