From b7e394a3e2f85a4ece0b40cbdd7eb4ea9aeb6c19 Mon Sep 17 00:00:00 2001 From: ivan deng Date: Tue, 4 Jun 2019 04:10:04 +0800 Subject: [PATCH] opt expiry --- app_odoo_customize/models/__init__.py | 1 + app_odoo_customize/models/ir_ui_menu.py | 27 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 app_odoo_customize/models/ir_ui_menu.py diff --git a/app_odoo_customize/models/__init__.py b/app_odoo_customize/models/__init__.py index 5bf3fd59..839c37e2 100644 --- a/app_odoo_customize/models/__init__.py +++ b/app_odoo_customize/models/__init__.py @@ -4,4 +4,5 @@ from . import res_config_settings from . import ir_ui_view from . import base_language_install from . import models +# from . import ir_ui_menu # from . import mail_thread diff --git a/app_odoo_customize/models/ir_ui_menu.py b/app_odoo_customize/models/ir_ui_menu.py new file mode 100644 index 00000000..c8e2fa0f --- /dev/null +++ b/app_odoo_customize/models/ir_ui_menu.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +import re + +from odoo import api, fields, models, tools, _ + +MENU_ITEM_SEPARATOR = "/" +NUMBER_PARENS = re.compile(r"\(([0-9]+)\)") + + +class IrUiMenu(models.Model): + _inherit = 'ir.ui.menu' + + def _get_full_name(self, level=6): + """ Return the full name of ``self`` (up to a certain level). """ + if level <= 0: + return '...' + if self.parent_id: + try: + name = self.parent_id._get_full_name(level - 1) + MENU_ITEM_SEPARATOR + (self.name or "") + except Exception: + name = self.name or "..." + else: + name = self.name + return name +