Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Inherit frontend website theme to add custom font/css

Naroči se

Get notified when there's activity on this post

This question has been flagged
websiteodoo16features
1 Odgovori
4172 Prikazi
Avatar
Matija

I am trying to inherit current website theme (Odoo v16) and add custom fonts/css to it. In documentation I was only able to find how to create new theme from scratch but not how to inherit it. This is what I've done (so far with no success):

Module folder structure:
website_theme/ ├── __init__.py ├── controllers/ ├── models/ │ __init__.py │ website_inherit.py ├── static/ │ src/ │ css/ │ custom_styles.css │ fonts/ │ Walkway_Bold.ttf ├── views/ │ odoo_theme.xml ├── __manifest__.py

This are the contents of files:
init.py

# -*- coding: utf-8 -*- from . import models

manifest.py
{ 'name': 'Website theme', 'description': 'Customisation for website theme', 'version': '1.0', 'author': 'author', 'data': ['views/odoo_theme.xml'], 'category': 'Website', 'depends': ['website',], 'assets': { 'web._assets_primary_variables': [ "website_theme/static/src/css/custom_styles.css", ], }, 'installable': True, }

/models/init.py

# -*- coding: utf-8 -*- from . import website_inherit

/models/website_inherit.py
from odoo import models class WebsiteInherit(models.Model): _inherit = 'website'

/static/src/css/custom_styles.css
@font-face { font-family: 'WalkwayBold'; src: url('/custom_website/static/src/fonts/Walkway_Bold.ttf') format('truetype'); } $o-theme-font-configs: map-merge($o-theme-font-configs, ( 'WalkwayBold': ( 'family': ('WalkwayBold'), ), ));

/views/odoo_theme.xml
< -- odoo>
    < -- data>
        
        < -- template id="website.layout" inherit_id="website.layout">
            < --- xpath expr="//head" position="inside">
                
            < -- /xpath>
        < -- /template>
    < -- /data>
< -- /odoo>

In odoo_theme xml file I had to add -- in tags so it can be displayed, it is not like that in the module.


I updated this module (using .sh editor) and restarted server. Found module in apps and try to install it. This is the error I get:

You cannot create recursive inherited views. View error context: '-no context-'

There is way to add custom CSS / JS in website editor but coming from Wordpress I'd like to have module for this and store this information in separate file/module outside the editor. Also, I need to use font that is not available in Google Fonts repository. Appreciate any help here, thank you.

0
Avatar
Opusti
Avatar
Nihal Haider 🇵🇰
Best Answer




try to add sans-serif in your css file

0
Avatar
Opusti
Matija
Avtor

Hi Nihal. I don't get it - this doesn't help with error - the problem is I'm not sure if theme inheritance is done correctly. Question is more complex on that side, adding font as you suggested would work if theme inheritance is correct :)

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
How to restrict access to a certain website page depending on group
website odoo16features
Avatar
Avatar
1
maj 25
2739
Error with website
website odoo16features
Avatar
0
jul. 24
256
how can I create a dropdown and put inside header the website1? odoo v16 please help me
website odoo16features
Avatar
0
maj 23
2749
Error when adding a new webiste in odoo 16
website odoo16features
Avatar
0
apr. 23
3474
HTTPS redirect to HTTP Content block of url
ecommerce website odoo16features
Avatar
Avatar
Avatar
Avatar
4
apr. 25
10011
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now