customizations.xml 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. <!-- Tailwind CSS is now loaded via ir_asset.xml for better performance and CI stability -->
  20. <!-- Tailwind Config: Disable preflight to prevent conflict with Odoo/Bootstrap -->
  21. <script>
  22. tailwind.config = {
  23. corePlugins: {
  24. preflight: false
  25. }
  26. }
  27. </script>
  28. </t>
  29. </xpath>
  30. <!-- Login enforcement script: Only when M22 theme is active -->
  31. <xpath expr="//body" position="inside">
  32. <t t-if="request.website.sudo().theme_id and request.website.sudo().theme_id.name == 'theme_m22tc'">
  33. <t t-if="request.env.user._is_public() and request.httprequest.path not in ['/web/login', '/web/signup', '/web/reset_password']">
  34. <script type="text/javascript">
  35. if (!window.location.pathname.startsWith('/web/login')) {
  36. window.location.href = '/web/login?redirect=' + encodeURIComponent(window.location.href);
  37. }
  38. </script>
  39. </t>
  40. </t>
  41. </xpath>
  42. <!-- Remove Header: Only when M22 theme is active -->
  43. <xpath expr="//header[@id='top']" position="attributes">
  44. <attribute name="t-if">not (request.website.sudo().theme_id and request.website.sudo().theme_id.name == 'theme_m22tc')</attribute>
  45. </xpath>
  46. <!-- Remove Footer: Only when M22 theme is active -->
  47. <xpath expr="//footer" position="attributes">
  48. <attribute name="t-if">not (request.website.sudo().theme_id and request.website.sudo().theme_id.name == 'theme_m22tc')</attribute>
  49. </xpath>
  50. <!-- Wrapwrap classes: Only when M22 theme is active -->
  51. <xpath expr="//div[@id='wrapwrap']" position="attributes">
  52. <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=" "/>
  53. </xpath>
  54. <!-- Main classes: Only when M22 theme is active -->
  55. <xpath expr="//main" position="attributes">
  56. <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=" "/>
  57. </xpath>
  58. </template>
  59. </odoo>