From d34adc04aec958374342cfa212ba882451700e10 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 14 Sep 2015 23:57:21 +0200 Subject: [PATCH] Add reverse one2many field --- stock_usability/stock.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stock_usability/stock.py b/stock_usability/stock.py index 9542fc1..f0f6ed8 100644 --- a/stock_usability/stock.py +++ b/stock_usability/stock.py @@ -37,6 +37,12 @@ class StockLocation(models.Model): _inherit = 'stock.location' name = fields.Char(translate=False) + # with the 'quant_ids' field below, you can for example search empty stock + # locations with self.env['stock.location'].search([ + # ('child_ids', '=', False), ('quant_ids', '=', False), + # ('usage', '=', 'internal')]) + quant_ids = fields.One2many( + 'stock.quant', 'location_id', string="Related Quants") class StockPickingType(models.Model):