calibration
This commit is contained in:
parent
e630edb389
commit
a1b4cc5616
19
__init__.py
19
__init__.py
@ -1,6 +1,6 @@
|
||||
from trytond.pool import Pool
|
||||
from . import (address, diary, party, product, purchase, sale,
|
||||
equipment, configuration_equipment, maintenance, move, subscription, exceptions)
|
||||
equipment, configuration_equipment, contract, maintenance, move, exceptions)
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
@ -9,11 +9,14 @@ def register():
|
||||
party.Party,
|
||||
product.Template,
|
||||
product.Product,
|
||||
product.Pattern,
|
||||
purchase.Purchase,
|
||||
purchase.Line,
|
||||
equipment.OpticalEquipment,
|
||||
equipment.EquipmentMaintenance,
|
||||
configuration_equipment.Configuration,
|
||||
maintenance.CreateContractInitial,
|
||||
maintenance.CalibrationSample,
|
||||
maintenance.Maintenance,
|
||||
maintenance.MaintenanceService,
|
||||
maintenance.MaintenanceActivity,
|
||||
@ -25,18 +28,12 @@ def register():
|
||||
move.ShipmentOut,
|
||||
sale.Sale,
|
||||
sale.SaleLine,
|
||||
subscription.Contract,
|
||||
subscription.Subscription,
|
||||
subscription.CreateInitialContract,
|
||||
subscription.CreateNextProrogue,
|
||||
subscription.ContractSupscription,
|
||||
subscription.ContractEquipment,
|
||||
subscription.SubscriptionEquipment,
|
||||
contract.Contract,
|
||||
contract.ContractEquipment,
|
||||
contract.ContractMaintenanceServices,
|
||||
module='optical_equipment', type_='model')
|
||||
Pool.register(
|
||||
subscription.CreateContract,
|
||||
subscription.CreateProrogue,
|
||||
subscription.CreateSubscriptionInvoice,
|
||||
maintenance.AssingAgended,
|
||||
maintenance.ReAssingAgended,
|
||||
maintenance.CreateContract,
|
||||
module='optical_equipment', type_='wizard')
|
||||
|
@ -6,10 +6,13 @@ class Configuration(ModelSingleton, ModelSQL, ModelView):
|
||||
'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'))
|
||||
])
|
||||
|
6
diary.py
6
diary.py
@ -5,13 +5,11 @@ class Diary(ModelSQL, ModelView):
|
||||
'Diary'
|
||||
__name__ = 'optical_equipment_maintenance.diary'
|
||||
|
||||
code = fields.Char(
|
||||
"Code", select=True,states={'readonly': True })
|
||||
|
||||
code = fields.Char("Code", select=True,states={'readonly': True })
|
||||
date_expected = fields.DateTime("Expected Date")
|
||||
date_estimated = fields.DateTime("Estimated Date")
|
||||
date_end = fields.DateTime("Date End")
|
||||
maintenance_service = fields.Many2One('optical_equipment.maintenance.service', 'Maintenance Service')
|
||||
maintenance_service = fields.Many2One('optical_equipment_maintenance.service', 'Maintenance Service')
|
||||
technical = fields.Many2One('company.employee', "Technical")
|
||||
|
||||
state = fields.Selection([('draft', "Draft"),
|
||||
|
106
diary.xml
Normal file
106
diary.xml
Normal file
@ -0,0 +1,106 @@
|
||||
<?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. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record model="res.group" id="group_agended_admin">
|
||||
<field name="name">Agended Administration</field>
|
||||
</record>
|
||||
<record model="res.user-res.group"
|
||||
id="user_admin_group_agended_admin">
|
||||
<field name="user" ref="res.user_admin"/>
|
||||
<field name="group" ref="group_agended_admin"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window" id="act_agended_list_form">
|
||||
<field name="name">Agended</field>
|
||||
<field name="res_model">optical_equipment_maintenance.diary</field>
|
||||
<field name="search_value"></field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id= "agended_list_view_tree">
|
||||
<field name="model">optical_equipment_maintenance.diary</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">diary_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="agended_list_view_form">
|
||||
<field name="model">optical_equipment_maintenance.diary</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">diary_form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain" id="act_agended_list_form_domain_draft">
|
||||
<field name="name">Draft</field>
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="domain"
|
||||
eval="[('state', '=', 'draft')]"
|
||||
pyson="1"/>
|
||||
<field name="count" eval="True"/>
|
||||
<field name="act_window" ref="act_agended_list_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain" id="act_agended_list_form_domain_agended">
|
||||
<field name="name">Agended</field>
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="domain"
|
||||
eval="[('state', '=', 'agended')]"
|
||||
pyson="1"/>
|
||||
<field name="count" eval="True"/>
|
||||
<field name="act_window" ref="act_agended_list_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain" id="act_agended_list_form_domain_in_progress">
|
||||
<field name="name">In progress</field>
|
||||
<field name="sequence" eval="30"/>
|
||||
<field name="domain"
|
||||
eval="[('state', '=', 'in_progress')]"
|
||||
pyson="1"/>
|
||||
<field name="count" eval="True"/>
|
||||
<field name="act_window" ref="act_agended_list_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain" id="act_agended_list_form_domain_failed">
|
||||
<field name="name">Failed</field>
|
||||
<field name="sequence" eval="30"/>
|
||||
<field name="domain"
|
||||
eval="[('state', '=', 'failed')]"
|
||||
pyson="1"/>
|
||||
<field name="count" eval="True"/>
|
||||
<field name="act_window" ref="act_agended_list_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain" id="act_agended_list_form_domain_finished">
|
||||
<field name="name">Finished</field>
|
||||
<field name="sequence" eval="40"/>
|
||||
<field name="domain"
|
||||
eval="[('state', '=', 'finished')]"
|
||||
pyson="1"/>
|
||||
<field name="count" eval="True"/>
|
||||
<field name="act_window" ref="act_agended_list_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain" id="act_agended_list_form_domain_all">
|
||||
<field name="name">All</field>
|
||||
<field name="sequence" eval="9999"/>
|
||||
<field name="domain"></field>
|
||||
<field name="act_window" ref="act_agended_list_form"/>
|
||||
</record>
|
||||
<record model="ir.sequence.type" id="sequence_type_agended">
|
||||
<field name="name">Agended</field>
|
||||
</record>
|
||||
<record model="ir.sequence.type-res.group"
|
||||
id="sequence_type_agended_group_admin">
|
||||
<field name="sequence_type" ref="sequence_type_agended"/>
|
||||
<field name="group" ref="res.group_admin"/>
|
||||
</record>
|
||||
<record model="ir.sequence.type-res.group"
|
||||
id="sequence_type_agended_group_agended_admin">
|
||||
<field name="sequence_type" ref="sequence_type_agended"/>
|
||||
<field name="group" ref="group_agended_admin"/>
|
||||
</record>
|
||||
<record model="ir.sequence" id="sequence_agended">
|
||||
<field name="name">Agended</field>
|
||||
<field name="sequence_type" ref="sequence_type_agended"/>
|
||||
</record>
|
||||
<menuitem parent="menu_equipment"
|
||||
name="Diary"
|
||||
sequence="10"
|
||||
id="menu_diary"/>
|
||||
<menuitem parent="menu_diary"
|
||||
action="act_agended_list_form"
|
||||
sequence="20"
|
||||
id="menu_agended_list_form"/>
|
||||
</data>
|
||||
</tryton>
|
21
equipment.py
21
equipment.py
@ -88,11 +88,10 @@ class OpticalEquipment(DeactivableMixin, Workflow, ModelSQL, ModelView):
|
||||
depends=_depends)
|
||||
health_register = fields.Char("Health Register", size=None,
|
||||
states=_states,)
|
||||
|
||||
subscription_history = fields.Many2Many('sale.subscription-optical_equipment.equipment',
|
||||
'equipment','subscription', "Subscriptions",
|
||||
states={'readonly': True}
|
||||
)
|
||||
contract_history = fields.Many2Many('optical_equipment.contract-optical_equipment.equipment', 'equipment','Contracts', "Contracts", states={'readonly': True})
|
||||
#subscription_history = fields.Many2Many('sale.subscription-optical_equipment.equipment',
|
||||
# 'equipment','subscription', "Subscriptions",
|
||||
# states={'readonly': True})
|
||||
|
||||
contract_history = fields.Many2Many('optical_equipment.contract-optical_equipment.equipment',
|
||||
'equipment', 'contract')
|
||||
@ -160,6 +159,7 @@ class OpticalEquipment(DeactivableMixin, Workflow, ModelSQL, ModelView):
|
||||
|
||||
return [Sale.__name__]
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_destination(cls):
|
||||
Model = Pool().get('ir.model')
|
||||
@ -169,8 +169,6 @@ class OpticalEquipment(DeactivableMixin, Workflow, ModelSQL, ModelView):
|
||||
return [(None, '')] + [(m, get_name(m)) for m in models]
|
||||
|
||||
|
||||
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(OpticalEquipment, cls).__setup__()
|
||||
@ -296,7 +294,14 @@ class OpticalEquipment(DeactivableMixin, Workflow, ModelSQL, ModelView):
|
||||
|
||||
class EquipmentMaintenance(ModelSQL, ModelView):
|
||||
'Optical Equipment - Equipment - Maintenance'
|
||||
__name__='optical_equipment.maintenance-optical_equipment.equipment'
|
||||
__name__ ='optical_equipment.maintenance-optical_equipment.equipment'
|
||||
|
||||
equipment = fields.Many2One('optical_equipment.equipment', 'Equipment', select=True)
|
||||
maintenance = fields.Many2One('optical_equipment.maintenance', 'Maintenances', select=True)
|
||||
|
||||
class EquipmentContract(ModelSQL, ModelView):
|
||||
'Optical Equipment - Contracs Equipment'
|
||||
__name__ = 'optical_equipment.contract-optical_equipment.equipment'
|
||||
|
||||
equipment = fields.Many2One('optical_equipment.equipment', 'Equipment', select=True)
|
||||
contract = fields.Many2One('optical_equipment.contract', 'Contract', select=True)
|
||||
|
@ -100,7 +100,7 @@
|
||||
</record>
|
||||
<menuitem parent="menu_equipment"
|
||||
action="act_optical_equipment_form"
|
||||
sequence="20"
|
||||
sequence="60"
|
||||
id="menu_optical_equipment_form"/>
|
||||
|
||||
<record model="ir.action.act_window" id="act_optical_equipment_form1">
|
||||
@ -130,7 +130,7 @@
|
||||
<menuitem
|
||||
parent="menu_equipment"
|
||||
action="act_optical_equipment_form1"
|
||||
sequence="30"
|
||||
sequence="70"
|
||||
id="menu_optical_equipment_serial_form"/>
|
||||
|
||||
<record model="ir.ui.menu-res.group"
|
||||
|
139
locale/es.po
139
locale/es.po
@ -362,40 +362,6 @@ msgctxt "field:purchase.line,health_register:"
|
||||
msgid "Health Register"
|
||||
msgstr "Registro Invima"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:sale_subscription.menu_service_form"
|
||||
msgid "Subscription Services"
|
||||
msgstr "Servicios de Contrato"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:sale_subscription.menu_configuration"
|
||||
msgid "Subscription"
|
||||
msgstr "Contratos"
|
||||
|
||||
|
||||
msgctxt "field:sale.configuration,subscription_sequence:"
|
||||
msgid "Subscription Sequence"
|
||||
msgstr "Sequencia de contrato"
|
||||
|
||||
msgctxt "view:sale.subscription:"
|
||||
msgid "Subscription"
|
||||
msgstr "Contrato"
|
||||
|
||||
msgctxt "view:sale.subscription:"
|
||||
msgid "Equipments"
|
||||
msgstr "Equipos"
|
||||
|
||||
|
||||
msgctxt "field:sale.subscription.line,subscription_start_date:"
|
||||
msgid "Subscription Start Date"
|
||||
msgstr "Fecha inicial del contrato"
|
||||
|
||||
msgctxt "field:sale.subscription.line,subscription_end_date:"
|
||||
msgid "Subscription End Date"
|
||||
msgstr "Fecha final del Contrato"
|
||||
|
||||
msgctxt ""
|
||||
"model:ir.action.act_window.domain,name:act_subscription_form_domain_closed"
|
||||
msgid "Closed"
|
||||
msgstr "Vencidas"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_contracts"
|
||||
msgid "Contracts Management"
|
||||
@ -413,9 +379,6 @@ msgctxt "model:ir.ui.menu,name:menu_contract_form"
|
||||
msgid "Contracts"
|
||||
msgstr "Contratos"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:sale_subscription.menu_subscription_form"
|
||||
msgid "Subscriptions"
|
||||
msgstr "Prorrogas y Contratos"
|
||||
|
||||
msgctxt "field:optical_equipment.contract,company:"
|
||||
msgid "Company"
|
||||
@ -445,9 +408,6 @@ msgctxt "field:optical_equipment.contract,invoice_address:"
|
||||
msgid "Invoice Address"
|
||||
msgstr "Dirección de Facturación"
|
||||
|
||||
msgctxt "field:optical_equipment.contract,invoice_recurrence:"
|
||||
msgid "Invoice Recurrence"
|
||||
msgstr "Recurrencia de Facturación"
|
||||
|
||||
msgctxt "field:optical_equipment.contract,start_date:"
|
||||
msgid "Start Date"
|
||||
@ -517,105 +477,6 @@ msgctxt "selection:optical_equipment.contract,state:"
|
||||
msgid "Cancelled"
|
||||
msgstr "Cancelado"
|
||||
|
||||
msgctxt "field:optical_equipment.contract,prorogues:"
|
||||
msgid "Prorrogation"
|
||||
msgstr "Prorrogaciones"
|
||||
|
||||
msgctxt "field:optical_equipment_prorogue.next,initial_contract:"
|
||||
msgid "Initial Contract"
|
||||
msgstr "Contrato Inicial"
|
||||
|
||||
msgctxt "field:optical_equipment_prorogue.next,contact:"
|
||||
msgid "Contact"
|
||||
msgstr "Contacto"
|
||||
|
||||
msgctxt "field:optical_equipment_prorogue.next,invoice_address:"
|
||||
msgid "Invoice Address"
|
||||
msgstr "Dirección de Facturación"
|
||||
|
||||
msgctxt "field:optical_equipment_prorogue.next,invoice_recurrence:"
|
||||
msgid "Invoice Recurrence"
|
||||
msgstr "Recurrencia de Facturación"
|
||||
|
||||
msgctxt "field:optical_equipment_prorogue.next,payment_term:"
|
||||
msgid "Payment Term"
|
||||
msgstr "Plazo de Pago"
|
||||
|
||||
msgctxt "field:optical_equipment_prorogue.next,start_date:"
|
||||
msgid "Start Date"
|
||||
msgstr "Fecha Inicial"
|
||||
|
||||
msgctxt "field:optical_equipment_prorogue.next,end_date:"
|
||||
msgid "End Date"
|
||||
msgstr "Fecha Final"
|
||||
|
||||
msgctxt "field:optical_equipment_prorogue.next,invoice_start_date:"
|
||||
msgid "Invoice Start Date"
|
||||
msgstr "Fecha Inicio Facturación"
|
||||
|
||||
msgctxt "field:optical_equipment_prorogue.next,service:"
|
||||
msgid "Service"
|
||||
msgstr "Servicio"
|
||||
|
||||
msgctxt "field:optical_equipment_prorogue.next,quantity:"
|
||||
msgid "Quantity"
|
||||
msgstr "Cantidad"
|
||||
|
||||
msgctxt "field:optical_equipment_prorogue.next,unit_price:"
|
||||
msgid "Unit Price"
|
||||
msgstr "Precio Unitario"
|
||||
|
||||
msgctxt "field:optical_equipment_prorogue.next,equipments:"
|
||||
msgid "Equipments"
|
||||
msgstr "Equipos"
|
||||
|
||||
msgctxt "field:optical_equipment_contract.initial,party:"
|
||||
msgid "Party"
|
||||
msgstr "Tercero"
|
||||
|
||||
msgctxt "field:optical_equipment_contract.initial,contact:"
|
||||
msgid "Contact"
|
||||
msgstr "Contacto"
|
||||
|
||||
msgctxt "field:optical_equipment_contract.initial,invoice_address:"
|
||||
msgid "Invoice Address"
|
||||
msgstr "Dirección de Facturación"
|
||||
|
||||
msgctxt "field:optical_equipment_contract.initial,invoice_recurrence:"
|
||||
msgid "Invoice Recurrence"
|
||||
msgstr "Recurrencia de Facturación"
|
||||
|
||||
msgctxt "field:optical_equipment_contract.initial,payment_term:"
|
||||
msgid "Payment Term"
|
||||
msgstr "Plazo de Pago"
|
||||
|
||||
msgctxt "field:optical_equipment_contract.initial,start_date:"
|
||||
msgid "Start Date"
|
||||
msgstr "Fecha Inicial"
|
||||
|
||||
msgctxt "field:optical_equipment_contract.initial,end_date:"
|
||||
msgid "End Date"
|
||||
msgstr "Fecha Final"
|
||||
|
||||
msgctxt "field:optical_equipment_contract.initial,invoice_start_date:"
|
||||
msgid "Invoice Start Date"
|
||||
msgstr "Fecha Inicio Facturación"
|
||||
|
||||
msgctxt "field:optical_equipment_contract.initial,service:"
|
||||
msgid "Service"
|
||||
msgstr "Servicio"
|
||||
|
||||
msgctxt "field:optical_equipment_contract.initial,quantity:"
|
||||
msgid "Quantity"
|
||||
msgstr "Cantidad"
|
||||
|
||||
msgctxt "field:optical_equipment_contract.initial,unit_price:"
|
||||
msgid "Unit Price"
|
||||
msgstr "Precio Unitario"
|
||||
|
||||
msgctxt "field:optical_equipment_contract.initial,equipments:"
|
||||
msgid "Equipments"
|
||||
msgstr "Equipos"
|
||||
|
||||
msgctxt "model:ir.action.act_window.domain,name:act_contract_form_domain_draft"
|
||||
msgid "Draft"
|
||||
|
@ -1,5 +0,0 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:sale_subscription.menu_subscription_form"
|
276
maintenance.py
276
maintenance.py
@ -7,6 +7,10 @@ from trytond.wizard import (
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pyson import Bool, Eval, If, Id
|
||||
from trytond.pool import Pool
|
||||
from trytond.modules.currency.fields import Monetary
|
||||
from trytond.modules.product import price_digits
|
||||
|
||||
import datetime
|
||||
from datetime import timedelta
|
||||
import math as mt
|
||||
import numpy as np
|
||||
@ -16,7 +20,7 @@ from trytond.exceptions import UserError
|
||||
|
||||
class MaintenanceService(Workflow, ModelSQL, ModelView):
|
||||
'Equipment Maintenance Service'
|
||||
__name__ = 'optical_equipment.maintenance.service'
|
||||
__name__ = 'optical_equipment_maintenance.service'
|
||||
|
||||
_states = {'readonly': If(Eval('state') != 'draft', True)}
|
||||
|
||||
@ -25,6 +29,8 @@ class MaintenanceService(Workflow, ModelSQL, ModelView):
|
||||
help="The identification of an external origin.")
|
||||
description = fields.Char("Description",states=_states)
|
||||
sale_date = fields.Char("Sale Date")
|
||||
contract_origin = fields.Reference("Contract Base", selection='get_origin_contract', select=True,
|
||||
states={'readonly': True})
|
||||
sale_origin = fields.Reference("Sale Origin", selection='get_origin', select=True,
|
||||
states={'readonly': True})
|
||||
company = fields.Many2One('company.company', "Company", readonly=True)
|
||||
@ -38,7 +44,7 @@ class MaintenanceService(Workflow, ModelSQL, ModelView):
|
||||
lines = fields.One2Many('optical_equipment.maintenance', 'service_maintenance', "Lines",
|
||||
states={'readonly': If(Eval('state') != 'in_progress', True)})
|
||||
estimated_agended = fields.DateTime("Date Maintenance", states=_states)
|
||||
history_agended = fields.Many2Many('optical_equipment.maintenance.service-maintenance.diary', 'maintenance_service', 'agended', "History Agended", readonly=True)
|
||||
history_agended = fields.Many2Many('optical_equipment_maintenance.service-maintenance.diary', 'maintenance_service', 'agended', "History Agended", readonly=True)
|
||||
state_agended = fields.Selection([('no_agenda', "No agenda"),
|
||||
('agended', "Agended"),
|
||||
('in_progress', "In progress"),
|
||||
@ -98,6 +104,22 @@ class MaintenanceService(Workflow, ModelSQL, ModelView):
|
||||
|
||||
return [(None, '')] + [(m, get_name(m)) for m in models]
|
||||
|
||||
@classmethod
|
||||
def _get_origin_contract(cls):
|
||||
'Return list of Model names for origin Reference'
|
||||
pool = Pool()
|
||||
Sale = pool.get('optical_equipment.contract')
|
||||
|
||||
return [Sale.__name__]
|
||||
|
||||
@classmethod
|
||||
def get_origin_contract(cls):
|
||||
Model = Pool().get('ir.model')
|
||||
get_name = Model.get_name
|
||||
models = cls._get_origin()
|
||||
|
||||
return [(None, '')] + [(m, get_name(m)) for m in models]
|
||||
|
||||
@classmethod
|
||||
def set_code(cls, maintenance):
|
||||
pool = Pool()
|
||||
@ -132,7 +154,7 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
||||
__name__ = 'optical_equipment.maintenance'
|
||||
|
||||
|
||||
service_maintenance = fields.Many2One('optical_equipment.maintenance.service', "Maintenance Service",
|
||||
service_maintenance = fields.Many2One('optical_equipment_maintenance.service', "Maintenance Service",
|
||||
ondelete='CASCADE', select=True)
|
||||
code = fields.Char(
|
||||
"Code", select=True,states={'readonly': True })
|
||||
@ -142,9 +164,6 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
||||
], "Maintenance Type")
|
||||
|
||||
state = fields.Selection([('draft', "Draft"),
|
||||
('agended', "Agended"),
|
||||
('in_progress', "In Progress"),
|
||||
('failed', "Failed"),
|
||||
('finished', "Finished")
|
||||
], "State",required=True, readonly=True, sort=False)
|
||||
|
||||
@ -160,25 +179,44 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
||||
depends=['service_maintenance'])
|
||||
#when the maintenance is in agended status
|
||||
diary = fields.One2Many('optical_equipment_maintenance.diary', 'diary')
|
||||
estimated_agended = fields.DateTime("Date Maintenance")
|
||||
state_agended = fields.Selection([('no_agenda', "No agenda"),
|
||||
('agended', "Agended"),
|
||||
('in_progress', "In progress"),
|
||||
('finish', "Finish"),
|
||||
('failed', "Failed")], "State Agenda")
|
||||
technical = fields.Many2One('company.employee', "Technical")
|
||||
|
||||
#estimated_agended = fields.DateTime("Date Maintenance")
|
||||
#state_agended = fields.Selection([('no_agenda', "No agenda"),
|
||||
# ('agended', "Agended"),
|
||||
# ('in_progress', "In progress"),
|
||||
# ('finish', "Finish"),
|
||||
# ('failed', "Failed")], "State Agenda")
|
||||
#technical = fields.Many2One('company.employee', "Technical")
|
||||
#Preventive maintenance
|
||||
initial_operation = fields.Boolean("Verificiación inicial de funcionamiento")
|
||||
check_equipment = fields.Boolean("Revisión del Equipo")
|
||||
check_eletric_system = fields.Boolean("Revisión del sistema electríco")
|
||||
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")
|
||||
optical = fields.Boolean("Optical")
|
||||
check_calibration = fields.Boolean("Verificar Calibración")
|
||||
maintenance_activity = fields.One2Many('optical_equipment_maintenance.activity', 'maintenance', "Maintenance Activitys")
|
||||
#Calibration
|
||||
patterns_equipments = fields.Char("K Pattern", states={'readonly': True},
|
||||
depends=['equipment'])
|
||||
lines_calibration = fields.One2Many('optical_equipment.maintenance.calibration_sample', 'maintenance', "Lines of Calibration")
|
||||
|
||||
maintenance_lines = fields.One2Many('optical_equipment.maintenance.line', 'maintenance', 'Lines')
|
||||
|
||||
"""
|
||||
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)},
|
||||
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'))],
|
||||
states={'invisible' : If(Eval('moisture_min') == None, True)},
|
||||
depends=['moisture_min'])
|
||||
"""
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(Maintenance, cls).__setup__()
|
||||
@ -198,6 +236,41 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
||||
self.propietary = self.service_maintenance.propietary
|
||||
self.propietary_address = self.service_maintenance.propietary_address
|
||||
|
||||
@fields.depends('equipment', 'patterns_equipments')
|
||||
def on_change_equipment(self):
|
||||
if self.equipment and self.equipment.product.calibration:
|
||||
self.patterns_equipments = self.equipment.product.k_pattern
|
||||
else:
|
||||
self.patterns_equipments = None
|
||||
|
||||
@classmethod
|
||||
def default_initial_operation(cls):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def default_check_equipment(cls):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def default_check_electric_system(cls):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def default_clean_int_ext(cls):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def default_clean_eyes(cls):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def default_optical(cls):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def default_check_calibration(cls):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def default_state(cls):
|
||||
return 'draft'
|
||||
@ -210,6 +283,7 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
||||
def default_state_agended(cls):
|
||||
return 'no_agenda'
|
||||
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('in_progress')
|
||||
@ -234,6 +308,117 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
||||
})
|
||||
]
|
||||
|
||||
class CreateContractInitial(ModelView, ModelSQL):
|
||||
'Create Contract Inicial'
|
||||
__name__ = 'optical_equipment_create.contract'
|
||||
|
||||
company = fields.Many2One(
|
||||
'company.company', "Company", readonly=True, required=True, select=True,
|
||||
states={
|
||||
'readonly': (Eval('state') != 'draft') | Eval('party', True),
|
||||
},help="Make the subscription belong to the company.")
|
||||
party = fields.Many2One(
|
||||
'party.party', "Party", required=True,
|
||||
help="The party who subscribes.")
|
||||
invoice_address = fields.Many2One('party.address', 'Invoice Address',
|
||||
required=True, domain=[('party', '=', Eval('party'))])
|
||||
payment_term = fields.Many2One('account.invoice.payment_term',
|
||||
'Payment Term')
|
||||
contact = fields.Many2One(
|
||||
'party.contact_mechanism', "Contact", required=True,
|
||||
domain=[('party', '=', Eval('party'))],
|
||||
context={
|
||||
'company': Eval('company', -1),
|
||||
})
|
||||
start_date = fields.Date("Start Date", required=True)
|
||||
end_date = fields.Date("End Date",
|
||||
domain=['OR',
|
||||
('end_date', '>=', If(
|
||||
Bool(Eval('start_date')),
|
||||
Eval('start_date', datetime.date.min),
|
||||
datetime.date.min)),
|
||||
('end_date', '=', None),
|
||||
])
|
||||
|
||||
|
||||
@staticmethod
|
||||
def default_company():
|
||||
return Transaction().context.get('company')
|
||||
|
||||
@classmethod
|
||||
def default_start_date(cls):
|
||||
pool = Pool()
|
||||
Date = pool.get('ir.date')
|
||||
return Date.today()
|
||||
|
||||
|
||||
@fields.depends('party')
|
||||
def on_change_party(self):
|
||||
pool = Pool()
|
||||
Date = pool.get('ir.date')
|
||||
if self.party:
|
||||
self.invoice_address = self.party.address_get(type='invoice')
|
||||
if self.party.client_type == "ips":
|
||||
self.end_date = Date.today() + timedelta(days=365)
|
||||
else:
|
||||
self.end_date = Date.today() + timedelta(days=182)
|
||||
|
||||
|
||||
class CreateContract(Wizard):
|
||||
__name__ = 'optical_equipment.maintenance.contract'
|
||||
|
||||
start = StateView('optical_equipment_create.contract',
|
||||
'optical_equipment.create_contract_view_form',[
|
||||
Button('Cancel', 'end', 'tryton-cancel'),
|
||||
Button('Create', 'create_contract', 'tryton-ok', default=True),
|
||||
])
|
||||
create_contract = StateAction('optical_equipment.act_contract_form')
|
||||
|
||||
|
||||
@property
|
||||
def _subscription_start(self):
|
||||
return dict(
|
||||
party=self.start.party,
|
||||
contact=self.start.contact,
|
||||
start_date=self.start.start_date,
|
||||
end_date=self.start.end_date,
|
||||
invoice_address=self.start.invoice_address
|
||||
)
|
||||
def _create_contract_base(self, dates, subscription):
|
||||
pool = Pool()
|
||||
ContractBase = pool.get('optical_equipment.contract')
|
||||
|
||||
a = self._subscription_start
|
||||
|
||||
contractBase = ContractBase(
|
||||
state='draft',
|
||||
party=a['party'],
|
||||
invoice_address=a['invoice_address'],
|
||||
start_date=a['start_date'],
|
||||
end_date=a['end_date'],
|
||||
contact=a['contact'],
|
||||
equipments=a['equipments']
|
||||
)
|
||||
contractBase.save()
|
||||
|
||||
def do_create_contract(self, action):
|
||||
maintenance_service = self.records[0]
|
||||
pool = Pool()
|
||||
Contract = pool.get('optical_equipment.contract')
|
||||
|
||||
dates = self._subscription_start
|
||||
|
||||
prorogues = (maintenance_service,)
|
||||
contract = Contract(party=dates['party'],
|
||||
invoice_address=dates['invoice_address'],
|
||||
contact=dates['contact'],
|
||||
start_date=dates['start_date'],
|
||||
end_date=dates['end_date'],
|
||||
maintenance_services=prorogues
|
||||
)
|
||||
contract.save()
|
||||
|
||||
|
||||
class MaintenanceActivity(ModelView, ModelSQL):
|
||||
'Maintenance Activitys'
|
||||
__name__ = 'optical_equipment_maintenance.activity'
|
||||
@ -246,7 +431,7 @@ class AgendedInitial(ModelView):
|
||||
'Agended maintenance service'
|
||||
__name__ = 'optical_equipment_maintenance.agended'
|
||||
|
||||
maintenance_service = fields.Many2One('optical_equipment.maintenance.service',"Maintenaince Service",
|
||||
maintenance_service = fields.Many2One('optical_equipment_maintenance.service',"Maintenaince Service",
|
||||
required=True, domain=[('state', '=', 'draft')])
|
||||
estimated_agended = fields.DateTime("Date Maintenance", required=True)
|
||||
technical = fields.Many2One('company.employee', "Technical", required=True)
|
||||
@ -263,11 +448,16 @@ class AssingAgended(Wizard):
|
||||
|
||||
assing_agended = StateAction('optical_equipment.act_maintenance_service_form')
|
||||
|
||||
|
||||
def do_assing_agended(self, action):
|
||||
pool = Pool()
|
||||
Diary = pool.get('optical_equipment_maintenance.diary')
|
||||
MaintenanceService = pool.get('optical_equipment.maintenance.service')
|
||||
diary = Diary(maintenance_service=self.start.maintenance_service,
|
||||
Config = pool.get('optical_equipment.configuration')
|
||||
config = Config(3)
|
||||
|
||||
MaintenanceService = pool.get('optical_equipment_maintenance.service')
|
||||
diary = Diary(code=config.agended_sequence.get(),
|
||||
maintenance_service=self.start.maintenance_service,
|
||||
date_expected=self.start.estimated_agended,
|
||||
date_estimated=self.start.estimated_agended + timedelta(days=15),
|
||||
date_end=self.start.estimated_agended + timedelta(days=15),
|
||||
@ -289,7 +479,7 @@ class ReAgended(ModelView):
|
||||
'Agended maintenance service'
|
||||
__name__ = 'optical_equipment_maintenance.reagended'
|
||||
|
||||
maintenance_service = fields.Many2One('optical_equipment.maintenance.service',"Maintenaince Service",
|
||||
maintenance_service = fields.Many2One('optical_equipment_maintenance.service',"Maintenaince Service",
|
||||
required=True, domain=[('state', '=', 'failed')])
|
||||
estimated_agended = fields.DateTime("Date Maintenance", required=True)
|
||||
technical = fields.Many2One('company.employee', "Technical", required=True)
|
||||
@ -329,9 +519,10 @@ class ReAssingAgended(Wizard):
|
||||
|
||||
class ServiceMaintenanceAgended(ModelSQL):
|
||||
'Service Maintenance - Agended'
|
||||
__name__ = 'optical_equipment.maintenance.service-maintenance.diary'
|
||||
__name__ = 'optical_equipment_maintenance.service-maintenance.diary'
|
||||
|
||||
maintenance_service = fields.Many2One('optical_equipment.maintenance.service', "Maintenance Service")
|
||||
|
||||
maintenance_service = fields.Many2One('optical_equipment_maintenance.service', "Maintenance Service")
|
||||
agended = fields.Many2One('optical_equipment_maintenance.diary', "Agended")
|
||||
|
||||
|
||||
@ -353,6 +544,8 @@ class Calibration(ModelSQL, ModelView):
|
||||
'Calibration of Maintenance'
|
||||
__name__ = 'optical_equipment.maintenance.calibration'
|
||||
|
||||
maintenance = fields.Many2One('optical_equipment.maintenance', "Maintenance", ondelete="CASCADE",
|
||||
select=True, required=True)
|
||||
samples = fields.One2Many('optical_equipment.maintenance.calibration_sample', 'maintenance',
|
||||
'Samples')
|
||||
dev_std = fields.Function(
|
||||
@ -384,20 +577,6 @@ class Calibration(ModelSQL, ModelView):
|
||||
fields.Float("U eff"), 'get_uncertain_eff'
|
||||
)
|
||||
|
||||
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)},
|
||||
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'))],
|
||||
states={'invisible' : If(Eval('moisture_min') == None, True)},
|
||||
depends=['moisture_min'])
|
||||
|
||||
average = fields.Float("Average")
|
||||
|
||||
#total_samples total de muestras
|
||||
@ -480,12 +659,27 @@ class CalibrationSample(sequence_ordered(), ModelView, ModelSQL):
|
||||
'Samples of Calibration'
|
||||
__name__ = 'optical_equipment.maintenance.calibration_sample'
|
||||
|
||||
|
||||
maintenance = fields.Many2One('optical_equipment.maintenance', 'Maintenance',
|
||||
ondelete='CASCADE')
|
||||
|
||||
number_sample = fields.Integer("Sample #")
|
||||
value_pattern = fields.Integer("Value in Pattern")
|
||||
value_equipment = fields.Float("Value in Equipment")
|
||||
number_sample = fields.Float("Sample #")
|
||||
value_patterns = fields.Many2One('optical_equipment.product_pattern', "Value Pattern", required=True,
|
||||
ondelete='RESTRICT')
|
||||
#value_pattern = fields.Float("Value in Pattern")
|
||||
value_equipment = fields.Float("Value in Equipment", required=True,
|
||||
states={'readonly': Eval('value_patterns') == None})
|
||||
mistake = fields.Float("Mistake")
|
||||
mistake_rate = fields.Float("% Mistake")
|
||||
expanded_uncertainty = fields.Float("Uncertainy Expanded")
|
||||
mistake_rate = fields.Float("% Mistake", states={'readonly': True},
|
||||
depends=['mistake'])
|
||||
|
||||
@fields.depends('value_patterns', 'value_equipment', 'mistake', 'mistake_rate')
|
||||
def on_change_value_equipment(self):
|
||||
if float(self.value_patterns.pattern) < 0:
|
||||
self.mistake = self.value_patterns.pattern - self.value_equipment
|
||||
else:
|
||||
if self.value_patterns.pattern > self.value_equipment:
|
||||
self.mistake = self.value_patterns.pattern - self.value_equipment
|
||||
else:
|
||||
self.mistake = -self.value_patterns.pattern + self.value_equipment
|
||||
|
||||
self.mistake_rate = abs(self.mistake / self.value_patterns.pattern) * 100
|
||||
|
@ -20,16 +20,16 @@
|
||||
</record>
|
||||
<record model="ir.action.act_window" id="act_maintenance_service_form">
|
||||
<field name="name">Services Maintenance</field>
|
||||
<field name="res_model">optical_equipment.maintenance.service</field>
|
||||
<field name="res_model">optical_equipment_maintenance.service</field>
|
||||
<field name="search_value"></field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id= "maintenance_service_view_tree">
|
||||
<field name="model">optical_equipment.maintenance.service</field>
|
||||
<field name="model">optical_equipment_maintenance.service</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">maintenance_service_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="maintenance_service_view_form">
|
||||
<field name="model">optical_equipment.maintenance.service</field>
|
||||
<field name="model">optical_equipment_maintenance.service</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">maintenance_service_form</field>
|
||||
</record>
|
||||
@ -68,33 +68,6 @@
|
||||
<field name="count" eval="True"/>
|
||||
<field name="act_window" ref="act_maintenance_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain" id="act_maintenance_form_domain_agended">
|
||||
<field name="name">Agended</field>
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="domain"
|
||||
eval="[('state', '=', 'agended')]"
|
||||
pyson="1"/>
|
||||
<field name="count" eval="True"/>
|
||||
<field name="act_window" ref="act_maintenance_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain" id="act_maintenance_form_domain_in_progress">
|
||||
<field name="name">In progress</field>
|
||||
<field name="sequence" eval="30"/>
|
||||
<field name="domain"
|
||||
eval="[('state', '=', 'in_progress')]"
|
||||
pyson="1"/>
|
||||
<field name="count" eval="True"/>
|
||||
<field name="act_window" ref="act_maintenance_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain" id="act_maintenance_form_domain_failed">
|
||||
<field name="name">Failed</field>
|
||||
<field name="sequence" eval="30"/>
|
||||
<field name="domain"
|
||||
eval="[('state', '=', 'failed')]"
|
||||
pyson="1"/>
|
||||
<field name="count" eval="True"/>
|
||||
<field name="act_window" ref="act_maintenance_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain" id="act_maintenance_form_domain_finished">
|
||||
<field name="name">Finished</field>
|
||||
<field name="sequence" eval="40"/>
|
||||
@ -110,29 +83,26 @@
|
||||
<field name="domain"></field>
|
||||
<field name="act_window" ref="act_maintenance_form"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.model.button" id="maintenance_service_draft_button">
|
||||
<field name="name">draft</field>
|
||||
<field name="string">Draft</field>
|
||||
<field name="model" search="[('model', '=', 'optical_equipment.maintenance.service')]"/>
|
||||
<field name="model" search="[('model', '=', 'optical_equipment_maintenance.service')]"/>
|
||||
</record>
|
||||
<record model="ir.model.button" id="maintenance_service_in_progress_button">
|
||||
<field name="name">in_progress</field>
|
||||
<field name="string">In progress</field>
|
||||
<field name="model" search="[('model', '=', 'optical_equipment.maintenance.service')]"/>
|
||||
<field name="model" search="[('model', '=', 'optical_equipment_maintenance.service')]"/>
|
||||
</record>
|
||||
<record model="ir.model.button" id="maintenance_service_finished_button">
|
||||
<field name="name">finished</field>
|
||||
<field name="string">Finished</field>
|
||||
<field name="model" search="[('model', '=', 'optical_equipment.maintenance.service')]"/>
|
||||
<field name="model" search="[('model', '=', 'optical_equipment_maintenance.service')]"/>
|
||||
</record>
|
||||
<record model="ir.model.button" id="maintenance_finished_button">
|
||||
<field name="name">finished</field>
|
||||
<field name="string">Finished</field>
|
||||
<field name="model" search="[('model', '=', 'optical_equipment.maintenance')]"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.action.act_window.domain" id="act_maintenance_service_form_domain_draft">
|
||||
<field name="name">Draft</field>
|
||||
<field name="sequence" eval="10"/>
|
||||
@ -184,31 +154,30 @@
|
||||
<field name="domain"></field>
|
||||
<field name="act_window" ref="act_maintenance_service_form"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="maintenance_line_view_tree">
|
||||
<field name="model">optical_equipment.maintenance.line</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">maintenance_line_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="maintenance_calibration_view_form">
|
||||
<field name="model">optical_equipment.maintenance.calibration</field>
|
||||
<field name="model">optical_equipment.maintenance.calibration_sample</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">maintenance_sample_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="maintenance_calibration_view_tree">
|
||||
<field name="model">optical_equipment.maintenance.calibration</field>
|
||||
<field name="model">optical_equipment.maintenance.calibration_sample</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="10"/>
|
||||
<field name="name">maintenance_calibration_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="maintenance_service_view_calendar">
|
||||
<field name="model">optical_equipment.maintenance.service</field>
|
||||
<field name="model">optical_equipment_maintenance.service</field>
|
||||
<field name="type">calendar</field>
|
||||
<field name="name">maintenance_calendar</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window" id="act_maintenance_service_calendar">
|
||||
<field name="name">Calendar</field>
|
||||
<field name="res_model">optical_equipment.maintenance.service</field>
|
||||
<field name="res_model">optical_equipment_maintenance.service</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_maintenance_calendar_view1">
|
||||
@ -240,6 +209,21 @@
|
||||
<field name="name">ReAssing Agended</field>
|
||||
<field name="wiz_name">optical_equipment_maintenance.reassing_agended</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="create_contract_view_form">
|
||||
<field name="model">optical_equipment_create.contract</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">create_contract_form</field>
|
||||
</record>
|
||||
<record model="ir.action.wizard" id="maintenance_create_contract">
|
||||
<field name="name">Create Contract</field>
|
||||
<field name="wiz_name">optical_equipment.maintenance.contract</field>
|
||||
<field name="model">optical_equipment_maintenance.service</field>
|
||||
</record>
|
||||
<record model="ir.action.keyword" id="maintenance_create_contract_keyword">
|
||||
<field name="keyword">form_action</field>
|
||||
<field name="model">optical_equipment_maintenance.service,-1</field>
|
||||
<field name="action" ref="maintenance_create_contract"/>
|
||||
</record>
|
||||
<menuitem parent="menu_diary"
|
||||
action="act_maintenance_service_calendar"
|
||||
sequence="10"
|
||||
@ -254,11 +238,11 @@
|
||||
id="menu_maintenance_form"/>
|
||||
<menuitem parent="menu_diary"
|
||||
action="act_assing_agended"
|
||||
sequence="10"
|
||||
sequence="30"
|
||||
id="menu_assing_agended_form"/>
|
||||
<menuitem parent="menu_diary"
|
||||
action="act_reassing_agended"
|
||||
sequence="20"
|
||||
sequence="40"
|
||||
id="menu_reassing_agended_form"/>
|
||||
</data>
|
||||
</tryton>
|
||||
|
10
product.py
10
product.py
@ -161,7 +161,7 @@ class Template(metaclass=PoolMeta):
|
||||
help="Agregar valores separados por ',' Ej:-5,+5,-10,+10")
|
||||
k_pattern = fields.Char("K Pattern",
|
||||
help="Agregar valores separados por ',' Ej:-5,+5,-10,+10")
|
||||
|
||||
k_pattern_list = fields.One2Many('optical_equipment.product_pattern', 'product', "List of patterns K")
|
||||
resolution_type = fields.Selection([('',""),
|
||||
('analoga', "Analoga"),
|
||||
('digital', "Digital")], "Resolution Type",
|
||||
@ -327,3 +327,11 @@ class Template(metaclass=PoolMeta):
|
||||
|
||||
class Product(metaclass=PoolMeta):
|
||||
__name__ = 'product.product'
|
||||
|
||||
class Pattern(ModelSQL, ModelView):
|
||||
"Pattern K of equipment"
|
||||
__name__ = 'optical_equipment.product_pattern'
|
||||
_rec_name = 'pattern'
|
||||
|
||||
product = fields.Many2One('product.template', "Template", ondelete='CASCADE')
|
||||
pattern = fields.Float("Value Pattern")
|
||||
|
10
product.xml
10
product.xml
@ -13,5 +13,15 @@
|
||||
<field name="inherit" ref="product.template_view_tree"/>
|
||||
<field name="name">template_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="pattern_view_form">
|
||||
<field name="model">optical_equipment.product_pattern</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">pattern_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="pattern_view_tree">
|
||||
<field name="model">optical_equipment.product_pattern</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">pattern_tree</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
99
sale.py
99
sale.py
@ -14,14 +14,28 @@ from trytond.exceptions import UserError
|
||||
from trytond.wizard import (
|
||||
Button, StateAction, StateTransition, StateView, Wizard)
|
||||
|
||||
|
||||
class Sale(metaclass=PoolMeta):
|
||||
'Sale'
|
||||
__name__ = 'sale.sale'
|
||||
|
||||
agended = fields.Boolean("Scheduling")
|
||||
sale_type = fields.Selection([('maintenance', 'Maintenance'),
|
||||
('equipments', 'Equipos'),
|
||||
('replaces', 'Replaces')], "Sale Type", required=True)
|
||||
('equipments', 'Equipments'),
|
||||
('replaces', 'Replaces')], "Sale Type", required=True,
|
||||
states={'readonly': Eval('state') != 'draft'}
|
||||
)
|
||||
contract_base = fields.Many2One('optical_equipment.contract', "Contract Base",
|
||||
states={'invisible': (Eval('sale_type') != 'maintenance')},
|
||||
search_context={
|
||||
'related_party': Eval('party'),
|
||||
},)
|
||||
|
||||
agended = fields.Boolean("Scheduling",states={
|
||||
'invisible': (Eval('sale_type') != 'maintenance'),
|
||||
'readonly': True})
|
||||
|
||||
def on_chage_sale_type(self):
|
||||
self.lines= []
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@ -36,14 +50,16 @@ class Sale(metaclass=PoolMeta):
|
||||
cls.store_cache(sales)
|
||||
config = Configuration(1)
|
||||
|
||||
MaintenanceService = pool.get('optical_equipment.maintenance.service')
|
||||
MaintenanceService = pool.get('optical_equipment_maintenance.service')
|
||||
for sale in sales:
|
||||
if sale.sale_type == 'maintenance':
|
||||
for line in sale.lines:
|
||||
maintenanceService = MaintenanceService(
|
||||
maintenance_type='preventive',
|
||||
state_agended='no_agenda',
|
||||
propietary=sale.party,
|
||||
propietary_address=sale.shipment_address,
|
||||
#contract_origin=sale.contract_base,
|
||||
sale_origin=line,
|
||||
sale_date=sale.sale_date,
|
||||
state="draft"
|
||||
@ -68,76 +84,42 @@ class SaleLine(metaclass=PoolMeta):
|
||||
('product','=', Eval('product'))
|
||||
],
|
||||
states={'invisible': If(~Eval('product_equipment'), True)},)
|
||||
equipment_serial = fields.Char('Serial',states={'readonly': True,
|
||||
'invisible': If(~Eval('product_equipment'), True)},
|
||||
depends=['product_equipment'])
|
||||
address_equipment = fields.Many2One('party.address', "Direccion")
|
||||
unit_digits = fields.Function(fields.Integer('Unit Digits'),
|
||||
'on_change_with_unit_digits')
|
||||
|
||||
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(SaleLine, cls).__setup__()
|
||||
cls.quantity.states['readonly'] = If(Eval('product_equipment') == True, True)
|
||||
#raise UserError(str(Eval('_parent_sale', {}).get('sale_type')))
|
||||
if Eval('_parent_sale', {}).get('sale_type') == 'maintenance':
|
||||
cls.product.domain + [('type', '=', 'service'),
|
||||
('maintenance_activity', '=', True)]
|
||||
|
||||
@fields.depends('product_equipment','equipment')
|
||||
def get_serial_equipment(self):
|
||||
if self.product_equipment:
|
||||
return self.equipment.serial
|
||||
else:
|
||||
return None
|
||||
cls.product.domain.append(
|
||||
If(Eval('_parent_sale.sale_type') == 'maintenance',
|
||||
[('type', '=', 'service'),
|
||||
('maintenance_activity', '=', True)], []))
|
||||
cls.quantity.states['readonly'] = Eval('_parent_sale.sale_type') == 'equipments'
|
||||
|
||||
def on_change_with_unit_digits(self, name=None):
|
||||
if self.unit:
|
||||
return self.unit.digits
|
||||
return 2
|
||||
|
||||
@fields.depends('equipment', 'sale', 'quantity', '_parent_sale.shipment_address', methods=['on_change_product'])
|
||||
def on_change_equipment(self):
|
||||
if self.equipment:
|
||||
self.product = self.equipment.product.id
|
||||
self.address_equipment = self.sale.shipment_address.id
|
||||
self.equipment_serial = self.equipment.serial
|
||||
self.quantity = 1
|
||||
self.on_change_product()
|
||||
else:
|
||||
self.address_equipment = None
|
||||
self.product = None
|
||||
self.unit= None
|
||||
self.quantity = None
|
||||
self.unit_price = None
|
||||
self.amount = None
|
||||
self.equipment_serial = None
|
||||
self.on_change_product()
|
||||
|
||||
@fields.depends('product_equipment', 'quantity', methods=['on_change_equipment'])
|
||||
def on_change_product_equipment(self):
|
||||
if self.product_equipment == False:
|
||||
self.equipment = None
|
||||
self.on_change_equipment()
|
||||
else:
|
||||
self.quantity = 1
|
||||
|
||||
|
||||
@fields.depends('product', 'unit', 'quantity', 'sale',
|
||||
'_parent_sale.party',methods=['_get_tax_rule_pattern',
|
||||
'_parent_sale.party', '_parent_sale.sale_type', methods=['_get_tax_rule_pattern',
|
||||
'_get_context_sale_price','on_change_with_amount'])
|
||||
def on_change_product(self):
|
||||
Product = Pool().get('product.product')
|
||||
if not self.product:
|
||||
self.product_equipment = False
|
||||
self.unit = None
|
||||
self.quantity = None
|
||||
return
|
||||
|
||||
else:
|
||||
party = None
|
||||
|
||||
if self.sale.sale_type == 'equipments':
|
||||
self.quantity = 1
|
||||
|
||||
if self.sale and self.sale.party:
|
||||
self.product_equipment = False
|
||||
party = self.sale.party
|
||||
@ -179,7 +161,6 @@ class SaleLine(metaclass=PoolMeta):
|
||||
self.product_equipment = True
|
||||
|
||||
def get_move(self, shipment_type):
|
||||
|
||||
'''
|
||||
Return moves for the sale line according to shipment_type
|
||||
'''
|
||||
@ -222,7 +203,7 @@ class SaleLine(metaclass=PoolMeta):
|
||||
move.to_location = self.to_location
|
||||
move.state = 'draft'
|
||||
move.company = self.sale.company
|
||||
move.serial = self.equipment_serial
|
||||
#move.serial = self.equipment_serial
|
||||
|
||||
if move.on_change_with_unit_price_required():
|
||||
move.unit_price = self.unit_price
|
||||
@ -233,21 +214,3 @@ class SaleLine(metaclass=PoolMeta):
|
||||
move.origin = self
|
||||
|
||||
return move
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
def process(cls, sales):
|
||||
states = {'confirmed', 'processing', 'done'}
|
||||
sales = [s for s in sales if s.state in states]
|
||||
cls.lock(sales)
|
||||
cls._process_invoice(sales)
|
||||
cls._process_shipment(sales)
|
||||
cls._process_invoice_shipment_states(sales)
|
||||
cls._process_state(sales)
|
||||
|
||||
@classmethod
|
||||
def view_attributes(cls):
|
||||
return super(SaleLine, cls).view_attributes() + [
|
||||
('//page[@id="equipment"]', 'states', {
|
||||
'invisible': ~Eval('product_equipment', True),
|
||||
})]
|
||||
|
2
sale.xml
2
sale.xml
@ -6,6 +6,7 @@
|
||||
<field name="inherit" ref="sale.sale_view_form"/>
|
||||
<field name="name">sale_form</field>
|
||||
</record>
|
||||
<!--
|
||||
<record model="ir.ui.view" id="sale_line_view_form">
|
||||
<field name="model">sale.line</field>
|
||||
<field name="inherit" ref="sale.sale_line_view_form"/>
|
||||
@ -21,6 +22,7 @@
|
||||
<field name="inherit" ref="sale.sale_line_view_tree_sequence"/>
|
||||
<field name="name">sale_line_tree_sequence</field>
|
||||
</record>
|
||||
-->
|
||||
<!--
|
||||
<record model="ir.ui.view" id="create_subscription_view_form">
|
||||
<field name="model">sale.create.subscription.start</field>
|
||||
|
624
subscription.py
624
subscription.py
@ -1,624 +0,0 @@
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.model import (
|
||||
ModelSQL, ModelView, Workflow, fields)
|
||||
from trytond.pyson import Eval, If, Bool
|
||||
from trytond.modules.company.model import set_employee
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.wizard import (
|
||||
Button, StateAction, StateTransition, StateView, Wizard)
|
||||
|
||||
from trytond.modules.currency.fields import Monetary
|
||||
from trytond.modules.product import price_digits
|
||||
|
||||
import datetime
|
||||
from datetime import timedelta
|
||||
|
||||
|
||||
class Contract(ModelSQL, ModelView):
|
||||
'Contracts'
|
||||
__name__ = 'optical_equipment.contract'
|
||||
|
||||
company = fields.Many2One(
|
||||
'company.company', "Company", readonly=True, required=True, select=True,
|
||||
states={
|
||||
'readonly': (Eval('state') != 'draft') | Eval('party', True),
|
||||
},help="Make the subscription belong to the company.")
|
||||
number = fields.Char(
|
||||
"Number", readonly=True, select=True,
|
||||
help="The main identification of the subscription.")
|
||||
reference = fields.Char(
|
||||
"Reference", select=True,
|
||||
help="The identification of an external origin.")
|
||||
description = fields.Char("Description",
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
})
|
||||
party = fields.Many2One(
|
||||
'party.party', "Party", readonly=True, required=True,
|
||||
help="The party who subscribes.")
|
||||
contact = fields.Many2One('party.contact_mechanism', "Contact", readonly=True)
|
||||
invoice_address = fields.Many2One('party.address', 'Invoice Address', readonly=True,
|
||||
required=True, domain=[('party', '=', Eval('party'))])
|
||||
invoice_recurrence = fields.Many2One(
|
||||
'sale.subscription.recurrence.rule.set', "Invoice Recurrence", readonly=True,
|
||||
required=True)
|
||||
start_date = fields.Date("Start Date", readonly=True, required=False,)
|
||||
end_date = fields.Date(
|
||||
"End Date", readonly=True,
|
||||
domain=['OR',
|
||||
('end_date', '>=', If(
|
||||
Bool(Eval('start_date')),
|
||||
Eval('start_date', datetime.date.min),
|
||||
datetime.date.min)),
|
||||
('end_date', '=', None),
|
||||
],
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}
|
||||
)
|
||||
state = fields.Selection([
|
||||
('draft', "Draft"),
|
||||
('quotation', "Quotation"),
|
||||
('running', "Running"),
|
||||
('closed', "Closed"),
|
||||
('cancelled', "Cancelled"),
|
||||
], "State", readonly=True, required=False, sort=False,
|
||||
help="The current state of the subscription.")
|
||||
contract = fields.Many2One('sale.subscription', "Contract", readonly=True)
|
||||
prorogues = fields.Many2Many('sale.subscription-optical_equipment.contract', 'contract',
|
||||
'subscription', 'Prorrogation')
|
||||
equipments = fields.Many2Many('optical_equipment.contract-optical_equipment.equipment', 'contract', 'equipment',
|
||||
"Equipments", readonly=True,
|
||||
domain=[['OR',
|
||||
('state', '=', 'registred'),
|
||||
('state', '=', 'uncontrated')]
|
||||
])
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(Contract, cls).__setup__()
|
||||
cls._buttons.update({
|
||||
'quotation': {'invisible': Eval('state').in_(['quotation', 'running', 'closed', 'cancelled'])},
|
||||
'run': {'invisible': Eval('state').in_(['draft', 'running', 'closed', 'cancelled'])}
|
||||
})
|
||||
|
||||
@staticmethod
|
||||
def default_company():
|
||||
return Transaction().context.get('company')
|
||||
|
||||
@staticmethod
|
||||
def default_state():
|
||||
return 'draft'
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
def quotation(self, contract):
|
||||
#raise UserError(str(self))
|
||||
pool = Pool()
|
||||
Subscription = pool.get('sale.subscription')
|
||||
#raise UserError(str((subscription[0].equipments)))
|
||||
for equipment in contract[0].equipments:
|
||||
if equipment.state == "contrated":
|
||||
raise UserError(str("El equipo"+str(equipment.number) +
|
||||
"No puede pertencer a este contrato porque ya se encuentra en un contrato"))
|
||||
else:
|
||||
continue
|
||||
|
||||
if contract[0].contract and contract[0].prorogues == ():
|
||||
Subscription.quote([contract[0].contract])
|
||||
Subscription.run([contract[0].contract])
|
||||
else:
|
||||
IdProrogues = set()
|
||||
for ide in contract[0].prorogues:
|
||||
IdProrogues.add(ide.id)
|
||||
|
||||
subscription = Subscription.search([('state', '=', 'draft'),
|
||||
('id', 'in', IdProrogues)])
|
||||
|
||||
raise UserError(str(list(contract[0].prorogues).find(['state', '=', 'draft'])))
|
||||
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
def run(cls, subscription):
|
||||
pool = Pool()
|
||||
Subscription = pool.get('sale.subscription')
|
||||
|
||||
if subscription.state == 'quotation':
|
||||
Subscription.run(subscription)
|
||||
elif subscription.state == 'draft':
|
||||
for equipment in cls.equipments:
|
||||
if equipment.state == "contrated":
|
||||
raise UserError(str("El equipo"+str(equipment.number) +
|
||||
"No puede pertencer a este contrato porque ya se encuentra en un contrato"))
|
||||
else:
|
||||
continue
|
||||
|
||||
Subscription.quotation(subscription)
|
||||
Subscription.run(subscription)
|
||||
|
||||
Subscription.quotation(subscription)
|
||||
|
||||
|
||||
class CreateInitialContract(ModelView):
|
||||
'Create Initial Contract'
|
||||
__name__ = 'optical_equipment_contract.initial'
|
||||
|
||||
company = fields.Many2One(
|
||||
'company.company', "Company", readonly=True, required=True, select=True,
|
||||
states={
|
||||
'readonly': (Eval('state') != 'draft') | Eval('party', True),
|
||||
},help="Make the subscription belong to the company.")
|
||||
party = fields.Many2One(
|
||||
'party.party', "Party", required=True,
|
||||
help="The party who subscribes.")
|
||||
invoice_address = fields.Many2One('party.address', 'Invoice Address',
|
||||
required=True, domain=[('party', '=', Eval('party'))])
|
||||
payment_term = fields.Many2One('account.invoice.payment_term',
|
||||
'Payment Term')
|
||||
contact = fields.Many2One(
|
||||
'party.contact_mechanism', "Contact", required=True,
|
||||
domain=[('party', '=', Eval('party'))],
|
||||
context={
|
||||
'company': Eval('company', -1),
|
||||
})
|
||||
start_date = fields.Date("Start Date", required=True)
|
||||
end_date = fields.Date("End Date",
|
||||
domain=['OR',
|
||||
('end_date', '>=', If(
|
||||
Bool(Eval('start_date')),
|
||||
Eval('start_date', datetime.date.min),
|
||||
datetime.date.min)),
|
||||
('end_date', '=', None),
|
||||
])
|
||||
invoice_recurrence = fields.Many2One('sale.subscription.recurrence.rule.set',
|
||||
"Invoice Recurrence",required=True)
|
||||
invoice_start_date = fields.Date("Invoice Start Date", required=True,
|
||||
help='Billing start date')
|
||||
service = fields.Many2One('sale.subscription.service', "Service", required=True)
|
||||
quantity = fields.Float("Quantity", digits='unit', required=True)
|
||||
unit_price = Monetary("Unit Price", currency='currency',
|
||||
digits=price_digits,required=True
|
||||
)
|
||||
equipments = fields.Many2Many('sale.subscription-optical_equipment.equipment', 'subscription',
|
||||
'equipment', "Equipments", required=True,
|
||||
domain=[['OR',
|
||||
('state', '=', 'registred'),
|
||||
('state', '=', 'uncontrated')],
|
||||
('propietary', '=', Eval('party'))
|
||||
])
|
||||
|
||||
@staticmethod
|
||||
def default_company():
|
||||
return Transaction().context.get('company')
|
||||
|
||||
@classmethod
|
||||
def default_start_date(cls):
|
||||
pool = Pool()
|
||||
Date = pool.get('ir.date')
|
||||
return Date.today()
|
||||
|
||||
@classmethod
|
||||
def default_quantity(self):
|
||||
return 1
|
||||
|
||||
@fields.depends('invoice_recurrence')
|
||||
def on_change_invoice_recurrence(self):
|
||||
if self.invoice_recurrence.rules[0].freq == "yearly":
|
||||
pool = Pool()
|
||||
Date = pool.get('ir.date')
|
||||
self.end_date = Date.today() + timedelta(days=365)
|
||||
elif self.invoice_recurrence == None:
|
||||
self.end_date = None
|
||||
|
||||
|
||||
@classmethod
|
||||
@fields.depends(methods=['default_start_date'])
|
||||
def default_invoice_start_date(self):
|
||||
invoice_start_date = self.default_start_date()
|
||||
return invoice_start_date
|
||||
|
||||
@fields.depends('party')
|
||||
def on_change_party(self):
|
||||
if self.party:
|
||||
self.invoice_address = self.party.address_get(type='invoice')
|
||||
|
||||
class CreateContract(Wizard):
|
||||
'Create Contract'
|
||||
__name__ = 'sale.create.contract'
|
||||
|
||||
start = StateView('optical_equipment_contract.initial',
|
||||
'optical_equipment.create_contract_view_form',[
|
||||
Button('Cancel', 'end', 'tryton-cancel'),
|
||||
Button('Create', 'create_contract', 'tryton-ok', default=True),
|
||||
])
|
||||
create_contract = StateAction('sale_subscription.act_subscription_form')
|
||||
|
||||
done_ = StateView('optical_equipment_contract.initial',
|
||||
'optical_equipment.create_contract_view_form',[
|
||||
Button('Done', 'end', 'tryton-cancel'),
|
||||
])
|
||||
|
||||
@property
|
||||
def _subscription_start(self):
|
||||
return dict(
|
||||
party=self.start.party,
|
||||
contact=self.start.contact,
|
||||
start_date=self.start.start_date,
|
||||
end_date=self.start.end_date,
|
||||
payment_term=self.start.payment_term,
|
||||
invoice_address=self.start.invoice_address,
|
||||
invoice_recurrence=self.start.invoice_recurrence,
|
||||
invoice_start_date=self.start.invoice_start_date,
|
||||
service=self.start.service,
|
||||
quantity=self.start.quantity,
|
||||
unit_price=self.start.unit_price,
|
||||
equipments=self.start.equipments)
|
||||
|
||||
def _create_contract_base(self,dates, subscription):
|
||||
pool = Pool()
|
||||
ContractBase = pool.get('optical_equipment.contract')
|
||||
|
||||
a = self._subscription_start
|
||||
|
||||
contractBase = ContractBase(
|
||||
state='draft',
|
||||
party=a['party'],
|
||||
invoice_address=a['invoice_address'],
|
||||
start_date=a['start_date'],
|
||||
end_date=a['end_date'],
|
||||
invoice_recurrence=a['invoice_recurrence'],
|
||||
contact=a['contact'],
|
||||
contract=subscription,
|
||||
equipments=a['equipments']
|
||||
)
|
||||
contractBase.save()
|
||||
|
||||
def do_create_contract(self, action):
|
||||
pool = Pool()
|
||||
Subscription = pool.get('sale.subscription')
|
||||
SubscriptionLine = pool.get('sale.subscription.line')
|
||||
|
||||
a = self._subscription_start
|
||||
|
||||
equipments_to_subscription=self.start.equipments
|
||||
subscription_lines = [SubscriptionLine(
|
||||
start_date=a['start_date'],
|
||||
end_date=a['end_date'],
|
||||
consumption_recurrence=a['invoice_recurrence'],
|
||||
service=a['service'],
|
||||
unit=a['service'].product.default_uom,
|
||||
quantity=a['quantity'],
|
||||
unit_price=a['unit_price']
|
||||
)]
|
||||
|
||||
subscription = Subscription(
|
||||
state='draft',
|
||||
type='contract',
|
||||
party=a['party'],
|
||||
invoice_address=a['invoice_address'],
|
||||
payment_term=a['payment_term'],
|
||||
start_date=a['start_date'],
|
||||
end_date=a['end_date'],
|
||||
invoice_recurrence=a['invoice_recurrence'],
|
||||
invoice_start_date=a['invoice_start_date'],
|
||||
contact=a['contact'],
|
||||
invoice_party=a['party'],
|
||||
lines=subscription_lines,
|
||||
equipments=equipments_to_subscription,
|
||||
)
|
||||
antes = subscription.id
|
||||
subscription.save()
|
||||
despues = subscription.id
|
||||
andes = str(antes) + str(despues)
|
||||
self._create_contract_base(a, subscription)
|
||||
|
||||
|
||||
class CreateNextProrogue(ModelView):
|
||||
'Create Next Prorogue'
|
||||
__name__ = 'optical_equipment_prorogue.next'
|
||||
|
||||
party = fields.Many2One('party.party', "Party", required=True,
|
||||
help="The party who subscribes.")
|
||||
initial_contract = fields.Many2One('optical_equipment.contract', "Initial Contract", required=True,
|
||||
domain=[('party', '=', Eval('party')),
|
||||
('state', '=', "closed")],
|
||||
depends=['party'])
|
||||
contact = fields.Many2One('party.contact_mechanism', "Contact", required=True,
|
||||
domain=[('party', '=', Eval('party'))])
|
||||
invoice_address = fields.Many2One('party.address', 'Invoice Address',
|
||||
required=True, domain=[('party', '=', Eval('party'))])
|
||||
invoice_recurrence = fields.Many2One('sale.subscription.recurrence.rule.set', "Invoice Recurrence",
|
||||
required=True)
|
||||
payment_term = fields.Many2One(
|
||||
'account.invoice.payment_term', "Payment Term")
|
||||
start_date = fields.Date("Start Date", required=True,)
|
||||
end_date = fields.Date("End Date", required=True,
|
||||
domain=['OR',
|
||||
('end_date', '>=', If(
|
||||
Bool(Eval('start_date')),
|
||||
Eval('start_date', datetime.date.min),
|
||||
datetime.date.min)),
|
||||
('end_date', '=', None),
|
||||
],
|
||||
depends=['invoice_start_date'])
|
||||
invoice_start_date = fields.Date("Invoice Start Date", required=True,
|
||||
help='Billing start date',
|
||||
depends=['start_date'])
|
||||
service = fields.Many2One('sale.subscription.service', "Service", required=True)
|
||||
quantity = fields.Float("Quantity", digits='unit', required=True)
|
||||
unit_price = Monetary("Unit Price", currency='currency',
|
||||
digits=price_digits,required=True
|
||||
)
|
||||
equipments = fields.Many2Many('optical_equipment.contract-optical_equipment.equipment', 'contract',
|
||||
'equipment', "Equipments", required=True,
|
||||
domain=[['OR',
|
||||
('state', '=', 'registred'),
|
||||
('state', '=', 'uncontrated')],
|
||||
('propietary', '=', Eval('party'))
|
||||
])
|
||||
|
||||
|
||||
@fields.depends('party', 'contact')
|
||||
def on_change_party(self):
|
||||
self.contact = None
|
||||
self.initial_contract = None
|
||||
|
||||
@fields.depends('initial_contract', 'party', 'contact', 'invoice_address',
|
||||
'invoice_recurrence', 'start_date', 'end_date',
|
||||
'equipments')
|
||||
def on_change_initial_contract(self):
|
||||
if self.initial_contract:
|
||||
contract = self.initial_contract
|
||||
self.party = contract.party.id
|
||||
self.contact = contract.contact.id
|
||||
self.invoice_address = contract.invoice_address.id
|
||||
self.start_date = contract.end_date
|
||||
self.invoice_start_date = contract.end_date
|
||||
self.equipments = contract.equipments
|
||||
else:
|
||||
self.party = None
|
||||
self.contact = None
|
||||
self.invoice_address = None
|
||||
self.invoice_recurrence = None
|
||||
self.start_date = None
|
||||
self.equipments = []
|
||||
|
||||
@fields.depends('invoice_recurrence', 'start_date')
|
||||
def on_change_invoice_recurrence(self):
|
||||
if self.invoice_recurrence and self.invoice_recurrence.rules[0].freq == "yearly":
|
||||
#pool = Pool()
|
||||
#Date = pool.get('ir.date')
|
||||
self.end_date = self.start_date + timedelta(days=365)
|
||||
#self.end_date = Date.today() + timedelta(days=365)
|
||||
elif self.invoice_recurrence == None:
|
||||
self.end_date = None
|
||||
|
||||
|
||||
@fields.depends('invoice_start_date', 'start_date')
|
||||
def on_change_start_date(self):
|
||||
self.invoice_start_date = self.start_date
|
||||
|
||||
@classmethod
|
||||
def default_quantity(self):
|
||||
return 1
|
||||
|
||||
class CreateProrogue(Wizard):
|
||||
'Create Prorogue'
|
||||
__name__ = 'optical_equipment.prorogue'
|
||||
|
||||
start = StateView('optical_equipment_prorogue.next',
|
||||
'optical_equipment.create_prorogue_view_form',
|
||||
[Button('Cancel', 'end', 'tryton-cancel'),
|
||||
Button('Create', 'create_prorogue', 'tryton-ok', default=True),
|
||||
])
|
||||
|
||||
create_prorogue = StateAction('sale_subscription.act_subscription_form')
|
||||
|
||||
done_ = StateView('optical_equipment_prorogue.next',
|
||||
'optical_equipment.create_prorogue_view_form',[
|
||||
Button('Done', 'end', 'tryton-cancel'),
|
||||
])
|
||||
|
||||
@property
|
||||
def _subscription_start(self):
|
||||
return dict(
|
||||
party=self.start.party,
|
||||
contact=self.start.contact,
|
||||
start_date=self.start.start_date,
|
||||
end_date=self.start.end_date,
|
||||
payment_term=self.start.payment_term,
|
||||
invoice_address=self.start.invoice_address,
|
||||
invoice_recurrence=self.start.invoice_recurrence,
|
||||
invoice_start_date=self.start.invoice_start_date,
|
||||
service=self.start.service,
|
||||
quantity=self.start.quantity,
|
||||
unit_price=self.start.unit_price,
|
||||
equipments=self.start.equipments)
|
||||
|
||||
def do_create_prorogue(self, action):
|
||||
pool = Pool()
|
||||
Subscription = pool.get('sale.subscription')
|
||||
SubscriptionLine = pool.get('sale.subscription.line')
|
||||
|
||||
a = self._subscription_start
|
||||
|
||||
equipments_to_subscription=self.start.equipments
|
||||
subscription_lines = [SubscriptionLine(
|
||||
start_date=a['start_date'],
|
||||
end_date=a['end_date'],
|
||||
consumption_recurrence=a['invoice_recurrence'],
|
||||
service=a['service'],
|
||||
unit=a['service'].product.default_uom,
|
||||
quantity=a['quantity'],
|
||||
unit_price=a['unit_price']
|
||||
)]
|
||||
|
||||
subscription = Subscription(
|
||||
state='draft',
|
||||
type='prorrogation',
|
||||
party=a['party'],
|
||||
invoice_address=a['invoice_address'],
|
||||
payment_term=a['payment_term'],
|
||||
start_date=a['start_date'],
|
||||
end_date=a['end_date'],
|
||||
invoice_recurrence=a['invoice_recurrence'],
|
||||
invoice_start_date=a['invoice_start_date'],
|
||||
contact=a['contact'],
|
||||
invoice_party=a['party'],
|
||||
lines=subscription_lines,
|
||||
equipments=equipments_to_subscription,
|
||||
)
|
||||
|
||||
subscription.save()
|
||||
|
||||
IdInitialContract = self.start.initial_contract.id
|
||||
pool = Pool()
|
||||
Contract = pool.get('optical_equipment.contract')
|
||||
contract = Contract.search(['id', '=', IdInitialContract])[0]
|
||||
contract.start_date = a['start_date']
|
||||
contract.end_date = a['end_date']
|
||||
contract.invoice_address = a['invoice_address']
|
||||
contract.contact = a['contact']
|
||||
contract.invoice_recurrence = a['invoice_recurrence']
|
||||
contract.state = subscription.state
|
||||
#raise UserError(str(contract.id))
|
||||
|
||||
contract.prorogues += (subscription.id,)
|
||||
|
||||
contract.equipments = equipments_to_subscription
|
||||
contract.save()
|
||||
|
||||
|
||||
class Subscription(metaclass=PoolMeta):
|
||||
__name__ = 'sale.subscription'
|
||||
|
||||
type = fields.Selection([
|
||||
('contract', "Main"),
|
||||
('prorrogation', "Extension"),
|
||||
], "Type", select=True, required=True,
|
||||
states={
|
||||
'readonly': ((Eval('state') != 'draft')
|
||||
| Eval('context', {}).get('type')
|
||||
),
|
||||
})
|
||||
|
||||
prorogues = fields.Many2Many('sale.subscription-optical_equipment.contract', 'contract','subscription',
|
||||
'Prorrogation')
|
||||
equipments = fields.Many2Many('sale.subscription-optical_equipment.equipment', 'subscription',
|
||||
'equipment', "Equipments",
|
||||
domain=[['OR',
|
||||
('state', '=', 'registred'),
|
||||
('state', '=', 'uncontrated')]
|
||||
])
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('running')
|
||||
@set_employee('run_by')
|
||||
def run(cls, subscriptions):
|
||||
pool = Pool()
|
||||
Line = pool.get('sale.subscription.line')
|
||||
lines = []
|
||||
|
||||
pool = Pool()
|
||||
Equipments = pool.get('optical_equipment.equipment')
|
||||
|
||||
for subscription in subscriptions:
|
||||
if not subscription.next_invoice_date:
|
||||
subscription.next_invoice_date = (
|
||||
subscription.compute_next_invoice_date())
|
||||
for line in subscription.lines:
|
||||
if (line.next_consumption_date is None
|
||||
and not line.consumed_until):
|
||||
line.next_consumption_date = (
|
||||
line.compute_next_consumption_date())
|
||||
lines.extend(subscription.lines)
|
||||
for equipment in subscription.equipments:
|
||||
equipment.state = "contrated"
|
||||
equipment.save()
|
||||
Line.save(lines)
|
||||
cls.save(subscriptions)
|
||||
|
||||
|
||||
class CreateSubscriptionInvoice(Wizard):
|
||||
"Create Subscription Invoice"
|
||||
__name__ = 'sale.subscription.create_invoice'
|
||||
|
||||
start = StateView(
|
||||
'sale.subscription.create_invoice.start',
|
||||
'sale_subscription.create_invoice_start_view_form', [
|
||||
Button("Cancel", 'end', 'tryton-cancel'),
|
||||
Button("Create", 'create_', 'tryton-ok', default=True),
|
||||
])
|
||||
|
||||
create_ = StateTransition()
|
||||
|
||||
def generate_invoice(self, date=None):
|
||||
pool = Pool()
|
||||
Date = pool.get('ir.date')
|
||||
Configuration = pool.get('account.configuration')
|
||||
Config = Configuration(1)
|
||||
Journals = pool.get('account.journal')
|
||||
Invoice = pool.get('account.invoice')
|
||||
InvoiceLine = pool.get('account.invoice.line')
|
||||
invoice_lines = []
|
||||
|
||||
if date is None:
|
||||
date = Date.today()
|
||||
|
||||
for subscription in self.records:
|
||||
for line in subscription.lines:
|
||||
invoice_lines.append(
|
||||
InvoiceLine(
|
||||
origin=line,
|
||||
product=line.service,
|
||||
account=line.service.product.account_revenue_used,
|
||||
quantity=line.quantity,
|
||||
unit=line.unit,
|
||||
unit_price=line.unit_price,
|
||||
)
|
||||
)
|
||||
|
||||
invoice = Invoice(
|
||||
type='out',
|
||||
journal=Journals.search(['type', '=', 'revenue'])[0],
|
||||
account=Config.default_account_receivable,
|
||||
party=subscription.party,
|
||||
invoice_date=date,
|
||||
invoice_address=subscription.invoice_address,
|
||||
lines=invoice_lines,
|
||||
)
|
||||
invoice.save()
|
||||
|
||||
def transition_create_(self):
|
||||
pool = Pool()
|
||||
Subscription = pool.get('sale.subscription')
|
||||
self.generate_invoice(date=self.start.date)
|
||||
|
||||
return 'end'
|
||||
|
||||
|
||||
class ContractEquipment(ModelSQL):
|
||||
'Optical Equipment - Contract'
|
||||
__name__ = 'optical_equipment.contract-optical_equipment.equipment'
|
||||
|
||||
equipment = fields.Many2One('optical_equipment.equipment', 'Equipment', select=True)
|
||||
contract = fields.Many2One('optical_equipment.contract', 'Contract', select=True)
|
||||
|
||||
|
||||
class SubscriptionEquipment(ModelSQL):
|
||||
'Optical Equipment - Subscription'
|
||||
__name__ = 'sale.subscription-optical_equipment.equipment'
|
||||
|
||||
subscription = fields.Many2One('sale.subscription', 'Subscription', select=True)
|
||||
equipment = fields.Many2One('optical_equipment.equipment', 'Equipment', select=True)
|
||||
|
||||
|
||||
class ContractSupscription(ModelSQL):
|
||||
'Prorrogation to the Contract'
|
||||
__name__='sale.subscription-optical_equipment.contract'
|
||||
|
||||
contract = fields.Many2One('optical_equipment.contract', 'Contract', select=True)
|
||||
subscription = fields.Many2One('sale.subscription', 'Subscription', select=True)
|
160
subscription.xml
160
subscription.xml
@ -1,160 +0,0 @@
|
||||
<?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="contract_view_form">
|
||||
<field name="model">optical_equipment.contract</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">contract_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="contract_view_list">
|
||||
<field name="model">optical_equipment.contract</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">contract_list</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window" id="act_contract_form">
|
||||
<field name="name">Contracts</field>
|
||||
<field name="res_model">optical_equipment.contract</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_contract_form_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="contract_view_list"/>
|
||||
<field name="act_window" ref="act_contract_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_contract_form_view2">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="contract_view_form"/>
|
||||
<field name="act_window" ref="act_contract_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
id="act_contract_form_domain_draft">
|
||||
<field name="name">Draft</field>
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="domain" eval="[('state', '=', 'draft')]" pyson="1"/>
|
||||
<field name="count" eval="True"/>
|
||||
<field name="act_window" ref="act_contract_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
id="act_contract_form_domain_quotation">
|
||||
<field name="name">Quotation</field>
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="domain" eval="[('state', '=', 'quotation')]"
|
||||
pyson="1"/>
|
||||
<field name="count" eval="True"/>
|
||||
<field name="act_window" ref="act_contract_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
id="act_contract_form_domain_running">
|
||||
<field name="name">Running</field>
|
||||
<field name="sequence" eval="30"/>
|
||||
<field name="domain" eval="[('state', '=', 'running')]" pyson="1"/>
|
||||
<field name="act_window" ref="act_contract_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
id="act_contract_form_domain_closed">
|
||||
<field name="name">Closed</field>
|
||||
<field name="sequence" eval="40"/>
|
||||
<field name="domain" eval="[('state', '=', 'closed')]" pyson="1"/>
|
||||
<field name="act_window" ref="act_contract_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
id="act_contract_form_domain_all">
|
||||
<field name="name">All</field>
|
||||
<field name="sequence" eval="9999"/>
|
||||
<field name="domain"></field>
|
||||
<field name="act_window" ref="act_contract_form"/>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="subscription_view_form">
|
||||
<field name="model">sale.subscription</field>
|
||||
<field name="inherit" ref="sale_subscription.subscription_view_form"/>
|
||||
<field name="name">subscription_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.menu" id="sale_subscription.menu_line_consumption_create">
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
<record model="ir.ui.menu" id="sale_subscription.menu_create_invoice">
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
<record model="ir.action.wizard" id="create_invoice">
|
||||
<field name="name">Create_Invoices</field>
|
||||
<field name="wiz_name">sale.subscription.create_invoice</field>
|
||||
<field name="model">sale.subscription</field>
|
||||
</record>
|
||||
<record model="ir.action.keyword" id="create_invoice_keyword">
|
||||
<field name="keyword">form_action</field>
|
||||
<field name="model">sale.subscription,-1</field>
|
||||
<field name="action" ref="create_invoice"/>
|
||||
</record>
|
||||
<record model="ir.action.report" id="report_contract">
|
||||
<field name="name">Contract</field>
|
||||
<field name="model">sale.subscription</field>
|
||||
<field name="report_name">sale.subscription</field>
|
||||
<field name="report">report/contract.fodt</field>
|
||||
<field name="single" eval="True"/>
|
||||
</record>
|
||||
<record model="ir.action.keyword" id="report_contract_keyword">
|
||||
<field name="keyword">form_print</field>
|
||||
<field name="model">sale.subscription,-1</field>
|
||||
<field name="action" ref="report_contract"/>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="create_contract_view_form">
|
||||
<field name="model">optical_equipment_contract.initial</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">create_subscription_form</field>
|
||||
</record>
|
||||
<record model="ir.action.wizard" id="act_create_contract">
|
||||
<field name="name">Initial Contract</field>
|
||||
<field name="wiz_name">sale.create.contract</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="create_prorogue_view_form">
|
||||
<field name="model">optical_equipment_prorogue.next</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">create_prorogue_form</field>
|
||||
</record>
|
||||
<record model="ir.action.wizard" id="act_create_prorogue">
|
||||
<field name="name">Prorogue to Contract</field>
|
||||
<field name="wiz_name">optical_equipment.prorogue</field>
|
||||
</record>
|
||||
<record model="ir.model.button" id="run_prorrogation_button">
|
||||
<field name="name">run</field>
|
||||
<field name="model" search="[('model', '=', 'optical_equipment.contract')]"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
id="act_subscription_form_domain_closed">
|
||||
<field name="name">Closed</field>
|
||||
<field name="sequence" eval="40"/>
|
||||
<field name="domain" eval="[('state', '=', 'closed')]" pyson="1"/>
|
||||
<field name="act_window" ref="sale_subscription.act_subscription_form"/>
|
||||
</record>
|
||||
<record model="ir.model.button" id="quotation_contract_button">
|
||||
<field name="name">quotation</field>
|
||||
<field name="string">Quotation</field>
|
||||
<field name="confirm">Are you sure you want to quote these subscription?</field>
|
||||
<field name="model" search="[('model', '=', 'optical_equipment.contract')]"/>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Contracts Management"
|
||||
sequence="50"
|
||||
id="menu_contracts"/>
|
||||
<menuitem
|
||||
parent="menu_contracts"
|
||||
action="act_create_contract"
|
||||
sequence="10"
|
||||
id="menu_create_contract_initial"/>
|
||||
<menuitem
|
||||
parent="menu_contracts"
|
||||
action="act_create_prorogue"
|
||||
sequence="20"
|
||||
id="menu_create_prorogue"/>
|
||||
<menuitem
|
||||
parent="menu_contracts"
|
||||
action="act_contract_form"
|
||||
sequence="30"
|
||||
id="menu_contract_form"/>
|
||||
<menuitem
|
||||
parent="menu_contracts"
|
||||
action="sale_subscription.act_subscription_form"
|
||||
sequence="40"
|
||||
id="sale_subscription.menu_subscription_form"/>
|
||||
</tryton>
|
@ -14,7 +14,6 @@ depends:
|
||||
sale
|
||||
stock
|
||||
country
|
||||
sale_subscription
|
||||
sale_history
|
||||
sale_advance_payment
|
||||
sale_amendment
|
||||
@ -23,13 +22,14 @@ xml:
|
||||
party.xml
|
||||
product.xml
|
||||
equipment.xml
|
||||
contract.xml
|
||||
configuration_equipment.xml
|
||||
sale.xml
|
||||
purchase.xml
|
||||
uom.xml
|
||||
move.xml
|
||||
subscription.xml
|
||||
message.xml
|
||||
diary.xml
|
||||
maintenance.xml
|
||||
|
||||
|
11
view/assing_agended_form.xml
Normal file
11
view/assing_agended_form.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form>
|
||||
<label name="maintenance_service"/>
|
||||
<field name="maintenance_service"/>
|
||||
<label name="technical"/>
|
||||
<field name="technical"/>
|
||||
<label name="estimated_agended"/>
|
||||
<field name="estimated_agended"/>
|
||||
</form>
|
@ -10,9 +10,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="number"/>
|
||||
<label name="contact"/>
|
||||
<field name="contact"/>
|
||||
<label name="invoice_recurrence"/>
|
||||
<field name="invoice_recurrence"/>
|
||||
<newline/>
|
||||
<label name="description"/>
|
||||
<field name="description" colspan="3"/>
|
||||
<label name="reference"/>
|
||||
@ -25,13 +22,12 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="end_date"/>
|
||||
<notebook colspan="6">
|
||||
<page string="Contracts and Prorogues" id="contracts">
|
||||
<separator id="current_contract" string="Current Contract" colspan="6"/>
|
||||
<field name="contract"/>
|
||||
<newline/>
|
||||
<field name="prorogues"/>
|
||||
<field name="maintenance_services"/>
|
||||
</page>
|
||||
<page string="Equipments" id="equipments">
|
||||
<!--
|
||||
<field name="equipments"/>
|
||||
-->
|
||||
</page>
|
||||
<page string="Other Info" id="other">
|
||||
<label name="company"/>
|
||||
@ -42,7 +38,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="state"/>
|
||||
<group col="2" colspan="2" id="button">
|
||||
<!--<button name="draft"/> -->
|
||||
<!--
|
||||
<button name="quotation"/>
|
||||
<button name="run"/>
|
||||
-->
|
||||
</group>
|
||||
</form>
|
||||
|
@ -8,4 +8,5 @@
|
||||
<field name="description"/>
|
||||
<field name="start_date"/>
|
||||
<field name="end_date"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
|
24
view/diary_form.xml
Normal file
24
view/diary_form.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?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. -->
|
||||
<form col="6">
|
||||
<label name="maintenance_service"/>
|
||||
<field name="maintenance_service"/>
|
||||
<label name="code"/>
|
||||
<field name="code"/>
|
||||
<newline/>
|
||||
<notebook colspan="6">
|
||||
<page string="Dates" id="dates_agended">
|
||||
<label name="date_expected"/>
|
||||
<field name="date_expected"/>
|
||||
<label name="date_estimated"/>
|
||||
<field name="date_estimated"/>
|
||||
<label name="date_end"/>
|
||||
<field name="date_end"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<label name="technical"/>
|
||||
<field name="technical"/>
|
||||
<label name="state"/>
|
||||
<field name="state"/>
|
||||
</form>
|
12
view/diary_tree.xml
Normal file
12
view/diary_tree.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?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. -->
|
||||
<tree>
|
||||
<field name="code"/>
|
||||
<field name="date_expected" widget="date"/>
|
||||
<field name="date_expected" string="time" widget="time"/>
|
||||
<field name="date_estimated" widget="date"/>
|
||||
<field name="date_end" widget="date"/>
|
||||
<field name="maintenance_service"/>
|
||||
<field name="technical"/>
|
||||
</tree>
|
7
view/maintenance_activity_form.xml
Normal file
7
view/maintenance_activity_form.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?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. -->
|
||||
<form>
|
||||
<label name="product"/>
|
||||
<field name="product"/>
|
||||
</form>
|
6
view/maintenance_activity_tree.xml
Normal file
6
view/maintenance_activity_tree.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?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. -->
|
||||
<tree>
|
||||
<field name="product"/>
|
||||
</tree>
|
@ -2,4 +2,8 @@
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms.-->
|
||||
<tree>
|
||||
<field name="value_patterns" expand="1"/>
|
||||
<field name="value_equipment" expand="1"/>
|
||||
<field name="mistake" expand="1"/>
|
||||
<field name="mistake_rate" expand="1"/>
|
||||
</tree>
|
||||
|
@ -17,6 +17,7 @@
|
||||
<label name="service_maintenance"/>
|
||||
<field name="service_maintenance"/>
|
||||
<notebook colspan="6">
|
||||
<!--
|
||||
<page string="Agended" id="agended">
|
||||
<label name="estimated_agended"/>
|
||||
<field name="estimated_agended"/>
|
||||
@ -25,18 +26,40 @@
|
||||
<label name="state_agended"/>
|
||||
<field name="state_agended"/>
|
||||
</page>
|
||||
-->
|
||||
<page string="Preventive" id="preventive">
|
||||
<field name="maintenance_activity"/>
|
||||
<label name="initial_operation"/>
|
||||
<field name="initial_operation"/>
|
||||
<label name="check_equipment"/>
|
||||
<field name="check_equipment"/>
|
||||
<label name="check_electric_system"/>
|
||||
<field name="check_electric_system"/>
|
||||
<label name="clean_int_ext"/>
|
||||
<field name="clean_int_ext"/>
|
||||
<label name="clean_eyes"/>
|
||||
<field name="clean_eyes"/>
|
||||
<label name="optical"/>
|
||||
<field name="optical"/>
|
||||
<label name="check_calibration"/>
|
||||
<field name="check_calibration"/>
|
||||
<newline/>
|
||||
<!--
|
||||
<label name="check_calibration"/>
|
||||
<field name="check_calibration"/>
|
||||
-->
|
||||
</page>
|
||||
<page string="Corrective" id="corrective">
|
||||
<label name="maintenance_lines"/>
|
||||
<field name="maintenance_lines"/>
|
||||
<field name="maintenance_lines"/>
|
||||
</page>
|
||||
<page string="Calibration" id="calibration">
|
||||
<label name="maintenance_lines"/>
|
||||
<field name="maintenance_lines"/>
|
||||
<page string="Calibration" colspan="6" id="calibration">
|
||||
<label name="patterns_equipments"/>
|
||||
<field name="patterns_equipments"/>
|
||||
<newline/>
|
||||
<group colspan="6" yexpand="1" id="lines_calibration">
|
||||
<field name="lines_calibration"/>
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
<newline/>
|
||||
|
@ -16,6 +16,8 @@
|
||||
<field name="sale_origin"/>
|
||||
<label name="sale_date"/>
|
||||
<field name="sale_date"/>
|
||||
<label name="contract_origin"/>
|
||||
<field name="contract_origin"/>
|
||||
<label name="maintenance_type"/>
|
||||
<field name="maintenance_type"/>
|
||||
<newline/>
|
||||
@ -23,10 +25,10 @@
|
||||
<page string="General" id="general">
|
||||
<label name="state_agended"/>
|
||||
<field name="state_agended"/>
|
||||
<label name="estimated_agended"/>
|
||||
<field name="estimated_agended"/>
|
||||
<label name="technical"/>
|
||||
<field name="technical"/>
|
||||
<label name="estimated_agended"/>
|
||||
<field name="estimated_agended"/>
|
||||
</page>
|
||||
<page string="Lines Of Mantenaince" id="lines_maintenance">
|
||||
<field name="lines"/>
|
||||
|
@ -4,6 +4,7 @@
|
||||
<tree>
|
||||
<field name="code"/>
|
||||
<field name="maintenance_type" expand="0"/>
|
||||
<field name="service_maintenance" expand="1"/>
|
||||
<field name="propietary"/>
|
||||
<field name="propietary_address"/>
|
||||
<field name="equipment"/>
|
||||
|
@ -6,7 +6,11 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<separator id="sequences" string="Sequences" colspan="4"/>
|
||||
<label name="equipment_sequence"/>
|
||||
<field name="equipment_sequence"/>
|
||||
<newline/>
|
||||
<label name="maintenance_sequence"/>
|
||||
<field name="maintenance_sequence"/>
|
||||
<newline/>
|
||||
<label name="agended_sequence"/>
|
||||
<field name="agended_sequence"/>
|
||||
</form>
|
||||
|
||||
|
@ -52,8 +52,8 @@
|
||||
<label name="origin_country"/>
|
||||
<field name="origin_country"/>
|
||||
</page>
|
||||
<page string="Subscriptions" id="subscriptions_equipment">
|
||||
<field name="subscription_history"/>
|
||||
<page string="Contracts" id="contract_equipment">
|
||||
<field name="contract_history"/>
|
||||
</page>
|
||||
<page string="Maintenances" id="maintenances_equipment">
|
||||
<field name="maintenance_history"/>
|
||||
|
11
view/reassing_agended_form.xml
Normal file
11
view/reassing_agended_form.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form>
|
||||
<label name="maintenance_service"/>
|
||||
<field name="maintenance_service"/>
|
||||
<label name="estimated_agended"/>
|
||||
<field name="estimated_agended"/>
|
||||
<label name="technical"/>
|
||||
<field name="technical"/>
|
||||
</form>
|
@ -8,5 +8,7 @@
|
||||
<field name="sale_type"/>
|
||||
<label name="agended"/>
|
||||
<field name="agended"/>
|
||||
<label name="contract_base"/>
|
||||
<field name="contract_base"/>
|
||||
</xpath>
|
||||
</data>
|
||||
|
@ -58,6 +58,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<label name="k_pattern"/>
|
||||
<field name="k_pattern"/>
|
||||
<newline/>
|
||||
<label name="k_pattern_list"/>
|
||||
<field name="k_pattern_list"/>
|
||||
<newline/>
|
||||
<label name="resolution_type"/>
|
||||
<field name="resolution_type"/>
|
||||
<newline/>
|
||||
|
Loading…
Reference in New Issue
Block a user