最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

list view is not showing odoo 18 - Stack Overflow

programmeradmin0浏览0评论

Here is my model from my custom module, my custom module is under custom directory and when run I run with custom modules and I updated my apps when I make any changes but the problem is not solved.

from odoo import models, fields


class ResPartner(models.Model):
    _inherit = "res.partner"

    cnp = fields.Char(string="CNP", help="Cod Numeric Personal for verification")

here is my cnp_list_view.xml,

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

    <!-- List View -->
    <record id="cnp_number_view_tree" model="ir.ui.view">
        <field name="name">res.partner.view.list.inheritp</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_tree"/>
        <field name="arch" type="xml">
            <xpath expr="//field" position="before">
                <field name="name"/>
                <field name="phone"/>
                <field name="email"/>
                <field name="city"/>
                <field name="cnp"/>
            </xpath>
        </field>
    </record>

    <!-- Form View -->
    <record id="cnp_number_view_form" model="ir.ui.view">
        <field name="name">res.partner.view.form.inherit</field>
        <field name="model">res.partner</field>
        <field name="arch" type="xml">
            <form string="CNP Numbers">
                <div class="s_website_form_rows row s_col_no_bgcolor">
                    <div class="form-group s_website_form_field col-12 s_website_form_done" data-name="Field">
                        <field id="name" name="name" placeholder="Name"/>
                        <field name="phone" placeholder="Phone"/>
                        <field name="email" placeholder="Email"/>
                        <field name="city" placeholder="City"/>
                        <field name="cnp" placeholder="CNP"/>
                    </div>
                </div>
            </form> 
        </field>
    </record>

    <!-- Action -->
    <record id="action_cnp_validation" model="ir.actions.act_window">
        <field name="name">CNP Numbers</field>
        <field name="res_model">res.partner</field>
        <field name="view_mode">list,form</field>
    </record>

    <!-- Menu -->
    <menuitem
        id="menu_cnp_validation_root"
        name="CNP Validation App"
    />

    <menuitem
        id="menu_cnp_validation"
        parent="menu_cnp_validation_root"
        action="action_cnp_validation"
    />
</data>
</odoo>

After adding the form view I can't see the list view , from interface if I click on debug no list view is found

Here is my model from my custom module, my custom module is under custom directory and when run I run with custom modules and I updated my apps when I make any changes but the problem is not solved.

from odoo import models, fields


class ResPartner(models.Model):
    _inherit = "res.partner"

    cnp = fields.Char(string="CNP", help="Cod Numeric Personal for verification")

here is my cnp_list_view.xml,

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

    <!-- List View -->
    <record id="cnp_number_view_tree" model="ir.ui.view">
        <field name="name">res.partner.view.list.inherit.cnp</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_tree"/>
        <field name="arch" type="xml">
            <xpath expr="//field" position="before">
                <field name="name"/>
                <field name="phone"/>
                <field name="email"/>
                <field name="city"/>
                <field name="cnp"/>
            </xpath>
        </field>
    </record>

    <!-- Form View -->
    <record id="cnp_number_view_form" model="ir.ui.view">
        <field name="name">res.partner.view.form.inherit</field>
        <field name="model">res.partner</field>
        <field name="arch" type="xml">
            <form string="CNP Numbers">
                <div class="s_website_form_rows row s_col_no_bgcolor">
                    <div class="form-group s_website_form_field col-12 s_website_form_done" data-name="Field">
                        <field id="name" name="name" placeholder="Name"/>
                        <field name="phone" placeholder="Phone"/>
                        <field name="email" placeholder="Email"/>
                        <field name="city" placeholder="City"/>
                        <field name="cnp" placeholder="CNP"/>
                    </div>
                </div>
            </form> 
        </field>
    </record>

    <!-- Action -->
    <record id="action_cnp_validation" model="ir.actions.act_window">
        <field name="name">CNP Numbers</field>
        <field name="res_model">res.partner</field>
        <field name="view_mode">list,form</field>
    </record>

    <!-- Menu -->
    <menuitem
        id="menu_cnp_validation_root"
        name="CNP Validation App"
    />

    <menuitem
        id="menu_cnp_validation"
        parent="menu_cnp_validation_root"
        action="action_cnp_validation"
    />
</data>
</odoo>

After adding the form view I can't see the list view , from interface if I click on debug no list view is found

Share Improve this question asked Feb 4 at 11:42 Md.Muntasir MamunMd.Muntasir Mamun 931 gold badge2 silver badges10 bronze badges 2
  • Are you sure your module is installed and that the xml file(s) are listed in the manifest file? – CZoellner Commented Feb 5 at 12:32
  • Yes,evething is ok I also installed and reinstalled and upgrade the app – Md.Muntasir Mamun Commented Feb 5 at 13:11
Add a comment  | 

1 Answer 1

Reset to default 0

Check if the "cnp" field exists in the model. If so, you know that at least the module is installed. If not check that the status is "Installed" and not something like "Pending" or "Updating".

If the "cnp" field does exist, check if you're correctly referencing the view file in the manifest https://www.odoo/documentation/18.0/developer/tutorials/define_module_data.html?highlight=manifest#data-declaration

发布评论

评论列表(0)

  1. 暂无评论
ok 不同模板 switch ($forum['model']) { /*case '0': include _include(APP_PATH . 'view/htm/read.htm'); break;*/ default: include _include(theme_load('read', $fid)); break; } } break; case '10': // 主题外链 / thread external link http_location(htmlspecialchars_decode(trim($thread['description']))); break; case '11': // 单页 / single page $attachlist = array(); $imagelist = array(); $thread['filelist'] = array(); $threadlist = NULL; $thread['files'] > 0 and list($attachlist, $imagelist, $thread['filelist']) = well_attach_find_by_tid($tid); $data = data_read_cache($tid); empty($data) and message(-1, lang('data_malformation')); $tidlist = $forum['threads'] ? page_find_by_fid($fid, $page, $pagesize) : NULL; if ($tidlist) { $tidarr = arrlist_values($tidlist, 'tid'); $threadlist = well_thread_find($tidarr, $pagesize); // 按之前tidlist排序 $threadlist = array2_sort_key($threadlist, $tidlist, 'tid'); } $allowpost = forum_access_user($fid, $gid, 'allowpost'); $allowupdate = forum_access_mod($fid, $gid, 'allowupdate'); $allowdelete = forum_access_mod($fid, $gid, 'allowdelete'); $access = array('allowpost' => $allowpost, 'allowupdate' => $allowupdate, 'allowdelete' => $allowdelete); $header['title'] = $thread['subject']; $header['mobile_link'] = $thread['url']; $header['keywords'] = $thread['keyword'] ? $thread['keyword'] : $thread['subject']; $header['description'] = $thread['description'] ? $thread['description'] : $thread['brief']; $_SESSION['fid'] = $fid; if ($ajax) { empty($conf['api_on']) and message(0, lang('closed')); $apilist['header'] = $header; $apilist['extra'] = $extra; $apilist['access'] = $access; $apilist['thread'] = well_thread_safe_info($thread); $apilist['thread_data'] = $data; $apilist['forum'] = $forum; $apilist['imagelist'] = $imagelist; $apilist['filelist'] = $thread['filelist']; $apilist['threadlist'] = $threadlist; message(0, $apilist); } else { include _include(theme_load('single_page', $fid)); } break; default: message(-1, lang('data_malformation')); break; } ?>