初始提交
This commit is contained in:
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