changeset aea743c40e4a in modules/purchase_request_quotation:6.0
details: 
https://hg.tryton.org/modules/purchase_request_quotation?cmd=changeset&node=aea743c40e4a
description:
        Reuse existing join in order_quotation_state

        issue11865
        review421911003
        (grafted from 009d7282cf9d1cdf1990236886416abcb11544c9)
diffstat:

 purchase.py |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (23 lines):

diff -r 10af03ab2a17 -r aea743c40e4a purchase.py
--- a/purchase.py       Wed Feb 16 23:53:04 2022 +0100
+++ b/purchase.py       Tue Nov 08 00:41:12 2022 +0100
@@ -327,11 +327,14 @@
     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]
 

Reply via email to