details:   https://code.tryton.org/tryton/commit/080a54372a41
branch:    default
user:      Sergi Almacellas Abellana <[email protected]>
date:      Fri Jan 12 11:46:55 2024 +0100
description:
        Open purchase requests for quotations created from wizard

        Closes #12927
diffstat:

 modules/purchase_request_quotation/CHANGELOG                                   
            |   1 +
 modules/purchase_request_quotation/purchase.py                                 
            |  22 +++++-----
 modules/purchase_request_quotation/purchase.xml                                
            |   6 --
 
modules/purchase_request_quotation/tests/scenario_purchase_request_quotation.rst
           |  14 ++----
 modules/purchase_request_quotation/tryton.cfg                                  
            |   1 -
 
modules/purchase_request_quotation/view/purchase_request_quotation_create_succeed_form.xml
 |   8 ---
 6 files changed, 17 insertions(+), 35 deletions(-)

diffs (133 lines):

diff -r 38417ada2345 -r 080a54372a41 
modules/purchase_request_quotation/CHANGELOG
--- a/modules/purchase_request_quotation/CHANGELOG      Tue Nov 11 18:00:55 
2025 +0100
+++ b/modules/purchase_request_quotation/CHANGELOG      Fri Jan 12 11:46:55 
2024 +0100
@@ -1,3 +1,4 @@
+* Open requests for quotations created from wizard
 
 Version 7.6.0 - 2025-04-28
 --------------------------
diff -r 38417ada2345 -r 080a54372a41 
modules/purchase_request_quotation/purchase.py
--- a/modules/purchase_request_quotation/purchase.py    Tue Nov 11 18:00:55 
2025 +0100
+++ b/modules/purchase_request_quotation/purchase.py    Fri Jan 12 11:46:55 
2024 +0100
@@ -17,7 +17,8 @@
 from trytond.pyson import Bool, Eval, Id, If
 from trytond.tools import sortable_values
 from trytond.transaction import Transaction
-from trytond.wizard import Button, StateTransition, StateView, Wizard
+from trytond.wizard import (
+    Button, StateAction, StateTransition, StateView, Wizard)
 
 from .exceptions import PreviousQuotation
 
@@ -478,13 +479,8 @@
             Button('Cancel', 'end', 'tryton-cancel'),
             Button('Process', 'create_quotations', 'tryton-ok', default=True),
             ])
-    create_quotations = StateTransition()
-    succeed = StateView(
-        'purchase.request.quotation.create.succeed',
-        'purchase_request_quotation.'
-        'purchase_request_quotation_create_succeed', [
-            Button('Close', 'end', 'tryton-close', True),
-            ])
+    create_quotations = StateAction(
+        'purchase_request_quotation.act_purchase_request_quotation_form')
 
     def transition_start(self):
         pool = Pool()
@@ -521,7 +517,7 @@
     def _group_request_key(self, request):
         return (('company', request.company),)
 
-    def transition_create_quotations(self):
+    def do_create_quotations(self, action):
         pool = Pool()
         Quotation = pool.get('purchase.request.quotation')
         QuotationLine = pool.get('purchase.request.quotation.line')
@@ -547,8 +543,12 @@
         QuotationLine.save(lines)
 
         self.model.update_state(requests)
-        self.succeed.number_quotations = len(quotations)
-        return 'succeed'
+        action['domain'] = []
+        if len(quotations) == 1:
+            action['views'].reverse()
+        return action, {
+            'res_id': list(map(int, quotations))
+            }
 
     def get_quotation(self, supplier, key):
         pool = Pool()
diff -r 38417ada2345 -r 080a54372a41 
modules/purchase_request_quotation/purchase.xml
--- a/modules/purchase_request_quotation/purchase.xml   Tue Nov 11 18:00:55 
2025 +0100
+++ b/modules/purchase_request_quotation/purchase.xml   Fri Jan 12 11:46:55 
2024 +0100
@@ -91,12 +91,6 @@
         </record>
 
         <record model="ir.ui.view"
-            id="purchase_request_quotation_create_succeed">
-            <field 
name="model">purchase.request.quotation.create.succeed</field>
-            <field name="type">form</field>
-            <field 
name="name">purchase_request_quotation_create_succeed_form</field>
-        </record>
-        <record model="ir.ui.view"
             id="purchase_request_quotation_create_ask_suppliers">
             <field 
name="model">purchase.request.quotation.create.ask_suppliers</field>
             <field name="type">form</field>
diff -r 38417ada2345 -r 080a54372a41 
modules/purchase_request_quotation/tests/scenario_purchase_request_quotation.rst
--- 
a/modules/purchase_request_quotation/tests/scenario_purchase_request_quotation.rst
  Tue Nov 11 18:00:55 2025 +0100
+++ 
b/modules/purchase_request_quotation/tests/scenario_purchase_request_quotation.rst
  Fri Jan 12 11:46:55 2024 +0100
@@ -108,24 +108,20 @@
     >>> assertEqual(create_quotation.form.suppliers, [supplier])
     >>> create_quotation.form.suppliers.append(Party(supplier2.id))
     >>> create_quotation.execute('create_quotations')
-    >>> create_quotation.execute('end')
+    >>> quotations = create_quotation.actions[0]
+    >>> len(quotations)
+    2
     >>> purchase_request.state
     'quotation'
 
 Check Quotation Lines (1 Request with 2 Suppliers = 2 Quotation Lines)::
 
-    >>> QuotationLine = Model.get('purchase.request.quotation.line')
-    >>> quotation_lines = QuotationLine.find(
-    ...     [('quotation_state', '=', 'draft')])
-    >>> len(quotation_lines)
-    2
+    >>> len(quotations[0].lines), len(quotations[1].lines)
+    (1, 1)
 
 Send Quotations::
 
     >>> Quotation = Model.get('purchase.request.quotation')
-    >>> quotations = Quotation.find([('state', '=', 'draft')])
-    >>> len(quotations)
-    2
     >>> for quotation in quotations:
     ...     quotation.click('send')
     >>> quotations = Quotation.find([('state', '=', 'sent')])
diff -r 38417ada2345 -r 080a54372a41 
modules/purchase_request_quotation/tryton.cfg
--- a/modules/purchase_request_quotation/tryton.cfg     Tue Nov 11 18:00:55 
2025 +0100
+++ b/modules/purchase_request_quotation/tryton.cfg     Fri Jan 12 11:46:55 
2024 +0100
@@ -21,7 +21,6 @@
     purchase.Quotation
     purchase.QuotationLine
     purchase.CreatePurchaseRequestQuotationAskSuppliers
-    purchase.CreatePurchaseRequestQuotationSucceed
     purchase.PurchaseRequest
 wizard:
     purchase.CreatePurchaseRequestQuotation
diff -r 38417ada2345 -r 080a54372a41 
modules/purchase_request_quotation/view/purchase_request_quotation_create_succeed_form.xml
--- 
a/modules/purchase_request_quotation/view/purchase_request_quotation_create_succeed_form.xml
        Tue Nov 11 18:00:55 2025 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0"?>
-<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
-this repository contains the full copyright notices and license terms. -->
-<form >
-    <image name="tryton-info" xexpand="0" xfill="0"/>
-    <label name="number_quotations"/>
-    <field name="number_quotations"/>
-</form>

Reply via email to