-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by sebastienbeau
- Loading branch information
Showing
9 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Faire la preview de mail avec envoie par mail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import wizards |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2023 Akretion (https://www.akretion.com). | ||
# @author Sébastien BEAU <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Mail Preview send", | ||
"summary": "Send preview email", | ||
"version": "14.0.1.0.0", | ||
"development_status": "Alpha", | ||
"category": "Uncategorized", | ||
"website": "https://github.com/akretion/ak-odoo-incubator", | ||
"author": " Akretion", | ||
"license": "AGPL-3", | ||
"external_dependencies": { | ||
"python": [], | ||
"bin": [], | ||
}, | ||
"depends": [ | ||
"mail", | ||
"web_domain_field", | ||
"mail_unique_layout", | ||
], | ||
"data": [ | ||
"wizards/mail_template_preview_view.xml", | ||
], | ||
"demo": [], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import mail_template_preview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2023 Akretion (https://www.akretion.com). | ||
# @author Sébastien BEAU <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
import json | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class MailTemplatePreview(models.TransientModel): | ||
_inherit = "mail.template.preview" | ||
|
||
layout_id = fields.Many2one( | ||
"ir.ui.view", | ||
"Layout", | ||
) | ||
layout_domain = fields.Char(compute="_compute_layout_domain") | ||
|
||
def send(self): | ||
xml_id = self.layout_id.get_external_id()[self.layout_id.id] | ||
self.mail_template_id.with_context(force_mail_uniq_layout_id=xml_id).send_mail( | ||
self.model_id.id | ||
) | ||
|
||
def _get_layout_domain(self): | ||
return [] | ||
|
||
@api.depends("mail_template_id") | ||
def _compute_layout_domain(self): | ||
for record in self: | ||
record.layout_domain = json.dumps(self._get_layout_domain()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<odoo> | ||
|
||
|
||
<record id="mail_template_preview_view_form" model="ir.ui.view"> | ||
<field name="model">mail.template.preview</field> | ||
<field name="inherit_id" ref="mail.mail_template_preview_view_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='lang']/../.." position="after"> | ||
<div class="row"> | ||
<span | ||
class="col-md-5 col-lg-4 col-sm-12 pl-0" | ||
>Choisir un layout: </span> | ||
<div class="col-md-7 col-lg-6 col-sm-12 pl-0"> | ||
<field name="layout_domain" invisible="1" /> | ||
<field name="layout_id" domain="layout_domain" /> | ||
</div> | ||
</div> | ||
</xpath> | ||
<button special="cancel" position="before"> | ||
<button name="send" type="object" string="Send" class="btn btn-primary" /> | ||
</button> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../mail_preview_send |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |