콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
1729 화면

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?

아바타
취소
베스트 답변

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

아바타
취소