Reuse existing join in order_quotation_state

issue11865
review421911003
This commit is contained in:
Cédric Krier committed 2022-11-08 00:41:12 +01:00
1 parent 7cb9b75202
commit ae38c7dcb1
1 file changed
+8 -5
+8 -5
View File
@@ -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]