changeset 4b15fdbe5f36 in modules/stock_quantity_early_planning:default
details:
https://hg.tryton.org/modules/stock_quantity_early_planning?cmd=changeset&node=4b15fdbe5f36
description:
Use company from user and filter moves on company
issue11025
review374411002
diffstat:
stock.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (33 lines):
diff -r df358a8f2ab6 -r 4b15fdbe5f36 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),