Corrección de bugs
This commit is contained in:
parent
242f31ce09
commit
5058339aa1
19
stock.py
19
stock.py
|
@ -51,7 +51,7 @@ class Location:
|
|||
states={'invisible': Not(Equal(Eval('type'), 'storage')),
|
||||
'required': Bool(Eval('control_space'))},
|
||||
depends=['type', 'control_space']),
|
||||
'on_change_with_space_unit')
|
||||
'get_space_unit')
|
||||
space_unit_digits = fields.Function(fields.Integer('Space Digits'),
|
||||
'on_change_with_space_unit_digits')
|
||||
|
||||
|
@ -73,6 +73,16 @@ class Location:
|
|||
def default_space_measure():
|
||||
return 'length'
|
||||
|
||||
@staticmethod
|
||||
def default_space_unit():
|
||||
pool = Pool()
|
||||
Modeldata = pool.get('ir.model.data')
|
||||
res = Location.default_space_measure()
|
||||
if res == 'length':
|
||||
return Modeldata.get_id('product', 'uom_meter')
|
||||
if res == 'surface':
|
||||
return Modeldata.get_id('product', 'uom_square_meter')
|
||||
|
||||
@staticmethod
|
||||
def default_control_space():
|
||||
return False
|
||||
|
@ -96,13 +106,14 @@ class Location:
|
|||
return {}
|
||||
return {'space_measure': 'length',
|
||||
'overload_behavior': 'warn',
|
||||
'space_unit': self.on_change_with_space_unit()}
|
||||
'space_unit': self.get_space_unit()}
|
||||
|
||||
@fields.depends('space_measure')
|
||||
def on_change_with_space_unit(self, name=None):
|
||||
def get_space_unit(self, name=None):
|
||||
pool = Pool()
|
||||
Modeldata = pool.get('ir.model.data')
|
||||
|
||||
if not getattr(self, 'space_measure', None):
|
||||
return None
|
||||
if self.space_measure == 'length':
|
||||
return Modeldata.get_id('product', 'uom_meter')
|
||||
if self.space_measure == 'surface':
|
||||
|
|
Loading…
Reference in New Issue