我想根据serial_no != 0的device_model和product_qty来过滤serial_no。我的代码:
class EmployeeCustody(models.Model):
_name = 'employee.custody'
name = fields.Char(required=True)
device_model = fields.Many2one('product.product', string='Device Model', required=True)
serial_no = fields.Many2one('stock.production.lot', string='Serial Number',
domain="[('product_id', '=', device_model),('product_qty', '!=', 0)]")
class ProductionLot(models.Model):
_name = 'stock.production.lot'
name = fields.Char(required=True)
product_id = fields.Many2one('product.product', 'Product', required=True)
product_qty = fields.Float('Quantity', default=0)我根据device_model得到了数量为所有数量的数量(我不想要数量= 0)
发布于 2020-06-22 21:15:53
默认情况下,Float字段的值为None
所以你可以试试
domain=['&',('product_id', '=', device_model),('product_qty', 'not in', (0, None))]
或
product_qty = fields.Float('Quantity', default=0)
希望它能有所帮助,因为我无法测试我的解决方案
https://stackoverflow.com/questions/62511652
复制相似问题