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

In Domain how to call default method:-

    def _get_lotproduct(self, cr, uid, context=None):
        lot_obj = self.pool.get('stock.production.lot')
        lotids = lot_obj.search(cr, uid, [])
        product_id = []
        for val in lot_obj.browse(cr, uid, lotids):
            product_id.append(val.product_id.id)
        return product_id[0]


 'product_id': fields.many2one('product.product', 'Product',  domain="[('product_id','=',_get_lotproduct)]"),

    _defaults = {
           'product_id'   : _get_lotproduct
    }

domain="[('product_id','=',_get_lotproduct)]" Is it possible to call default method in domain?

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

Hi..

In defaults, you can only set a default value for the field and not domain...

Instead u can do the other way, add another field which will fetch the domain value and that field try to use it as a domain to your fields..

Example:

lets say, 'field1': => used to store the domain value 'field2':.... domain=[('product_id','=',field1)]

hope this helps you

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ต.ค. 25
9
1
มิ.ย. 24
4208
Domain one2many field? แก้ไขแล้ว
5
มิ.ย. 23
36360
[Solved] Close window on button press แก้ไขแล้ว
1
ธ.ค. 23
20108
1
ก.ค. 15
6147