customizations.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <!--
  4. Global Layout Customization for M22 Tech Theme
  5. Goal: Remove standard Header and Footer globally to create a pure "App-like" feel.
  6. Also enforces Login for all public users.
  7. IMPORTANT: Only applies when theme_m22tc is the active theme.
  8. -->
  9. <template id="layout_custom_m22" inherit_id="website.layout" name="M22 Global Layout" priority="50">
  10. <!-- Head Injections: Only when M22 theme is active -->
  11. <xpath expr="//head" position="inside">
  12. <t t-if="request.website.sudo().theme_id and request.website.sudo().theme_id.name == 'theme_m22tc'">
  13. <!-- 1. Google Fonts: Urbanist -->
  14. <link href="https://fonts.googleapis.com" rel="preconnect"/>
  15. <link crossorigin="" href="https://fonts.gstatic.com" rel="preconnect"/>
  16. <link href="https://fonts.googleapis.com/css2?family=Urbanist:wght@400;600;700;800&amp;display=swap" rel="stylesheet"/>
  17. <!-- 2. Material Symbols -->
  18. <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" rel="stylesheet"/>
  19. <!-- 3. Tailwind CSS -->
  20. <script src="https://cdn.tailwindcss.com?plugins=forms,typography"></script>
  21. <!-- Tailwind Config: Disable preflight to prevent conflict with Odoo/Bootstrap -->
  22. <script>
  23. tailwind.config = {
  24. corePlugins: {
  25. preflight: false
  26. }
  27. }
  28. </script>
  29. </t>
  30. </xpath>
  31. <!-- Login enforcement script: Only when M22 theme is active -->
  32. <xpath expr="//body" position="inside">
  33. <t t-if="request.website.sudo().theme_id and request.website.sudo().theme_id.name == 'theme_m22tc'">
  34. <t t-if="request.env.user._is_public() and request.httprequest.path not in ['/web/login', '/web/signup', '/web/reset_password']">
  35. <script type="text/javascript">
  36. if (!window.location.pathname.startsWith('/web/login')) {
  37. window.location.href = '/web/login?redirect=' + encodeURIComponent(window.location.href);
  38. }
  39. </script>
  40. </t>
  41. </t>
  42. </xpath>
  43. <!-- Remove Header: Only when M22 theme is active -->
  44. <xpath expr="//header[@id='top']" position="attributes">
  45. <attribute name="t-if">not (request.website.sudo().theme_id and request.website.sudo().theme_id.name == 'theme_m22tc')</attribute>
  46. </xpath>
  47. <!-- Remove Footer: Only when M22 theme is active -->
  48. <xpath expr="//footer" position="attributes">
  49. <attribute name="t-if">not (request.website.sudo().theme_id and request.website.sudo().theme_id.name == 'theme_m22tc')</attribute>
  50. </xpath>
  51. <!-- Wrapwrap classes: Only when M22 theme is active -->
  52. <xpath expr="//div[@id='wrapwrap']" position="attributes">
  53. <attribute name="t-attf-class" add="#{request.website.sudo().theme_id and request.website.sudo().theme_id.name == 'theme_m22tc' and 'd-flex flex-column h-100' or ''}" separator=" "/>
  54. </xpath>
  55. <!-- Main classes: Only when M22 theme is active -->
  56. <xpath expr="//main" position="attributes">
  57. <attribute name="t-attf-class" add="#{request.website.sudo().theme_id and request.website.sudo().theme_id.name == 'theme_m22tc' and 'flex-grow-1' or ''}" separator=" "/>
  58. </xpath>
  59. </template>
  60. </odoo>