带odoo12的Javascript

带odoo12的Javascript,javascript,python,odoo,odoo-12,Javascript,Python,Odoo,Odoo 12,我目前正在使用odoo12ce,我正在尝试用JS创建一个简单的自定义仪表板,由和操作触发,但由于官方文档不明确,我遇到了一些问题 我已经继承并扩展了res.model,添加了两个字段 猫=字段。整数(字符串=“猫的数量”) 狗=字段。整数(字符串=“狗的数量”) 我想开始使用JS在res.model中显示记录列表,并在javascript(类似于树视图)中显示猫狗数量 我从一个网站下载了这个模块,我认为这将是一个很好的起点,但我不知道如何从JS访问res.partner odoo.define(

我目前正在使用odoo12ce,我正在尝试用JS创建一个简单的自定义仪表板,由和操作触发,但由于官方文档不明确,我遇到了一些问题

我已经继承并扩展了res.model,添加了两个字段

猫=字段。整数(字符串=“猫的数量”) 狗=字段。整数(字符串=“狗的数量”)

我想开始使用JS在res.model中显示记录列表,并在javascript(类似于树视图)中显示猫狗数量

我从一个网站下载了这个模块,我认为这将是一个很好的起点,但我不知道如何从JS访问res.partner

odoo.define('hello_world.main', function (require) {
  // The require will import the AbstractAction from the web module.
  // The AbstractAction is the base class for all actions in Odoo
  const AbstractAction = require('web.AbstractAction');
  const core = require('web.core');

  const OurAction = AbstractAction.extend({
    // Loads the template from static/src/xml/hello_world.xml
    template: "hello_world.ClientAction",
    info: "this message comes from the JS"
  });

  // Adds it to the registry so that the action is loaded by Odoo
  core.action_registry.add('hello_world.action', OurAction);
});


你好,奥多
还有动作按钮

    <data>
        <record id="action_hello_world" model="ir.actions.client">
            <field name="name">Tutorial Demo</field>
            <field name="tag">hello_world.action</field>
        </record>

        <menuitem name="Hello World"
                  id="hello_world_menu_root"
                  action="action_hello_world"/>
    </data>

教程演示
你好,世界行动
代码工作正常,在我单击时显示Hello Odoo和info小部件,我想扩展访问res.partner记录的功能

    <data>
        <record id="action_hello_world" model="ir.actions.client">
            <field name="name">Tutorial Demo</field>
            <field name="tag">hello_world.action</field>
        </record>

        <menuitem name="Hello World"
                  id="hello_world_menu_root"
                  action="action_hello_world"/>
    </data>