-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathproduct.py
30 lines (25 loc) · 969 Bytes
/
product.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- coding: utf-8 -*-
"""
product.py
:copyright: (c) 2014 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
from trytond.pyson import PYSONEncoder, PYSONDecoder
from trytond.modules.stock import ProductByLocation
__all__ = ['ProductByLocationExcludeAssigned']
class ProductByLocationExcludeAssigned(ProductByLocation):
"""
Show Product by Locations excluding assigned quantities
"""
__name__ = 'product.by_location.exclude_assigned'
def do_open(self, action):
action, data = super(
ProductByLocationExcludeAssigned, self
).do_open(action)
# Decode pyson context
context = PYSONDecoder().decode(action['pyson_context'])
# Update context
context['stock_assign'] = True
# Encode the new context to create new pyson context
action['pyson_context'] = PYSONEncoder().encode(context)
return action, data