changeset fc747c5bec63 in modules/purchase_request_quotation:6.2
details: 
https://hg.tryton.org/modules/purchase_request_quotation?cmd=changeset&node=fc747c5bec63
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 0139b82ebbeb -r fc747c5bec63 purchase.py
--- a/purchase.py       Wed Feb 16 23:52:44 2022 +0100
+++ b/purchase.py       Tue Nov 08 00:41:12 2022 +0100
@@ -324,11 +324,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