This question has been flagged
1 Reply
2040 Views

Hi All,

I got the following message error:
Field "is_published" does not exist in model "product.template"
when I try to inherit view form from website_sale.

What I want to do is that the attribute readonly='true' on the field website_id change to 'false' to a specific user group.

here the xml:

 < record model="ir.ui.view" id="product_template_form_view_inherit">
   < field name="name">product.template.product.website.form.inherit < /field>
   < field name="model">product.template< /field>
   < field name="inherit_id" ref="website_sale.product_template_form_view"/>
   < field name="groups_id" eval="[(4, ref('base.group_erp_manager'))]"/>
   < field name="arch" type="xml">
        < xpath expr="//field[@name='website_id']" position="attributes">
            < attribute name="readonly"> False < /attribute>
        < /xpath>
   < /field>
< /record>

and here is my model:

class Product(models.Model):
    _inherit = 'product.template'
website_id = fields.Many2one('website',string='User website' ,required='true', readonly='true', default=lambda self: self._default_website())

odoo14


Avatar
Discard
Best Answer

Hi,

Did you add website_sale in the depends of your module? if not, add it in the depends and try again.

Thanks

Avatar
Discard