Skip to content

Commit

Permalink
[ADD] foodhub_munich_custom
Browse files Browse the repository at this point in the history
  • Loading branch information
vvrossem committed Jun 29, 2021
1 parent f1bb87c commit 6914969
Show file tree
Hide file tree
Showing 11 changed files with 831 additions and 0 deletions.
57 changes: 57 additions & 0 deletions foodhub_munich_custom/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
=====================
Foodhub Munich Custom
=====================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-coopiteasy%2Fcie--custom-lightgray.png?logo=github
:target: https://github.com/coopiteasy/cie-custom/tree/12.0/foodhub_munich_custom
:alt: coopiteasy/cie-custom

|badge1| |badge2| |badge3|

Foodhub Munich customizations

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/coopiteasy/cie-custom/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 <https://github.com/coopiteasy/cie-custom/issues/new?body=module:%20foodhub_munich_custom%0Aversion:%2012.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 SCRL fs

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

* Vincent Van Rossem <[email protected]>

Maintainers
~~~~~~~~~~~

This module is part of the `coopiteasy/cie-custom <https://github.com/coopiteasy/cie-custom/tree/12.0/foodhub_munich_custom>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions foodhub_munich_custom/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions foodhub_munich_custom/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2021 Coop IT Easy SCRLfs
# Vincent Van Rossem <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Foodhub Munich Custom",
"version": "12.0.1.0.0",
"summary": """
Foodhub Munich customizations""",
"author": "Coop IT Easy SCRL fs",
"website": "https://coopiteasy.be",
"license": "AGPL-3",
"category": "Cooperative management",
"depends": ["easy_my_coop"],
"data": [
"report/easy_my_coop_report.xml",
"report/cooperator_membership_declaration.xml",
"data/mail_template_data.xml", # must be loaded after reports
],
}
66 changes: 66 additions & 0 deletions foodhub_munich_custom/data/mail_template_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<!--Membership Declaration Email template -->
<record id="email_template_membership_declaration" model="mail.template">
<field name="name">Declaration of Membership - Send by Email
</field>
<field name="email_from">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="subject">${object.company_id.name} Declaration of Membership
</field>
<field name="partner_to">${object.partner_id.id}</field>
<field name="reply_to">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="model_id" ref="easy_my_coop.model_subscription_request"/>
<field name="auto_delete" eval="True"/>
<field name="report_template" ref="action_cooperator_membership_declaration_report"/>
<field name="report_name">
${(object.name or '').replace('/','_')}_${object.state == 'draft' and 'draft' or ''}
</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.partner_id.name},</p>
<p>You will find in attachment the Membership Declaration.</p>
<p>Sustainably your,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''}
${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>

</data>
</odoo>
1 change: 1 addition & 0 deletions foodhub_munich_custom/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import subscription_request
21 changes: 21 additions & 0 deletions foodhub_munich_custom/models/subscription_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from odoo import models


class SubscriptionRequest(models.Model):
_inherit = "subscription.request"

def create_invoice(self, partner):
invoice = super().create_invoice(partner)
self.send_membership_declaration()
return invoice

def send_membership_declaration(self):
if self.company_id.send_capital_release_email:
mail_template = self.get_membership_declaration_mail_template()
mail_template.sudo().send_mail(self.id, True)

def get_membership_declaration_mail_template(self):
template = (
"foodhub_munich_custom.email_template_membership_declaration"
)
return self.env.ref(template, False)
1 change: 1 addition & 0 deletions foodhub_munich_custom/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Vincent Van Rossem <[email protected]>
1 change: 1 addition & 0 deletions foodhub_munich_custom/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Foodhub Munich customizations
Loading

0 comments on commit 6914969

Please sign in to comment.