[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.
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user