Skip to content

Commit

Permalink
[MIG] mail_multicompany: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SodexisTeam committed Jan 25, 2024
1 parent 87bdcc8 commit c0ba703
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion mail_multicompany/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Email Gateway Multi company",
"version": "16.0.1.0.1",
"version": "17.0.1.0.1",
"category": "Extra Tools",
"author": "Odoo Community Association (OCA), " "Comunitea",
"maintainers": [
Expand Down
12 changes: 5 additions & 7 deletions mail_multicompany/models/mail_message.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models
from odoo import api, models


class MailMessage(models.Model):
_inherit = "mail.message"

company_id = fields.Many2one("res.company", "Company")

@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if vals.get("model") and vals.get("res_id"):
current_object = self.env[vals["model"]].browse(vals["res_id"])
if hasattr(current_object, "company_id") and current_object.company_id:
vals["company_id"] = current_object.company_id.id
if not vals.get("company_id"):
vals["company_id"] = self.env.company.id
vals["record_company_id"] = current_object.company_id.id
if not vals.get("record_company_id"):
vals["record_company_id"] = self.env.company.id
if not vals.get("mail_server_id"):
vals["mail_server_id"] = (
self.sudo()
.env["ir.mail_server"]
.search(
[("company_id", "=", vals.get("company_id", False))],
[("company_id", "=", vals.get("record_company_id", False))],
order="sequence",
limit=1,
)
Expand Down
2 changes: 1 addition & 1 deletion mail_multicompany/security/mail_security.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
<field name="global" eval="True" />
<field
name="domain_force"
>['|',('company_id','=',False),('company_id', 'in', company_ids)]</field>
>['|',('record_company_id','=',False),('record_company_id', 'in', company_ids)]</field>
</record>
</odoo>
1 change: 0 additions & 1 deletion mail_multicompany/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down

0 comments on commit c0ba703

Please sign in to comment.