diff options
| author | William Henrotin <whe@odoo.com> | 2020-01-15 08:36:05 +0000 |
|---|---|---|
| committer | William Henrotin <whe@odoo.com> | 2020-01-15 08:52:21 +0000 |
| commit | 139f6b1f55f711d5710800c433123449a76f5844 (patch) | |
| tree | febc2e768df60ac0dbdf4b75ff43804701fb959e /addons/purchase_mrp/models | |
| parent | 59a96739e09d8f1adb8baff6d96f976cb514820e (diff) | |
[FIX] purchase_mrp: return string instead or recordset
Commit e923058 aims to ensure the key 'created_purchase_line_id is
returned only if the move as this field filled. The issue is due to
the way python compare falsy object.
a = b and c will return b (not False) if b is falsy
will return c if neither b nor c are falsy.
If move_raw_id passed in the method doesn't have created_purchase_line_id
iterate_key = purchase.line.id() or 'created_purchase_line_id'
= purchase.line.id()
which is not correct as the method should return a string or False.
closes odoo/odoo#43320
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Diffstat (limited to 'addons/purchase_mrp/models')
| -rw-r--r-- | addons/purchase_mrp/models/purchase_mrp.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/purchase_mrp/models/purchase_mrp.py b/addons/purchase_mrp/models/purchase_mrp.py index 452f39a6ba0..1f644978b35 100644 --- a/addons/purchase_mrp/models/purchase_mrp.py +++ b/addons/purchase_mrp/models/purchase_mrp.py @@ -10,8 +10,8 @@ class MrpProduction(models.Model): def _get_document_iterate_key(self, move_raw_id): iterate_key = super(MrpProduction, self)._get_document_iterate_key(move_raw_id) - if not iterate_key: - iterate_key = move_raw_id.created_purchase_line_id and 'created_purchase_line_id' + if not iterate_key and move_raw_id.created_purchase_line_id: + iterate_key = 'created_purchase_line_id' return iterate_key class PurchaseOrderLine(models.Model): |
