-
-
Notifications
You must be signed in to change notification settings - Fork 615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[16.0][IMP] mail_gateway: Allow to use expand on Gateway messages #1489
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document why this method override.