Add user to API of _non_moves_clause

Since issue10859 there is an additional user parameter.

issue10932
review377491002
This commit is contained in:
Cédric Krier committed 2021-11-20 00:06:20 +01:00
1 parent 2c63905549
commit 712a079ea4
1 file changed
+4 -10
+4 -10
View File
@@ -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