From 712a079ea4d7bc518a7d72ecb66548f1ec2a7fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 20 Nov 2021 00:06:20 +0100 Subject: [PATCH] Add user to API of _non_moves_clause Since issue10859 there is an additional user parameter. issue10932 review377491002 --- product.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/product.py b/product.py index fb0568f1b9..e0099aae69 100644 --- a/product.py +++ b/product.py @@ -262,14 +262,8 @@ class ProductCostHistory(metaclass=PoolMeta): __name__ = 'product.product.cost_history' @classmethod - def _non_moves_clause(cls, history_table): - pool = Pool() - Company = pool.get('company.company') - clause = super()._non_moves_clause(history_table) - context = Transaction().context - if context.get('company'): - company = Company(context['company']) - if company.cost_price_warehouse: - warehouse = context.get('warehouse') - clause &= history_table.warehouse == warehouse + def _non_moves_clause(cls, history_table, user): + clause = super()._non_moves_clause(history_table, user) + if user.company and user.company.cost_price_warehouse: + clause &= history_table.warehouse == user.warehouse return clause