measurements default in product
This commit is contained in:
parent
553e3bf668
commit
1e03f2e213
52
product.py
52
product.py
@ -10,7 +10,6 @@ from trytond.pyson import Bool, If, Eval, Id
|
|||||||
from trytond.exceptions import UserError
|
from trytond.exceptions import UserError
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_RISK = [('', ""),
|
_RISK = [('', ""),
|
||||||
('uno', 'I'),
|
('uno', 'I'),
|
||||||
('dosA', 'IIA'),
|
('dosA', 'IIA'),
|
||||||
@ -109,9 +108,51 @@ class Template(metaclass=PoolMeta):
|
|||||||
warranty_uom = fields.Many2One('product.uom', 'Useful Life UOM',
|
warranty_uom = fields.Many2One('product.uom', 'Useful Life UOM',
|
||||||
domain=[('category', '=', Id('product', "uom_cat_time"))])
|
domain=[('category', '=', Id('product', "uom_cat_time"))])
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
@fields.depends('temperature')
|
||||||
|
def default_temperature_uom(self):
|
||||||
|
#raise UserError(str(dir(self.temperature)))
|
||||||
|
if self.temperature != float:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
pool = Pool()
|
||||||
|
Measurements = pool.get('product.uom')
|
||||||
|
measurement = Measurements.search(['name', '=', 'Celsius'])[0].id
|
||||||
|
|
||||||
|
return measurement
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_equipment():
|
def default_frequency_uom():
|
||||||
return False
|
pool = Pool()
|
||||||
|
Measurements = pool.get('product.uom')
|
||||||
|
measurement = Measurements.search(['name', '=', 'Hertz'])[0].id
|
||||||
|
|
||||||
|
return measurement
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def default_wet_uom():
|
||||||
|
pool = Pool()
|
||||||
|
Measurements = pool.get('product.uom')
|
||||||
|
measurement = Measurements.search(['name', '=', 'Relative Humedity'])[0].id
|
||||||
|
|
||||||
|
return measurement
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def default_voltageAC_uom():
|
||||||
|
pool = Pool()
|
||||||
|
Measurements = pool.get('product.uom')
|
||||||
|
measurement = Measurements.search(['name', '=', 'Volt'])[0].id
|
||||||
|
|
||||||
|
return measurement
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def default_voltageDC_uom():
|
||||||
|
pool = Pool()
|
||||||
|
Measurements = pool.get('product.uom')
|
||||||
|
measurement = Measurements.search(['name', '=', 'Volt'])[0].id
|
||||||
|
|
||||||
|
return measurement
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_risk():
|
def default_risk():
|
||||||
@ -137,6 +178,11 @@ class Template(metaclass=PoolMeta):
|
|||||||
def default_refurbish():
|
def default_refurbish():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def default_refurbish():
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
@fields.depends('mark_category', 'model_category')
|
@fields.depends('mark_category', 'model_category')
|
||||||
def on_change_mark_category(self):
|
def on_change_mark_category(self):
|
||||||
if self.mark_category:
|
if self.mark_category:
|
||||||
|
Loading…
Reference in New Issue
Block a user