Search code examples
pythonodooodoo-16

Extend Calendar Popover View in Odoo 16


I’m trying to extend a calendar view in Odoo 16, specifically the “popover”. I’ve followed various steps and guides, but I keep encountering the following error:

odoo.tools.convert.ParseError: while parsing None:3, somewhere inside.

enter image description here

I can’t figure out what I’m doing wrong. Can anyone help me?

Thank you very much!

# Module structure
my_module/
├── __init__.py
├── __manifest__.py
└── views/
    └── attendee_calendar_common_popover_extension.xml

# __manifest__.py
{
    'name': 'My Module',
    'version': '1.0',
    'summary': 'Estende la vista del calendario per aggiungere più campi',
    'category': 'Calendar',
    'depends': ['calendar'],
    'data': [
        'views/attendee_calendar_common_popover_extension.xml',
    ],
    'installable': True,
    'application': False,
}

xml file

Parent View https://github.com/odoo/odoo/blob/16.0/addons/calendar/static/src/views/attendee_calendar/common/attendee_calendar_common_popover.xml


Solution

  • The file should be added to the assets entry under web.assets_backend like they did in the calendar module

    Example:

    {
        'name': 'My Module',
        'version': '1.0',
        'summary': 'Estende la vista del calendario per aggiungere più campi',
        'category': 'Calendar',
        'depends': ['calendar'],
        'assets': {
            'web.assets_backend': [
                'my_module/static/src/views/attendee_calendar_common_popover_extension.xml',
            ],
        },
        'installable': True,
        'application': False,
    }
    

    You need to change your code to use QWEB Template inheritance

    Example:

    <?xml version="1.0" encoding="UTF-8"?>
    <templates>
        <t t-name="cf_toCalendar.attendee_calendar_common_popover_extension_body" t-inherit="calendar.AttendeeCalendarCommonPopover.body" t-inherit-mode="extension" owl="1"> 
            <xpath expr="//ul[hasclass('o_cw_popover_fields_secondary')]" position="inside">
                           
          </xpath>
        </t>
    </templates>