初始提交

This commit is contained in:
2026-11-04 19:58:07 +08:00
commit 53b7d22429
829 changed files with 469986 additions and 0 deletions

View 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

View 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

View 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