Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
1739 Visualizzazioni

I've defined a new model that inherits from product_template. 

classTire(models.Model):
    _name="product.tire"
    _inherits={"product.template":"product_template_id"}

    product_template_id= fields.Many2one(
        "product.template",
        string="Related_product_id",
        auto_join=True,
        index=True,
        ondelete="cascade",
        required=True,
    )
    ...

I've also defined a view that extends the default product_template form.

<record id="product_tire_form"model="ir.ui.view">
    <field name="name">product.product.formfield>
    <field name="model">product.tirefield>
    <field name="mode">primaryfield>
    <field name="inherit_id"ref="product.product_template_form_view"/>
    <field name="arch"type="xml">
        <form position="attributes">
            <attribute name="string">Testattribute>
        form>
    field>
record>


I'm getting the following error when upgrading the module "action_open_label_layout is not a valid action on product.tire"

This is on Odoo v16. Anyone encounter this an have a solution?

Avatar
Abbandona
Risposta migliore

When you use  Delegation Inheritance, only the fields will be inherited but for the methods you need to redefine them in you new model. 

The error showing that the method named 'action_open_label_layout' (used to print label) is not defined in your new model as its used in the product_template_form_view view.

You can find the method code in product.product and product.template below:

action_open_label_layout method for product.product

action_open_label_layout method for product.template

Avatar
Abbandona