Skip to content
Draft
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
86 changes: 86 additions & 0 deletions membership_expiry_mail/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
======================
Membership Expiry Mail
======================

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

.. |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/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fvertical--association-lightgray.png?logo=github
:target: https://github.com/OCA/vertical-association/tree/16.0/membership_expiry_mail
:alt: OCA/vertical-association
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/vertical-association-16-0/vertical-association-16-0-membership_expiry_mail
: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/vertical-association&target_branch=16.0
:alt: Try me on Runboat

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

Add a scheduled action to send a mail to mnth..

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/vertical-association/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/vertical-association/issues/new?body=module:%20membership_expiry_mail%0Aversion:%2016.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
~~~~~~~

* Coop IT Easy SC

Contributors
~~~~~~~~~~~~

* `Coop IT Easy SC <https://coopiteasy.be>`_:

* Simon Hick

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-mihien| image:: https://github.com/mihien.png?size=40px
:target: https://github.com/mihien
:alt: mihien

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

|maintainer-mihien|

This module is part of the `OCA/vertical-association <https://github.com/OCA/vertical-association/tree/16.0/membership_expiry_mail>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions membership_expiry_mail/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2026 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from . import models
24 changes: 24 additions & 0 deletions membership_expiry_mail/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: 2026 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

{
"name": "Membership Expiry Mail",
"summary": "Send a mail to members whose membership will expire in a month.",
"version": "16.0.1.0.0",
"category": "Association",
"website": "https://github.com/OCA/vertical-association",
"author": "Coop IT Easy SC, Odoo Community Association (OCA)",
"maintainers": ["mihien"],
"license": "AGPL-3",
"depends": [
"mail",
"membership",
],
# Please remove empty values below.
"data": [
"data/ir_cron.xml",
"data/membership_expiry_mail.xml",
],
"demo": [],
}
20 changes: 20 additions & 0 deletions membership_expiry_mail/data/ir_cron.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">

<record forcecreate="True" id="ir_cron_membership_expiry_reminder" model="ir.cron">
<field name="name">Membership: Send Expiry Reminders (1 Month)</field>
<field name="active" eval="True" />
<field name="model_id" ref="base.model_res_partner" />
<field name="state">code</field>
<field name="code">model._cron_membership_expiry_mail()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="priority">10</field>
<field
name="nextcall"
eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d 06:00:00')"
/>
</record>

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

<record id="mail_template_membership_expiry" model="mail.template">
<field name="name">Membership Expiry Reminder</field>
<field name="model_id" ref="base.model_res_partner" />
<field name="subject">Your membership expires in one month</field>
<field name="email_from">{{ (object.company_id.email or user.email) }}</field>
<field name="email_to">{{ object.email }}</field>
<field name="lang">{{ object.lang }}</field>
<field name="auto_delete" eval="True" />
<field name="body_html" type="html">
<div style="margin: 0px; padding: 0px;">
<p style="margin: 0px; padding: 0px; font-size: 13px;">
Dear <t t-out="object.name or ''" />
<t t-if="object.parent_id">
(<t t-out="object.parent_id.name or ''" />)
</t>
<br /><br />
Your membership will expire in one month, the
<span style="font-weight:bold;" t-out="object.membership_stop or ''" />.
<br /><br />
<t t-out="object.company_id.website" />
<br /><br />
</p>
</div></field>
</record>

</odoo>
5 changes: 5 additions & 0 deletions membership_expiry_mail/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2026 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from . import res_partner
26 changes: 26 additions & 0 deletions membership_expiry_mail/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-FileCopyrightText: 2026 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from datetime import date, timedelta

from odoo import api, models


class Partner(models.Model):
_inherit = "res.partner"

@api.model
def _cron_membership_expiry_mail(self):
expiry_date = date.today() + timedelta(days=30)
expiring_members = self.search(
[
("membership_stop", "=", expiry_date),
("membership_state", "=", "paid"),
]
)
for member in expiring_members:
template = self.env.ref(
"membership_expiry_mail.mail_template_membership_expiry"
)
template.send_mail(member.id)
3 changes: 3 additions & 0 deletions membership_expiry_mail/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Coop IT Easy SC <https://coopiteasy.be>`_:

* Simon Hick
1 change: 1 addition & 0 deletions membership_expiry_mail/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a scheduled action to send a mail to mnth..
Loading