I created a module in Odoo 18 and within it, an XML file called product_views. It contains a list view. I added a button to the header of the list, but it doesn't appear.
Here is my xml file:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_product_list" model="ir.ui.view">
<field name='name'>"electronic.product.list"</field>
<field name='model'>product.product</field>
<field name="priority" eval="99"/>
<field name="arch" type="xml">
<list>
<header>
<button name="import_action"
string="import"
type='object'/>
</header>
<field name="name" string="product name" />
<field name="volume" string="quantity" />
<field name="x_link" string="quantity" />
</list>
</field>
</record>
<record id="action_electronic_products" model="ir.actions.act_window">
<field name="name">Electronic Products</field>
<field name="res_model">product.product</field>
<field name="view_mode">list</field>
<field name="view_id" ref="view_product_list"/>
</record>
<menuitem
id="menu_electronic_product_root"
name="Electronic Products"
action="action_electronic_products"
sequence="10"
groups="base.group_user"/>
This is my model:
from odoo import models, fields, api
class ProductProduct(models.Model):
_inherit = 'product.product' # Correct inheritance
x_link = fields.Char(
string='Product Link',
help='URL of the product',
default='',
tracking=True # Shows changes in chatter
)
def import_action(self):
return {
'name': 'Import Products',
'type': 'ir.actions.act_window',
'res_model': 'product.import.wizard',
'view_mode': 'form',
'target': 'new',
'context': {'default_product_id': self.id},
}
Can you help me please?

