Added DeactivableMixin
This commit is contained in:
parent
825e99ea3b
commit
533865538e
|
@ -1,20 +1,19 @@
|
|||
# The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.model import ModelSQL, ModelView, fields
|
||||
from trytond.model import ModelSQL, ModelView, fields, DeactivableMixin
|
||||
from trytond.pool import PoolMeta, Pool
|
||||
from trytond.pyson import Eval
|
||||
|
||||
__all__ = ['Combined', 'LocationCombined', 'Location']
|
||||
|
||||
|
||||
class Combined(ModelView, ModelSQL):
|
||||
class Combined(DeactivableMixin, ModelView, ModelSQL):
|
||||
"""Combined location"""
|
||||
__name__ = 'stock.location.combined'
|
||||
|
||||
name = fields.Char('Name', required=True, translate=True,
|
||||
states={'readonly': ~Eval('active')},
|
||||
depends=['active'])
|
||||
active = fields.Boolean('Active')
|
||||
code = fields.Char('Code')
|
||||
type = fields.Function(
|
||||
fields.Selection([], 'Locations type'),
|
||||
|
@ -37,10 +36,6 @@ class Combined(ModelView, ModelSQL):
|
|||
cls.locations.domain.append(
|
||||
('type', 'in', cls._locations_domain()))
|
||||
|
||||
@staticmethod
|
||||
def default_active():
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def _locations_domain(cls):
|
||||
return ['production']
|
||||
|
|
Loading…
Reference in New Issue