mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
fix #I7N69Y [app_odoo_customize]开发者模式下增加可查看应用所在目录
This commit is contained in:
@@ -5,5 +5,6 @@ from . import base_language_install
|
||||
from . import ir_module_module
|
||||
from . import web_environment_ribbon_backend
|
||||
from . import ir_http
|
||||
from . import ir_module_addons_path
|
||||
# from . import ir_ui_view
|
||||
# from . import ir_ui_menu
|
||||
|
||||
40
app_odoo_customize/models/ir_module_addons_path.py
Normal file
40
app_odoo_customize/models/ir_module_addons_path.py
Normal file
@@ -0,0 +1,40 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import random
|
||||
from odoo import api, fields, models, modules, tools, _
|
||||
|
||||
|
||||
class IrModuleAddonsPath(models.Model):
|
||||
_name = "ir.module.addons.path"
|
||||
|
||||
def _default_bg_color(self):
|
||||
colors = ['#F06050', '#F4A45F', '#F7CD2E', '#6CC1ED', '#EB7E7F', '#5CC482',
|
||||
'#2c8297', '#D8485E', '#9365B8', '#804967', '#475576', ]
|
||||
res = '#FFFFFF'
|
||||
try:
|
||||
res = random.choice(colors)
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
|
||||
name = fields.Char(string='Short Name')
|
||||
path = fields.Char(string='Path')
|
||||
path_temp = fields.Char(string='Path Temp')
|
||||
color = fields.Char(default=_default_bg_color)
|
||||
module_ids = fields.One2many('ir.module.module', 'addons_path_id')
|
||||
module_count = fields.Integer(compute='_compute_module_count')
|
||||
|
||||
def _compute_module_count(self):
|
||||
for rec in self:
|
||||
rec.module_count = len(rec.module_ids)
|
||||
|
||||
def open_apps_view(self):
|
||||
self.ensure_one()
|
||||
|
||||
return {'type': 'ir.actions.act_window',
|
||||
'name': 'Apps',
|
||||
'view_mode': 'kanban,tree,form',
|
||||
'res_model': 'ir.module.module',
|
||||
'context': {},
|
||||
'domain': [('addons_path_id', '=', self.id)],
|
||||
}
|
||||
@@ -4,6 +4,7 @@ from odoo import api, fields, models, modules, tools, _
|
||||
|
||||
import operator
|
||||
|
||||
|
||||
class IrModule(models.Model):
|
||||
_inherit = 'ir.module.module'
|
||||
|
||||
@@ -15,6 +16,8 @@ class IrModule(models.Model):
|
||||
# latest_version = fields.Char('Installed Version', readonly=True)
|
||||
|
||||
local_updatable = fields.Boolean('Local updatable', compute=False, default=False, store=True)
|
||||
addons_path_id = fields.Many2one('ir.module.addons.path', string='Addons Path', readonly=True)
|
||||
addons_path = fields.Char(string='Addons Path', related='addons_path_id.path', readonly=True)
|
||||
|
||||
def module_multi_uninstall(self):
|
||||
""" Perform the various steps required to uninstall a module completely
|
||||
|
||||
Reference in New Issue
Block a user