-
Notifications
You must be signed in to change notification settings - Fork 148
multi_livechat: change mail.channel.partner to mail.channel.member #461
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
base: 16.0
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,11 @@ | ||
| # Copyright 2021 Ivan Yelizariev <https://twitter.com/yelizariev> | ||
| # License MIT (https://opensource.org/licenses/MIT). | ||
| from odoo import api, fields, models | ||
| from odoo import api, fields, models, _ | ||
| from odoo.exceptions import UserError, ValidationError | ||
|
|
||
| import logging | ||
|
|
||
| _logger = logging.getLogger(__name__) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New imports are not used...
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed not used imports |
||
|
|
||
| ODOO_CHANNEL_TYPES = ["chat", "channel", "livechat", "group"] | ||
|
|
||
|
|
@@ -21,16 +26,17 @@ def _prepare_multi_livechat_channel_vals( | |
| ): | ||
| return { | ||
| "channel_partner_ids": [(4, pid) for pid in partner_ids], | ||
| "public": "groups", | ||
| "group_public_id": self.env.ref("base.group_user").id, | ||
| # "public": "groups", # V16 dropout public field | ||
| "group_public_id": False, # V16 checks contrains with group_public_id self.env.ref("base.group_user").id, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Field Field
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remove Field group_public_id, and it's working after I tested it. |
||
| "channel_type": channel_type, | ||
| "name": channel_name, | ||
| } | ||
|
|
||
| def _compute_is_pinned(self): | ||
| # TODO: make batch search via read_group | ||
| for r in self: | ||
| r.is_pinned = self.env["mail.channel.partner"].search_count( | ||
| # V16 change mail.channel.partner to mail.channel.member | ||
| r.is_pinned = self.env["mail.channel.member"].search_count( | ||
|
yelizariev marked this conversation as resolved.
|
||
| [ | ||
| ("partner_id", "=", self.env.user.partner_id.id), | ||
| ("channel_id", "=", r.id), | ||
|
|
@@ -41,7 +47,8 @@ def _compute_is_pinned(self): | |
| def _inverse_is_pinned(self): | ||
| # TODO: make batch search via read_group | ||
| for r in self: | ||
| channel_partner = self.env["mail.channel.partner"].search( | ||
| # V16 change mail.channel.partner to mail.channel.member | ||
| channel_partner = self.env["mail.channel.member"].search( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
| [ | ||
| ("partner_id", "=", self.env.user.partner_id.id), | ||
| ("channel_id", "=", r.id), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.