Files
dn20/mail_enterprise/models/update.py
2026-11-04 19:58:07 +08:00

34 lines
1002 B
Python

# -*- 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