Skip to content

Commit

Permalink
Merge PR #1197 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Aug 10, 2023
2 parents 8eba436 + 0267290 commit 164298a
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 467 deletions.
4 changes: 4 additions & 0 deletions mail_tracking/models/ir_mail_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ def send_email(
smtp_user=None,
smtp_password=None,
smtp_encryption=None,
smtp_ssl_certificate=None,
smtp_ssl_private_key=None,
smtp_debug=False,
smtp_session=None,
):
Expand All @@ -149,6 +151,8 @@ def send_email(
smtp_user=smtp_user,
smtp_password=smtp_password,
smtp_encryption=smtp_encryption,
smtp_ssl_certificate=smtp_ssl_certificate,
smtp_ssl_private_key=smtp_ssl_private_key,
smtp_debug=smtp_debug,
smtp_session=smtp_session,
)
Expand Down
65 changes: 27 additions & 38 deletions mail_tracking/models/mail_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,46 +99,35 @@ def _fields_view_get(
res = super()._fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu
)
if view_type not in {"search", "form"}:
if view_type != "search":
return res
doc = etree.XML(res["arch"])
if view_type == "search":
# Modify view to add new filter element
nodes = doc.xpath("//search")
if nodes:
# Create filter element
new_filter = etree.Element(
"filter",
{
"string": _("Failed sent messages"),
"name": "failed_message_ids",
"domain": str(
# Modify view to add new filter element
nodes = doc.xpath("//search")
if nodes:
# Create filter element
new_filter = etree.Element(
"filter",
{
"string": _("Failed sent messages"),
"name": "failed_message_ids",
"domain": str(
[
[
[
"failed_message_ids.mail_tracking_ids.state",
"in",
list(self.env["mail.message"].get_failed_states()),
],
[
"failed_message_ids.mail_tracking_needs_action",
"=",
True,
],
]
),
},
)
nodes[0].append(etree.Element("separator"))
nodes[0].append(new_filter)
elif view_type == "form":
# Modify view to add new field element
nodes = doc.xpath("//field[@name='message_ids' and @widget='mail_thread']")
if nodes:
# Create field
field_failed_messages = etree.Element(
"field",
{"name": "failed_message_ids", "widget": "mail_failed_message"},
)
nodes[0].addprevious(field_failed_messages)
"failed_message_ids.mail_tracking_ids.state",
"in",
list(self.env["mail.message"].get_failed_states()),
],
[
"failed_message_ids.mail_tracking_needs_action",
"=",
True,
],
]
),
},
)
nodes[0].append(etree.Element("separator"))
nodes[0].append(new_filter)
res["arch"] = etree.tostring(doc, encoding="unicode")
return res
5 changes: 4 additions & 1 deletion mail_tracking/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
* Add pivot for tracking events and mail trackings
* Integrate with the core `mail.notification` model. A soft way would be to write a
notification event along with the mail.tracking.event ones. Another way could be
to merge both models and build the module features on top of it. This might imply
a refactor though.
16 changes: 10 additions & 6 deletions mail_tracking/static/src/js/chatter.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {attr} from "@mail/model/model_field";

registerInstancePatchModel(
"mail.chatter",
"mail/static/src/models/chatter/chatter.js",
"mail/static/src/models/chatter/chatter.esm.js",
{
async refresh() {
this._super(...arguments);
Expand All @@ -24,8 +24,12 @@ registerInstancePatchModel(
},
}
);
registerFieldPatchModel("mail.chatter", "mail/static/src/models/chatter/chatter.js", {
isMessageFailedBoxVisible: attr({
default: true,
}),
});
registerFieldPatchModel(
"mail.chatter",
"mail/static/src/models/chatter/chatter.esm.js",
{
isMessageFailedBoxVisible: attr({
default: true,
}),
}
);
Loading

0 comments on commit 164298a

Please sign in to comment.