diff --git a/sh_backmate_theme_adv_enterprise/__manifest__.py b/sh_backmate_theme_adv_enterprise/__manifest__.py index 3e60c3b13..b27af28ce 100644 --- a/sh_backmate_theme_adv_enterprise/__manifest__.py +++ b/sh_backmate_theme_adv_enterprise/__manifest__.py @@ -11,7 +11,7 @@ "summary": "Advance Material Backend Theme, Responsive Theme, Fully functional Theme, flexible Backend Theme, fast Backend Theme, lightweight Backend Theme, Animated Backend Theme, Modern multipurpose theme, Customizable Backend Theme, Multi Tab Backend Theme Odoo", "category": "Themes/Backend", "version": "0.0.4", - "depends": ["base", "web", "web_enterprise", "mail", "mail_enterprise", "voip", "yuthon_base"], + "depends": ["base", "web", "web_enterprise", "mail", "mail_enterprise", "voip"], "data": [ "security/base_security.xml", "security/ir.model.access.csv", diff --git a/sh_backmate_theme_adv_enterprise/models/global_search.py b/sh_backmate_theme_adv_enterprise/models/global_search.py index 494c5d710..50e22a592 100644 --- a/sh_backmate_theme_adv_enterprise/models/global_search.py +++ b/sh_backmate_theme_adv_enterprise/models/global_search.py @@ -36,13 +36,7 @@ class GlobalSearch(models.Model): if self.env.user.company_id.enable_menu_search: menu_roots = self.env['ir.ui.menu'].search([('parent_id', '=', False)]) - menu_data = self.env['ir.ui.menu'].search([ - ('id', 'child_of', menu_roots.ids), - '|', - ('name', 'ilike', query[0].lower()), - ('name_pinyin', 'ilike', query[0].lower()), - ('action', '!=', False) - ]) + menu_data = self.env['ir.ui.menu'].search([('id', 'child_of', menu_roots.ids),('name','ilike',query[0].lower()),('action','!=',False)]) if menu_data: menu_data = menu_data._filter_visible_menus() for menu in menu_data: diff --git a/yuthon_base/models/__init__.py b/yuthon_base/models/__init__.py index 901d6b9b9..19457e29a 100644 --- a/yuthon_base/models/__init__.py +++ b/yuthon_base/models/__init__.py @@ -9,5 +9,4 @@ from . import res_partner from . import base_month_year from . import system_logs from . import res_users -from . import mail_thread -from . import ir_ui_menu_piyin \ No newline at end of file +from . import mail_thread \ No newline at end of file diff --git a/yuthon_base/models/ir_ui_menu_piyin.py b/yuthon_base/models/ir_ui_menu_piyin.py deleted file mode 100644 index 8528ee5d2..000000000 --- a/yuthon_base/models/ir_ui_menu_piyin.py +++ /dev/null @@ -1,50 +0,0 @@ -import pypinyin - -from odoo import fields, models, api -from odoo.models import BaseModel - - -class IrUiMenuPiyin(models.Model): - _inherit = 'ir.ui.menu' - - # 添加菜单名称的拼音字段 - name_pinyin = fields.Char( - string='Name Pinyin', - compute='_compute_name_pinyin', - store=True, - index=True, - help='Pinyin representation of the menu name for search purposes' - ) - - @api.depends('name') - def _compute_name_pinyin(self): - for record in self: - if record.name: - # 使用pypinyin生成拼音,去除空格,小写 - pinyin_list = pypinyin.lazy_pinyin(record.name) - record.name_pinyin = ''.join(pinyin_list).lower() - else: - record.name_pinyin = '' - - # 重写搜索方法,支持拼音搜索 - @api.model - def _search(self, domain, offset=0, limit=None, order=None, access_rights_uid=None): - # 检查是否有拼音搜索条件 - new_domain = [] - for condition in domain: - if isinstance(condition, (list, tuple)) and len(condition) == 3: - field, operator, value = condition - if field == 'name' and operator in ['ilike', 'like']: - # 添加拼音搜索条件 - new_domain.append('|') - new_domain.append(('name', operator, value)) - new_domain.append(('name_pinyin', operator, value)) - else: - new_domain.append(condition) - else: - new_domain.append(condition) - - if not new_domain: - new_domain = domain - - return super()._search(new_domain, offset=offset, limit=limit, order=order, access_rights_uid=access_rights_uid)