İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
2322 Görünümler

I am trying to deliver a Stock Move ,and in the lot/serial number field I should Only see serial numbers(lot_id) of product variants with Qty on hand.

look at this item(pic included). and all the lot ids. this item has a on hand of 5. we should only see the 5 lot ids.Tied to this.i did try this(my code is given below),  and also other methods too, but in this case it shows all records first after changing once i gets the required values, is there any other way to get my required values on the first click ??i need The results shown in Second Pic Is In My First Click, Is there any solution For This?


code:

@api.onchange('lot_id')
def _show_appropriate_serial_number(self):
print("hello i can show up here")
quantity_on_hand = self.env['stock.quant'].search([('on_hand', '=', True)])
lists = []
for rec in quantity_on_hand:
if self.product_id == rec.product_id:
lists.append(rec.lot_id.id)
print(lists)
return {'domain': {'lot_id': [('id', 'in', lists)]}}


Avatar
Vazgeç
En İyi Yanıt

change 'in' to '=' and check again last line of your code, hope this will work :)

Avatar
Vazgeç
Üretici

not working,same as before

İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Ağu 20
2814
0
Ara 19
3246
0
Ara 20
2680
0
Eki 20
3045
0
May 20
2625