207 Commits
6.4 ... 6.6

Author SHA1 Message Date
Alejandro Ayala Usuga
c5647cc3f8 UPGRADE-6.6
Signed-off-by: Alejandro Ayala Usuga <sinergia@noreply.onecluster.org>
2022-11-21 18:50:28 -05:00
yo
24cadfc01b stringddd
Signed-off-by: yo <yo@yo>
2022-11-20 16:12:51 -05:00
2e0a0d725c update cv equipment 2022-11-18 15:21:25 -05:00
3463ddf1ca update cv equipment 2022-11-18 15:16:52 -05:00
b639aaee28 update cv equipment 2022-11-18 15:12:40 -05:00
749a52332a update certificated calibration 2022-11-18 14:42:34 -05:00
462ecdbb4f update certificated calibration 2022-11-18 14:35:54 -05:00
2ffcca013b update type measuring_range 2022-11-18 19:24:34 +00:00
c61b422cbc update certificated calibration 2022-11-18 13:58:37 -05:00
2b312d787d update optical_equipment 2022-11-18 13:51:06 -05:00
42965ff680 update optical_equipment 2022-11-18 13:50:53 -05:00
c32c506346 add attributes group to saleline 2022-11-15 12:48:30 -05:00
f88612dfa1 add attributes group to saleline 2022-11-15 12:48:22 -05:00
9c36d6663d add report maintenance timeline closed #94 2022-11-10 15:50:20 -05:00
0b33a1c2c3 corrections to sales 2022-11-10 13:38:33 -05:00
df4bca7485 corrections to sales 2022-11-10 13:37:15 -05:00
6929fec5ec enviromental conditions in calibration 2022-11-09 16:33:30 -05:00
1ac2816f39 update calibration 2022-11-09 13:11:53 -05:00
34e71ade15 update calibration 2022-11-09 11:30:42 -05:00
ebf7d7fc99 update calibratio 2022-11-09 09:57:48 -05:00
8f3c07a69d health register required in purchase 2022-11-09 09:19:59 -05:00
c0e3024e46 health register required in purchase 2022-11-09 09:14:25 -05:00
b1ff95cf27 correction paths of reports 2022-11-08 22:17:01 -05:00
446df7a69e correction paths of reports 2022-11-08 22:14:07 -05:00
4e026a1422 update graph 2022-11-08 21:27:53 -05:00
4d9e352611 update graph 2022-11-08 16:16:52 -05:00
8b93ae13e0 update graph 2022-11-08 16:15:01 -05:00
12f66e35bb update graph 2022-11-08 15:49:45 -05:00
3bdb22d3f6 update graph 2022-11-08 15:20:45 -05:00
2de04793cc add report prorrogation 2022-11-08 14:59:00 -05:00
b9c222c642 add report prorrogation 2022-11-08 14:58:51 -05:00
4dd0c83e5e add report 2022-11-08 08:37:13 -05:00
62309d5095 update maintenance 2022-11-03 16:14:55 -05:00
836ee474a6 modification to reports 2022-11-02 18:20:52 -05:00
e2ff22223c modification to reports 2022-11-02 18:16:13 -05:00
9355cb73d1 mistake 0 2022-11-02 09:28:24 -05:00
196a5a90cc mean in calibration total 2022-11-01 16:01:28 -05:00
f9be62649a update report calibration 2022-10-31 18:25:13 -05:00
8a6e334223 add reports 2022-10-31 12:14:04 -05:00
bd26902a9e clean home 2022-10-29 12:24:18 -05:00
bca233fa37 add graphs to calibration 2022-10-28 16:24:50 -05:00
b31e9f39f7 Merge branch '6.2' of https://gitea.onecluster.org/OneTeam/trytondo-optical_equipment into 6.2 2022-10-28 16:24:20 -05:00
92d92d4c50 add graphs to calibration 2022-10-28 16:21:40 -05:00
4f18a39a96 Change field contact sale 2022-10-27 15:28:42 -05:00
b64c897618 Reports sale and maintenance_service 2022-10-20 23:31:33 -05:00
587ff4094f cambios finales 2022-10-19 20:51:14 -05:00
16d5ee6df5 Traducciones Faltantes 2022-10-19 16:56:25 -05:00
d69e4b141a change to location of equipments 2022-10-18 10:40:09 -05:00
bcfb207a30 Correction to field date in ssing agended 2022-10-18 09:49:11 -05:00
6a9711a919 change name report 2022-10-14 16:33:57 +00:00
d1fc0872f0 add reports maintenance history 2022-10-14 11:32:00 -05:00
3ad449f466 changes finished 2022-10-14 16:29:33 +00:00
534f89486d changes finished 2022-10-14 16:27:31 +00:00
89cdad5101 resports finished 2022-10-13 11:51:45 -05:00
9f352bbd63 Merge branch '6.2' of https://gitea.onecluster.org/OneTeam/trytondo-optical_equipment into 6.2 2022-10-13 11:50:15 -05:00
bc8dc103ed resports finished 2022-10-13 11:48:41 -05:00
a6a400017a changes finished reports 2022-10-13 16:40:58 +00:00
c6486b2243 add reports 2022-10-12 17:40:41 -05:00
16dedba779 add reports 2022-10-12 17:40:08 -05:00
253500af41 add rec_names 2022-10-12 12:17:58 -05:00
ae62a07fe1 add report calibration 2022-10-11 18:19:20 -05:00
517cc3a58e Add the diopter field 2022-10-11 18:11:29 -05:00
13cc3b6e3e changes finished 2022-10-11 16:54:47 -05:00
9a9a0eecff add report calibration 2022-10-11 16:08:41 -05:00
917e820b37 add report calibration 2022-10-11 16:04:54 -05:00
ecde79d84d add report calibration 2022-10-11 14:21:06 -05:00
3535043b99 add formats and reports 2022-10-11 13:22:36 -05:00
9d8c526aeb add formats and reports 2022-10-11 13:22:26 -05:00
a442f1d098 changes finished 2022-10-10 18:50:13 -05:00
01f3e58c7e changes finished 2022-10-10 18:49:56 -05:00
a3ef82f4d1 add traslations 2022-10-10 09:59:35 -05:00
9493d39b9f changes finished 2022-10-06 21:19:48 -05:00
221c887cb6 changes finished 2022-10-06 00:26:24 -05:00
4767cc94c7 changes finished 2022-10-05 18:39:23 -05:00
e47594fb10 changes finished 2022-10-05 18:37:22 -05:00
739440efb9 correction to direction model calendar 2022-10-05 13:56:04 -05:00
41d44b4956 changes finished 2022-10-05 10:48:45 -05:00
927e6c060d calibration 2022-10-04 01:44:23 -05:00
a1b4cc5616 calibration 2022-10-04 01:44:02 -05:00
e630edb389 management maintenances services, maintenances, agended 2022-09-27 11:30:21 -05:00
87a843754d create model maintenance_service 2022-09-23 12:05:03 -05:00
9736b1baf3 create model maintenance_service 2022-09-23 11:03:47 -05:00
8cd2cf17bf correction to module contracts 2022-09-21 09:24:00 -05:00
86b6bef61d corrections to relations many2many 2022-09-20 11:00:02 -05:00
d1940a271d add class contract - equipment 2022-09-19 18:34:22 -05:00
20a0df5c50 corrections to module contracts 2022-09-19 07:59:01 -05:00
50dc5aa2b0 module contracts 2022-09-19 00:41:50 -05:00
4d09b42324 add traductions modules contracts 2022-09-18 01:23:12 -05:00
9b09080ae8 add wizard for contract management and creation of model contracts maangement 2022-09-16 14:50:05 -05:00
0c88126ae8 Create Traductions module subscriptions 2022-09-13 14:01:12 -05:00
206bad122b modification to report contract.fodt 2022-09-12 14:41:36 -05:00
7c7db3a3c0 add report contract 2022-09-12 13:21:08 -05:00
e9f288bfbd modifity to wizzard 'CreateSubscriptionInvoice' 2022-09-07 14:13:26 -05:00
6a3ce61e06 model of move 2022-09-02 13:24:59 -05:00
f1e0d9b274 update format cv Equipment 2022-08-23 10:47:43 -05:00
113de78608 changes pending 2022-08-19 11:44:18 -05:00
ef5154ed6f changes pending 2022-08-19 10:31:39 -05:00
785d8890f2 correction to format sheet out 2022-08-15 18:47:05 -05:00
55bef63e37 traslate pending 2022-08-15 14:31:38 -05:00
b19e096c94 traslate pending 2022-08-15 13:27:37 -05:00
61473998d2 only one quantity for sale 2022-08-15 00:10:20 -05:00
46ad43845f add format shipment equipments 2022-08-14 13:12:58 -05:00
9e73d4ec09 shipment equipments 2022-08-14 11:16:13 -05:00
c4151da4f2 changes in cv of equipment 2022-08-13 00:46:47 -05:00
f056418573 states in serial tree 2022-08-12 22:32:21 -05:00
c678e72f4a add traductions to module equipments 2022-08-12 17:35:20 -05:00
1d302cc485 Traducciones al módulo de equipos 2022-08-12 09:58:37 -05:00
7bf05f4857 changes to equipments 2022-08-10 23:16:03 -05:00
33f3cdc5ef template cv of equipment 2022-08-10 21:46:00 -05:00
a8ce002f4f correction errors 2022-08-10 18:08:58 -05:00
da07c0eee0 add report equipment to equipment 2022-08-10 16:57:46 -05:00
9bdee108ac add report equipment to equipment 2022-08-10 16:57:31 -05:00
054b78fd01 value for default 0 in fields of equipment 2022-08-10 09:38:54 -05:00
b7976c2b04 module subscriptions 2022-08-06 10:10:14 -05:00
9981598350 init model calibrations 2022-08-03 16:21:55 -05:00
5c857d8a9e changes de state and propietary of equipment 2022-08-03 13:14:15 -05:00
3c3e38e7fa fields change product in purchase 2022-08-02 21:28:03 -05:00
f7740e3827 fields empy when change product in purchase 2022-08-02 20:42:13 -05:00
b657f5cd4d correction to assigned serial 2022-08-02 19:37:32 -05:00
5566df2b5d relation maintenances to equipment 2022-08-02 00:37:47 -05:00
e234737535 add function for search of equipments 2022-07-30 19:05:41 -05:00
35a5d217ac entry of serial and button registred 2022-07-28 09:37:31 -05:00
af32d1c9fb view invisible in 'features' and 'calibration' 2022-07-26 21:23:12 -05:00
720710e094 change traslate 'enviromental conditions' 2022-07-26 19:33:04 -05:00
5d88267435 change required resolution 2022-07-26 19:29:55 -05:00
8fad2a7cf3 correction to module products 2022-07-26 19:21:12 -05:00
40204302f4 del states in serial for view tree edit serial 2022-07-26 16:17:48 -05:00
7e7ce08625 add file views add serials 2022-07-26 15:50:05 -05:00
f802a9c3e5 commits pendientes 2022-07-24 22:50:56 -05:00
6bca322af8 maintenance frequency in equipments 2022-07-23 13:33:17 -05:00
ebf2dd372e view asigned serials 2022-07-22 16:13:54 -05:00
569db4ba4b changes menores 2022-07-21 17:14:54 -05:00
35ea0a037c delete constraint serial unique 2022-07-21 12:56:33 -05:00
42218f5f06 delete sequence_serial in line_purchase 2022-07-21 12:52:09 -05:00
a0fbc157ff delete serial draft 2022-07-21 12:46:56 -05:00
c056bbc38a sequence draft serial, add multiple equipments 2022-07-21 02:47:05 -05:00
f08e0a0f83 traductions module products 2022-07-20 22:09:59 -05:00
40846ec28b traductions module products 2022-07-20 22:09:29 -05:00
8400110fdb button 'create equipment' invisible when purchase not has invoice 2022-07-19 12:54:30 -05:00
209a2083b3 correction to bugs and add complete behaviors 2022-07-18 23:19:17 -05:00
8e173c4758 activitys of maintenance 2022-07-18 13:36:20 -05:00
50f6249562 tabs in maintenance 2022-07-18 12:52:18 -05:00
610106befe add field maintenance type 2022-07-18 09:36:19 -05:00
11473f11ba add function _equipment_to_subscription to wizard create_subscription 2022-07-16 11:30:04 -05:00
41ec228407 wizard 'create equipments' 2022-07-14 21:09:07 -05:00
4d02d61639 registred class diary in __init__ 2022-07-14 11:35:48 -05:00
103b9d89ba create model diary 2022-07-14 11:32:43 -05:00
04d7041be7 delete view address_equipment 2022-07-14 11:20:58 -05:00
a5c58d104e add maintenance_lines 2022-07-13 13:00:11 -05:00
97a1f77fbc add atribute template of product 'replacement' and 'maintenance_activity' 2022-07-13 12:33:23 -05:00
6ee312bb2e correction to workflow on maintenance 2022-07-13 09:53:18 -05:00
e26d7e50d6 model 'maintenance' 2022-07-12 17:19:08 -05:00
5b652cb2ac init model 'Maintenance' 2022-07-12 12:28:49 -05:00
3d14ee5dc0 add lines to subcription 2022-07-12 11:54:19 -05:00
76513e61c1 address_equipment for default in line the sale 2022-07-12 09:02:37 -05:00
65770b97c7 add default_shipment_address 2022-07-11 16:18:53 -05:00
9aa5fad86b add field 'equipment' which contains the relation with 'optical_equipment.equipment' 2022-07-11 14:53:42 -05:00
9bb6f4066c add field 'equipment' which contains the relation with 'optical_equipment.equipment' 2022-07-11 14:46:21 -05:00
425c7e225a _do_create_subscription wizard 'create_subscription' 2022-07-09 00:13:59 -05:00
d453653bfc create view 'sale.create.subscription' 2022-07-08 07:11:24 -05:00
f14684b403 add view 2022-07-08 06:00:35 -05:00
a8ba3f056c initial model for wizard 'create_subscription' 2022-07-07 18:10:19 -05:00
a9f20c356f domain of values in template the equipment 2022-07-07 11:54:26 -05:00
db126e496e charge company for default in equipment 2022-07-07 11:04:56 -05:00
ffaed5fe49 sequence in equipments 2022-07-07 10:53:15 -05:00
0fe894d10f add workflow to equipments 2022-07-07 00:16:16 -05:00
8910886374 correction 2022-07-05 11:43:58 -05:00
8ec9c4c130 corrections 2022-07-05 10:36:21 -05:00
e00a5415ef change position field 'equipments create' 2022-07-04 16:31:10 -05:00
93a409daf6 change values in line of purchase if change product o not product 2022-07-04 16:24:40 -05:00
5e820d5670 model sequence equipments 2022-07-04 15:52:07 -05:00
6883d20a7d model sequence equipments 2022-07-04 15:51:08 -05:00
1a9b979e3b Add groups admin to menu 'menu_equipment' 2022-07-04 15:06:05 -05:00
2cc22349e2 add views to model 'optical_equipment.configuration' 2022-07-04 14:49:08 -05:00
609cf1e386 create model 'configuration_equipment' 2022-07-04 11:52:07 -05:00
47743f378e correct name variable 2022-07-04 11:39:40 -05:00
2f92c8f74b change name 'equipment_available' to 'equipment_create' 2022-07-04 11:37:57 -05:00
8cc60e6540 changes position 'useful_life' and 'warranty' 2022-07-04 11:33:32 -05:00
d0ab043193 values for default fields _uom 2022-07-04 11:20:40 -05:00
1e03f2e213 measurements default in product 2022-07-03 09:23:35 -05:00
553e3bf668 add value 'otro' type_client28 2022-07-03 08:33:14 -05:00
9756cea8c1 add value 'otro' type_client#28 2022-07-03 08:30:23 -05:00
0931aa7727 tab 'equipment' in sale invisible with product 2022-07-01 00:14:59 -05:00
0566d0d66f exclude categorys 'accounting' equal True 2022-06-30 22:58:30 -05:00
a99a70fd1d add message.xml to tryton.cfg 2022-06-30 22:13:16 -05:00
b432c75314 add constrain a serial unique 2022-06-30 17:46:13 -05:00
a9876fada4 views 2022-06-30 13:00:56 -05:00
f0f76ca652 add domains to fields 2022-06-30 12:32:41 -05:00
141cb90ead modification to template of products 2022-06-30 11:21:37 -05:00
98b33d8b8c tab 'equipment invisible in line of purchase when product is 'equipment' 2022-06-30 09:32:01 -05:00
b23e83eb25 add field address for default of the company to equipment in purchase 2022-06-30 08:26:53 -05:00
93f037923b tab 'equipment' in saleline invisible if product not is a equipment 2022-06-29 15:33:53 -05:00
5058a46c37 tab 'equipment' in purchase invisible if product not is a equipment 2022-06-29 14:33:11 -05:00
274a095b72 button 'create_equipments' invisible in case to 'equipments_availables = True' 2022-06-29 14:13:39 -05:00
887ec2eeaa add view 'create_equipments' and domain on the button 2022-06-29 13:27:23 -05:00
cf34d85596 add button 'create_equipment' 2022-06-29 12:07:11 -05:00
f49769990e field Subscription of 'optical_equipment.equipment' always readonly 2022-06-29 00:57:30 -05:00
7b5cdd61b0 delete model measurements and put in model product 2022-06-28 23:21:54 -05:00
5dce5130ce add measurement 'relative humedity' and domain 2022-06-28 12:34:42 -05:00
5d948b5427 add domain in measurements of equipments 2022-06-28 12:21:10 -05:00
ff34a02dd5 change in class 'Measurements' to 'Template' 2022-06-27 15:43:43 -05:00
87639119e4 add domain in measurements 2022-06-27 14:41:57 -05:00
b61bcce44b add fields 'campus' and 'party_related' 2022-06-27 12:30:12 -05:00
7e2648e114 add model address 2022-06-26 13:31:03 -05:00
5430dc54ee add model address 2022-06-26 13:30:05 -05:00
4818d84db1 change version tryton.cfg '6.2' 2022-06-26 12:18:37 -05:00
cceb3906ba create branch 6.2 add model 'party.address' 2022-06-26 10:56:07 -05:00
94 changed files with 23691 additions and 321 deletions

