Skip to Content
Menu
This question has been flagged
1 Reply
1433 Views

Hi. I have installed the module from OCA on version 15 EE that allows me to archive serial number. My serial numbers have an extra field called condition_id. Im trying to search for condition ilike Good and Quantity 0 and then what ever the search finds i want to get archived. Here is my Code


ser_lots = env['stock.production.lot'].search([('product_qty', '=', 0),('condition_id','ilike','Good')])
for lots in ser_lots:
lots.write({'active': False})


apparently im doing something wrong because when i run it it archives all the Good serials. I want it to archive the Good with Qty 0



Avatar
Discard
Best Answer

Hi,

Try like below.

ser_lots = env['stock.production.lot'].search([‘&’,('product_qty', '=',0),('condition_id','ilike','Good')])
for lots in ser_lots:
​lots.write({'active': False})

Regards

Avatar
Discard
Author

unfortunately it does the same thing. looks like it cannot see 'product_qty', '=',0