Avoid processing duplicate opportunities

issue10496
review338311002
This commit is contained in:
Sergi Almacellas Abellana committed 2021-06-11 09:43:54 +02:00
1 parent 21740c1d42
commit fb9b0f4be1
1 file changed
+3 -2
+3 -2
View File
@@ -14,8 +14,9 @@ def process_opportunity(func):
pool = Pool()
Opportunity = pool.get('sale.opportunity')
with Transaction().set_context(_check_access=False):
opportunities = [s.origin for s in cls.browse(sales)
if isinstance(s.origin, Opportunity)]
opportunities = Opportunity.browse(
set(s.origin for s in cls.browse(sales)
if isinstance(s.origin, Opportunity)))
func(cls, sales)
with Transaction().set_context(_check_access=False):
Opportunity.process(opportunities)