From ae38c7dcb1934746176315c2a645a030ff2dc409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 8 Nov 2022 00:41:12 +0100 Subject: [PATCH] Reuse existing join in order_quotation_state issue11865 review421911003 --- purchase.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/purchase.py b/purchase.py index 5e3e6fb819..2a44694309 100644 --- a/purchase.py +++ b/purchase.py @@ -330,11 +330,14 @@ class QuotationLine(ModelSQL, ModelView): def order_quotation_state(tables): pool = Pool() Quotation = pool.get('purchase.request.quotation') - quotation_line, _ = tables[None] - quotation = Quotation.__table__() - tables['purchase.request.quotation'] = { - None: (quotation, quotation_line.quotation == quotation.id), - } + table, _ = tables[None] + if 'quotation' not in tables: + quotation = Quotation.__table__() + tables['quotation'] = { + None: (quotation, table.quotation == quotation.id), + } + else: + quotation, _ = tables['quotation'][None] return [Case((quotation.state == 'received', 0), else_=1), quotation.state]