changeset f355521d6eb1 in modules/sale:default
details: https://hg.tryton.org/modules/sale?cmd=changeset;node=f355521d6eb1
description:
        Use search context for product field on line

        The context is only useful when searching product from line on the 
client.
        So it is better to minimize the context to improve the caching.

        issue9519
        review310181002
diffstat:

 sale.py |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 0173ea044cf9 -r f355521d6eb1 sale.py
--- a/sale.py   Mon Aug 10 23:38:04 2020 +0200
+++ b/sale.py   Sun Aug 16 16:52:00 2020 +0200
@@ -1090,19 +1090,21 @@
             'readonly': Eval('sale_state') != 'draft',
             },
         context={
+            'company': Eval('company', None),
+            },
+        search_context={
             'locations': If(Bool(Eval('_parent_sale', {}).get('warehouse')),
                 [Eval('_parent_sale', {}).get('warehouse', 0)], []),
             'stock_date_end': Eval('_parent_sale', {}).get('sale_date'),
             'stock_skip_warehouse': True,
-            # From _get_context_sale_price
-            'company': Eval('company', None),
             'currency': Eval('_parent_sale', {}).get('currency'),
             'customer': Eval('_parent_sale', {}).get('party'),
             'sale_date': Eval('_parent_sale', {}).get('sale_date'),
             'uom': Eval('unit'),
             'taxes': Eval('taxes', []),
             'quantity': Eval('quantity'),
-            }, depends=['type', 'sale_state', 'company'])
+            },
+        depends=['type', 'sale_state', 'company'])
     product_uom_category = fields.Function(
         fields.Many2One('product.uom.category', 'Product Uom Category'),
         'on_change_with_product_uom_category')

Reply via email to