Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2516 มุมมอง

Hi, 

I inherited product.template classe and created a char field on Odoo v16.

I created a new product_template_action with a context and a domain on my new field. The domain works, but not the context. I tested to pass an Odoo field (like default_code) and another custom field : context with default_code works but not my custom field.


Here are my .py and .xml

class ProductTemplate(models.Model):
​_inherit = "product.template"
   
​di_nature_type = fields.Char('Nature Type')

    

ir.actions.act_window">

        Labour

        ir.actions.act_window

        product.template

        tree,kanban,form

        {'default_di_nature_type': '1'}

        [('di_nature_type','=','1')]

       

           

                Create a new product

           

       


What's wrong ?

Thanks for help

อวตาร
ละทิ้ง
ผู้เขียน

This is the xml, the /code bug in my post

<record id="product_template_action_labour" model="ir.actions.act_window">
<field name="name">Labour</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_mode">tree,kanban,form</field>
<field name="context">{'default_di_nature_type': '1'}</field>
<field name="domain">[('di_nature_type','=','1')]</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new product
</p>
</field>
</record>

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
มิ.ย. 23
4866
2
มี.ค. 19
13170
1
พ.ค. 24
2099
1
เม.ย. 24
1981
1
ก.พ. 24
2811