5
.gitignore vendored
View File

@@ -28,6 +28,11 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
GPATH
GRTAGS
GTAGS
# PyInstaller
# Usually these files are written by a python script from a template

View File

@@ -1,17 +1,44 @@
from trytond.pool import Pool
from . import (party, product, purchase, sale,
equipment, subscription, measurements)
from . import (address, diary, party, product, purchase, sale,
equipment, configuration_equipment, contract, maintenance, move, exceptions)
def register():
Pool.register(
address.Address,
diary.Diary,
party.Party,
product.Template,
product.Product,
product.Pattern,
purchase.Purchase,
purchase.Line,
sale.SaleLine,
equipment.OpticalEquipment,
subscription.Subscription,
subscription.SubscriptionEquipment,
measurements.Measurements,
equipment.EquipmentMaintenance,
equipment.EquipmentParty,
equipment.ChangePropietary,
configuration_equipment.Configuration,
maintenance.Calibration,
maintenance.CreateContractInitial,
maintenance.CalibrationSample,
maintenance.Maintenance,
maintenance.MaintenanceService,
maintenance.MaintenanceActivity,
maintenance.MaintenanceLine,
maintenance.AgendedInitial,
maintenance.ReAgended,
maintenance.ServiceMaintenanceAgended,
move.Move,
move.ShipmentOut,
move.ShipmentInternal,
sale.Sale,
sale.SaleLine,
contract.Contract,
contract.ContractEquipment,
contract.ContractMaintenanceServices,
module='optical_equipment', type_='model')
Pool.register(
maintenance.AssingAgended,
maintenance.ReAssingAgended,
maintenance.CreateContract,
equipment.NewPropietary,
module='optical_equipment', type_='wizard')

11
address.py Normal file
View File

@@ -0,0 +1,11 @@
from trytond.pool import PoolMeta
from trytond.model import fields
from trytond.pyson import Eval, If
class Address(metaclass=PoolMeta):
__name__ = 'party.address'
campus = fields.Boolean("Campus")
party_related = fields.Many2One('party.party', "Party Related",
states ={ 'invisible': (~Eval("campus"))})

15
address.xml Normal file
View File

@@ -0,0 +1,15 @@
<?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>
<record model="ir.ui.view" id="address_view_tree">
<field name="model">party.address</field>
<field name="inherit" ref="party.address_view_tree"/>
<field name="name">address_tree</field>
</record>
<record model="ir.ui.view" id="address_view_form">
<field name="model">party.address</field>
<field name="inherit" ref="party.address_view_form"/>
<field name="name">address_form</field>
</record>
</tryton>

View File

View File

@@ -0,0 +1,20 @@
from trytond.model import (
ModelSingleton, ModelSQL, ModelView, fields)
from trytond.pyson import Id
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'))
])
contract_sequence = fields.Many2One('ir.sequence', "Contract Sequence",
domain=[('sequence_type', '=', Id('optical_equipment', 'sequence_type_contract'))
])

View File

@@ -0,0 +1,33 @@
<?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="ir.ui.view" id="optical_equipment_configuration_view_form">
<field name="model">optical_equipment.configuration</field>
<field name="type">form</field>
<field name="name">optical_equipment_configuration_form</field>
</record>
<record model="ir.action.act_window" id="act_optical_equipment_configuration_form">
<field name="name">Configuration</field>
<field name="res_model">optical_equipment.configuration</field>
</record>
<record model="ir.action.act_window.view" id="act_optical_equipment_configuration_form_view1">
<field name="sequence" eval="10"/>
<field name="view" ref="optical_equipment_configuration_view_form"/>
<field name="act_window" ref="act_optical_equipment_configuration_form"/>
</record>
<menuitem
name="Configuration"
parent="menu_equipment"
sequence="0"
id="menu_equipment_configuration"
icon="tryton-settings"/>
<menuitem
parent="menu_equipment_configuration"
action="act_optical_equipment_configuration_form"
sequence="10"
id="menu_optical_equipment_configuration"
icon="tryton-list"/>
</data>
</tryton>

153
contract.py Normal file
View File

@@ -0,0 +1,153 @@
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(Workflow, ModelSQL, ModelView):
'Contracts'
__name__ = 'optical_equipment.contract'
_rec_name = 'number'
_order_name = 'number'
company = fields.Many2One(
'company.company', "Company", 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", required=True,
states={
'readonly': (Eval('state') != 'draft') | Eval('party', True),
},help="The party who subscribes.")
contact = fields.Many2One('party.contact_mechanism', "Contact", required=True)
invoice_address = fields.Many2One('party.address', 'Invoice Address',
required=True, domain=[('party', '=', Eval('party'))],
states={
'readonly': (Eval('state') != 'draft') | Eval('party', True),
})
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),
],
states={
'readonly': Eval('state') != 'draft',
})
maintenance_services = fields.Many2Many('optical_equipment_maintenance.service-equipment.contract',
'contract', 'maintenance_services', "Prorogues")
equipments = fields.One2Many('optical_equipment.equipment', 'contract', "Equipments")
price_contract = Monetary("Price Contract", digits=price_digits, currency='currency', required=True,
states={'readonly': Eval('state') != 'draft'})
state = fields.Selection([
('draft', "Draft"),
('running', "Running"),
('closed', "Closed"),
('cancelled', "Cancelled"),
], "State", readonly=True, required=False, sort=False,
help="The current state of the subscription.")
@classmethod
def __setup__(cls):
super(Contract, cls).__setup__()
cls._order = [
('number', 'DESC NULLS FIRST'),
('id', 'DESC'),
]
cls._transitions = ({
('draft', 'running'),
('running', 'closed'),
('running', 'cancelled'),
})
cls._buttons.update({
'running': {'invisible': Eval('state').in_(['cancelled', 'running'])},
'cancelled': {'invisible': Eval('state').in_(['draft', 'cancelled'])}
})
@staticmethod
def default_company():
return Transaction().context.get('company')
@staticmethod
def default_state():
return 'draft'
@classmethod
def set_number(cls, contracts):
pool = Pool()
Config = pool.get('optical_equipment.configuration')
config = Config(4)
if config.contract_sequence != None:
if not contracts[0].number:
try:
contracts[0].number = config.contract_sequence.get()
cls.save(contracts)
except UserError:
raise UserError(str('Validation Error'))
else:
raise UserError(gettext('optical_equipment.msg_not_sequence_equipment'))
@classmethod
@ModelView.button
@Workflow.transition('running')
def running(cls, contracts):
contract = contracts[0]
for equipment in contract.equipments:
equipment.state = "contrated"
equipment.contract_history += (contract.id,)
equipment.save()
cls.set_number(contracts)
contract.state='running'
contract.save()
@classmethod
@ModelView.button
@Workflow.transition('cancelled')
def cancelled(cls, contracts):
pass
class ContractMaintenanceServices(ModelSQL):
'Contract - Maintenance Services'
__name__ = 'optical_equipment_maintenance.service-equipment.contract'
maintenance_services = fields.Many2One('optical_equipment_maintenance.service', "Maintenance Service", select=True)
contract = fields.Many2One('optical_equipment.contract', "Contract")
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)

128
contract.xml Normal file
View File

@@ -0,0 +1,128 @@
<?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_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.model.button" id="contrac_running_button">
<field name="name">running</field>
<field name="string">Run</field>
<field name="model" search="[('model', '=', 'optical_equipment.contract')]"/>
</record>
<record model="ir.model.button" id="contract_cancelled_button">
<field name="name">cancelled</field>
<field name="string">Cancel</field>
<field name="model" search="[('model', '=', 'optical_equipment.contract')]"/>
</record>
<record model="res.group" id="group_contract_admin">
<field name="name">Contract Administration</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_contract_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_contract_admin"/>
</record>
<record model="ir.sequence.type" id="sequence_type_contract">
<field name="name">Contract</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_contract_group_admin">
<field name="sequence_type" ref="sequence_type_contract"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_contract_group_contract_admin">
<field name="sequence_type" ref="sequence_type_contract"/>
<field name="group" ref="group_contract_admin"/>
</record>
<record model="ir.sequence" id="sequence_contract">
<field name="name">Contract</field>
<field name="sequence_type" ref="sequence_type_contract"/>
</record>
<record model="ir.action.report" id="report_contract">
<field name="name">Contract</field>
<field name="model">optical_equipment.contract</field>
<field name="report_name">optical_equipment.contract</field>
<field name="report">optical_equipment/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">optical_equipment.contract,-1</field>
<field name="action" ref="report_contract"/>
</record>
<record model="ir.action.report" id="report_prorrogation">
<field name="name">Prorrogation</field>
<field name="model">optical_equipment.contract</field>
<field name="report_name">optical_equipment.contract</field>
<field name="report">optical_equipment/report/Prorrogation.fodt</field>
<field name="single" eval="True"/>
</record>
<record model="ir.action.keyword" id="report_prorrogation_keyword">
<field name="keyword">form_print</field>
<field name="model">optical_equipment.contract,-1</field>
<field name="action" ref="report_prorrogation"/>
</record>
<menuitem
parent="menu_equipment"
name="Contracts Management"
sequence="50"
id="menu_contracts"/>
<menuitem
parent="menu_contracts"
action="act_contract_form"
sequence="30"
id="menu_contract_form"/>
</tryton>

0
cv.py
View File

View File

23
diary.py Normal file
View File

@@ -0,0 +1,23 @@
from trytond.model import (
ModelSQL, ModelView, fields)
class Diary(ModelSQL, ModelView):
'Diary'
__name__ = 'optical_equipment_maintenance.diary'
code = fields.Char("Code", select=True,states={'readonly': True })
date_expected = fields.DateTime("Expected Date", required=True)
date_estimated = fields.DateTime("Estimated Date")
date_end = fields.DateTime("Date End")
maintenance_service = fields.Many2One('optical_equipment_maintenance.service', 'Maintenance Service', required=True)
technical = fields.Many2One('company.employee', "Technical", required=True)
state = fields.Selection([('draft', "Draft"),
('agended', "Agended"),
('in_progress', "In Progress"),
('failed', "Failed"),
('finished', "Finished")
], "State", required=True, readonly=True, sort=True)
@classmethod
def default_state(self):
return 'draft'

106
diary.xml Normal file
View 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>

View File

