documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Inner content snippet cannot be placed

Open Silur opened this issue 1 year ago • 5 comments

Impacted versions: 17.0

Steps to reproduce:

  • create a custom module according to the official documentation https://www.odoo.com/documentation/17.0/developer/howtos/website_themes/building_blocks.html
    <?xml version="1.0" encoding="utf-8"?>
    <odoo>
        <template id="s_custom_snippet" name="Custom snippet">
            <div class="s_custom_snippet" data-drop-in=".content, nav" data-selector="custom-snippet">
                Foo Bar
            </div>
        </template>
    </odoo>
<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <template id="snippets" inherit_id="website.snippets" name="Custom">
        <xpath expr="//div[@id='snippet_content']/div[@class='o_panel_body']" position="inside">
            <t t-snippet="custom_web_blocks.s_custom_snippet" t-thumbnail="/website/static/src/img/snippets_thumbs/s_card.svg">
                <keywords>Custom</keywords>
            </t>
        </xpath>
    </template>
</odoo>

Current behavior: image Snippet cannot be dragged, is disabled and when inspected with devtools it has the title "No location to drop in" - even though data-drop-in is filled.

Wrapping the snippet into <section></section> works as expected

Expected behavior: Snippet should be draggable into .conent and nav elements.

Silur avatar Feb 05 '24 19:02 Silur

For anyone else encountering this, the completely undocumented piece of code that enables inner content snippets to be actually placed with the editor (place this inside your_module/options.xml if you followed the official docs:

  <template id="s_custom_snippet_options" inherit_id="website.snippet_options" name="Custom snippet options">
    <xpath expr="//*[@t-set='so_content_addition_selector']" position="inside">, .s_flipping_card</xpath>
   </template>

The special so_content_addition class that enumerates every inner content snippet and you have to explicitly add yours into this list.

It'd be really nice to mention this in the documentation as what's currently online is faulty.

Silur avatar Feb 17 '24 07:02 Silur

Oh, God, you really saved me @Silur ! I thought I would go insane in solving this. Tried to post the same question to the forum: https://www.odoo.com/forum/help-1/custom-inline-content-blocks-odoo-16-249894.

Thanks a lot!

mikkeschiren avatar Apr 13 '24 12:04 mikkeschiren

Hi @Silur Thanks for the feedback. I'll move this issue to the documentation repository so that someone can work on this. Cheers

vava-odoo avatar Apr 16 '24 09:04 vava-odoo

Hi @CVDE-odoo, I think this if for you ;)

AntoineVDV avatar Apr 16 '24 09:04 AntoineVDV

@AntoineVDV Thanks, it's noted. I will have a look into this and include it for the next documentation update !

CVDE-odoo avatar Apr 16 '24 10:04 CVDE-odoo