0

我正在创建一个网站,我能够创建主页

想要创建<a href="#services">services </a> 如何使用代码创建它

<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>

我创建了主页并将其设置为主页并为其创建了菜单项

n_theme_web_h_home__services_link没有工作

4

1 回答 1

1

它不是那样工作的。您应该通过指定视图 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>
于 2020-09-23T05:54:18.350 回答