@@ -1,58 +1,360 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import datetime
from collections import defaultdict
from trytond.pool import Pool
from trytond.model import ModelSQL, ModelView, fields
from trytond.model import (
DeactivableMixin, Workflow, ModelSQL, ModelView, Unique, fields)
from trytond.pyson import Eval, If
from trytond.transaction import Transaction
from trytond.i18n import gettext
from trytond.exceptions import UserError
from trytond.model.exceptions import AccessError
from trytond.wizard import (
Button, StateAction, StateTransition, StateView, Wizard)
class OpticalEquipment(ModelSQL, ModelView):
_MAINTENANCE_FREQUENCY = [("none", ''),
("6", 'Seis Meses'),
("12", 'Doce Meses')]
class OpticalEquipment(DeactivableMixin, Workflow, ModelSQL, ModelView):
'Optical Equipment'
__name__ = "optical_equipment.equipment"
__name__ = 'optical_equipment.equipment'
_rec_name = 'rec_name'
_order_name = 'code'
company = fields.Many2One('company.company', "Company")
location = fields.Many2One('stock.location', "Location")
party = fields.Many2One('party.party', "Party")
party_address = fields.Many2One('party.address', "Party Address")
#origin = fields.reference("Origin", selection='get_origin', select=True)
product = fields.Many2One('product.product', "Product")
refurbish = fields.Boolean("Refurbish")
equipment_type = fields.Char('type')
risk = fields.Char('Type risk')
use = fields.Char('Use')
biomedical_class = fields.Char('Biomedical Class')
main_tecnology = fields.Char('Main tecnology')
calibration = fields.Boolean("Apply calibration")
mark_category = fields.Many2One('product.category', 'Mark')
model_category = fields.Many2One('product.category', "Model")
reference = fields.Char("Reference", size=None)
origin_country = fields.Many2One('country.country',"Origin Country")
software_version = fields.Char("Software version", size=None)
useful_life = fields.Char("Useful life", size=None)
warranty = fields.Char("Warranty", size=None)
serial = fields.Char("Serial", size=None)
health_register = fields.Char("Health Register", size=None)
_states={
'readonly': Eval('state') != 'draft',
}
subscription_history = fields.Many2Many('sale.subscription-optical_equipment.equipment', 'equipment', 'subscription', "Subscriptions")
_depends = ['state']
_states_serial={
'readonly': Eval('state') != 'draft',
}
code = fields.Char(
"Code", select=True,states={'readonly': True })
state = fields.Selection([('draft', "Draft"),
('registred', "Registred"),
('uncontrated', "UnContrated"),
('contrated', "Contrated")
], "State",
required=True, readonly=True, sort=False)
contract = fields.Many2One('optical_equipment.contract', "Contract", ondelete='CASCADE')
company = fields.Many2One('company.company', "Company", readonly=True)
location = fields.Many2One('stock.location', "Location",
states=_states,)
propietary = fields.Many2One('party.party',"Propietary", required=True,
states=_states,)
propietary_address = fields.Many2One('party.address', "Propietary Address", required=True,
domain=[('party', '=', Eval('propietary'))],
states=_states
)
propietarys = fields.Many2Many('optical_equipment.equipment-party.party', 'equipment', 'party', "Propietarys")
product = fields.Many2One('product.product', "Product",
domain=[('equipment', '=', True)],
states=_states,
depends=['equipment']
)
refurbish = fields.Boolean("Refurbish",
states=_states,)
equipment_type = fields.Char('type', states={'readonly': If('product', True)})
risk = fields.Char('Type risk',states={'readonly': If('product', True)})
use = fields.Char('Use', states={'readonly': If('product', True)})
biomedical_class = fields.Char('Biomedical Class', states={'readonly': If('product', True)})
main_tecnology = fields.Char('Main tecnology', states={'readonly': If('product', True)})
calibration = fields.Boolean("Apply calibration", states={'readonly': If('product', True)})
mark_category = fields.Many2One('product.category', 'Mark', required=True,
domain=[('parent', '=', None),
('accounting', '=', False)],
states=_states
)
model_category = fields.Many2One('product.category', "Model", required=True,
domain=[('parent', '=', Eval('mark_category')),
('accounting', '=', False)],
states=_states,)
reference_category = fields.Many2One('product.category', "Reference",
domain=[('parent', '=', Eval('model_category'))],
states=_states,
depends=['model_category']
)
origin_country = fields.Many2One('country.country',"Origin Country",
states=_states,)
software_version = fields.Char("Software version", size=None,
states=_states,)
useful_life = fields.Integer("Useful life",
states=_states,)
warranty = fields.Integer("Warranty",
states=_states,)
serial = fields.Char("Serial", size=None,
states=_states_serial,
depends=_depends)
health_register = fields.Char("Health Register", size=None,
states=_states,)
contract_history = fields.Many2Many('optical_equipment.contract-optical_equipment.equipment', 'equipment','contract', "Contracts", states={'readonly': True})
maintenance_history = fields.Function(
fields.Many2Many('optical_equipment.maintenance-optical_equipment.equipment',
'equipment', 'maintenance',"Maintenances"), 'get_maintenances_of_equipment')
software_version = fields.Char("Software version", size=None,
states=_states,)
maintenance_frequency = fields.Selection(_MAINTENANCE_FREQUENCY, "Maintenance Frequency",
depends=['propietary'])
purchase_origin = fields.Reference("Purchase Origin", selection='get_origin',select=True,
states={'readonly': True})
sale_destination = fields.Reference("Sale Destination", selection='get_destination',select=True,
states={'readonly': True})
shipment_destination = fields.Reference("Stock Move", selection='get_shipment', select=True,
states={'readonly': True})
rec_name = fields.Function(fields.Char("rec_name"), 'get_rec_name')
del _states_serial, _states, _depends
@fields.depends('product', 'serial', 'code')
def get_rec_name(self, name):
name = str(self.product.name) + '@' + str(self.serial) + '/' + str(self.code)
return name
@staticmethod
def get_origin():
return None
def _get_shipment():
'Return list of Model names for shipment Reference'
return [
'stock.shipment.in',
'stock.shipment.out',
'stock.shipment.out.return',
'stock.shipment.in.return',
'stock.shipment.internal',
]
@classmethod
def get_subscription_history(cls, records, names):
def get_shipment(cls):
IrModel = Pool().get('ir.model')
get_name = IrModel.get_name
models = cls._get_shipment()
return [(None, '')] + [(m, get_name(m)) for m in models]
@classmethod
def _get_origin(cls):
'Return list of Model names for origin Reference'
pool = Pool()
ids = []
for record in records:
ids.append(record.id)
Purchase = pool.get('purchase.line')
Subscriptions = pool.get('sale.subscription-optical_equipment.equipment')
subscriptions = Subscriptions.search([("equipment", 'in', ids)])
subscriptions_history_id = []
DICC = {}
return [Purchase.__name__]
for subscription in subscriptions:
DICC[subscription.equipment.id] = subscription.id
@classmethod
def get_origin(cls):
Model = Pool().get('ir.model')
get_name = Model.get_name
models = cls._get_origin()
#raise UserError(str(type(subscriptions_history_id[0])))
#raise UserError(str(list(subscriptions_history_id[0])))
#raise UserError(str(type(subscriptions_history_id)))
return [(None, '')] + [(m, get_name(m)) for m in models]
return DICC
@classmethod
def _get_destination(cls):
'Return list of Model names for origin Reference'
pool = Pool()
Sale = pool.get('sale.line')
return [Sale.__name__]
@classmethod
def get_destination(cls):
Model = Pool().get('ir.model')
get_name = Model.get_name
models = cls._get_destination()
return [(None, '')] + [(m, get_name(m)) for m in models]
@classmethod
def __setup__(cls):
super(OpticalEquipment, cls).__setup__()
cls._transitions = ({
('draft', 'registred'),
('registred', 'uncontrated'),
('uncontrated', 'contrated'),
})
cls._buttons.update({
# 'draft': {
# 'invisible': Eval('state') == 'draft'},
'registred': {
'invisible': Eval('state').in_(['registred', 'uncontrated', 'contrated'])}}
)
@classmethod
def set_code(cls, equipments):
pool = Pool()
Config = pool.get('optical_equipment.configuration')
config = Config(1)
for equipment in equipments:
if config.equipment_sequence != None:
if not equipment.code:
try:
equipment.code = config.equipment_sequence.get()
cls.save(equipments)
except UserError:
raise UserError(str('Validation Error'))
else:
raise UserError(gettext('optical_equipment.msg_not_sequence_equipment'))
def get_maintenances_of_equipment(self, records):
pool = Pool()
MaintenancesEquipment = pool.get('optical_equipment.maintenance')
maintenancesEquipment = set()
maintenancesEquipment = MaintenancesEquipment.search(['equipment', '=', self.id])
maintenances = []
for key in maintenancesEquipment:
maintenances.append(key.id)
return maintenances
@classmethod
def default_state(cls):
return 'draft'
@staticmethod
def default_company():
return Transaction().context.get('company')
@fields.depends('propietary', 'maintenance_frequency')
def on_change_propietary(self):
if self.propietary:
if self.propietary.client_type == 'ips':
self.maintenance_frequency = "6"
else:
self.maintenance_frequency = "12"
else:
self.maintenance_frequency = "none"
@fields.depends('product', 'equipment_type','use',
'biomedical_class', 'calibration',
'mark_category', 'model_category')
def on_change_product(self):
if self.product:
self.equipment_type=self.product.equipment_type
self.use=self.product.use
self.biomedical_class=self.product.biomedical_class
self.calibration=self.product.calibration
self.mark_category=self.product.mark_category
self.model_category=self.product.model_category
self.reference_category=self.product.reference_category
self.useful_life=self.product.useful_life if self.product.useful_life else int(0)
self.calibration=True if self.product.calibration else False
self.warranty=self.product.warranty if self.product.warranty else int(0)
self.risk=self.product.risk
self.origin_country=self.product.origin_country
self.use=self.product.use
self.biomedical_class=self.product.biomedical_class
else:
self.equipment_type=None
self.use=None
self.biomedical_class=None
self.calibration=None
self.mark_category=None
self.model_category=None
self.reference_category=None
self.useful_life=None
self.calibration=False
self.warranty=None
self.risk=None
self.origin_country=None
self.use=None
self.biomedical_class=None
self.refurbish=None
self.serial=None
self.health_register=None
self.software_version=None
@classmethod
def delete(cls, equipments):
for equipment in equipments:
if equipment.purchase_origin:
raise AccessError(
gettext('estos equipos no se pueden borrar'))
elif equipment.state != 'draft' and equipment.serial != None:
raise AccessError(
gettext('estos equipos no se pueden borrar'))
super(OpticalEquipment, cls).delete(equipments)
@classmethod
@ModelView.button
@Workflow.transition('registred')
def registred(cls, equipments):
for i in equipments:
if i.serial == None:
raise UserError(str("El Equipo no cuenta con un Serial"))
else:
cls.set_code(equipments)
class EquipmentMaintenance(ModelSQL, ModelView):
'Optical Equipment - Equipment - Maintenance'
__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)
class EquipmentParty(ModelSQL, ModelView):
'Optical Equipment - Party'
__name__ = 'optical_equipment.equipment-party.party'
equipment = fields.Many2One('optical_equipment.equipment', "Equipment", select=True)
party = fields.Many2One('party.party', "Party", select=True)
class ChangePropietary(ModelView):
'Change of Propietary Equipment'
__name__ = 'optical_equipment.change_propietary.form'
equipment = fields.Many2One('optical_equipment.equipment', "Equipment")
new_propietary = fields.Many2One('party.party', "New Propietary")
new_address = fields.Many2One('party.address', "New Address", required=True,
domain=[('party', '=', Eval('new_propietary'))],)
change_date = fields.Date("Change Date", readonly=True)
@classmethod
def default_change_date(cls):
pool = Pool()
Date = pool.get('ir.date')
return Date.today()
class NewPropietary(Wizard):
'Change Propietary'
__name__ = 'optical_equipment.change_propietary'
start = StateView('optical_equipment.change_propietary.form',
'optical_equipment.change_propietary_view_form',[
Button('Cancel', 'end', 'tryton-cancel'),
Button('Create', 'change_propietary', 'tryton-ok', default=True),
])
change_propietary = StateAction('optical_equipment.act_optical_equipment_form')
def do_change_propietary(self, action):
equipment = self.start.equipment
new_propietary = self.start.new_propietary
new_address = self.start.new_address
equipment.propietarys += (equipment.propietary,)
equipment.propietary = new_propietary
equipment.propietary_address = new_address
equipment.maintenance_frequency = "6" if new_propietary.client_type == 'ips' else "12"
equipment.save()

View File

@@ -3,13 +3,30 @@
this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<record model="res.group" id="group_equipment_admin">
<field name="name">Equipment Administration</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_equipment_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_equipment_admin"/>
</record>
<record model="res.group" id="group_maintenance_admin">
<field name="name">Maintenance Administration</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_maintenance_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_maintenance_admin"/>
</record>
<menuitem
name="Equipment"
sequence="40"
id="menu_equipment"/>
<record model="ir.action.act_window" id="act_optical_equipment">
<record model="ir.action.act_window" id="act_optical_equipment_form">
<field name="name">Equipments</field>
<field name="res_model">optical_equipment.equipment</field>
<field name="search_value"></field>
</record>
<record model="ir.ui.view" id="optical_equipment_view_tree">
<field name="model">optical_equipment.equipment</field>
@@ -22,15 +39,178 @@
<field name="name">optical_equipment_form</field>
</record>
<record model="ir.action.act_window.view" id="act_optical_equipment_view1">
<field name="sequence" eval="50"/>
<field name="sequence" eval="10"/>
<field name="view" ref="optical_equipment_view_tree"/>
<field name="act_window" ref="act_optical_equipment"/>
<field name="act_window" ref="act_optical_equipment_form"/>
</record>
<record model="ir.action.act_window.view" id="act_optical_equipment_view2">
<field name="sequence" eval="50"/>
<field name="sequence" eval="20"/>
<field name="view" ref="optical_equipment_view_form"/>
<field name="act_window" ref="act_optical_equipment"/>
<field name="act_window" ref="act_optical_equipment_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_optical_equipment_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_optical_equipment_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_optical_equipment_form_domain_registred">
<field name="name">Registred</field>
<field name="sequence" eval="20"/>
<field name="domain"
eval="[('state', '=', 'registred')]"
pyson="1"/>
<field name="count" eval="True"/>
<field name="act_window" ref="act_optical_equipment_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_optical_equipment_form_domain_uncontrated">
<field name="name">UnContrated</field>
<field name="sequence" eval="30"/>
<field name="domain"
eval="[('state', '=', 'uncontrated')]"
pyson="1"/>
<field name="count" eval="True"/>
<field name="act_window" ref="act_optical_equipment_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_optical_equipment_form_domain_contrated">
<field name="name">Contrated</field>
<field name="sequence" eval="30"/>
<field name="domain"
eval="[('state', '=', 'contrated')]"
pyson="1"/>
<field name="count" eval="True"/>
<field name="act_window" ref="act_optical_equipment_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_optical_equipment_form_domain_all">
<field name="name">All</field>
<field name="sequence" eval="9999"/>
<field name="domain"></field>
<field name="act_window" ref="act_optical_equipment_form"/>
</record>
<record model="ir.model.button" id="registred_equipment_button">
<field name="name">registred</field>
<field name="string">Registred</field>
<field name="confirm">Are you sure you want to registred these equipments?</field>
<field name="model" search="[('model', '=', 'optical_equipment.equipment')]"/>
</record>
<menuitem parent="menu_equipment"
action="act_optical_equipment_form"
sequence="60"
id="menu_optical_equipment_form"/>
<record model="ir.action.act_window" id="act_optical_equipment_form1">
<field name="name">Serials</field>
<field name="res_model">optical_equipment.equipment</field>
<field name="search_value"></field>
</record>
<record model="ir.ui.view" id="optical_equipment_view_tree1">
<field name="model">optical_equipment.equipment</field>
<field name="type">tree</field>
<field name="name">optical_equipment_serial_tree</field>
</record>
<record model="ir.action.act_window.view" id="act_optical_equipment_view3">
<field name="sequence" eval="10"/>
<field name="view" ref="optical_equipment_view_tree1"/>
<field name="act_window" ref="act_optical_equipment_form1"/>
</record>
<record model="ir.action.act_window.domain" id="act_optical_equipment_serial_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_optical_equipment_form1"/>
</record>
<menuitem
parent="menu_equipment"
action="act_optical_equipment_form1"
sequence="70"
id="menu_optical_equipment_serial_form"/>
<record model="ir.ui.menu-res.group"
id="menu_party_group_equipment_admin">
<field name="menu" ref="menu_equipment"/>
<field name="group" ref="group_equipment_admin"/>
</record>
<record model="ir.sequence.type" id="sequence_type_equipment">
<field name="name">Equipment</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_equipment_group_admin">
<field name="sequence_type" ref="sequence_type_equipment"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_equipment_group_equipment_admin">
<field name="sequence_type" ref="sequence_type_equipment"/>
<field name="group" ref="group_equipment_admin"/>
</record>
<record model="ir.sequence" id="sequence_equipment">
<field name="name">Equipment</field>
<field name="sequence_type" ref="sequence_type_equipment"/>
</record>
<record model="ir.sequence.type" id="sequence_type_maintenances">
<field name="name">Maintenances</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_maintenance_group_admin">
<field name="sequence_type" ref="sequence_type_maintenances"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_maintenance_group_maintenance_admin">
<field name="sequence_type" ref="sequence_type_maintenances"/>
<field name="group" ref="group_maintenance_admin"/>
</record>
<record model="ir.sequence" id="sequence_maintenances">
<field name="name">Maintenance</field>
<field name="sequence_type" ref="sequence_type_maintenances"/>
</record>
<record model="ir.action.report" id="report_equipment">
<field name="name">Equipment</field>
<field name="model">optical_equipment.equipment</field>
<field name="report_name">optical_equipment.equipment</field>
<field name="report">optical_equipment/report/CV_Equipment.fodt</field>
<field name="single" eval="True"/>
</record>
<record model="ir.action.keyword" id="report_equipment_keyword">
<field name="keyword">form_print</field>
<field name="model">optical_equipment.equipment,-1</field>
<field name="action" ref="report_equipment"/>
</record>
<record model="ir.action.report" id="report_history_maintenance">
<field name="name">Maintenance History</field>
<field name="model">optical_equipment.equipment</field>
<field name="report_name">optical_equipment.equipment</field>
<field name="report">optical_equipment/report/Maintenance_History.fodt</field>
<field name="single" eval="True"/>
</record>
<record model="ir.action.keyword" id="report_history_maintenance_keyword">
<field name="keyword">form_print</field>
<field name="model">optical_equipment.equipment,-1</field>
<field name="action" ref="report_history_maintenance"/>
</record>
<record model="ir.ui.view" id="change_propietary_view_form">
<field name="model">optical_equipment.change_propietary.form</field>
<field name="type">form</field>
<field name="name">change_propietary_form</field>
</record>
<record model="ir.action.wizard" id="equipment_change_propietary">
<field name="name">Change Propietary</field>
<field name="wiz_name">optical_equipment.change_propietary</field>
<field name="model">optical_equipment.equipment</field>
</record>
<record model="ir.action.keyword" id="equipment_change_propietary_keyword">
<field name="keyword">form_action</field>
<field name="model">optical_equipment.equipment,-1</field>
<field name="action" ref="equipment_change_propietary"/>
</record>
<menuitem parent="menu_equipment" sequence="40" action="act_optical_equipment" id="menu_optical_equipment"/>
</data>
</tryton>

11
exceptions.py Normal file
View File

@@ -0,0 +1,11 @@
# 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.exceptions import UserError
from trytond.model.exceptions import ValidationError
class InvalidNumberPurchases(UserError):
pass
class NotSequenceEquipment(ValidationError):
pass

