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

        issue11025
        review374411002
        (grafted from 4b15fdbe5f36ed2a2e83955a5d1714afa7f553d5)
diffstat:

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

diffs (33 lines):

diff -r b152a5bce138 -r a1cb8a2af026 stock.py
--- a/stock.py  Thu Dec 16 22:11:07 2021 +0100
+++ b/stock.py  Thu Dec 16 22:21:10 2021 +0100
@@ -226,19 +226,18 @@
         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')
+        User = pool.get('res.user')
 
-        transaction = Transaction()
         today = Date.today()
         if warehouses is None:
             warehouses = Location.search([
                     ('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([
@@ -260,6 +259,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