-
-
Notifications
You must be signed in to change notification settings - Fork 618
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 pedrobaeza
- Loading branch information
Showing
7 changed files
with
198 additions
and
11 deletions.
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
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from . import mail_guest_manage | ||
from . import mail_message_gateway_send | ||
from . import mail_message_gateway_link | ||
from . import mail_compose_gateway_message |
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,75 @@ | ||
# Copyright 2024 Dixmit | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class MailComposeGatewayMessage(models.TransientModel): | ||
_name = "mail.compose.gateway.message" | ||
_inherit = "mail.compose.message" | ||
_description = "Mail Compose Gateway Message" | ||
|
||
wizard_partner_ids = fields.Many2many( | ||
"res.partner", | ||
"mail_compose_gateway_message_res_partner_rel", | ||
"wizard_id", | ||
"partner_id", | ||
) | ||
wizard_channel_ids = fields.Many2many( | ||
"res.partner.gateway.channel", | ||
"mail_compose_gateway_message_gateway_channel_rel", | ||
"wizard_id", | ||
"channel_id", | ||
) | ||
attachment_ids = fields.Many2many( | ||
"ir.attachment", | ||
"mail_compose_gateway_message_ir_attachments_rel", | ||
"wizard_id", | ||
"attachment_id", | ||
"Attachments", | ||
) | ||
partner_ids = fields.Many2many( | ||
"res.partner", | ||
"mail_compose_gateway_message_res_partner_rel", | ||
"wizard_id", | ||
"partner_id", | ||
"Additional Contacts", | ||
domain=lambda r: r._partner_ids_domain(), | ||
) | ||
# Dummy compatibility with other OCA modules | ||
# OCA/mail_attach_existing_attachment | ||
object_attachment_ids = fields.Many2many( | ||
comodel_name="ir.attachment", | ||
relation="mail_compose_gateway_message_ir_attachments_object_rel", | ||
column1="wizard_id", | ||
column2="attachment_id", | ||
string="Object Attachments", | ||
) | ||
# OCA/mail_composer_cc_bcc | ||
partner_cc_ids = fields.Many2many( | ||
comodel_name="res.partner", | ||
relation="mail_compose_gateway_message_res_partner_cc_rel", | ||
column1="wizard_id", | ||
column2="partner_id", | ||
string="Cc", | ||
) | ||
partner_bcc_ids = fields.Many2many( | ||
comodel_name="res.partner", | ||
relation="mail_compose_gateway_message_res_partner_bcc_rel", | ||
column1="wizard_id", | ||
column2="partner_id", | ||
string="Bcc", | ||
) | ||
|
||
def get_mail_values(self, res_ids): | ||
self.ensure_one() | ||
res = super(MailComposeGatewayMessage, self).get_mail_values(res_ids) | ||
res[res_ids[0]]["gateway_notifications"] = [ | ||
{ | ||
"partner_id": channel.partner_id.id, | ||
"channel_type": "gateway", | ||
"gateway_channel_id": channel.id, | ||
} | ||
for channel in self.wizard_channel_ids | ||
] | ||
return res |
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,43 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- Copyright 2024 Dixmit | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> | ||
<odoo> | ||
|
||
<record model="ir.ui.view" id="mail_compose_gateway_message_form_view"> | ||
<field name="model">mail.compose.gateway.message</field> | ||
<field name="inherit_id" ref="mail.email_compose_message_wizard_form" /> | ||
<field name="mode">primary</field> | ||
<field name="arch" type="xml"> | ||
<label for="partner_ids" position="attributes"> | ||
<attribute name="invisible">1</attribute> | ||
</label> | ||
<field name="partner_ids" position="attributes"> | ||
<attribute name="invisible">1</attribute> | ||
</field> | ||
<field name="subject" position="before"> | ||
<field name="wizard_partner_ids" invisible="1" /> | ||
<field | ||
name="wizard_channel_ids" | ||
string="Gateways" | ||
widget="many2many_tags" | ||
context="{'mail_gateway_partner_info': 1}" | ||
domain="[('partner_id', 'in', wizard_partner_ids)]" | ||
/> | ||
</field> | ||
<field name="subject" position="attributes"> | ||
<attribute name="invisible">1</attribute> | ||
<attribute name="required">0</attribute> | ||
</field> | ||
<xpath | ||
expr="//span[@name='document_followers_text']/.." | ||
position="attributes" | ||
> | ||
<attribute name="invisible">1</attribute> | ||
<attribute name="attrs" /> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
|
||
|
||
</odoo> |