1292
locale/es.po Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,954 @@
# 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.model import (
Workflow, ModelSQL, ModelView, Unique, fields, sequence_ordered)
from trytond.wizard import (
Button, StateAction, StateTransition, StateView, Wizard)
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
from scipy.stats import t
import matplotlib.pyplot as plt
import numpy as np
import math as mt
from io import BytesIO
from trytond.exceptions import UserError
_digits = (16, 2)
class MaintenanceService(Workflow, ModelSQL, ModelView):
'Equipment Maintenance Service'
__name__ = 'optical_equipment_maintenance.service'
_rec_name = 'rec_name'
_order_name = 'code'
_states = {'readonly': If(Eval('state') != 'draft', True)}
code = fields.Char("Code", readonly=True, select=True)
reference = fields.Char("Reference", select=True,
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)
maintenance_type = fields.Selection([('initial','Initial'),
('preventive', 'Preventive'),
('corrective', 'Corrective')
], "Maintenance Type", states=_states)
propietary = fields.Many2One('party.party', "Propietary", required=True, states=_states)
propietary_address = fields.Many2One('party.address', "Propietary Address", required=True,
domain=[('party', '=', Eval('propietary'))],
states=_states)
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)
state_agended = fields.Selection([('no_agenda', "No agenda"),
('agended', "Agended"),
('in_progress', "In progress"),
('finish', "Finish"),
('failed', "Failed")], "State Agenda", states=_states)
technical = fields.Many2One('company.employee', "Technical", states=_states)
state = fields.Selection([('draft', "Draft"),
('agended', "Agended"),
('in_progress', "In Progress"),
('failed', "Failed"),
('finished', "Finished")
], "State", required=True, readonly=True, sort=True)
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
@classmethod
def __setup__(cls):
super(MaintenanceService, cls).__setup__()
cls._transitions = ({
('draft', 'agended'),
('agended', 'in_progress'),
('in_progress', 'finished'),
})
cls._buttons.update({
'in_progress': {'invisible': Eval('state').in_(['draft', 'in_progress', 'finished'])},
'finished': {'invisible': Eval('state').in_(['draft', 'agended', 'finished'])}
})
@staticmethod
def default_company():
return Transaction().context.get('company')
@classmethod
def default_maintenance_type(self):
return 'preventive'
@classmethod
def default_state_agended(self):
return 'no_agenda'
@classmethod
def default_state(self):
return 'draft'
@classmethod
def _get_origin(cls):
'Return list of Model names for origin Reference'
pool = Pool()
Sale = pool.get('sale.line')
return [Sale.__name__]
@classmethod
def get_origin(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 _get_origin_contract(cls):
'Return list of Model names for origin Reference'
pool = Pool()
Contract = pool.get('optical_equipment.contract')
return [Contract.__name__]
@classmethod
def get_origin_contract(cls):
Model = Pool().get('ir.model')
get_name = Model.get_name
models = cls._get_origin_contract()
return [(None, '')] + [(m, get_name(m)) for m in models]
@classmethod
def set_code(cls, maintenance):
pool = Pool()
Config = pool.get('optical_equipment.configuration')
config = Config(2)
if config.maintenance_sequence != None:
if not maintenance.code:
try:
maintenance.code = config.maintenance_sequence.get()
maintenance.save()
except UserError:
raise UserError(str('Validation Error'))
else:
raise UserError(gettext('optical_equipment.msg_not_sequence_equipment'))
@classmethod
@ModelView.button
@Workflow.transition('in_progress')
def in_progress(cls, maintenances):
pass
@classmethod
@ModelView.button
@Workflow.transition('finished')
def finished(cls, maintenances):
pass
class Maintenance(Workflow, ModelSQL, ModelView):
'Equipment Maintenance'
__name__ = 'optical_equipment.maintenance'
_states={'required': True,
'readonly': Eval('state').in_(['finished'])}
service_maintenance = fields.Many2One('optical_equipment_maintenance.service', "Maintenance Service",
ondelete='CASCADE', select=True,
states=_states)
code = fields.Char(
"Code", select=True,states={'readonly': True })
maintenance_type = fields.Selection([('initial', 'initial'),
('preventive', 'Preventive'),
('corrective', 'Corrective')], "Maintenance Type", states=_states)
state = fields.Selection([('draft', "Draft"),
('finished', "Finished")
], "State", readonly=True, sort=False,
states=_states)
company = fields.Many2One('company.company', "Company", readonly=True)
propietary = fields.Many2One('party.party', "Propietary", states=_states,
depends=['service_maintenance'])
propietary_address = fields.Many2One('party.address', "Propietary Address",
states=_states,
domain=[('party', '=', Eval('propietary'))],
depends=['service_maintenance'])
equipment = fields.Many2One('optical_equipment.equipment', "Equipment",
domain=[('propietary', '=', Eval('propietary'))],
states=_states,
depends=['service_maintenance'])
#when the maintenance is in agended status
diary = fields.One2Many('optical_equipment_maintenance.diary', 'diary')
#Preventive maintenance
initial_operation = fields.Boolean("Verificiació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")
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",
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')
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')},
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),
'readonly': Eval('state') == 'finished'},
depends=['moisture_min']
)
graph_calibration = fields.Binary('Graphs')
@classmethod
def __setup__(cls):
super(Maintenance, cls).__setup__()
cls._transitions.update({
('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') == ())) |
(Eval('calibration_total') == ())},
'calibrate': {'invisible': (Eval('lines_calibration') == ()) | (Eval('state').in_(['finished'])),
'depends': ['state'],}
})
@classmethod
def view_attributes(cls):
return super(Maintenance, cls).view_attributes() + [
('//page[@id="preventive"]', 'states', {
'invisible': If(Eval('maintenance_type') != 'preventive', True),
}),
('//page[@id="corrective"]', 'states',{
'invisible': If(Eval('maintenance_type') != 'corrective', True),
})
]
@staticmethod
def default_company():
return Transaction().context.get('company')
@classmethod
def default_state(cls):
return 'draft'
@classmethod
def default_maintenance_type(cls):
return 'preventive'
@classmethod
def default_state_agended(cls):
return 'no_agenda'
@classmethod
def default_initial_operation(self):
return True
@classmethod
def default_check_equipment(self):
return True
@classmethod
def default_check_electric_system(self):
return True
@classmethod
def default_clean_int_ext(self):
return True
@classmethod
def default_clean_eyes(self):
return True
@classmethod
def default_optical(self):
return True
@classmethod
def default_check_calibration(self):
return True
@fields.depends('temperature_min', 'temperature_uom')
def on_change_temperature_min(self):
if self.temperature_min:
pool = Pool()
Measurements = pool.get('product.uom')
self.temperature_uom = Measurements.search(['name', '=', 'Celsius'])[0].id
@fields.depends('moisture_min', 'moisture_uom')
def on_change_moisture_min(self):
pool = Pool()
Measurements = pool.get('product.uom')
self.moisture_uom = Measurements.search(['name', '=', 'Relative Humedity'])[0].id
def get_next_maintenance(self, action):
next_maintenance = None
if self.service_maintenance.estimated_agended:
if self.propietary.client_type == "ips":
next_maintenance = self.service_maintenance.estimated_agended + timedelta(days=365)
else:
next_maintenance = self.service_maintenance.estimated_agended + timedelta(days=182)
return next_maintenance
def get_standard_deviation(samples):
"""
This function calculated the
standartd deviation
"""
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 = mt.sqrt(dev_std_square)
return dev_std
def get_uncertain_type_A(samples, dev_std):
"""
This function calculated the
uncertain type A
"""
n_samples = len(samples)
uncertain_type_A = dev_std /mt.sqrt(n_samples)
return uncertain_type_A
def get_uncertain_pattern(self):
"""
uncertain_pattern = 0,25 constante viene del equipo
"""
uncertain_pattern = 0.25
return uncertain_pattern
def get_k_certificated_calibration(self):
k_certificated_calibration = 2
return k_certicated_calibration
def get_uncertain_U_b1(self):
uncertain_b1 = MEP / mt.sqrt(3)
uncertain_b1a = uncertain_pattern / k_certificated_calibration
return uncertain_b1
def default_d_resolution(self):
return d
def get_uncertain_b2_digital(self):
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)
return uncertain_b2_analog
def get_uncertain_combinated(self):
"""
Incertidumbre Combinada
"""
sum_uncertain_c = uncertain_type_A**2 + uncertain_b1**2 + uncertain_b2**2
uncertain_c = math.sqrt(sum_uncertain_c)
return uncertain_c
def get_uncertain_eff(self):
"""
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))
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)
count = 0
for pattern in patterns:
error = pattern - matrix[count][0]
yerr.append(matrix[count][1])
errors.append(error)
count+=1
labels = list(patterns)
x = labels
y = errors
if equipment_risk == 'dosB':
if sum(errors) == 0:
top = 1.5
bottom = -1.5
else:
top = 2
bottom = -2
else:
top = 0.60
bottom = -0.60
ls = 'dotted'
fig, ax1 = plt.subplots(nrows=1, ncols=1)
ax1.set_ylim(bottom, top)
ax1.set_xlim((-21, 21))
ax1.yaxis.grid(True)
ax1.set_title('Error[D]')
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.errorbar(x, y, yerr=yerr, marker='D', markersize=10, linestyle=ls)
plt.savefig(image, format='png')
plt.close()
return image.getvalue()
@fields.depends('service_maintenance')
def on_change_service_maintenance(self):
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
@ModelView.button
@Workflow.transition('in_progress')
def in_progress(cls, maintenances):
pass
@classmethod
@ModelView.button
@Workflow.transition('finished')
def finished(cls, maintenances):
for maintenance in maintenances:
if maintenance.calibration_total == ():
raise UserError("No puede finalizar este mantenimiento sin una calibración")
else:
maintenance.state = 'finished'
maintenance.code = maintenance.id
maintenance.save()
@classmethod
@ModelView.button
def calibrate(cls, maintenances):
pool = Pool()
CalibrationLineTotal = pool.get('optical_equipment.maintenance.calibration')
dates = {}
dates_mistake_pattern = []
patterns = set()
for maintenance in maintenances:
maintenance.calibration_total = ()
if len(maintenance.lines_calibration) < 5:
raise UserError("Por favor Ingrese mas de (5) Muestras por patrón (Dioptría)")
else:
for line in maintenance.lines_calibration:
if line.value_patterns.pattern not in patterns:
patterns.add(line.value_patterns.pattern)
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)
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
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_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))
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_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])
if maintenance.equipment.product.resolution_type == "analoga":
calibrationLineTotal = CalibrationLineTotal(
diopter=pattern,
mean=mean,
dev_std=dev_std,
uncertain_type_A=uncertain_type_A,
uncertain_pattern=uncertain_pattern,
k_c_calibration=k_certificated_calibration,
uncertain_U_b1=uncertain_b1,
d_resolution=a_resolution,
uncertain_U_b2_dig=0,
uncertain_U_b2_ana=uncertain_b2_analog,
uncertain_combinated=uncertain_c,
uncertain_eff=uncertain_eff,
t_student=t_student,
uncertain_expanded=uncertain_expanded,
state='Aprobado' if uncertain_expanded <= a_resolution else 'Rechazado'
)
maintenance.calibration_total += (calibrationLineTotal,)
elif maintenance.equipment.product.resolution_type == "digital":
calibrationLineTotal = CalibrationLineTotal(
diopter=pattern,
mean=mean,
dev_std=dev_std,
uncertain_type_A=uncertain_type_A,
uncertain_pattern=uncertain_pattern,
k_c_calibration=k_certificated_calibration,
uncertain_U_b1=uncertain_b1,
d_resolution=d_resolution,
uncertain_U_b2_dig=uncertain_b2_digital,
uncertain_U_b2_ana=0,
uncertain_combinated=uncertain_c,
uncertain_eff=uncertain_eff,
t_student=t_student,
uncertain_expanded=uncertain_expanded,
state='Aprobado' if uncertain_expanded <= d_resolution else 'Rechazado'
)
maintenance.calibration_total += (calibrationLineTotal,)
maintenance.save()
equipment_risk = maintenance.equipment.product.risk
image = cls.get_create_graph(dates_mistake_pattern, patterns, resolution, equipment_risk)
maintenance.graph_calibration = image
maintenance.save()
class Calibration(ModelSQL, ModelView):
'Calibration of Maintenance'
__name__ = 'optical_equipment.maintenance.calibration'
_states={'readonly': True}
maintenance = fields.Many2One('optical_equipment.maintenance', "Maintenance", ondelete="CASCADE",
select=True, required=True)
graph_dates = fields.Char("Graph Dates", readonly=True)
diopter = fields.Float("Diopter", states=_states)
mean = fields.Float("Mean", states=_states)
dev_std = fields.Float("Standart Desviation", states=_states)
uncertain_type_A = fields.Float("Uncertain Type A", states=_states)
uncertain_pattern = fields.Float("Uncertain Pattern", states=_states)
k_c_calibration = fields.Float("K Crt Calibration",states=_states)
uncertain_U_b1 = fields.Float("U_b1", states=_states)
d_resolution = fields.Float("d_resolution", states=_states)
uncertain_U_b2_dig = fields.Float("U_b2", states=_states)
uncertain_U_b2_ana = fields.Float("U_b2", states=_states)
uncertain_combinated = fields.Float("U_combinated", states=_states)
uncertain_eff = fields.Float("U eff", states=_states)
t_student = fields.Float("T Student", states=_states)
uncertain_expanded = fields.Float("Uexpand", _digits, states=_states)
state = fields.Char('State')
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.Float("Sample #", _digits)
value_patterns = fields.Many2One('optical_equipment.product_pattern', "Value Pattern", required=True,
ondelete='RESTRICT')
value_equipment = fields.Float("Value in Equipment", _digits, required=True,
states={'readonly': Eval('value_patterns') == None})
mistake = fields.Float("Mistake", _digits)
mistake_rate = fields.Float("% Mistake", _digits,
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
if self.value_patterns.pattern == self.value_equipment:
self.mistake_rate = 0
else:
self.mistake_rate = abs(self.mistake / self.value_patterns.pattern) * 100
class AgendedInitial(ModelView):
'Agended maintenance service'
__name__ = 'optical_equipment_maintenance.agended'
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)
class AssingAgended(Wizard):
'Assing Agended'
__name__ = 'optical_equipment_maintenance.assing_agended'
start = StateView('optical_equipment_maintenance.agended',
'optical_equipment.assing_agended_view_form', [
Button('Cancel', 'end', 'tryton-cancel'),
Button('Assing', 'assing_agended', 'tryton-ok', default=True),
])
assing_agended = StateAction('optical_equipment.act_maintenance_service_form')
def do_assing_agended(self, action):
pool = Pool()
Diary = pool.get('optical_equipment_maintenance.diary')
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),
technical=self.start.technical.id,
state='agended')
diary.save()
maintenanceService = self.start.maintenance_service
maintenanceService.estimated_agended = self.start.estimated_agended
maintenanceService.technical = self.start.technical
maintenanceService.state_agended = 'agended'
maintenanceService.state = 'agended'
maintenanceService.history_agended += (diary.id,)
maintenanceService.set_code(maintenanceService)
maintenanceService.save()
class ReAgended(ModelView):
'Agended maintenance service'
__name__ = 'optical_equipment_maintenance.reagended'
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)
class ReAssingAgended(Wizard):
'Assing Agended'
__name__ = 'optical_equipment_maintenance.reassing_agended'
start = StateView('optical_equipment_maintenance.reagended',
'optical_equipment.reassing_agended_view_form', [
Button('Cancel', 'end', 'tryton-cancel'),
Button('Assing', 'assing_agended', 'tryton-ok', default=True),
])
assing_agended = StateAction('optical_equipment.act_maintenance_service_form')
def do_assing_agended(self, action):
pool = Pool()
Diary = pool.get('optical_equipment_maintenance.diary')
diary = Diary(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),
technical=self.start.technical.id,
state='agended')
diary.save()
maintenanceService = self.start.maintenance_service
maintenanceService.estimated_agended = self.start.estimated_agended
maintenanceService.technical = self.start.technical
maintenanceService.state_agended = 'agended'
maintenanceService.state = 'agended'
maintenanceService.history_agended += (diary.id,)
maintenanceService.save()
class ServiceMaintenanceAgended(ModelSQL):
'Service Maintenance - Agended'
__name__ = 'optical_equipment_maintenance.service-maintenance.diary'
maintenance_service = fields.Many2One('optical_equipment_maintenance.service', "Maintenance Service")
agended = fields.Many2One('optical_equipment_maintenance.diary', "Agended")
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)
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)},
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)},
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)),
])
product_uom_category = fields.Function(fields.Many2One('product.uom.category', 'Product Uom Category'),
'on_change_with_product_uom_category')
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):
if self.maintenance and self.maintenance.company:
return self.maintenance.company.id
@fields.depends('line_replace', 'replacement')
def on_change_line_replace(self, name=None):
if self.line_replace == False:
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
@fields.depends('replacement', 'maintenance', 'unit', 'maintenance')
def on_change_replacement(self):
if not self.replacement:
self.unit = None
return
if not self.unit or self.unit.category != category:
self.unit = self.replacement.sale_uom
@fields.depends('maintenance_activity',
'quantity', 'unit')
def on_change_maintenance_activity(self):
if not self.maintenance_activity:
self.quantity = None
self.unit = None
return
self.quantity = 1
if not self.unit or self.unit.category != category:
self.unit = self.maintenance_activity.sale_uom
class MaintenanceActivity(ModelView, ModelSQL):
'Maintenance Activitys'
__name__ = 'optical_equipment_maintenance.activity'
maintenance = fields.Many2One('optical_equipment.maintenance')
product = fields.Many2One('product.product', 'Product',
domain=[('maintenance_activity', '=', True)])
class CreateContractInitial(ModelView, ModelSQL):
'Create Contract Inicial'
__name__ = 'optical_equipment_create.contract'
currency = fields.Many2One('currency.currency', 'Currency', required=True)
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),
])
unit_price = Monetary(
"Unit Price", digits=price_digits, currency='currency')
@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 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,)
equipments = []
for line in maintenance_service.lines:
equipments.append(line.equipment.id)
if maintenance_service.contract_origin:
contract=maintenance_service.contract_origin
contract.invoice_address=dates['invoice_address']
contract.contact=dates['contact']
contract.start_date=dates['start_date']
contract.end_date=dates['end_date']
contract.maintenance_services+=prorogues
contract.equipments=equipments
contract.state='draft'
contract.price_contract=maintenance_service.sale_origin.sale.total_amount
contract.save()
else:
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,
equipments=equipments,
state='draft',
price_contract=maintenance_service.sale_origin.sale.total_amount
)
contract.save()

292
maintenance.xml Normal file
View File

@@ -0,0 +1,292 @@
<?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="ir.action.act_window" id="act_maintenance_form">
<field name="name">Maintenances</field>
<field name="res_model">optical_equipment.maintenance</field>
<field name="search_value"></field>
</record>
<record model="ir.ui.view" id= "maintenance_view_tree">
<field name="model">optical_equipment.maintenance</field>
<field name="type">tree</field>
<field name="name">maintenance_tree</field>
</record>
<record model="ir.ui.view" id="maintenance_view_form">
<field name="model">optical_equipment.maintenance</field>
<field name="type">form</field>
<field name="name">maintenance_form</field>
</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="search_value"></field>
</record>
<record model="ir.ui.view" id= "maintenance_service_view_tree">
<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="type">form</field>
<field name="name">maintenance_service_form</field>
</record>
<record model="ir.ui.view" id= "maintenance_equipment_view_form">
<field name="model">optical_equipment.maintenance-optical_equipment.equipment</field>
<field name="inherit" ref="maintenance_view_form"/>
<field name="name">maintenance_equipment_form</field>
</record>
<record model="ir.ui.view" id="maintenance_activity_view_form">
<field name="model">optical_equipment_maintenance.activity</field>
<field name="type">form</field>
<field name="name">maintenance_activity_form</field>
</record>
<record model="ir.ui.view" id="maintenance_activity_view_tree">
<field name="model">optical_equipment_maintenance.activity</field>
<field name="type">tree</field>
<field name="priority" eval="10"/>
<field name="name">maintenance_activity_tree</field>
</record>
<record model="ir.action.act_window.view" id="act_maintenance_view1">
<field name="sequence" eval="10"/>
<field name="view" ref="maintenance_view_tree"/>
<field name="act_window" ref="act_maintenance_form"/>
</record>
<record model="ir.action.act_window.view" id="act_maintenance_view2">
<field name="sequence" eval="20"/>
<field name="view" ref="maintenance_view_form"/>
<field name="act_window" ref="act_maintenance_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_maintenance_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_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"/>
<field name="domain"
eval="[('state', '=', 'finished')]"
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_all">
<field name="name">All</field>
<field name="sequence" eval="9999"/>
<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')]"/>
</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')]"/>
</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')]"/>
</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.model.button" id="maintenance_calibrate_button">
<field name="name">calibrate</field>
<field name="string">Calibrate</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"/>
<field name="domain"
eval="[('state', '=', 'draft')]"
pyson="1"/>
<field name="count" eval="True"/>
<field name="act_window" ref="act_maintenance_service_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_maintenance_service_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_service_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_maintenance_service_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_service_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_maintenance_service_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_service_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_maintenance_service_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_maintenance_service_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_maintenance_service_form_domain_all">
<field name="name">All</field>
<field name="sequence" eval="9999"/>
<field name="domain"></field>
<field name="act_window" ref="act_maintenance_service_form"/>
</record>
<record model="ir.ui.view" id="maintenance_line_view_form">
<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_line_view_tree">
<field name="model">optical_equipment.maintenance.line</field>
<field name="type">tree</field>
<field name="name">maintenance_line_tree</field>
</record>
<record model="ir.ui.view" id="maintenance_calibration_view_form">
<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_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="calibration_total_view_tree">
<field name="model">optical_equipment.maintenance.calibration</field>
<field name="type">tree</field>
<field name="name">calibration_total_tree</field>
</record>
<record model="ir.ui.view" id="calibration_total_view_form">
<field name="model">optical_equipment.maintenance.calibration</field>
<field name="type">form</field>
<field name="name">calibration_total_form</field>
</record>
<record model="ir.ui.view" id="assing_agended_view_form">
<field name="model">optical_equipment_maintenance.agended</field>
<field name="type">form</field>
<field name="name">assing_agended_form</field>
</record>
<record model="ir.action.wizard" id="act_assing_agended">
<field name="name">Assing Agended</field>
<field name="wiz_name">optical_equipment_maintenance.assing_agended</field>
</record>
<record model="ir.ui.view" id="reassing_agended_view_form">
<field name="model">optical_equipment_maintenance.reagended</field>
<field name="type">form</field>
<field name="name">reassing_agended_form</field>
</record>
<record model="ir.action.wizard" id="act_reassing_agended">
<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>
<record model="ir.action.report" id="report_calibration">
<field name="name">Calibration</field>
<field name="model">optical_equipment.maintenance</field>
<field name="report_name">optical_equipment.maintenance</field>
<field name="report">optical_equipment/report/Calibration.fodt</field>
<field name="single" eval="True"/>
</record>
<record model="ir.action.keyword" id="report_calibration_keyword">
<field name="keyword">form_print</field>
<field name="model">optical_equipment.maintenance,-1</field>
<field name="action" ref="report_calibration"/>
</record>
<record model="ir.action.report" id="report_capacitation">
<field name="name">Capacitation</field>
<field name="model">optical_equipment_maintenance.service</field>
<field name="report_name">optical_equipment_maintenance.service</field>
<field name="report">optical_equipment/report/Capacitation.fodt</field>
<field name="single" eval="True"/>
</record>
<record model="ir.action.keyword" id="report_capacitation_keyword">
<field name="keyword">form_print</field>
<field name="model">optical_equipment_maintenance.service,-1</field>
<field name="action" ref="report_capacitation"/>
</record>
<record model="ir.action.report" id="report_maintenance_service">
<field name="name">Maintenance Service</field>
<field name="model">optical_equipment.maintenance</field>
<field name="report_name">optical_equipment.maintenance</field>
<field name="report">optical_equipment/report/Maintenance_Service.fodt</field>
<field name="single" eval="True"/>
</record>
<record model="ir.action.keyword" id="report_maintenance_service_keyword">
<field name="keyword">form_print</field>
<field name="model">optical_equipment.maintenance,-1</field>
<field name="action" ref="report_maintenance_service"/>
</record>
<record model="ir.action.report" id="report_maintenance_timeline">
<field name="name">Maintenance Service</field>
<field name="model">optical_equipment.maintenance</field>
<field name="report_name">optical_equipment.maintenance</field>
<field name="report">optical_equipment/report/Maintenance_Timeline.fodt</field>
<field name="single" eval="True"/>
</record>
<record model="ir.action.keyword" id="report_maintenance_timeline_keyword">
<field name="keyword">form_print</field>
<field name="model">optical_equipment.maintenance,-1</field>
<field name="action" ref="report_maintenance_timeline"/>
</record>
<menuitem parent="menu_equipment"
action="act_maintenance_service_form"
sequence="20"
id="menu_maintenance_service_form"/>
<menuitem parent="menu_maintenance_service_form"
action="act_maintenance_form"
sequence="30"
id="menu_maintenance_form"/>
<menuitem parent="menu_diary"
action="act_assing_agended"
sequence="30"
id="menu_assing_agended_form"/>
<menuitem parent="menu_diary"
action="act_reassing_agended"
sequence="40"
id="menu_reassing_agended_form"/>
</data>
</tryton>

View File

@@ -1,21 +0,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.
from trytond.model import fields
from trytond.pool import PoolMeta
class Measurements(metaclass=PoolMeta):
__name__ = 'product.template'
temperature = fields.Float("Temperature")
temperature_uom = fields.Many2One('product.uom', "Temperature UOM")
frequency = fields.Float("Frequency")
frequency_uom = fields.Many2One('product.uom', "Frequency UOM")
wet = fields.Float("Wet")
wet_uom = fields.Many2One('product.uom', "Wet UOM")
voltageAC = fields.Float("Voltage AC")
voltageAC_uom = fields.Many2One('product.uom', "Voltage AC UOM")
voltageDC = fields.Float("Voltage DC")
voltageDC_uom = fields.Many2One('product.uom', "Voltage DC UOM")

View File

@@ -1,9 +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="template_view_form">
<field name="model">product.template</field>
<field name="inherit" ref="product.template_view_form"/>
<field name="name">template_form</field>
</record>
</tryton>

16
message.xml Normal file
View File

@@ -0,0 +1,16 @@
<?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 grouped="1">
<record model="ir.message" id="msg_invalid_number_purchases">
<field name="text">Please, select only one purchase.</field>
</record>
<record model="ir.message" id="msg_serial_unique">
<field name="text">The serial number of equipment, should be unique.</field>
</record>
<record model="ir.message" id="msg_not_sequence_equipment">
<field name="text">You do not have a sequence assigned for equipments</field>
</record>
</data>
</tryton>

214
move.py Normal file
View File

@@ -0,0 +1,214 @@
from trytond.model import fields, ModelSQL, ModelView, Workflow, dualmethod
from trytond.modules.company.model import employee_field, set_employee
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Eval, If
from trytond.exceptions import UserError
from itertools import groupby
from trytond.transaction import Transaction
class Move(metaclass=PoolMeta):
"Stock Move"
__name__ = "stock.move"
equipment = fields.Many2One('optical_equipment.equipment', "Equipment",
domain=[('state', '=', 'registred'),
('product','=', Eval('product'))
],
states={'invisible': If(~Eval('product_equipment'), True),
'readonly': (Eval('state').in_(['cancelled', 'done'])),},
depends=['product_equipment'])
equipment_serial = fields.Function(fields.Char('Serial',
states={'readonly': True,
'invisible': If(~Eval('product_equipment'), True)},
depends=['product_equipment']),
'get_equipment_serial')
product_equipment = fields.Function(fields.Boolean("It Equipment"),'get_product_equipment')
@fields.depends('product')
def get_product_equipment(self, product):
if self.product.equipment:
return True
else:
return False
@fields.depends('equipment')
def get_equipment_serial(self, equipment):
if self.equipment:
return self.equipment.serial
else:
return None
@fields.depends('product', 'equipment', 'uom')
def on_change_product(self):
if self.product:
if (not self.uom
or self.uom.category != self.product.default_uom.category):
self.uom = self.product.default_uom
@fields.depends(methods=['get_equipment_serial'])
def on_change_equipment(self):
if self.equipment:
self.product = self.equipment.product.id
self.equipment_serial = self.get_equipment_serial(self.equipment)
else:
self.equipment_serial = None
class ShipmentOut(metaclass=PoolMeta):
"Customer Shipment"
__name__ = 'stock.shipment.out'
service_maintenance_initial = fields.Boolean('Maintenance Initial', states={'readonly': True})
@classmethod
def __setup__(cls):
super(ShipmentOut, cls).__setup__()
cls._buttons.update({
'maintenance_initial': {'invisible': If(Eval('service_maintenance_initial') == True, True)}})
def get_outgoing_moves(self, name):
moves = []
if self.state == 'done':
for move in self.inventory_moves:
moves.append(move.id)
return moves
else:
for move in self.moves:
if move.from_location == self.warehouse_output:
moves.append(move.id)
return moves
@classmethod
def view_attributes(cls):
return super(ShipmentOut, cls).view_attributes() + [
('//page[@name="inventory_moves"]', 'states', {
'invisible': False,
}),]
@classmethod
@ModelView.button
def maintenance_initial(cls, shipments):
pool = Pool()
MaintenanceService = pool.get('optical_equipment_maintenance.service')
Maintenance = pool.get('optical_equipment.maintenance')
SaleLine = pool.get('sale.line')
Equipments = pool.get('optical_equipment.equipment')
for shipment in shipments:
for move in shipment.inventory_moves:
count = 0
if move.equipment:
equipment = move.equipment
Id = equipment.id
equipment = Equipments.search(['id', '=',Id])[0]
equipment.propietary = shipment.customer.id
equipment.propietary_address= shipment.delivery_address.id
equipment.state="uncontrated"
equipment.shipment_destination = shipment
equipment.sale_destination = shipment.outgoing_moves[count].origin
equipment.propietarys += (shipment.customer,)
equipment.maintenance_frequency = "6" if shipment.customer.client_type == "ips" else "12"
count+=1
equipment.save()
else:
count+=1
for shipment in shipments:
sale_origin = shipment.outgoing_moves[0].origin.sale.id
saleLine = SaleLine(
type='line',
quantity=1,
unit_price=0,
sale=sale_origin)
saleLine.save()
maintenanceService = MaintenanceService(
sale_date=shipment.outgoing_moves[0].origin.sale.sale_date,
sale_origin=saleLine,
maintenance_type='initial',
propietary=shipment.customer.id,
propietary_address=shipment.delivery_address.id)
maintenanceService.save()
serial = False
for move in shipment.inventory_moves:
if move.product_equipment and move.equipment:
serial = True
else:
serial = False
if serial == True:
for move in shipment.inventory_moves:
if move.product_equipment and move.equipment:
maintenance = Maintenance(
service_maintenance=maintenanceService.id,
maintenance_type='initial',
propietary=shipment.customer.id,
propietary_address=shipment.delivery_address.id,
equipment=move.equipment.id)
maintenance.save()
shipment.service_maintenance_initial = True
else:
raise UserError(str('Por favor Primero debe Asignar un serial a todos los Equipos.'))
def _get_inventory_move(self, move):
'Return inventory move for the outgoing move if necessary'
pool = Pool()
Move = pool.get('stock.move')
Uom = pool.get('product.uom')
quantity = move.quantity
for inventory_move in self.inventory_moves:
if (inventory_move.origin == move
and inventory_move.state != 'cancelled'):
quantity -= Uom.compute_qty(
inventory_move.uom, inventory_move.quantity, move.uom)
quantity = move.uom.round(quantity)
if quantity <= 0:
return
inventory_move = Move(
from_location=self.warehouse_storage,
to_location=move.from_location,
product=move.product,
uom=move.uom,
quantity=quantity,
shipment=self,
planned_date=move.planned_date,
company=move.company,
origin=move,
state='staging' if move.state == 'staging' else 'draft',
)
if inventory_move.on_change_with_unit_price_required():
inventory_move.unit_price = move.unit_price
inventory_move.currency = move.currency
return inventory_move
class ShipmentInternal(metaclass=PoolMeta):
'Shipment Interncal'
__name__ = 'stock.shipment.internal'
@classmethod
@ModelView.button
@Workflow.transition('done')
@set_employee('done_by')
def done(cls, shipments):
pool = Pool()
Move = pool.get('stock.move')
Date = pool.get('ir.date')
for shipment in shipments:
for move in shipment.moves:
if move.equipment:
move.equipment.location = shipment.to_location
move.equipment.save()
Move.do([m for s in shipments for m in s.incoming_moves])
cls.write([s for s in shipments if not s.effective_date], {
'effective_date': Date.today(),})

31
move.xml Normal file
View File

@@ -0,0 +1,31 @@
<?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="move_view_list_shipment">
<field name="model">stock.move</field>
<field name="inherit" ref="stock.move_view_list_shipment"/>
<field name="name">move_list_shipment</field>
</record>
<record model="ir.ui.view" id="move_view_form">
<field name="model">stock.move</field>
<field name="inherit" ref="stock.move_view_form"/>
<field name="name">move_form</field>
</record>
<record model="ir.model.button" id="maintenance_initial_button">
<field name="name">maintenance_initial</field>
<field name="string">Maintenance Initial</field>
<field name="model" search="[('model', '=', 'stock.shipment.out')]"/>
</record>
<record model="ir.action.report" id="report_shipment_out_picking_list1">
<field name="name">Acta Entrega</field>
<field name="model">stock.shipment.out</field>
<field name="report_name">stock.shipment.out.picking_list1</field>
<field name="report">optical_equipment/report/Delivery_Certificated.fodt</field>
</record>
<record model="ir.action.keyword" id="report_shipment_out_picking_list1_keyword">
<field name="keyword">form_print</field>
<field name="model">stock.shipment.out,-1</field>
<field name="action" ref="report_shipment_out_picking_list1"/>
</record>
</tryton>

View File

@@ -3,7 +3,8 @@ from trytond.model import ModelSQL, ModelView, fields
from . import equipment
_CLIENT_TYPE = [('ips', 'IPS'),
('optica', 'Optica')]
('optica', 'Optica'),
('otro', 'Otro')]
class Party(metaclass=PoolMeta):
__name__ = 'party.party'

View File

@@ -1,76 +1,276 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#txhis repository contains the full copyright notices and license terms
from sql import Literal
from sql.operators import Equal
#this repository contains the full copyright notices and license terms
from trytond.pool import Pool, PoolMeta
from trytond.model import (
ModelView, ModelSQL, fields, Exclude)
from trytond.pyson import If, Eval
from trytond.pyson import Bool, If, Eval, Id
from trytond.exceptions import UserError
_RISK = [('uno', 'I'),
_RISK = [('n/a', "No aplíca"),
('uno', 'I'),
('dosA', 'IIA'),
('dosB', 'IIB')]
_USE = [('medico', 'Médico'),
_USE = [('', ""),
('medico', 'Médico'),
('basico', 'Basico'),
('apoyo', 'Apoyo')]
_BIOMEDICAL_CLASS = [('diagnostico', 'Diagnóstico'),
_BIOMEDICAL_CLASS = [
('n/a', "No aplíca"),
('diagnostico', 'Diagnóstico'),
('rehabilitación', 'Rehabilitación')]
_MAIN_TECNOLOGY = [('mecanico', 'Mecánico'),
_MAIN_TECNOLOGY = [
('', ""),
('mecanico', 'Mecánico'),
('electrico', 'Electrico'),
('electronico', 'Electrónico'),
('hidraulico', 'Hidraulico'),
('neumatico', 'Neumatico')]
_EQUIPMENT_TYPE = [('mobiliario_optico', 'Mobiliario óptico'),
_EQUIPMENT_TYPE = [
('', ""),
('mobiliario_optico', 'Mobiliario óptico'),
('refraccion', 'Refracción'),
('medico', 'Medicion'),
('accesorios', 'Accesorios')]
NON_MEASURABLE = ['service']
class Template(metaclass=PoolMeta):
'Template'
__name__ = 'product.template'
equipment = fields.Boolean('It is equipment')
equipment_type = fields.Selection(_EQUIPMENT_TYPE, 'Equipment type')
product = fields.Many2One('optical_equipment.maintenance', "Maintenance Activity",
ondelete='CASCADE', select=True)
equipment = fields.Boolean('It is equipment',
states={'invisible': Eval('type', 'goods') != 'goods',
},depends=['type']
)
maintenance_activity = fields.Boolean('Maintenance Activity',
states={'invisible': Eval('type', 'service') != 'service',
'readonly': If(Eval('equipment',True), True)
| If(Eval('replacement',True), True)
},depends=['type']
)
replacement = fields.Boolean('Replacement',
states={'invisible': Eval('type', 'goods') != 'goods',
'readonly': If(Eval('equipment',True), True)
| If(Eval('maintenance_activity',True), True)
},depends=['type']
)
equipment_type = fields.Selection(_EQUIPMENT_TYPE, 'Equipment type',
states={'required': Eval('equipment', False)},
depends=['equipment']
)
risk = fields.Selection(_RISK, 'Type risk')
use = fields.Selection(_USE, 'Use')
biomedical_class = fields.Selection(_BIOMEDICAL_CLASS,
'Biomedical Class')
main_tecnology = fields.Selection(_MAIN_TECNOLOGY,
'Main tecnology')
use = fields.Selection(_USE, 'Use',
states={'required': Eval('equipment', False)},
depends=['equipment']
)
biomedical_class = fields.Selection(_BIOMEDICAL_CLASS,'Biomedical Class',
states={'required': Eval('equipment', False)},
depends=['equipment']
)
main_tecnology = fields.Selection(_MAIN_TECNOLOGY,'Main tecnology',
states={'required': Eval('equipment', False)},
depends=['equipment']
)
calibration = fields.Boolean("Apply calibration")
observation = fields.Text('Observation')
mark_category = fields.Many2One('product.category', 'Mark')
model_category = fields.Many2One('product.category', "Model")
reference = fields.Char("Reference", size=None)
mark_category = fields.Many2One('product.category', 'Mark',
domain=[('parent', '=', None),
('accounting', '=', False)],
states={'required': Eval('equipment', False)},
depends=['equipment']
)
model_category = fields.Many2One('product.category', "Model",
domain=[('parent', '=', Eval('mark_category')),
('accounting', '=', False)],
states={'required': Eval('equipment', False)},
depends=['equipment']
)
reference_category = fields.Many2One('product.category', "Reference",
domain=[('parent', '=', Eval('model_category'))],
)
origin_country = fields.Many2One('country.country',"Origin Country")
software_version = fields.Char(
"Software version", size=None)
useful_life = fields.Char(
"Useful life", size=None)
warranty = fields.Char(
"Warranty", size=None)
serial = fields.Char(
"Serial", size=None)
health_register = fields.Char(
"Health_Register", size=None)
refurbish = fields.Boolean('Refurbish')
software_required = fields.Boolean("Software Required")
software_version = fields.Char("Software version",
states={'invisible': If(~Eval('software_required'), True)},
depends=['software_required'])
#These are measurements required for the equipments, are in this place
# for manage of class 'product.template'
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']
)
frequency = fields.Float("Frequency")
frequency_uom = fields.Many2One('product.uom', "Frequency UOM",
domain=[('category', '=', Id('optical_equipment', 'uom_cat_frequency'))],
states={'invisible' : If(Eval('frequency') == None, True)},
depends=['frequency']
)
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']
)
electrical_equipment = fields.Boolean("Electrical Equipment")
frequency = fields.Float("Frequency",
states={'invisible': ~Bool(Eval('electrical_equipment'))})
frequency_uom = fields.Many2One('product.uom', "Frequency UOM",
domain=[('category', '=', Id('optical_equipment', 'uom_cat_frequency'))],
states={'invisible' : If(Eval('frequency') == None, True) |
~Eval('electrical_equipment', True)},
depends=['frequency']
)
voltageAC = fields.Float("Voltage AC",
states={'invisible': ~Bool(Eval('electrical_equipment'))})
voltageAC_uom = fields.Many2One('product.uom', "Voltage AC UOM",
domain=[('category', '=', Id('optical_equipment', 'uom_cat_electrical_tension'))],
states={'invisible' : If(Eval('voltageAC') == None, True) |
~Eval('electrical_equipment', True)},
depends=['voltageAC']
)
voltageDC = fields.Float("Voltage DC",
states={'invisible': ~Bool(Eval('electrical_equipment'))})
voltageDC_uom = fields.Many2One('product.uom', "Voltage DC UOM",
domain=[('category', '=', Id('optical_equipment', 'uom_cat_electrical_tension'))],
states={'invisible' : If(Eval('voltageDC') == None, True) |
~Eval('electrical_equipment', True)},
depends=['voltageDC'])
useful_life = fields.Integer("Useful life")
warranty = fields.Integer("Warranty")
#### calibration parameters
measuring_range = fields.Selection([
('dioptria', "Dioptria"),
('mmhg', "mmHg")], "Rango de Medición")
MEP = fields.Float("MEP", states={'required': Eval('calibration', False)},)
uncertainy_pattern = fields.Float("Uncertainy Pattern", states={'required': Eval('calibration', True)},
help="Agregar valores separados por ',' Ej:-5,+5,-10,+10")
k_pattern = fields.Char("K Pattern",states={'required': Eval('calibration', False)},
help="Agregar valores separados por ',' Ej:-5,+5,-10,+10")
k_pattern_list = fields.One2Many('optical_equipment.product_pattern', 'product', "List of patterns K",
states={'required': Eval('calibration', False)},)
resolution_type = fields.Selection([('',""),
('analoga', "Analoga"),
('digital', "Digital")], "Resolution Type",
states={'required': Eval('calibration', False)},
depends=['calibration'])
d_resolution = fields.Float("Resolution d",
states={'invisible': If(Eval('resolution_type') != 'digital', True)},
depends=['resolution_type'])
analog_resolution = fields.Float("Analog resolution",
states={'invisible': If(Eval('resolution_type') != 'analoga', True),},
depends=['resolution_type'])
a_factor_resolution = fields.Float("(a) Resolution",
states={'invisible': If(Eval('resolution_type') != 'analoga', True)},
depends=['resolution_type'])
Usubi = fields.Integer("Usub i",states={'required': Eval('calibration', False)},)
@classmethod
def view_attributes(cls):
return super(Template, cls).view_attributes() + [
('//page[@id="features"]', 'states', {
'invisible': ~Eval('equipment'),
}),
('//page[@id="calibration"]', 'states', {
'invisible': ~Eval('calibration')},)
]
@classmethod
@fields.depends('measuring_range')
def default_measuring_range(self):
return 'dioptria'
@classmethod
@fields.depends('temperature_min')
def default_temperature_min(self):
return 0
@classmethod
@fields.depends('temperature_max')
def default_temperature_max(self):
return 0
@classmethod
@fields.depends('temperature')
def default_temperature_uom(self):
pool = Pool()
Measurements = pool.get('product.uom')
measurement = Measurements.search(['name', '=', 'Celsius'])[0].id
return measurement
@staticmethod
def default_equipment():
return False
def default_frequency():
return 0
@staticmethod
def default_frequency_uom():
pool = Pool()
Measurements = pool.get('product.uom')
measurement = Measurements.search(['name', '=', 'Hertz'])[0].id
return measurement
@staticmethod
def default_moisture_min():
return 0
@staticmethod
def default_moisture_max():
return 0
@staticmethod
def default_moisture_uom():
pool = Pool()
Measurements = pool.get('product.uom')
measurement = Measurements.search(['name', '=', 'Relative Humedity'])[0].id
return measurement
@staticmethod
def default_voltageAC():
return 0
@staticmethod
def default_voltageAC_uom():
pool = Pool()
Measurements = pool.get('product.uom')
measurement = Measurements.search(['name', '=', 'Volt'])[0].id
return measurement
@staticmethod
def default_voltageDC():
return 0
@fields.depends('voltageDC', 'voltageDC_uom')
def on_change_voltageDC_uom(self):
pool = Pool()
Measurements = pool.get('product.uom')
measurement = Measurements.search(['name', '=', 'Volt'])[0].id
self.voltageDC_uom = measurement
@staticmethod
def default_risk():
return None
return 'n/a'
@staticmethod
def default_use():
@@ -78,7 +278,7 @@ class Template(metaclass=PoolMeta):
@staticmethod
def default_biomedical_class():
return None
return 'n/a'
@staticmethod
def default_main_tecnology():
@@ -92,17 +292,56 @@ class Template(metaclass=PoolMeta):
def default_refurbish():
return False
@fields.depends('mark_category', 'model_category')
def on_change_mark_category(self):
if self.mark_category:
self.model_category = None
@staticmethod
def default_refurbish():
return False
@fields.depends('software_required', 'software_version')
def on_change_with_sotfware_required(self):
self.software_version = None
@fields.depends('d_resolution', 'analog_resolution', 'a_factor_resolution')
def on_change_resolution_type(self):
self.d_resolution = None
self.analog_resolution = None
self.a_factor_resolution = None
@fields.depends('equipment', 'replacement')
def on_change_equipment(self):
if self.equipment:
self.replacement=False
self.maintenance_activity=False
self.calibration=False
@fields.depends('mark_category', 'model_category', 'reference_category')
def on_change_mark_category(self):
if not self.mark_category:
self.model_category = None
self.reference_category = None
@fields.depends('model_category', 'reference_category')
def on_change_model_category(self):
if not self.model_category:
self.reference_category = None
@fields.depends('electrical_equipment')
def on_change_electrical_equipment(self):
if self.electrical_equipment:
self.voltageAC = 0
self.voltageDC = 0
self.frequency = 0
@classmethod
def view_attributes(cls):
return super(Template, cls).view_attributes() + [
('//page[@id="features"]', 'states', {
'invisible': ~Eval('equipment'),
})]
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")

View File

@@ -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>

View File

@@ -1,72 +1,175 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#txhis repository contains the full copyright notices and license terms
from trytond.pool import Pool, PoolMeta
from trytond.model import ModelView, ModelSQL, fields
from trytond.model import (
ModelView, ModelSQL, Workflow, fields)
from trytond.modules.product import price_digits, round_price
from trytond.pyson import Eval, If, Bool
from trytond.exceptions import UserError
from trytond.i18n import gettext
from .exceptions import (
InvalidNumberPurchases)
from trytond.transaction import Transaction
class Purchase(metaclass=PoolMeta):
__name__ = 'purchase.purchase'
equipment_create = fields.Boolean("Equipments Creates", readonly=True)
@classmethod
def __setup__(cls):
super(Purchase, cls).__setup__()
cls._buttons.update({
'create_equipments': {
'invisible': If(Eval('invoice_state') == 'none', True) |
If(Bool(Eval('equipment_create')), True),
'depends': ['invoice_state'],}
})
@classmethod
@ModelView.button
def process(cls, purchases):
def create_equipments(cls, purchases):
if len(purchases) == 1:
pool = Pool()
Equipment = pool.get('optical_equipment.equipment')
#raise UserError(str(type(Equipment)))
Line = pool.get('purchase.line')
lines = []
process, done = [], []
cls.lock(purchases)
for purchase in purchases:
"""if purchase.state not in {'confirmed', 'processing', 'done'}:
continue
purchase.create_invoice()
purchase.set_invoice_state()
purchase.create_move('in')
return_moves = purchase.create_move('return')
if return_moves:
purchase.create_return_shipment(return_moves)
purchase.set_shipment_state()
"""
#raise UserError(str(dir(purchase)))
#equipment = Equipment()
Config = pool.get('optical_equipment.configuration')
config = Config(1)
purchase = purchases[0]
for line in purchase.lines:
#raise UserError(str(dir(line)))
if line.product.equipment:
for i in range(0,int(line.quantity)):
equipment = Equipment(
company=line.company,
location=line.to_location,
equipment_type=line.product.equipment_type,
party_address=line.address_equipment,
propietary=line.company.party,
propietary_address=line.address_equipment,
product=line.product,
model_category=line.product.model_category,
mark_category=line.product.mark_category,
reference_category=line.product.reference_category,
useful_life=line.product.useful_life if line.product.useful_life else 0,
calibration=True if line.product.calibration else False,
warranty=line.product.warranty if line.product.warranty else 0,
risk=line.product.risk,
origin_country=line.product.origin_country,
use=line.product.use,
biomedical_class=line.product.biomedical_class,
calibration=line.product.calibration,
refurbish=line.refurbish,
serial=line.serial_equipment,
software_version=line.product.software_version,
serial=None if line.quantity > 1 else line.serial_equipment,
health_register=line.health_register,
software_version=line.product.software_version if line.product.software_required else "No Aplica",
maintenance_frequency="none",
purchase_origin=line,
)
equipment.save()
#raise UserError(str([equipment.serial, equipment.software_version]))
""" line.set_actual_quantity()
lines.append(line)
else:
continue
purchase.equipment_create = True
cls.save(purchases)
else:
raise InvalidNumberPurchases(
gettext('purchase.msg_invalid_number_purchases'))
if purchase.is_done():
if purchase.state != 'done':
if purchase.state == 'confirmed':
process.append(purchase)
done.append(purchase)
elif purchase.state != 'processing':
process.append(purchase)
Line.save(lines)
if process:
cls.proceed(process)
if done:
cls.do(done)"""
class Line(metaclass=PoolMeta):
__name__ = 'purchase.line'
address_equipment = fields.Many2One('party.address', "Direccion")
serial_equipment = fields.Char("Serial", size=None, required=True)
origin_country = origin_country = fields.Many2One('country.country',"Origin Country")
address_equipment = fields.Many2One('party.address', "Direccion", required=True)
serial_equipment = fields.Char("Serial", size=None,
states={'invisible': If(Eval('quantity') > 1, True),
},depends=['quantity'])
refurbish = fields.Boolean("Refurbish")
product_equipment = fields.Boolean("Product Equipment",
states={'readonly': True})
software_version = fields.Char("Software version")
health_register = fields.Char("Health Register", states={'required': Eval('product_equipment', True)})
@classmethod
def default_address_equipment(cls):
pool = Pool()
Company = pool.get('company.company')
company = Transaction().context.get('company')
if company:
company = Company(company)
return company.party.addresses[0].id
@fields.depends(
'product', 'quantity', methods=['_get_context_purchase_price'])
def on_change_quantity(self):
Product = Pool().get('product.product')
if self.quantity > 1 or self.quantity < 1:
self.serial_equipment = None
if not self.product:
self.serial_equipment = None
return
with Transaction().set_context(self._get_context_purchase_price()):
self.unit_price = Product.get_purchase_price([self.product],
abs(self.quantity or 0))[self.product.id]
if self.unit_price:
self.unit_price = round_price(self.unit_price)
@fields.depends('product', 'unit', 'purchase',
'_parent_purchase.party', '_parent_purchase.invoice_party',
'product_supplier', 'product_equipment',
'serial_equipment', 'software_version',
'health_register', 'refurbish', methods=['compute_taxes', 'compute_unit_price',
'_get_product_supplier_pattern'])
def on_change_product(self):
if not self.product:
self.product_equipment = False
self.address_equipment = None
self.serial_equipment = None
self.software_version = None
self.health_register = None
self.refurbish = None
self.quantity = None
self.unit_price = None
self.unit = None
return
party = None
if self.purchase:
party = self.purchase.invoice_party or self.purchase.party
# Set taxes before unit_price to have taxes in context of purchase
# price
self.taxes = self.compute_taxes(party)
category = self.product.purchase_uom.category
if not self.unit or self.unit.category != category:
self.unit = self.product.purchase_uom
product_suppliers = list(self.product.product_suppliers_used(
**self._get_product_supplier_pattern()))
if len(product_suppliers) == 1:
self.product_supplier, = product_suppliers
elif (self.product_supplier
and self.product_supplier not in product_suppliers):
self.product_supplier = None
self.unit_price = self.compute_unit_price()
self.type = 'line'
self.amount = self.on_change_with_amount()
if self.product.equipment:
self.product_equipment = True
self.address_equipment = self.default_address_equipment()
if self.product.software_required:
self.software_version = self.product.software_version
@classmethod
def view_attributes(cls):
return super(Line, cls).view_attributes() + [
('//page[@id="equipment"]', 'states', {
'invisible': ~Eval('product_equipment', True),
})]

View File

@@ -8,5 +8,27 @@ this repository contains the full copyright notices and license terms. -->
<field name="inherit" ref="purchase.purchase_line_view_form"/>
<field name="name">purchase_line_form</field>
</record>
<record model="ir.ui.view" id="purchase_view_form">
<field name="model">purchase.purchase</field>
<field name="inherit" ref="purchase.purchase_view_form"/>
<field name="name">purchase_form</field>
</record>
<record model="ir.model.button" id="purchase_create_equipments">
<field name="name">create_equipments</field>
<field name="string">Create Equipments</field>
<field name="model" search="[('model', '=', 'purchase.purchase')]"/>
</record>
<record model="ir.action.report" id="report_purchase">
<field name="name">Purchase</field>
<field name="model">purchase.purchase</field>
<field name="report_name">purchase.purchase</field>
<field name="report">optical_equipment/report/Purchase.fodt</field>
<field name="single" eval="True"/>
</record>
<record model="ir.action.keyword" id="report_purchase_keyword">
<field name="keyword">form_print</field>
<field name="model">purchase.purchase,-1</field>
<field name="action" ref="report_purchase"/>
</record>
</data>
</tryton>

1506
report/CV_Equipment.fodt Normal file

File diff suppressed because it is too large Load Diff

2010
report/Calibration.fodt Normal file

File diff suppressed because it is too large Load Diff

1183
report/Capacitation.fodt Normal file

File diff suppressed because it is too large Load Diff

2154
report/Contract.fodt Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1313
report/Prorrogation.fodt Normal file

File diff suppressed because it is too large Load Diff

1492
report/Purchase.fodt Normal file

File diff suppressed because it is too large Load Diff

2392
report/Sale.fodt Normal file

File diff suppressed because it is too large Load Diff

279
sale.py
View File

@@ -1,21 +1,280 @@
from trytond.pool import Pool, PoolMeta
from trytond.model import ModelView, ModelSQL, fields
from trytond.modules.currency.fields import Monetary
from trytond.pyson import Eval, Bool, If, Get, Equal
from decimal import Decimal
from trytond.modules.product import price_digits
from trytond.transaction import Transaction
from trytond.model import Workflow
from trytond.modules.company.model import (
employee_field, set_employee, reset_employee)
from trytond.exceptions import UserError
from trytond.wizard import (
Button, StateAction, StateTransition, StateView, Wizard)
class Sale(metaclass=PoolMeta):
'Sale'
__name__ = 'sale.sale'
sale_type = fields.Selection([('maintenance', 'Maintenance'),
('equipments', 'Equipments'),
('replaces', 'Replaces')], "Sale Type", required=True,
states={'readonly': Eval('state') != 'draft'})
maintenance_type = fields.Selection([('', ""),
('preventive', 'Preventive'),
('corrective', 'Corrective')
], "Maintenance Type",
states={
'invisible': Eval('sale_type') != "maintenance",
'required': Eval('sale_type') == "maintenance",
'readonly': Eval('state') != 'draft'},
depends=['sale_type'])
contract_ref = fields.Reference("Contract Base", selection='get_origin_contract',
domain=[('party', '=', Eval('party')),
('state', '=', 'closed')],
states={'invisible': (Eval('sale_type') != 'maintenance')},
search_context={
'related_party': Eval('party'),
},)
agended = fields.Boolean("Scheduling",states={
'invisible': (Eval('sale_type') != 'maintenance'),
'readonly': True})
@classmethod
def __setup__(cls):
super(Sale, cls).__setup__()
cls.contact.states['required']=True
cls._buttons.update({
'draft': {
'invisible': (Eval('state').in_(
['cancelled', 'draft'])) | (Eval('shipment_state') == 'sent')}})
cls._transitions |= set((
('draft', 'quotation'),
('quotation', 'confirmed'),
('confirmed', 'processing'),
('confirmed', 'draft'),
('processing', 'processing'),
('processing', 'done'),
('done', 'processing'),
('draft', 'cancelled'),
('quotation', 'cancelled'),
('quotation', 'draft'),
('cancelled', 'draft'),
('processing', 'draft')
))
@fields.depends('lines', 'sale_type', 'agended')
def on_chage_sale_type(self):
self.lines= []
if self.sale_type != "maintenance":
self.agended = False
@classmethod
def default_agended(self):
return False
@classmethod
def _get_origin_contract(cls):
'Return list of Model names for origin Reference'
pool = Pool()
Contract = pool.get('optical_equipment.contract')
return [Contract.__name__]
@classmethod
def get_origin_contract(cls):
Model = Pool().get('ir.model')
get_name = Model.get_name
models = cls._get_origin_contract()
return [(None, '')] + [(m, get_name(m)) for m in models]
@classmethod
@ModelView.button
@Workflow.transition('confirmed')
@set_employee('confirmed_by')
def confirm(cls, sales):
pool = Pool()
Configuration = pool.get('sale.configuration')
transaction = Transaction()
context = transaction.context
cls.set_sale_date(sales)
cls.store_cache(sales)
config = Configuration(1)
MaintenanceService = pool.get('optical_equipment_maintenance.service')
for sale in sales:
if sale.sale_type == 'maintenance':
for line in sale.lines:
maintenanceService = MaintenanceService(
description=sale.description,
maintenance_type=sale.maintenance_type,
state_agended='no_agenda',
propietary=sale.party,
propietary_address=sale.shipment_address,
contract_origin=sale.contract_ref if sale.contract_ref else None,
sale_origin=line,
sale_date=sale.sale_date,
state="draft"
)
maintenanceService.save()
sale.agended = True
sale.save()
with transaction.set_context(
queue_scheduled_at=config.sale_process_after,
queue_batch=context.get('queue_batch', True)):
cls.__queue__.process(sales)
class SaleLine(metaclass=PoolMeta):
'SaleLine'
__name__ = 'sale.line'
address_equipment = fields.Many2One('party.address', "Direccion")
product_equipment = fields.Boolean("Product Equipment")
equipment = fields.Many2One('optical_equipment.equipment', "Equipment",
domain=[('state', '=', 'registred'),
('product','=', Eval('product'))
],
states={'invisible': If(~Eval('product_equipment'), True)},)
unit_digits = fields.Function(fields.Integer('Unit Digits'),
'on_change_with_unit_digits')
@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)
def __setup__(cls):
super(SaleLine, cls).__setup__()
cls.product.domain.append(
If(Eval('_parent_sale.sale_type') == 'maintenance',
[('type', '=', 'service'),
('maintenance_activity', '=', True)], []))
cls.product.domain.append(If(Eval('_parent_sale.sale_type') == 'equipments',
[('equipment', '=', True)], []))
cls.product.domain.append(If(Eval('_parent_sale.sale_type') == 'replaces',
[('replacement', '=', True),
('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('product', 'unit', 'quantity', 'sale',
'_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
# Set taxes before unit_price to have taxes in context of sale price
taxes = []
pattern = self._get_tax_rule_pattern()
for tax in self.product.customer_taxes_used:
if party and party.customer_tax_rule:
tax_ids = party.customer_tax_rule.apply(tax, pattern)
if tax_ids:
taxes.extend(tax_ids)
continue
taxes.append(tax.id)
if party and party.customer_tax_rule:
tax_ids = party.customer_tax_rule.apply(None, pattern)
if tax_ids:
taxes.extend(tax_ids)
self.taxes = taxes
category = self.product.sale_uom.category
if not self.unit or self.unit.category != category:
self.unit = self.product.sale_uom
self.unit_digits = self.product.sale_uom.digits
with Transaction().set_context(self._get_context_sale_price()):
self.unit_price = Product.get_sale_price([self.product],
self.quantity or 0)[self.product.id]
if self.unit_price:
self.unit_price = self.unit_price.quantize(
Decimal(1) / 10 ** self.__class__.unit_price.digits[1])
self.type = 'line'
self.amount = self.on_change_with_amount()
if self.product.equipment:
self.product_equipment = True
def get_move(self, shipment_type):
'''
Return moves for the sale line according to shipment_type
'''
pool = Pool()
Move = pool.get('stock.move')
if self.type != 'line':
return
if not self.product:
return
if self.product.type not in Move.get_product_types():
return
if (shipment_type == 'out') != (self.quantity >= 0):
return
quantity = (self._get_move_quantity(shipment_type)
- self._get_shipped_quantity(shipment_type))
quantity = self.unit.round(quantity)
if quantity <= 0:
return
if not self.sale.party.customer_location:
raise PartyLocationError(
gettext('sale.msg_sale_customer_location_required',
sale=self.sale.rec_name,
party=self.sale.party.rec_name))
move = Move()
move.quantity = quantity
move.uom = self.unit
move.product = self.product
move.from_location = self.from_location
move.to_location = self.to_location
move.state = 'draft'
move.company = self.sale.company
if move.on_change_with_unit_price_required():
move.unit_price = self.unit_price
move.currency = self.sale.currency
move.planned_date = self.planned_shipping_date
move.invoice_lines = self._get_move_invoice_lines(shipment_type)
move.origin = self
return move

View File

@@ -1,9 +1,26 @@
<?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="sale_line_view_form">
<field name="model">sale.line</field>
<field name="inherit" ref="sale.sale_line_view_form"/>
<field name="name">sale_line_form</field>
<record model="ir.ui.view" id="sale_view_form">
<field name="model">sale.sale</field>
<field name="inherit" ref="sale.sale_view_form"/>
<field name="name">sale_form</field>
</record>
<record model="ir.ui.view" id="product_view_list_sale_line">
<field name="model">product.product</field>
<field name="inherit" ref="sale.product_view_list_sale_line"/>
<field name="name">product_list_sale_line</field>
</record>
<record model="ir.action.report" id="report_sale">
<field name="name">Sale Equipments</field>
<field name="model">sale.sale</field>
<field name="report_name">sale.sale</field>
<field name="report">optical_equipment/report/Sale.fodt</field>
<field name="single" eval="True"/>
</record>
<record model="ir.action.keyword" id="report_sale_keyword">
<field name="keyword">form_print</field>
<field name="model">sale.sale,-1</field>
<field name="action" ref="report_sale"/>
</record>
</tryton>

10
shipment.xml Normal file
View 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="shipment_out_view_form">
<field name="model">stock.shipment.out</field>
<field name="inherit" ref="stock.shipment_out_view_form"/>
<field name="name">shipment_out_form</field>
</record>
</tryton>

View File

@@ -1,14 +0,0 @@
from trytond.pool import PoolMeta
from trytond.model import ModelSQL, ModelView, fields
class Subscription(metaclass=PoolMeta):
__name__ = 'sale.subscription'
equipments = fields.Many2Many('sale.subscription-optical_equipment.equipment', 'subscription', 'equipment', "Equipments")
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)

View File

@@ -1,9 +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="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>
</tryton>

View File

@@ -1,22 +1,34 @@
[tryton]
version=6.0
version=6.6
depends:
ir
party
company
account_co_co
account_co_pyme
account_invoice
account_stock_continental
product
product_measurements
purchase
sale
stock
country
sale_subscription
sale_history
sale_advance_payment
sale_amendment
xml:
address.xml
party.xml
product.xml
measurements.xml
equipment.xml
contract.xml
configuration_equipment.xml
sale.xml
purchase.xml
uom.xml
subscription.xml
move.xml
message.xml
diary.xml
maintenance.xml
shipment.xml

46
uom.xml
View File

@@ -27,13 +27,55 @@ this repository contains the full copyright notices and license terms. -->
<field name="rounding" eval="1."/>
<field name="digits" eval="0"/>
</record>
<record model="product.uom.category" id="uom_cat_frecuency">
<record model="product.uom.category" id="uom_cat_frequency">
<field name="name">Frequency</field>
</record>
<record model="product.uom" id="uom_electrical2">
<field name="name">Hertz</field>
<field name="symbol">Hrz</field>
<field name="category" ref="uom_cat_frecuency"/>
<field name="category" ref="uom_cat_frequency"/>
<field name="rate" eval="1."/>
<field name="factor" eval="1."/>
<field name="rounding" eval="1."/>
<field name="digits" eval="0"/>
</record>
<record model="product.uom.category" id="uom_cat_temperature">
<field name="name">Temperature</field>
</record>
<record model="product.uom" id="uom_celsius">
<field name="name">Celsius</field>
<field name="symbol">°C</field>
<field name="category" ref="uom_cat_temperature"/>
<field name="rate" eval="1."/>
<field name="factor" eval="1."/>
<field name="rounding" eval="1."/>
<field name="digits" eval="0"/>
</record>
<record model="product.uom" id="uom_fahrenheit">
<field name="name">Fahrenheit</field>
<field name="symbol">°F</field>
<field name="category" ref="uom_cat_temperature"/>
<field name="rate" eval="1."/>
<field name="factor" eval="1."/>
<field name="rounding" eval="1."/>
<field name="digits" eval="0"/>
</record>
<record model="product.uom" id="uom_kelvin">
<field name="name">Kelvin</field>
<field name="symbol">°K</field>
<field name="category" ref="uom_cat_temperature"/>
<field name="rate" eval="1."/>
<field name="factor" eval="1."/>
<field name="rounding" eval="1."/>
<field name="digits" eval="0"/>
</record>
<record model="product.uom.category" id="uom_cat_relative_humedity">
<field name="name">Relative Humedity</field>
</record>
<record model="product.uom" id="uom_relative_humedity">
<field name="name">Relative Humedity</field>
<field name="symbol">%HR</field>
<field name="category" ref="uom_cat_relative_humedity"/>
<field name="rate" eval="1."/>
<field name="factor" eval="1."/>
<field name="rounding" eval="1."/>

14
view/address_form.xml Normal file
View File

@@ -0,0 +1,14 @@
<?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="/form/field[@name='party_name']" position="after">
<newline/>
<label name="party_related"/>
<field name="party_related"/>
</xpath>
<xpath expr="/form/group[@id='checkboxes']/field[@name='delivery']" position="after">
<label name="campus"/>
<field name="campus"/>
</xpath>
</data>

8
view/address_tree.xml Normal file
View File

@@ -0,0 +1,8 @@
<?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='name']" position="after">
<field name="street" expand="1"/>
</xpath>
</data>

View File

@@ -0,0 +1,16 @@
<?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" colspan="3"/>
<newline/>
<label name="estimated_agended"/>
<field name="estimated_agended" colspan="3" widget="date"/>
<newline/>
<label name="estimated_agended" string="Hora:"/>
<field name="estimated_agended" colspan="3" widget="time"/>
<newline/>
<label name="technical"/>
<field name="technical" colspan="3"/>
</form>

View File

@@ -0,0 +1,35 @@
<?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="diopter"/>
<field name="diopter"/>
<label name="dev_std"/>
<field name="dev_std"/>
<label name="uncertain_type_A"/>
<field name="uncertain_type_A"/>
<label name="uncertain_pattern"/>
<field name="uncertain_pattern"/>
<label name="k_c_calibration"/>
<field name="k_c_calibration"/>
<label name="uncertain_U_b1"/>
<field name="uncertain_U_b1"/>
<label name="d_resolution"/>
<field name="d_resolution"/>
<label name="uncertain_U_b2_dig"/>
<field name="uncertain_U_b2_dig"/>
<label name="uncertain_U_b2_ana"/>
<field name="uncertain_U_b2_ana"/>
<label name="uncertain_combinated"/>
<field name="uncertain_combinated"/>
<label name="uncertain_eff"/>
<field name="uncertain_eff"/>
<label name="t_student"/>
<field name="t_student"/>
<label name="uncertain_expanded"/>
<field name="uncertain_expanded"/>
<label name="graph_dates"/>
<field name="graph_dates"/>
<label name="state"/>
<field name="state"/>
</form>

View File

@@ -0,0 +1,19 @@
<?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="diopter" expand="1"/>
<field name="dev_std" expand="1"/>
<field name="uncertain_type_A" expand="1"/>
<field name="uncertain_pattern" expand="1"/>
<field name="k_c_calibration" expand="1"/>
<field name="uncertain_U_b1" expand="1"/>
<field name="d_resolution" expand="1"/>
<field name="uncertain_U_b2_dig" expand="1"/>
<field name="uncertain_U_b2_ana" expand="1"/>
<field name="uncertain_combinated" expand="1"/>
<field name="uncertain_eff" expand="1"/>
<field name="t_student" expand="1"/>
<field name="uncertain_expanded" expand="1"/>
<field name="state" expand="1"/>
</tree>

View File

@@ -0,0 +1,13 @@
<?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="equipment"/>
<field name="equipment" colspan="3"/>
<label name="new_propietary"/>
<field name="new_propietary" colspan="3"/>
<label name="new_address"/>
<field name="new_address" colspan="3"/>
<label name="change_date"/>
<field name="change_date" colspan="3"/>
</form>

47
view/contract_form.xml Normal file
View File

@@ -0,0 +1,47 @@
<?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="party"/>
<field name="party"/>
<label name="invoice_address"/>
<field name="invoice_address"/>
<label name="number"/>
<field name="number"/>
<newline/>
<label name="contact"/>
<field name="contact"/>
<newline/>
<label name="description"/>
<field name="description" colspan="3"/>
<label name="reference"/>
<field name="reference"/>
<newline/>
<separator id="validity" string="Validity" colspan="6"/>
<label name="start_date"/>
<field name="start_date"/>
<label name="end_date"/>
<field name="end_date"/>
<notebook colspan="6">
<page string="Contracts and Prorogues" id="contracts">
<field name="maintenance_services"/>
</page>
<page string="Equipments" id="equipments">
<field name="equipments"/>
</page>
<page string="Other Info" id="other">
<label name="company"/>
<field name="company"/>
</page>
</notebook>
<label name="price_contract"/>
<field name="price_contract"/>
<newline/>
<label name="state"/>
<field name="state"/>
<group col="2" colspan="2" id="button">
<!--<button name="draft"/> -->
<button name="cancelled"/>
<button name="running"/>
</group>
</form>

12
view/contract_list.xml Normal file
View 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="number"/>
<field name="party"/>
<field name="reference"/>
<field name="description"/>
<field name="start_date"/>
<field name="end_date"/>
<field name="state"/>
</tree>

9
view/contract_tree.xml Normal file
View File

@@ -0,0 +1,9 @@
<?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. -->
<tree>
<field name="number"/>
<field name="reference"/>
<field name="party"/>
<field name="start_date"/>
<field name="end_date"/>
</tree>

View File

@@ -0,0 +1,17 @@
<?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>
<group id="create_contract">
<label name="party"/>
<field name="party"/>
<label name="contact"/>
<field name="contact"/>
<label name="invoice_address"/>
<field name="invoice_address"/>
<label name="start_date"/>
<field name="start_date"/>
<label name="end_date"/>
<field name="end_date"/>
</group>
</form>

View 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. -->
<form col="2">
<image name="tryton-question" xexpand="0" xfill="0"/>
<group col="2" xexpand="1" id="create_date">
<label string="Create Subscription Invoices for date" id="create"/>
<field name="date"/>
</group>
</form>

View File

@@ -0,0 +1,36 @@
<?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>
<group id="create_prorogue">
<label name="party"/>
<field name="party"/>
<label name="contact"/>
<field name="contact"/>
<newline/>
<label name="initial_contract"/>
<field name="initial_contract" colspan="3"/>
<label name="invoice_address"/>
<field name="invoice_address"/>
<label name="payment_term"/>
<field name="payment_term"/>
<newline/>
<label name="invoice_recurrence"/>
<field name="invoice_recurrence"/>
<newline/>
<label name="start_date"/>
<field name="start_date"/>
<label name="end_date"/>
<field name="end_date"/>
<label name="invoice_start_date"/>
<field name="invoice_start_date"/>
<label name="service"/>
<field name="service"/>
<label name="quantity"/>
<field name="quantity"/>
<label name="unit_price"/>
<field name="unit_price"/>
</group>
<newline/>
<field name="equipments"/>
</form>

View File

@@ -0,0 +1,31 @@
<?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>
<group id="create_subscription">
<label name="party"/>
<field name="party"/>
<label name="contact"/>
<field name="contact"/>
<label name="invoice_address"/>
<field name="invoice_address"/>
<label name="invoice_recurrence"/>
<field name="invoice_recurrence"/>
<label name="start_date"/>
<field name="start_date"/>
<label name="end_date"/>
<field name="end_date"/>
<label name="invoice_start_date"/>
<field name="invoice_start_date"/>
<label name="service"/>
<field name="service"/>
<label name="quantity"/>
<field name="quantity"/>
<label name="unit_price"/>
<field name="unit_price"/>
<label name="payment_term"/>
<field name="payment_term"/>
</group>
<newline/>
<field name="equipments"/>
</form>

24
view/diary_form.xml Normal file
View 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
View 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>

View 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>

View 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>

View 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. -->
<calendar
dtstart="date_expected"
dtend="date_expected">
</calendar>

View File

@@ -0,0 +1,5 @@
<?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>
</data>

View File

@@ -0,0 +1,9 @@
<?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="value_patterns" expand="1"/>
<field name="value_equipment" expand="1"/>
<field name="mistake" expand="1"/>
<field name="mistake_rate" expand="1"/>
</tree>

View File

@@ -0,0 +1,9 @@
<?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="/form/field[@name='maintenance_type']" position="after">
<label name="equipment"/>
<field name="equipment"/>
</xpath>
</data>

83
view/maintenance_form.xml Normal file
View File

@@ -0,0 +1,83 @@
<?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="company"/>
<field name="company"/>
<label name="code"/>
<field name="code"/>
<label name="propietary"/>
<field name="propietary"/>
<label name="propietary_address"/>
<field name="propietary_address"/>
<label name="maintenance_type"/>
<field name="maintenance_type"/>
<label name="equipment"/>
<field name="equipment"/>
<label name="service_maintenance"/>
<field name="service_maintenance"/>
<newline/>
<label name="description_activity"/>
<field name="description_activity" colspan="3"/>
<notebook colspan="6">
<page string="Preventive" id="preventive">
<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"/>
</page>
<page string="Corrective" id="corrective">
<field name="maintenance_lines"/>
</page>
<page string="Enviromental Conditions" id="enviromental_conditions_calibration">
<group col="4" colspan="4" id="conditions">
<label name="temperature_min"/>
<field name="temperature_min"/>
<newline/>
<label name="temperature_max"/>
<field name="temperature_max"/>
<label name="temperature_uom"/>
<field name="temperature_uom"/>
<newline/>
<label name="moisture_min"/>
<field name="moisture_min"/>
<newline/>
<label name="moisture_max"/>
<field name="moisture_max"/>
<label name="moisture_uom"/>
<field name="moisture_uom"/>
</group>
</page>
<page string="Calibration" id="calibration">
<label name="patterns_equipments"/>
<field name="patterns_equipments"/>
<newline/>
<group colspan="6" yexpand="1" id="lines_calibration">
<field name="lines_calibration"/>
<newline/>
<field name="calibration_total"/>
</group>
</page>
<page string="Graph" id="graph">
<field name="graph_calibration"/>
</page>
</notebook>
<newline/>
<label name="state"/>
<field name="state"/>
<group id="button">
<button name="in_progress"/>
<button name="finished"/>
<button name="calibrate"/>
</group>
</form>

View File

@@ -0,0 +1,22 @@
<?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="line_replace"/>
<field name="line_replace"/>
<label name="line_maintenance_activity"/>
<field name="line_maintenance_activity"/>
<label name="maintenance"/>
<field name="maintenance"/>
<label name="replacement"/>
<field name="replacement"/>
<newline/>
<label name="maintenance_activity"/>
<field name="maintenance_activity"/>
<newline/>
<label name="unit"/>
<field name="unit"/>
<newline/>
<label name="quantity"/>
<field name="quantity"/>
</form>

View 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.-->
<tree>
<field name="line_replace" expand="1"/>
<field name="line_maintenance_activity" expand="1"/>
<field name="replacement" expand="1"/>
<field name="maintenance_activity" expand="1"/>
<field name="quantity"/>
</tree>

View File

@@ -0,0 +1,16 @@
<?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="number_sample"/>
<field name="number_sample"/>
<newline/>
<label name="value_patterns"/>
<field name="value_patterns"/>
<label name="value_equipment"/>
<field name="value_equipment"/>
<label name="mistake"/>
<field name="mistake"/>
<label name="mistake_rate"/>
<field name="mistake_rate"/>
</form>

View File

@@ -0,0 +1,51 @@
<?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="propietary"/>
<field name="propietary"/>
<label name="propietary_address"/>
<field name="propietary_address"/>
<label name="code"/>
<field name="code"/>
<label name="description"/>
<field name="description" colspan="3"/>
<label name="reference"/>
<field name="reference"/>
<label name="sale_origin"/>
<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/>
<notebook colspan="6">
<page string="General" id="general">
<label name="state_agended"/>
<field name="state_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"/>
</page>
<page string="Agendes" id="agendes">
<field name="history_agended"/>
</page>
<page string="Other Info" id="other_info">
<label name="company"/>
<field name="company"/>
</page>
</notebook>
<newline/>
<label name="state"/>
<field name="state"/>
<group id="button">
<button name="in_progress"/>
<button name="finished"/>
</group>
</form>

View 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="propietary"/>
<field name="propietary_address"/>
<field name="sale_origin"/>
<field name="sale_date"/>
<field name="technical"/>
<field name="lines" string="# Equipments"/>
</tree>

13
view/maintenance_tree.xml Normal file
View File

@@ -0,0 +1,13 @@
<?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="maintenance_type" expand="0"/>
<field name="service_maintenance" expand="1"/>
<field name="propietary"/>
<field name="propietary_address"/>
<field name="equipment"/>
<field name="state"/>
<button name="finished"/>
</tree>

12
view/move_form.xml Normal file
View 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. -->
<data>
<xpath expr="/form/field[@name='product']" position="after">
<newline/>
<label name="equipment"/>
<field name="equipment"/>
<label name="equipment_serial"/>
<field name="equipment_serial"/>
</xpath>
</data>

View File

@@ -0,0 +1,9 @@
<?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. -->
<data>
<xpath
expr="//field[@name='product']" position="after">
<field name="equipment"/>
<field name="equipment_serial"/>
</xpath>
</data>

View File

@@ -0,0 +1,19 @@
<?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>
<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"/>
<newline/>
<label name="contract_sequence"/>
<field name="contract_sequence"/>
</form>

View File

@@ -1,16 +1,22 @@
<?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>
<field name="subscription_history"/>
<form col="6">
<label name="code"/>
<field name="code"/>
<label name="company"/>
<field name="company"/>
<label name="active"/>
<field name="active"/>
<newline/>
<label name="propietary"/>
<field name="propietary"/>
<label name="propietary_address"/>
<field name="propietary_address"/>
<notebook colspan="6">
<page string="General" id="general_equipment">
<label name="location"/>
<field name="location"/>
<label name="party"/>
<field name="party"/>
<label name="party_address"/>
<field name="party_address"/>
<label name="product"/>
<field name="product"/>
<label name="equipment_type"/>
@@ -21,10 +27,13 @@
<field name="biomedical_class"/>
<label name="calibration"/>
<field name="calibration"/>
<newline/>
<label name="mark_category"/>
<field name="mark_category"/>
<label name="model_category"/>
<field name="model_category"/>
<label name="reference_category"/>
<field name="reference_category"/>
<label name="refurbish"/>
<field name="refurbish"/>
<label name="software_version"/>
@@ -33,10 +42,39 @@
<field name="useful_life"/>
<label name="warranty"/>
<field name="warranty"/>
<newline/>
<label name="maintenance_frequency"/>
<field name="maintenance_frequency"/>
<label name="serial"/>
<field name="serial"/>
<label name="health_register"/>
<field name="health_register"/>
<label name="origin_country"/>
<field name="origin_country"/>
</page>
<page string="Contracts" id="contract_equipment">
<field name="contract_history"/>
</page>
<page string="Maintenances" id="maintenances_equipment">
<field name="maintenance_history"/>
</page>
<page string="Propietarys" id="propietarys_equipment">
<field name="propietarys"/>
</page>
<page string="Origins" id="origins_equipment">
<separator id="purchase_origin" string="Purchase Origin" colspan="4"/>
<field name="purchase_origin"/>
<newline/>
<separator id="sale_destination" string="Sale Destination" colspan="4"/>
<field name="sale_destination"/>
<separator id="shipment_destination" string="Shipment Destination" colspan="4"/>
<field name="shipment_destination"/>
</page>
</notebook>
<group col="2" colspan="2" id="button">
<!--<button name="draft"/> -->
<button name="registred"/>
</group>
<label name="state"/>
<field name="state"/>
</form>

View File

@@ -0,0 +1,11 @@
<?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 editable="1">
<field name="code"/>
<field name="purchase_origin"/>
<field name="propietary"/>
<field name="product"/>
<field name="serial" expand="1"/>
<button name="registred"/>
</tree>

View File

@@ -2,22 +2,12 @@
<!-- 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="company"/>
<field name="code"/>
<field name="location"/>
<field name="party"/>
<field name="party_address"/>
<field name="product"/>
<field name="equipment_type"/>
<field name="use"/>
<field name="biomedical_class"/>
<field name="calibration"/>
<field name="propietary"/>
<field name="propietary_address"/>
<field name="product" expand="1"/>
<field name="mark_category"/>
<field name="model_category"/>
<field name="refurbish"/>
<field name="software_version"/>
<field name="useful_life"/>
<field name="warranty"/>
<field name="serial"/>
<field name="health_register"/>
<field name="origin_country"/>
</tree>

7
view/pattern_form.xml Normal file
View 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="pattern"/>
<field name="pattern"/>
</form>

6
view/pattern_tree.xml Normal file
View 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="pattern"/>
</tree>

View File

@@ -0,0 +1,8 @@
<?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='name']" position="after">
<field name="attributes_name" expand="1"/>
</xpath>
</data>

12
view/purchase_form.xml Normal file
View File

@@ -0,0 +1,12 @@
<?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. -->
<data>
<xpath
expr="/form/field[@name='invoice_address']" position="after">
<label name="equipment_create"/>
<field name="equipment_create"/>
</xpath>
<xpath expr="//button[@name='process']" position="after">
<button name="create_equipments"/>
</xpath>
</data>

View File

@@ -4,10 +4,25 @@
<xpath
expr="/form/notebook/page[@id='notes']" position="before">
<page string="Equipment" id="equipment">
<label name="address_equipment"/>
<field name="address_equipment"/>
<newline/>
<label name="serial_equipment"/>
<field name="serial_equipment"/>
<newline/>
<label name="software_version"/>
<field name="software_version"/>
<newline/>
<label name="health_register"/>
<field name="health_register"/>
<newline/>
<label name="refurbish"/>
<field name="refurbish"/>
</page>
</xpath>
<xpath
expr="/form/notebook/page[@id='general']/field[@name='product']" position="after">
<label name="product_equipment"/>
<field name="product_equipment"/>
</xpath>
</data>

View File

@@ -0,0 +1,16 @@
<?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"/>
<newline/>
<label name="estimated_agended"/>
<field name="estimated_agended" colspan="3" widget="date"/>
<newline/>
<label name="estimated_agended" string="Hora:"/>
<field name="estimated_agended" colspan="3" widget="time"/>
<newline/>
<label name="technical"/>
<field name="technical"/>
</form>

16
view/sale_form.xml Normal file
View File

@@ -0,0 +1,16 @@
<?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='reference']" position="after">
<newline/>
<label name="sale_type"/>
<field name="sale_type"/>
<label name="maintenance_type"/>
<field name="maintenance_type"/>
<label name="agended"/>
<field name="agended"/>
<label name="contract_ref"/>
<field name="contract_ref"/>
</xpath>
</data>

View File

@@ -1,11 +1,22 @@
<?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. -->
<data>
<!--
<xpath
expr="/form/notebook/page[@id='notes']" position="before">
<page string="Equipment" id="equipment">
<label name="address_equipment"/>
<field name="address_equipment"/>
</page>
</xpath>
<xpath
expr="/form/notebook/page[@id='general']/label[@name='product']" position="before">
<label name="product_equipment"/>
<field name="product_equipment"/>
</xpath>
<xpath
expr="/form/notebook/page[@id='general']/field[@name='product']" position="after">
<label name="equipment"/>
<field name="equipment"/>
<label name="equipment_serial"/>
<field name="equipment_serial"/>
</xpath>-->
</data>

6
view/sale_line_tree.xml Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0"?>
<data>
<xpath expr="//field[@name='summary']" position="replace">
<field name="equipment"/>
</xpath>
</data>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0"?>
<data>
<xpath expr="//field[@name='summary']" position="replace">
<field name="equipment_serial"/>
</xpath>
</data>

View File

@@ -0,0 +1,14 @@
<?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. -->
<data>
<xpath
expr="//field[@name='warehouse']" position="after">
<newline/>
<label name="service_maintenance_initial"/>
<field name="service_maintenance_initial"/>
</xpath>
<xpath
expr="//button[@name='wait']" position="after">
<button name="maintenance_initial"/>
</xpath>
</data>

View File

@@ -1,6 +1,12 @@
<?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. -->
<data>
<xpath
expr="//label[@name='party']" position="before">
<label name="type"/>
<field name="type"/>
<newline/>
</xpath>
<xpath
expr="/form/notebook/page[@id='subscription']" position="after">
<page string="Equipments" id="equipments_subscription">

View File

@@ -5,17 +5,20 @@ this repository contains the full copyright notices and license terms. -->
<xpath expr="/form/notebook/page[@id='general']/group[@id='checkboxes']" position="inside">
<label name="equipment"/>
<field name="equipment"/>
<label name="replacement"/>
<field name="replacement"/>
<label name="maintenance_activity"/>
<field name="maintenance_activity"/>
</xpath>
<xpath expr="/form/notebook/page[@id='general']" position="after">
<page string="Features" id="features">
<newline/>
<label name="mark_category"/>
<field name="mark_category"/>
<label name="model_category"/>
<field name="model_category"/>
<label name="serial"/>
<field name="serial"/>
<label name="health_register"/>
<field name="health_register"/>
<label name="reference_category"/>
<field name="reference_category"/>
<label name="equipment_type"/>
<field name="equipment_type"/>
<label name="calibration"/>
@@ -30,35 +33,86 @@ this repository contains the full copyright notices and license terms. -->
<field name="origin_country"/>
<label name="main_tecnology"/>
<field name="main_tecnology"/>
<label name="software_required"/>
<field name="software_required"/>
<label name="software_version"/>
<field name="software_version"/>
<label name="useful_life"/>
<field name="useful_life"/>
<label name="warranty"/>
<field name="warranty"/>
<newline/>
<label name="observation"/>
<field name="observation"/>
</page>
</xpath>
<xpath expr="/form/notebook/page[@id='measurements']" position="inside">
<xpath expr="/form/notebook/page[@id='features']" position="after">
<page string="Calibration" id="calibration">
<newline/>
<label name="calibration"/>
<field name="calibration"/>
<newline/>
<label name="uncertainy_pattern"/>
<field name="uncertainy_pattern"/>
<newline/>
<label name="k_pattern"/>
<field name="k_pattern"/>
<newline/>
<label name="k_pattern_list"/>
<field name="k_pattern_list"/>
<newline/>
<label name="measuring_range"/>
<field name="measuring_range"/>
<newline/>
<label name="MEP"/>
<field name="MEP"/>
<newline/>
<label name="resolution_type"/>
<field name="resolution_type"/>
<newline/>
<label name="d_resolution"/>
<field name="d_resolution"/>
<newline/>
<label name="a_factor_resolution"/>
<field name="a_factor_resolution"/>
<newline/>
<label name="analog_resolution"/>
<field name="analog_resolution"/>
<newline/>
<label name="Usubi"/>
<field name="Usubi"/>
</page>
</xpath>
<xpath expr="/form/notebook/page[@id='measurements']/label[@name='length']" position="before">
<separator id="measurements_equipment" string="Measurements of Equipment" colspan="4"/>
</xpath>
<xpath
expr="/form/notebook/page[@id='measurements']" position="inside">
<separator id="enviromental_working_conditions" string="Enviromental Working Conditions" colspan="4"/>
<separator id="enviromental_conditions" string="Enviromental Conditions" colspan="4"/>
<label name="temperature"/>
<field name="temperature"/>
<label name="temperature_min"/>
<field name="temperature_min"/>
<newline/>
<label name="temperature_max"/>
<field name="temperature_max"/>
<field name="temperature_uom"/>
<label name="wet"/>
<field name="wet"/>
<field name="wet_uom"/>
<newline/>
<label name="moisture_min"/>
<field name="moisture_min"/>
<newline/>
<label name="moisture_max"/>
<field name="moisture_max"/>
<field name="moisture_uom"/>
<separator id="electrical_conditions" string="Electrical Conditions" colspan="4"/>
<label name="electrical_equipment"/>
<field name="electrical_equipment"/>
<newline/>
<label name="frequency"/>
<field name="frequency"/>
<field name="frequency_uom"/>
<label name="voltageAC"/>
<field name="voltageAC"/>
<field name="voltageAC_uom"/>