中国本土应用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.5KB

  1. # -*- coding: utf-8 -*-
  2. import re
  3. from odoo import models
  4. class IrUiMenu(models.Model):
  5. _inherit = "ir.ui.menu"
  6. def load_web_menus(self, debug):
  7. menus = super(IrUiMenu, self).load_web_menus(debug)
  8. for menu in menus.values():
  9. # web icons for app root menus
  10. if menu["id"] == menu["appID"]:
  11. webIcon = menu.get("webIcon", "")
  12. webIconlist = webIcon and webIcon.split(",")
  13. iconClass = color = backgroundColor = None
  14. if webIconlist:
  15. if len(webIconlist) >= 2:
  16. iconClass, color = webIconlist[:2]
  17. if len(webIconlist) == 3:
  18. backgroundColor = webIconlist[2]
  19. if menu.get("webIconData"):
  20. menu["webIconData"] = re.sub(
  21. r"\s/g",
  22. "",
  23. (
  24. "data:image/png;base64,%s"
  25. % menu["webIconData"].decode("utf-8")
  26. ),
  27. )
  28. elif backgroundColor is not None: # Could split in three parts?
  29. menu["webIcon"] = ",".join(
  30. [iconClass or "", color or "", backgroundColor]
  31. )
  32. else:
  33. menu[
  34. "webIconData"
  35. ] = "/oec_theme_backend/static/img/default_icon_app.png"
  36. return menus
上海开阖软件有限公司 沪ICP备12045867号-1