From 6e69a2bf0bd36204eadff701244c29a387dcd5fd Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Fri, 8 May 2020 12:48:47 +0000 Subject: [PATCH] [FIX] mrp: successfully retrieve empty computed field 1. Install MRP 2. Launch an Odoo shell on the database 3. Type the command `print(env["mrp.bom.line"].browse(1).child_line_ids)` Traceback will occur with exception odoo.exceptions.CacheMiss: ('mrp.bom.line(1,).child_line_ids', None) This occur due to the empty value that the computation of the field yields, which is not saved in cache. Fix by adding a default value. opw-2226951 closes odoo/odoo#50950 X-original-commit: fc885499a3c75d8d564569ec4cea41a8a64f3164 Signed-off-by: Nicolas Martinelli (nim) --- addons/mrp/models/mrp_bom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/mrp_bom.py b/addons/mrp/models/mrp_bom.py index cbd86e6c6fa..362b63e5ee8 100644 --- a/addons/mrp/models/mrp_bom.py +++ b/addons/mrp/models/mrp_bom.py @@ -325,7 +325,7 @@ class MrpBomLine(models.Model): def _compute_child_line_ids(self): """ If the BOM line refers to a BOM, return the ids of the child BOM lines """ for line in self: - line.child_line_ids = line.child_bom_id.bom_line_ids.ids + line.child_line_ids = line.child_bom_id.bom_line_ids.ids or False @api.onchange('product_uom_id') def onchange_product_uom_id(self):