update range axis X in graph

This commit is contained in:
raskolnikov 2023-02-13 07:46:33 -05:00
parent aff9915942
commit 5dd4826e1d

View File

@ -387,14 +387,58 @@ class Maintenance(Workflow, ModelSQL, ModelView):
Measurements = pool.get('product.uom')
self.temperature_uom = Measurements.search(['name', '=', 'Celsius'])[0].id
@fields.depends('moisture_min', 'moisture_uom')
def on_change_moisture_min(self):
pool = Pool()
Measurements = pool.get('product.uom')
self.moisture_uom = Measurements.search(['name', '=', 'Relative Humedity'])[0].id
@fields.depends('service_maintenance')
def on_change_service_maintenance(self):
if self.service_maintenance:
self.propietary = self.service_maintenance.propietary
self.propietary_address = self.service_maintenance.propietary_address
service = self.service_maintenance
self.temperature_min = service.temperature_min
self.temperature_max = service.temperature_max
self.temperature_uom = service.temperature_uom
self.moisture_min = service.moisture_min
self.moisture_max = service.moisture_max
self.moisture_uom = service.moisture_uom
else:
self.propietary = None
self.propietary_address = None
self.temperature_min = None
self.temperature_max = None
self.temperature_uom = None
self.moisture_min = None
self.moisture_max = None
self.moisture_uom = None
@fields.depends('equipment', 'patterns_equipments')
def on_change_equipment(self):
if self.equipment:
self.patterns_equipments = self.equipment.product.k_pattern
self.equipment_calibrate = self.equipment.product.calibration
self.initial_operation = self.equipment.product.initial_operation
self.check_equipment = self.equipment.product.check_equipment
self.check_electric_system = self.equipment.product.check_electric_system
self.clean_int_ext = self.equipment.product.clean_int_ext
self.clean_eyes = self.equipment.product.clean_eyes
self.check_calibration = self.equipment.product.check_calibration
else:
self.patterns_equipments = None
self.equipment_calibrate = False
self.initial_operation = False
self.check_equipment = False
self.check_electric_system = False
self.clean_int_ext = False
self.clean_eyes = False
self.check_calibration = False
def get_next_maintenance(self, action):
next_maintenance = None
if self.service_maintenance.estimated_agended:
@ -514,9 +558,13 @@ class Maintenance(Workflow, ModelSQL, ModelView):
ls = 'dotted'
fig, ax1 = plt.subplots(nrows=1, ncols=1)
## Límites del Eje Y
ax1.set_ylim(bottom, top)
ax1.set_xlim((-21, 21))
## Límites del Eje X
ax1.set_xlim((min(labels)-1, max(labels)+1))
ax1.yaxis.grid(True)
ax1.xaxis.grid(True)
ax1.set_title('Error[D]')
ax1.set_xlabel('Patrones')
@ -532,51 +580,6 @@ class Maintenance(Workflow, ModelSQL, ModelView):
return image.getvalue()
@fields.depends('service_maintenance')
def on_change_service_maintenance(self):
if self.service_maintenance:
self.propietary = self.service_maintenance.propietary
self.propietary_address = self.service_maintenance.propietary_address
service = self.service_maintenance
self.temperature_min = service.temperature_min
self.temperature_max = service.temperature_max
self.temperature_uom = service.temperature_uom
self.moisture_min = service.moisture_min
self.moisture_max = service.moisture_max
self.moisture_uom = service.moisture_uom
else:
self.propietary = None
self.propietary_address = None
self.temperature_min = None
self.temperature_max = None
self.temperature_uom = None
self.moisture_min = None
self.moisture_max = None
self.moisture_uom = None
@fields.depends('equipment', 'patterns_equipments')
def on_change_equipment(self):
if self.equipment:
self.patterns_equipments = self.equipment.product.k_pattern
self.equipment_calibrate = self.equipment.product.calibration
self.initial_operation = self.equipment.product.initial_operation
self.check_equipment = self.equipment.product.check_equipment
self.check_electric_system = self.equipment.product.check_electric_system
self.clean_int_ext = self.equipment.product.clean_int_ext
self.clean_eyes = self.equipment.product.clean_eyes
self.check_calibration = self.equipment.product.check_calibration
else:
self.patterns_equipments = None
self.equipment_calibrate = False
self.initial_operation = False
self.check_equipment = False
self.check_electric_system = False
self.clean_int_ext = False
self.clean_eyes = False
self.check_calibration = False
@classmethod
@ModelView.button
@Workflow.transition('in_progress')
@ -745,8 +748,7 @@ class Calibration(ModelSQL, ModelView):
class CalibrationSample(sequence_ordered(), ModelView, ModelSQL):
'Samples of Calibration'
__name__ = 'optical_equipment.maintenance.calibration_sample'
maintenance = fields.Many2One('optical_equipment.maintenance', 'Maintenance')
product = fields.Function(fields.Integer("Product ID"), 'on_change_with_product')
number_sample = fields.Float("Sample #", _digits)
@ -760,8 +762,6 @@ class CalibrationSample(sequence_ordered(), ModelView, ModelSQL):
states={'readonly': True},
depends=['mistake'])
@fields.depends('maintenance', '_parent_maintenance.equipment')
def on_change_with_product(self, name=None):
if self.maintenance:
@ -881,7 +881,6 @@ class ServiceMaintenanceAgended(ModelSQL):
'Service Maintenance - Agended'
__name__ = 'optical_equipment_maintenance.service-maintenance.diary'
maintenance_service = fields.Many2One('optical_equipment_maintenance.service', "Maintenance Service")
agended = fields.Many2One('optical_equipment_maintenance.diary', "Agended")