Se añade tecnico responsable
This commit is contained in:
parent
4019750629
commit
92113f32cf
@ -1,14 +1,16 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.pool import Pool
|
||||
from . import (agended, balance_sale_party, calibration, configuration, contract, diary,
|
||||
equipment, party, product, maintenance, move, purchase, sale)
|
||||
from . import (agended, balance_sale_party, calibration, configuration,
|
||||
contract, company, diary, equipment, party, product,
|
||||
maintenance, move, purchase, sale)
|
||||
|
||||
__all__ = ['register']
|
||||
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
company.Emplyee,
|
||||
equipment.OpticalEquipment,
|
||||
equipment.EquipmentMaintenance,
|
||||
equipment.EquipmentContract,
|
||||
|
9
company.py
Normal file
9
company.py
Normal file
@ -0,0 +1,9 @@
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.model import fields
|
||||
|
||||
|
||||
class Emplyee(metaclass=PoolMeta):
|
||||
'Company'
|
||||
__name__ = 'company.employee'
|
||||
|
||||
invima = fields.Char('Invima')
|
10
company.xml
Normal file
10
company.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--This file file is part of Tryton. The COPYRIGHT file at the top level
|
||||
of this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<record model="ir.ui.view" id="employee_view_form">
|
||||
<field name="model">company.employee</field>
|
||||
<field name="inherit" ref="company.employee_view_form"/>
|
||||
<field name="name">employee_form</field>
|
||||
</record>
|
||||
</tryton>
|
@ -1,33 +1,51 @@
|
||||
from trytond.model import (
|
||||
ModelSingleton, ModelSQL, ModelView, fields)
|
||||
from trytond.pyson import Id
|
||||
from trytond.modules.company.model import (
|
||||
CompanyMultiValueMixin, CompanyValueMixin)
|
||||
from trytond.pyson import Id, Eval
|
||||
|
||||
|
||||
class Configuration(ModelSingleton, ModelSQL, ModelView, CompanyMultiValueMixin):
|
||||
class Configuration(ModelSingleton, ModelSQL, ModelView):
|
||||
'Equipment Configuration'
|
||||
__name__='optical_equipment.configuration'
|
||||
__name__ = 'optical_equipment.configuration'
|
||||
|
||||
equipment_sequence = fields.Many2One('ir.sequence', "Equipment Sequence",
|
||||
domain=[('sequence_type', '=', Id('optical_equipment', 'sequence_type_equipment'))])
|
||||
maintenance_sequence = fields.Many2One('ir.sequence', "Maintenance Sequence",
|
||||
domain=[('sequence_type', '=', Id('optical_equipment', 'sequence_type_maintenances'))])
|
||||
agended_sequence = fields.Many2One('ir.sequence', "Agended Sequence",
|
||||
domain=[('sequence_type', '=', Id('optical_equipment', 'sequence_type_agended'))])
|
||||
contract_sequence = fields.Many2One('ir.sequence', "Contract Sequence",
|
||||
domain=[('sequence_type', '=', Id('optical_equipment', 'sequence_type_contract'))])
|
||||
technician_responsible = fields.Many2One(
|
||||
'company.employee', "Technician Responsible")
|
||||
invima = fields.Char('Invima', states={
|
||||
'required': Eval('technician_responsible', True)
|
||||
})
|
||||
equipment_sequence = fields.Many2One(
|
||||
'ir.sequence', "Equipment Sequence", domain=[
|
||||
('sequence_type', '=',
|
||||
Id('optical_equipment', 'sequence_type_equipment'))])
|
||||
maintenance_sequence = fields.Many2One(
|
||||
'ir.sequence', "Maintenance Sequence",
|
||||
domain=[('sequence_type', '=',
|
||||
Id('optical_equipment', 'sequence_type_maintenances'))])
|
||||
agended_sequence = fields.Many2One(
|
||||
'ir.sequence', "Agended Sequence",
|
||||
domain=[('sequence_type', '=',
|
||||
Id('optical_equipment', 'sequence_type_agended'))])
|
||||
contract_sequence = fields.Many2One(
|
||||
'ir.sequence', "Contract Sequence", domain=[
|
||||
('sequence_type', '=',
|
||||
Id('optical_equipment', 'sequence_type_contract'))])
|
||||
temperature_min = fields.Float("Temp Min")
|
||||
temperature_max = fields.Float("Temp Max")
|
||||
temperature_uom = fields.Many2One('product.uom', 'Temperature UOM',
|
||||
domain=[('category', '=', Id('optical_equipment', "uom_cat_temperature"))],
|
||||
depends={'itemperature_min'})
|
||||
temperature_uom = fields.Many2One(
|
||||
'product.uom', 'Temperature UOM',
|
||||
domain=[
|
||||
('category', '=', Id(
|
||||
'optical_equipment', "uom_cat_temperature"))],
|
||||
depends={'itemperature_min'})
|
||||
moisture_min = fields.Float("Moisture Min")
|
||||
moisture_max = fields.Float("Moisture Max")
|
||||
moisture_uom = fields.Many2One('product.uom', "Moisture UOM",
|
||||
domain=[('category', '=', Id('optical_equipment', 'uom_cat_relative_humedity'))],
|
||||
depends={'moisture_min'})
|
||||
moisture_uom = fields.Many2One(
|
||||
'product.uom', "Moisture UOM",
|
||||
domain=[
|
||||
('category', '=', Id(
|
||||
'optical_equipment', 'uom_cat_relative_humedity'))],
|
||||
depends={'moisture_min'})
|
||||
sale_quote_number = fields.Many2One('ir.sequence', "Sale Quote Number",
|
||||
domain=[
|
||||
('sequence_type', '=', Id('sale','sequence_type_sale'))
|
||||
('sequence_type', '=', Id(
|
||||
'sale', 'sequence_type_sale'))
|
||||
])
|
||||
|
255
maintenance.py
255
maintenance.py
@ -40,7 +40,7 @@ class MaintenanceService(Workflow, ModelSQL, ModelView):
|
||||
sale_date = fields.Char("Sale Date")
|
||||
contract_origin = fields.Reference(
|
||||
"Contract Base", selection='get_origin_contract', select=True,
|
||||
states={'readonly': If(Eval('state') == 'finished', True)})
|
||||
states={'readonly': If(Eval('state') == 'finished', True)})
|
||||
sale_origin = fields.Reference(
|
||||
"Sale Origin", selection='get_origin', select=True,
|
||||
states={'readonly': True})
|
||||
@ -79,23 +79,27 @@ class MaintenanceService(Workflow, ModelSQL, ModelView):
|
||||
temperature_min = fields.Float("Temp Min", states={
|
||||
'readonly': If(Eval('state') == 'finished', True),
|
||||
'required': If(Eval('state') == 'in_progress', True)})
|
||||
temperature_max = fields.Float("Temp Max", states={
|
||||
temperature_max = fields.Float("Temp Max", states={
|
||||
'readonly': If(Eval('state') == 'finished', True),
|
||||
'required': If(Eval('state') == 'in_progress', True)})
|
||||
temperature_uom = fields.Many2One('product.uom', 'Temperature UOM',
|
||||
domain=[('category', '=', Id('optical_equipment', "uom_cat_temperature"))],
|
||||
states={'invisible': If(Eval('temperature_min') == None, True),
|
||||
'readonly': (Eval('state') == 'finished'),
|
||||
'required': If(Eval('state') == 'in_progress', True)},)
|
||||
moisture_min = fields.Float("Moisture Min", states={
|
||||
domain=[
|
||||
('category', '=', Id(
|
||||
'optical_equipment', "uom_cat_temperature"))],
|
||||
states={'invisible': If(Eval('temperature_min') is None, True),
|
||||
'readonly': (Eval('state') == 'finished'),
|
||||
'required': If(Eval('state') == 'in_progress', True)},)
|
||||
moisture_min = fields.Float("Moisture Min", states={
|
||||
'readonly': If(Eval('state') == 'finished', True),
|
||||
'required': If(Eval('state') == 'in_progress', True)})
|
||||
moisture_max = fields.Float("Moisture Max", states={
|
||||
'readonly': If(Eval('state') == 'finished', True),
|
||||
'required': If(Eval('state') == 'in_progress', True)})
|
||||
moisture_uom = fields.Many2One('product.uom', "Moisture UOM",
|
||||
domain=[('category', '=', Id('optical_equipment', 'uom_cat_relative_humedity'))],
|
||||
states={'invisible' : If(Eval('moisture_min') == None, True),
|
||||
domain=[
|
||||
('category', '=', Id(
|
||||
'optical_equipment', 'uom_cat_relative_humedity'))],
|
||||
states={'invisible': If(Eval('moisture_min') is None, True),
|
||||
'readonly': Eval('state') == 'finished',
|
||||
'required': If(Eval('state') == 'in_progress', True)},)
|
||||
|
||||
@ -234,7 +238,7 @@ class MaintenanceService(Workflow, ModelSQL, ModelView):
|
||||
pool = Pool()
|
||||
Config = pool.get('optical_equipment.configuration')
|
||||
config = Config(2)
|
||||
if config.maintenance_sequence != None:
|
||||
if config.maintenance_sequence is not None:
|
||||
if not maintenance.code:
|
||||
try:
|
||||
maintenance.code = config.maintenance_sequence.get()
|
||||
@ -305,62 +309,83 @@ class MaintenanceServiceLine(Workflow, ModelSQL, ModelView):
|
||||
('propietary_address', '=', Eval('propietary_address'))],
|
||||
states=_states,)
|
||||
equipment_calibrate = fields.Boolean("Calibrate Equipment", states={'readonly': True})
|
||||
#when the maintenance is in agended status
|
||||
# when the maintenance is in agended status
|
||||
diary = fields.One2Many('optical_equipment_maintenance.diary', 'diary')
|
||||
#Preventive maintenance
|
||||
# Preventive maintenance
|
||||
initial_operation = fields.Boolean("Verificación inicial de funcionamiento")
|
||||
check_equipment = fields.Boolean("Revisión del Equipo")
|
||||
check_electric_system = fields.Boolean("Revisión del sistema electríco")
|
||||
clean_int_ext = fields.Boolean("Limpieza interior y exterior")
|
||||
clean_eyes = fields.Boolean("Limpieza de lentes y espejos")
|
||||
check_calibration = fields.Boolean("Verificar Calibración")
|
||||
maintenance_activity = fields.One2Many('optical_equipment_maintenance.activity', 'maintenance', "Maintenance Activitys")
|
||||
#Calibration
|
||||
maintenance_activity = fields.One2Many(
|
||||
'optical_equipment_maintenance.activity',
|
||||
'maintenance',
|
||||
"Maintenance Activitys")
|
||||
# Calibration
|
||||
patterns_equipments = fields.Char("K Pattern", states={'readonly': True},)
|
||||
lines_calibration = fields.One2Many('optical_equipment.maintenance.calibration_sample', 'maintenance', "Lines of Calibration",
|
||||
states={'readonly': Eval('state') == 'finished'})
|
||||
calibration_total = fields.One2Many('optical_equipment.maintenance.calibration', 'maintenance', "Calibration Total",
|
||||
states={'readonly': Eval('state') == 'finished'})
|
||||
maintenance_lines = fields.One2Many('optical_equipment.maintenance.line', 'maintenance', 'Lines')
|
||||
maintenance_lines = fields.One2Many(
|
||||
'optical_equipment.maintenance.line', 'maintenance', 'Lines')
|
||||
description_activity = fields.Char('Activity')
|
||||
next_maintenance = fields.Function(fields.Date('Next Maintenance'), 'get_next_maintenance')
|
||||
temperature_min = fields.Float("Temp Min")
|
||||
temperature_max = fields.Float("Temp Max")
|
||||
temperature_uom = fields.Many2One('product.uom', 'Temperature UOM',
|
||||
domain=[('category', '=', Id('optical_equipment', "uom_cat_temperature"))],
|
||||
states={'invisible': If(Eval('temperature_min') == None, True),
|
||||
'readonly' : (Eval('state') == 'finished')},)
|
||||
domain=[
|
||||
('category', '=', Id(
|
||||
'optical_equipment', "uom_cat_temperature"))],
|
||||
states={'invisible': If(Eval('temperature_min') is None, True),
|
||||
'readonly': (Eval('state') == 'finished')},)
|
||||
moisture_min = fields.Float("Moisture Min")
|
||||
moisture_max = fields.Float("Moisture Max")
|
||||
moisture_uom = fields.Many2One('product.uom', "Moisture UOM",
|
||||
domain=[('category', '=', Id('optical_equipment', 'uom_cat_relative_humedity'))],
|
||||
states={'invisible' : If(Eval('moisture_min') == None, True),
|
||||
'readonly': Eval('state') == 'finished'},)
|
||||
domain=[
|
||||
('category', '=', Id(
|
||||
'optical_equipment', 'uom_cat_relative_humedity'))],
|
||||
states={'invisible': If(Eval('moisture_min') is None, True),
|
||||
'readonly': Eval('state') == 'finished'},)
|
||||
graph_calibration = fields.Binary('Graphs')
|
||||
rec_name = fields.Function(fields.Char('rec_name'), 'get_rec_name')
|
||||
|
||||
# @fields.depends('maintenance_type', 'code')
|
||||
# def get_rec_name(self, name):
|
||||
# if self.maintenance_type and self.code:
|
||||
# name = str(self.maintenance_type) + '@' + str(self.code)
|
||||
# else:
|
||||
# name = str(self.maintenance_type) + '@' + 'Borrador'
|
||||
# return name
|
||||
technician_responsible = fields.Char('Technician Responsible')
|
||||
invima = fields.Char('Invima')
|
||||
|
||||
@classmethod
|
||||
def default_technician_responsible(cls):
|
||||
pool = Pool()
|
||||
ConfigurationEquipment = pool.get('optical_equipment.configuration')
|
||||
config = ConfigurationEquipment(1)
|
||||
|
||||
if config.technician_responsible:
|
||||
technician_responsible = config.technician_responsible
|
||||
return technician_responsible.party.name
|
||||
|
||||
@classmethod
|
||||
def default_invima(cls):
|
||||
pool = Pool()
|
||||
ConfigurationEquipment = pool.get('optical_equipment.configuration')
|
||||
config = ConfigurationEquipment(1)
|
||||
if config.technician_responsible.invima:
|
||||
return config.technician_responsible.invima
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(MaintenanceServiceLine, cls).__setup__()
|
||||
cls._transitions.update({
|
||||
('draft', 'finished')
|
||||
})
|
||||
('draft', 'finished')
|
||||
})
|
||||
cls._buttons.update({
|
||||
'in_progress': {'invisible': Eval('state').in_(['draft', 'in_progress', 'finished'])},
|
||||
'finished': {'invisible': (Eval('state').in_(['finished'])) |
|
||||
((Eval('maintenance_type') == 'corrective') & (Eval('maintenance_lines') == ()))},
|
||||
'samples': {'invisible': (Eval('state').in_(['finished'])) | (Eval('lines_calibration') != ()) | (~Eval('equipment_calibrate'))},
|
||||
'calibrate': {'invisible': (Eval('lines_calibration') == ()) | (Eval('state').in_(['finished'])),
|
||||
'depends': ['state'],}
|
||||
})
|
||||
'depends': ['state'], }
|
||||
})
|
||||
|
||||
@classmethod
|
||||
def view_attributes(cls):
|
||||
@ -368,17 +393,16 @@ class MaintenanceServiceLine(Workflow, ModelSQL, ModelView):
|
||||
('//page[@id="preventive"]', 'states', {
|
||||
'invisible': If(Eval('maintenance_type') == 'corrective', True),
|
||||
}),
|
||||
('//page[@id="corrective"]', 'states',{
|
||||
('//page[@id="corrective"]', 'states', {
|
||||
'invisible': If(Eval('maintenance_type') != 'corrective', True),
|
||||
}),
|
||||
('//page[@id="calibration"]', 'states',{
|
||||
('//page[@id="calibration"]', 'states', {
|
||||
'invisible': ~Eval('equipment_calibrate'),
|
||||
}),
|
||||
('//page[@id="graph"]', 'states',{
|
||||
('//page[@id="graph"]', 'states', {
|
||||
'invisible': ~Eval('equipment_calibrate'),
|
||||
})
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def default_company():
|
||||
@ -386,15 +410,15 @@ class MaintenanceServiceLine(Workflow, ModelSQL, ModelView):
|
||||
|
||||
@classmethod
|
||||
def default_state(cls):
|
||||
return 'draft'
|
||||
return 'draft'
|
||||
|
||||
@classmethod
|
||||
def default_maintenance_type(cls):
|
||||
return 'preventive'
|
||||
return 'preventive'
|
||||
|
||||
@classmethod
|
||||
def default_state_agended(cls):
|
||||
return 'no_agenda'
|
||||
return 'no_agenda'
|
||||
|
||||
@fields.depends('temperature_min', 'temperature_uom')
|
||||
def on_change_temperature_min(self):
|
||||
@ -469,7 +493,7 @@ class MaintenanceServiceLine(Workflow, ModelSQL, ModelView):
|
||||
sum_samples = sum(samples)
|
||||
n_samples = len(samples)
|
||||
mean = sum_samples / n_samples
|
||||
dev_std_square = sum((l-mean)**2 for l in samples) / (n_samples - 1)
|
||||
dev_std_square = sum((l - mean)**2 for l in samples) / (n_samples - 1)
|
||||
dev_std = mt.sqrt(dev_std_square)
|
||||
|
||||
return dev_std
|
||||
@ -480,7 +504,7 @@ class MaintenanceServiceLine(Workflow, ModelSQL, ModelView):
|
||||
uncertain type A
|
||||
"""
|
||||
n_samples = len(samples)
|
||||
uncertain_type_A = dev_std /mt.sqrt(n_samples)
|
||||
uncertain_type_A = dev_std / mt.sqrt(n_samples)
|
||||
|
||||
return uncertain_type_A
|
||||
|
||||
@ -507,16 +531,16 @@ class MaintenanceServiceLine(Workflow, ModelSQL, ModelView):
|
||||
return d
|
||||
|
||||
def get_uncertain_b2_digital(self):
|
||||
uncertain_b2 = d/2*mt.sqrt(3)
|
||||
uncertain_b2 = d / 2 * mt.sqrt(3)
|
||||
|
||||
return uncertain_b2
|
||||
|
||||
|
||||
def get_uncertain_b2_analog(self):
|
||||
"""
|
||||
Incertidumbre por resolución Análoga
|
||||
a contante que viene del equipo
|
||||
"""
|
||||
uncertain_b2_analog = d/a * math.sqrt(3)
|
||||
uncertain_b2_analog = d / a * math.sqrt(3)
|
||||
|
||||
return uncertain_b2_analog
|
||||
|
||||
@ -533,24 +557,26 @@ class MaintenanceServiceLine(Workflow, ModelSQL, ModelView):
|
||||
"""
|
||||
Grados Efectivos de libertad
|
||||
"""
|
||||
uncertain_eff = uncertain_c**4/((uncertain_type_A**4)/(len(sample)-1)+(uncertain_b1**4/U_subi)+(uncertain_b2**4/U_subi))
|
||||
uncertain_eff = uncertain_c**4 / \
|
||||
((uncertain_type_A**4) / (len(sample) - 1) +
|
||||
(uncertain_b1**4 / U_subi) + (uncertain_b2**4 / U_subi))
|
||||
|
||||
return uncertain_eff
|
||||
|
||||
|
||||
def get_create_graph(matrix, patterns, resolution, equipment_risk):
|
||||
image = BytesIO()
|
||||
errors = []
|
||||
yerr = []
|
||||
|
||||
upresolution = resolution if resolution >=0 else (resolution*-1)
|
||||
lowresolution = resolution if resolution < 0 else (resolution*-1)
|
||||
upresolution = resolution if resolution >= 0 else (resolution * -1)
|
||||
lowresolution = resolution if resolution < 0 else (resolution * -1)
|
||||
|
||||
count = 0
|
||||
for pattern in patterns:
|
||||
error = pattern - matrix[count][0]
|
||||
error = pattern - matrix[count][0]
|
||||
yerr.append(matrix[count][1])
|
||||
errors.append(error)
|
||||
count+=1
|
||||
count += 1
|
||||
|
||||
labels = list(patterns)
|
||||
|
||||
@ -571,11 +597,11 @@ class MaintenanceServiceLine(Workflow, ModelSQL, ModelView):
|
||||
ls = 'dotted'
|
||||
fig, ax1 = plt.subplots(nrows=1, ncols=1)
|
||||
|
||||
## Límites del Eje Y
|
||||
# Límites del Eje Y
|
||||
ax1.set_ylim(bottom, top)
|
||||
## Límites del Eje X
|
||||
ax1.set_xlim((min(labels)-1, max(labels)+1))
|
||||
|
||||
# Límites del Eje X
|
||||
ax1.set_xlim((min(labels) - 1, max(labels) + 1))
|
||||
|
||||
ax1.yaxis.grid(True)
|
||||
ax1.xaxis.grid(True)
|
||||
|
||||
@ -583,8 +609,8 @@ class MaintenanceServiceLine(Workflow, ModelSQL, ModelView):
|
||||
ax1.set_xlabel('Patrones')
|
||||
ax1.set_ylabel('Valores Observados')
|
||||
|
||||
ax1.set_yticks([lowresolution,0.0,upresolution])
|
||||
#ax1.set_xticks([-10.0,-5.0,0.0,5.0,10.0])
|
||||
ax1.set_yticks([lowresolution, 0.0, upresolution])
|
||||
# ax1.set_xticks([-10.0,-5.0,0.0,5.0,10.0])
|
||||
|
||||
ax1.errorbar(x, y, yerr=yerr, marker='D', markersize=10, linestyle=ls)
|
||||
|
||||
@ -598,7 +624,7 @@ class MaintenanceServiceLine(Workflow, ModelSQL, ModelView):
|
||||
@Workflow.transition('in_progress')
|
||||
def in_progress(cls, maintenances):
|
||||
pass
|
||||
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('finished')
|
||||
@ -621,16 +647,16 @@ class MaintenanceServiceLine(Workflow, ModelSQL, ModelView):
|
||||
for pattern in patterns:
|
||||
samples = []
|
||||
calibrationSample = CalibrationSample(
|
||||
maintenance=maintenance.id,
|
||||
product=maintenance.equipment.product.template.id,
|
||||
value_patterns=pattern.id,
|
||||
value_equipment=pattern.pattern,
|
||||
mistake=0,
|
||||
mistake_rate=0)
|
||||
samples = [calibrationSample]*5
|
||||
maintenance.lines_calibration+=tuple(samples)
|
||||
maintenance=maintenance.id,
|
||||
product=maintenance.equipment.product.template.id,
|
||||
value_patterns=pattern.id,
|
||||
value_equipment=pattern.pattern,
|
||||
mistake=0,
|
||||
mistake_rate=0)
|
||||
samples = [calibrationSample] * 5
|
||||
maintenance.lines_calibration += tuple(samples)
|
||||
maintenance.save()
|
||||
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
def calibrate(cls, maintenances):
|
||||
@ -651,39 +677,45 @@ class MaintenanceServiceLine(Workflow, ModelSQL, ModelView):
|
||||
dates[line.value_patterns.pattern] = [line.value_equipment]
|
||||
else:
|
||||
dates[line.value_patterns.pattern].append(line.value_equipment)
|
||||
|
||||
|
||||
for pattern in patterns:
|
||||
samples = dates[pattern]
|
||||
mean = sum(samples)/len(samples)
|
||||
mean = sum(samples) / len(samples)
|
||||
U_subi = maintenance.equipment.product.Usubi
|
||||
uncertain_pattern = maintenance.equipment.product.uncertainy_pattern
|
||||
MEP = maintenance.equipment.product.MEP
|
||||
dev_std = cls.get_standard_deviation(samples)
|
||||
uncertain_type_A = cls.get_uncertain_type_A(samples, dev_std)
|
||||
k_certificated_calibration = 2
|
||||
uncertain_b1 = MEP / mt.sqrt(3) #Ub1_patron a 2 Decimales
|
||||
uncertain_b1a = uncertain_pattern / k_certificated_calibration #Ub1_MEP
|
||||
uncertain_b1 = MEP / mt.sqrt(3) # Ub1_patron a 2 Decimales
|
||||
uncertain_b1a = uncertain_pattern / k_certificated_calibration # Ub1_MEP
|
||||
|
||||
if maintenance.equipment.product.resolution_type == "analoga":
|
||||
a_resolution = maintenance.equipment.product.analog_resolution
|
||||
resolution = a_resolution
|
||||
factor_a = maintenance.equipment.product.a_factor_resolution
|
||||
uncertain_b2_analog = (a_resolution) / (factor_a*mt.sqrt(3))
|
||||
sum_uncertain_c = (uncertain_type_A**2) + (uncertain_b1**2) + (uncertain_b2_analog**2)
|
||||
uncertain_b2_analog = (a_resolution) / (factor_a * mt.sqrt(3))
|
||||
sum_uncertain_c = (uncertain_type_A**2) + \
|
||||
(uncertain_b1**2) + (uncertain_b2_analog**2)
|
||||
uncertain_c = mt.sqrt(sum_uncertain_c)
|
||||
uncertain_eff = uncertain_c**4/((uncertain_type_A**4)/(len(samples)-1)+(uncertain_b1**4/U_subi)+(uncertain_b2_analog**4/U_subi))
|
||||
uncertain_eff = uncertain_c**4 / \
|
||||
((uncertain_type_A**4) / (len(samples) - 1) +
|
||||
(uncertain_b1**4 / U_subi) + (uncertain_b2_analog**4 / U_subi))
|
||||
elif maintenance.equipment.product.resolution_type == "digital":
|
||||
d_resolution = maintenance.equipment.product.d_resolution
|
||||
resolution = d_resolution
|
||||
uncertain_b2_digital = (d_resolution) / (2*mt.sqrt(3))
|
||||
sum_uncertain_c = (uncertain_type_A**2) + (uncertain_b1**2) + (uncertain_b2_digital**2)
|
||||
uncertain_b2_digital = (d_resolution) / (2 * mt.sqrt(3))
|
||||
sum_uncertain_c = (uncertain_type_A**2) + \
|
||||
(uncertain_b1**2) + (uncertain_b2_digital**2)
|
||||
uncertain_c = mt.sqrt(sum_uncertain_c)
|
||||
uncertain_eff = uncertain_c**4/((uncertain_type_A**4)/(len(samples)-1)+(uncertain_b1**4/U_subi)+(uncertain_b2_digital**4/U_subi))
|
||||
|
||||
t_student = t.ppf(1-0.025, uncertain_eff)
|
||||
uncertain_expanded = round((t_student * uncertain_c),2)
|
||||
dates_mistake_pattern.append([mean,uncertain_expanded])
|
||||
|
||||
uncertain_eff = uncertain_c**4 / \
|
||||
((uncertain_type_A**4) / (len(samples) - 1) +
|
||||
(uncertain_b1**4 / U_subi) + (uncertain_b2_digital**4 / U_subi))
|
||||
|
||||
t_student = t.ppf(1 - 0.025, uncertain_eff)
|
||||
uncertain_expanded = round((t_student * uncertain_c), 2)
|
||||
dates_mistake_pattern.append([mean, uncertain_expanded])
|
||||
|
||||
if maintenance.equipment.product.resolution_type == "analoga":
|
||||
calibrationLineTotal = CalibrationLineTotal(
|
||||
diopter=pattern,
|
||||
@ -726,7 +758,8 @@ class MaintenanceServiceLine(Workflow, ModelSQL, ModelView):
|
||||
maintenance.save()
|
||||
|
||||
equipment_risk = maintenance.equipment.product.risk
|
||||
image = cls.get_create_graph(dates_mistake_pattern, patterns, resolution, equipment_risk)
|
||||
image = cls.get_create_graph(
|
||||
dates_mistake_pattern, patterns, resolution, equipment_risk)
|
||||
maintenance.graph_calibration = image
|
||||
maintenance.save()
|
||||
|
||||
@ -735,40 +768,56 @@ class MaintenanceLine(ModelSQL, ModelView):
|
||||
'Maintenance Line'
|
||||
__name__ = 'optical_equipment.maintenance.line'
|
||||
|
||||
line_replace = fields.Boolean("Replace", states={'readonly': If(Eval('line_maintenance_activity') == True, True)})
|
||||
line_maintenance_activity = fields.Boolean("Maintenance Activity", states={'readonly': If(Eval('line_replace') == True, True)})
|
||||
maintenance = fields.Many2One('optical_equipment.maintenance', 'Maintenance', ondelete='CASCADE', select=True)
|
||||
line_replace = fields.Boolean(
|
||||
"Replace",
|
||||
states={
|
||||
'readonly': If(
|
||||
Eval('line_maintenance_activity') == True,
|
||||
True)})
|
||||
line_maintenance_activity = fields.Boolean(
|
||||
"Maintenance Activity", states={
|
||||
'readonly': If(
|
||||
Eval('line_replace') == True, True)})
|
||||
maintenance = fields.Many2One(
|
||||
'optical_equipment.maintenance',
|
||||
'Maintenance',
|
||||
ondelete='CASCADE',
|
||||
select=True)
|
||||
replacement = fields.Many2One('product.product', 'Replacement', ondelete='RESTRICT',
|
||||
domain=[('replacement', '=', True)],
|
||||
states={'invisible': (If(Eval('line_maintenance_activity') == True, True)) | (If(Eval('line_replace') == False, True)),
|
||||
'required': If(Eval('line_replace') == True, True)},
|
||||
states={'invisible': (If(Eval('line_maintenance_activity') == True, True)) | (If(Eval('line_replace') == False, True)),
|
||||
'required': If(Eval('line_replace') == True, True)},
|
||||
depends={'line_replace'})
|
||||
maintenance_activity = fields.Many2One('product.product', 'Maintenance activity',
|
||||
domain=[('maintenance_activity', '=', True)],
|
||||
states={'invisible': If(Eval('line_replace') == True, True) |
|
||||
(If(Eval('line_maintenance_activity') == False, True)),
|
||||
'required': If(Eval('line_maintenance_actitvity') == True, True)},
|
||||
states={'invisible': If(Eval('line_replace') == True, True) |
|
||||
(If(Eval('line_maintenance_activity') == False, True)),
|
||||
'required': If(Eval('line_maintenance_actitvity') == True, True)},
|
||||
depends={'line_maintenance_activity'})
|
||||
|
||||
|
||||
quantity = fields.Float("Quantity", required=True, digits='unit')
|
||||
actual_quantity = fields.Float(
|
||||
"Actual Quantity", digits='unit', readonly=True,
|
||||
states={
|
||||
'invisible': Eval('type') != 'line',
|
||||
})
|
||||
})
|
||||
unit = fields.Many2One('product.uom', 'Unit', ondelete='RESTRICT',
|
||||
states={
|
||||
'readonly': Eval('_parent_maintenance.state') != 'draft',
|
||||
},domain=[If(Bool(Eval('product_uom_category')),
|
||||
('category', '=', Eval('product_uom_category')),
|
||||
('category', '!=', -1)),
|
||||
])
|
||||
}, domain=[If(Bool(Eval('product_uom_category')),
|
||||
('category', '=', Eval('product_uom_category')),
|
||||
('category', '!=', -1)),
|
||||
])
|
||||
product_uom_category = fields.Function(fields.Many2One('product.uom.category', 'Product Uom Category'),
|
||||
'on_change_with_product_uom_category')
|
||||
description = fields.Text("Description", states={
|
||||
'readonly': Eval('_parent_maintenance.state') != 'draft',
|
||||
})
|
||||
company = fields.Function(fields.Many2One('company.company', "Company"),'on_change_with_company')
|
||||
company = fields.Function(
|
||||
fields.Many2One(
|
||||
'company.company',
|
||||
"Company"),
|
||||
'on_change_with_company')
|
||||
|
||||
@fields.depends('maintenance', '_parent_maintenance.company')
|
||||
def on_change_with_company(self, name=None):
|
||||
@ -778,12 +827,12 @@ class MaintenanceLine(ModelSQL, ModelView):
|
||||
@fields.depends('line_replace', 'replacement')
|
||||
def on_change_line_replace(self, name=None):
|
||||
if self.line_replace == False:
|
||||
self.replacement = None
|
||||
self.replacement = None
|
||||
|
||||
@fields.depends('line_maintenance_activity', 'maintenance_activity')
|
||||
def on_change_line_maintenance_activity(self, name=None):
|
||||
if self.line_maintenance_activity == False:
|
||||
self.maintenance_activity = None
|
||||
self.maintenance_activity = None
|
||||
|
||||
@fields.depends('replacement', 'maintenance', 'unit', 'maintenance')
|
||||
def on_change_replacement(self):
|
||||
@ -823,8 +872,8 @@ class ChangePropietaryMaintenance(ModelView):
|
||||
old_propietary = fields.Many2One('party.party', 'Old Propietary',
|
||||
states={'required': True})
|
||||
maintenance_service = fields.Many2Many('optical_equipment_maintenance.service', None, None, "Maintenance Service",
|
||||
domain=[('propietary', '=', Eval('old_propietary'))],
|
||||
depends=['old_propietary'])
|
||||
domain=[('propietary', '=', Eval('old_propietary'))],
|
||||
depends=['old_propietary'])
|
||||
new_propietary = fields.Many2One('party.party', "New Propietary",
|
||||
states={'required': True})
|
||||
new_address = fields.Many2One('party.address', "New Address", required=True,
|
||||
@ -844,7 +893,7 @@ class NewPropietaryMaintenance(Wizard):
|
||||
__name__ = 'optical_equipment.change_propietary_maintenance'
|
||||
|
||||
start = StateView('optical_equipment.change_propietary_maintenance.form',
|
||||
'optical_equipment.change_propietary_maintenance_view_form',[
|
||||
'optical_equipment.change_propietary_maintenance_view_form', [
|
||||
Button('Cancel', 'end', 'tryton-cancel'),
|
||||
Button('Create', 'change_propietary', 'tryton-ok', default=True),
|
||||
])
|
||||
|
@ -12,6 +12,7 @@ depends:
|
||||
purchase
|
||||
sale
|
||||
xml:
|
||||
company.xml
|
||||
equipment.xml
|
||||
calibration.xml
|
||||
contract.xml
|
||||
|
@ -20,7 +20,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<label name="sale_quote_number"/>
|
||||
<field name="sale_quote_number"/>
|
||||
<newline/>
|
||||
<separator id="separator_configuraton" colspan="4"/>
|
||||
|
||||
<separator id="environmental_conditions" string="Environmental Conditions" colspan="4"/>
|
||||
<newline/>
|
||||
<label name="temperature_min"/>
|
||||
@ -41,4 +41,11 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<label name="moisture_uom"/>
|
||||
<field name="moisture_uom"/>
|
||||
<newline/>
|
||||
|
||||
<separator id="technician_responsible" string="Technician Responsible" colspan="4"/>
|
||||
<label name="technician_responsible"/>
|
||||
<field name="technician_responsible"/>
|
||||
|
||||
<label name="invima"/>
|
||||
<field name="invima"/>
|
||||
</form>
|
||||
|
10
view/employee_form.xml
Normal file
10
view/employee_form.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath expr="//field[@name='supervisor']" position="after">
|
||||
<label name="invima"/>
|
||||
<field name="invima"/>
|
||||
<newline/>
|
||||
</xpath>
|
||||
</data>
|
@ -73,6 +73,12 @@
|
||||
</page>
|
||||
</notebook>
|
||||
<newline/>
|
||||
<label name="technician_responsible"/>
|
||||
<field name="technician_responsible"/>
|
||||
|
||||
<label name="invima"/>
|
||||
<field name="invima"/>
|
||||
|
||||
<label name="state"/>
|
||||
<field name="state"/>
|
||||
<group id="button">
|
||||
|
Loading…
Reference in New Issue
Block a user