初始提交
This commit is contained in:
4
mail_enterprise/models/__init__.py
Normal file
4
mail_enterprise/models/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import res_group_functional
|
||||
from . import update
|
||||
35
mail_enterprise/models/res_group_functional.py
Normal file
35
mail_enterprise/models/res_group_functional.py
Normal file
@@ -0,0 +1,35 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ResGroupFunctional(models.Model):
|
||||
_name = "res.group.functional"
|
||||
_inherit = ["avatar.mixin"]
|
||||
_description = "Group Functional"
|
||||
_allow_sudo_commands = False
|
||||
|
||||
name = fields.Char(string="Name", required=True)
|
||||
user_ids = fields.Many2many("res.users", string="Users")
|
||||
responsible_ids = fields.Many2many(
|
||||
"res.users",
|
||||
"res_group_functional_responsible_id",
|
||||
string="Group Responsibles",
|
||||
default=lambda self: self.env.user,
|
||||
required=True,
|
||||
help="Responsibles can update and delete the group.",
|
||||
inverse="_inverse_responsible_ids"
|
||||
)
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
groups = super().create(vals_list)
|
||||
for group in groups:
|
||||
if not group.image_1920:
|
||||
group.image_1920 = group._avatar_generate_svg()
|
||||
return groups
|
||||
|
||||
def _inverse_responsible_ids(self):
|
||||
# Add the responsible as members
|
||||
for record in self:
|
||||
record.user_ids |= record.responsible_ids
|
||||
33
mail_enterprise/models/update.py
Normal file
33
mail_enterprise/models/update.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo import api
|
||||
from odoo.models import AbstractModel
|
||||
from odoo.tools import cloc
|
||||
|
||||
|
||||
class Publisher_WarrantyContract(AbstractModel):
|
||||
_inherit = "publisher_warranty.contract"
|
||||
|
||||
@api.model
|
||||
def _get_message(self):
|
||||
msg = super()._get_message()
|
||||
|
||||
ICP = self.env["ir.config_parameter"]
|
||||
if ICP.get_bool('publisher_warranty.maintenance_disable'):
|
||||
return msg
|
||||
|
||||
msg['maintenance'] = {
|
||||
"version": cloc.VERSION,
|
||||
}
|
||||
try:
|
||||
c = cloc.Cloc()
|
||||
c.count_env(self.env)
|
||||
if c.code:
|
||||
msg["maintenance"]["modules"] = c.code
|
||||
if c.errors:
|
||||
msg["maintenance"]["errors"] = list(c.errors.keys())
|
||||
except Exception:
|
||||
msg["maintenance"]["errors"] = ['cloc/error']
|
||||
|
||||
ICP.set_str('publisher_warranty.cloc', str(msg['maintenance']))
|
||||
return msg
|
||||
Reference in New Issue
Block a user