File: stock.py

package info (click to toggle)
tryton-modules-stock-location-sequence 5.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 304 kB
  • sloc: python: 141; xml: 18; makefile: 6; sh: 3
file content (19 lines) | stat: -rw-r--r-- 673 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# This file is part of Tryton.  The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import sequence_ordered
from trytond.pyson import Eval, Bool
from trytond.pool import PoolMeta

__all__ = ['Location']


class Location(sequence_ordered(), metaclass=PoolMeta):
    "Stock Location"
    __name__ = 'stock.location'

    @classmethod
    def __setup__(cls):
        super(Location, cls).__setup__()
        previous_readonly = cls.sequence.states.get('readonly', Bool(False))
        cls.sequence.states['readonly'] = previous_readonly | ~Eval('active')
        cls.sequence.depends = ['active']