0
votes

I was creating a website in I was able to create homepage

wanted to create <a href="#services">services </a> How to created it using code

<record id="n_theme_web_h_home" model="website.page">
            <field name="name">Home</field>
            <field name="website_published">True</field>
            <field name="is_homepage">True</field>
            <field name="url">/</field>
            <field name="view_id" ref="n_theme.web_h_home"/>
        </record>

        <record id="n_theme_web_h_home__home_link" model="website.menu">
            <field name="name">Home</field>
            <field name="url">/#home</field>
            <field name="page_id" ref="n_theme_web_h_home"/>
            <field name="parent_id" ref="website.main_menu"/>
            <field name="sequence" type="int">1</field>
        </record>


        <record id="n_theme_web_h_home__services_link" model="website.menu">
            <field name="name">Services down</field>
            <field name="url">#services</field>
            <field name="parent_id" ref="website.main_menu"/>
        </record>

I created the home page and set it as homepage and created the menu item for it

but n_theme_web_h_home__services_link did not work

1

1 Answers

1
votes

It doesn't work like that. You should inherit the existing view of the website, by specifying the view id.

 <?xml version="1.0" encoding="utf-8"?>
 <odoo>


 <data>
       <record id="test_menu" model="website.menu">
           <field name="name">Test</field> <!-- Name of the menu-->
           <field name="url">/test</field>
           <field name="parent_id" ref="website.main_menu"/>
           <field name="sequence" type="int">80</field>
              <!--sequence of the menu-->
       </record>
   </data>
</odoo>