Refactorizar módulo
This commit is contained in:
parent
ec2f410e92
commit
cf53beb47e
|
@ -1,3 +1,5 @@
|
|||
# The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta, Pool
|
||||
from trytond.pyson import Eval
|
||||
|
|
25
stock.py
25
stock.py
|
@ -1,3 +1,5 @@
|
|||
# The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta, Pool
|
||||
from trytond.pyson import Eval, Equal, Not, Bool
|
||||
|
@ -26,15 +28,15 @@ class Location:
|
|||
help='Enables storage space control',
|
||||
states={'invisible': Not(Equal(Eval('type'), 'storage'))},
|
||||
depends=['type'])
|
||||
storage_direction = fields.Selection([('', ''),
|
||||
('longitudinal', 'Longitudinal')], 'Storage direction',
|
||||
storage_direction = fields.Selection([('longitudinal', 'Longitudinal')],
|
||||
'Storage direction',
|
||||
states={'invisible': Not(Equal(Eval('type'), 'storage')),
|
||||
'required': Bool(Eval('control_space')),
|
||||
'readonly': True},
|
||||
depends=['type', 'control_space'])
|
||||
overload_behavior = fields.Selection([('', ''),
|
||||
('warn', 'Warn'),
|
||||
('stop', 'Stop')], 'Overload behavior',
|
||||
overload_behavior = fields.Selection([('warn', 'Warn'),
|
||||
('stop', 'Stop')],
|
||||
'Overload behavior',
|
||||
help='Determines system behavior when storage space is overloaded',
|
||||
states={'required': Bool(Eval('control_space')),
|
||||
'invisible': Not(Equal(Eval('type'), 'storage'))},
|
||||
|
@ -48,7 +50,7 @@ class Location:
|
|||
|
||||
@staticmethod
|
||||
def default_storage_direction():
|
||||
return ''
|
||||
return 'longitudinal'
|
||||
|
||||
@staticmethod
|
||||
def default_control_space():
|
||||
|
@ -56,7 +58,7 @@ class Location:
|
|||
|
||||
@staticmethod
|
||||
def default_overload_behavior():
|
||||
return ''
|
||||
return 'warn'
|
||||
|
||||
@classmethod
|
||||
def _extend_measure_field(cls, field):
|
||||
|
@ -72,13 +74,10 @@ class Location:
|
|||
|
||||
@fields.depends('control_space')
|
||||
def on_change_control_space(self):
|
||||
result = {'storage_direction': '',
|
||||
'overload_behavior': ''}
|
||||
if not self.control_space:
|
||||
return result
|
||||
result['storage_direction'] = 'longitudinal'
|
||||
result['overload_behavior'] = 'warn'
|
||||
return result
|
||||
return {}
|
||||
return {'storage_direction': 'longitudinal',
|
||||
'overload_behavior': 'warn'}
|
||||
|
||||
def storage_try(self, date, extra_space=float(0)):
|
||||
""" Determines if store in the location at date is possible"""
|
||||
|
|
Loading…
Reference in New Issue