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

Imagine the following situation (see below) where CustomModel1 and CustomModel2 are defined in different modules is there a neat way to order the inherited 'selection_add' states within the  form view statusbar widget ? 

Context :

    class BaseModel(model.Model):

    _name = somename.somename

    state = fields.Selection(

                                selection=[

                                    ('draft', 'draft'),

                                    ('open','Open'),

                                ]

       class CustomModel1(model.Model):

    _inherit = somename.somename

    state = fields.Selection(

                                selection_add=[

                                    ('newstate1','Newstate 1'),

                                ]

       class CustomModel2(model.Model):

    _inherit = somename.somename

    state = fields.Selection(

                                selection_add=[

                                    ('newstate2','Newstate 2'),

                                ]
Ideas : One option would be to create a third custom module that depends on the two initial ones and <xpath> the statusbar altogether. Ideally though there would be some qweb equivalent to the field selection_add attribute to simply add new stages rather than having to redefine the widget.

Thnx for the contributions

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,
The best way is to redefine whole field in new inherited class with your required sequence of selection field.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ย. 24
19986
How to install odoo 10 in ubuntu 20.04? แก้ไขแล้ว
1
ก.ย. 23
2886
4
ธ.ค. 23
22244
5
ก.ค. 24
15600
3
พ.ค. 23
5480