changeset f37a438501ee in modules/stock_quantity_early_planning:6.0
details: 
https://hg.tryton.org/modules/stock_quantity_early_planning?cmd=changeset&node=f37a438501ee
description:
        Use company from user and filter moves on company

        issue11025
        review374411002
        (grafted from 4b15fdbe5f36ed2a2e83955a5d1714afa7f553d5)
diffstat:

 stock.py |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r b43672608305 -r f37a438501ee stock.py
--- a/stock.py  Fri Nov 05 00:06:55 2021 +0100
+++ b/stock.py  Thu Dec 16 22:21:10 2021 +0100
@@ -220,12 +220,12 @@
         If warehouses is specified it searches only for moves from them.
         """
         pool = Pool()
-        Company = pool.get('company.company')
         Date = pool.get('ir.date')
         Location = pool.get('stock.location')
         Move = pool.get('stock.move')
         ProductQuantitiesByWarehouse = pool.get(
             'stock.product_quantities_warehouse')
+        User = pool.get('res.user')
 
         transaction = Transaction()
         today = Date.today()
@@ -234,7 +234,7 @@
                     ('type', '=', 'warehouse'),
                     ])
         if company is None:
-            company = Company(transaction.context.get('company'))
+            company = User(Transaction().user).company
 
         # Do not keep former plan as the may no more be valid
         opens = cls.search([
@@ -256,6 +256,7 @@
 
         for warehouse in warehouses:
             moves = Move.search([
+                    ('company', '=', company.id),
                     ('from_location', 'child_of', [warehouse.id], 'parent'),
                     ('to_location', 'not child_of', [warehouse.id], 'parent'),
                     ('planned_date', '>', today),

Reply via email to