import base64 from odoo.tools.misc import file_open def post_init_hook(env): """Metatroncube's own logo and favicon for the public website - a fixed brand asset, not tied to whichever school company happens to be active, matching the marketing homepage (views/homepage_templates.xml). Odoo ships two demo website records out of the box (website.default_website, website.website2), both created with noupdate=True. A plain write targeting either from this module's own data files is silently skipped - no error, nothing in the log - exactly the same trap demo/mc_cast_users_demo.xml already documented for an unrelated field. Running this as real Python instead isn't subject to that guard. Only runs on a fresh install of this module, per Odoo's own post_init_hook contract - it will not re-fire on `-u` of a database that already had this module installed before this hook existed. """ with file_open("mc_education_theme/static/img/logo.png", "rb") as f: logo = base64.b64encode(f.read()) with file_open("mc_education_theme/static/img/favicon.png", "rb") as f: favicon = base64.b64encode(f.read()) env["website"].search([]).write({"logo": logo, "favicon": favicon})