From 13ca39dd6d0b477804d9dcefd80ccb46d3f9d963 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 18 Aug 2017 18:48:17 +0200 Subject: [PATCH] [FIX] P3: remove pycompat.{keys,items,values} helpers Now that we're closer to switching to P3 for good, these helpers have outlived their usefulness, and mostly add noise. All remaining dict.iter*() or dict.view*() must be converted to the normal keys(), values() or items() calls. Whenever the result is likely to be used for more than the scope of a loop, or when the dict needs to be modified during iteration, the calls must be wrapped in a ``list()``, to protect the new P3 semantics. Those cases are very exceptional. Also removed some dead code or improved the API to remove unnecessary conversions. --- models/sale_coupon_program.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/models/sale_coupon_program.py b/models/sale_coupon_program.py index 3f6eb41fc44..8ef4edea880 100644 --- a/models/sale_coupon_program.py +++ b/models/sale_coupon_program.py @@ -4,7 +4,6 @@ from odoo import api, fields, models, _ from odoo.exceptions import UserError from odoo.tools.safe_eval import safe_eval -from odoo.tools import pycompat class SaleCouponProgram(models.Model): @@ -206,7 +205,7 @@ class SaleCouponProgram(models.Model): valid_programs = self.filtered(lambda program: not program.rule_products_domain) for program in self - valid_programs: ordered_rule_products_qty = sum( - qty for product, qty in pycompat.items(products_qties) + qty for product, qty in products_qties.items() if program._is_valid_product(product) ) # Avoid program if 1 ordered foo on a program '1 foo, 1 free foo'