lims_industry: remove racks and aliquots

This commit is contained in:
Adri?n Bernardi 2020-01-25 20:46:36 -03:00
parent 8613649659
commit 2d94fae1a9
27 changed files with 4 additions and 1554 deletions

View file

@ -7,8 +7,6 @@ from . import industry
from . import analysis
from . import sample
from . import party
from . import planification
from . import configuration
from . import task
@ -29,23 +27,13 @@ def register():
analysis.SampleAttributeAttributeSet,
analysis.SamplingType,
analysis.ProductType,
analysis.AliquotType,
analysis.AliquotTypeProductType,
analysis.Analysis,
sample.Entry,
sample.Sample,
sample.CreateSampleStart,
sample.EditSampleStart,
sample.Fraction,
sample.Aliquot,
party.Party,
party.Address,
planification.Rack,
planification.RackPosition,
configuration.Configuration,
configuration.ConfigurationSequence,
configuration.LabWorkYear,
configuration.LabWorkYearSequence,
task.AdministrativeTaskTemplate,
task.AdministrativeTask,
module='lims_industry', type_='model')
@ -53,6 +41,3 @@ def register():
sample.CreateSample,
sample.EditSample,
module='lims_industry', type_='wizard')
Pool.register(
sample.AliquotExternalReport,
module='lims_sale_industry', type_='report')

View file

@ -4,11 +4,10 @@
from trytond.model import ModelSQL, ModelView, DictSchemaMixin, fields
from trytond.pool import PoolMeta
from trytond.pyson import Eval
__all__ = ['SampleAttributeSet', 'SampleAttribute',
'SampleAttributeAttributeSet', 'SamplingType', 'ProductType',
'AliquotType', 'AliquotTypeProductType', 'Analysis']
'Analysis']
class SampleAttributeSet(ModelSQL, ModelView):
@ -54,54 +53,7 @@ class ProductType(metaclass=PoolMeta):
'Attribute Set')
class AliquotType(ModelSQL, ModelView):
'Aliquot Type'
__name__ = 'lims.aliquot.type'
name = fields.Char('Name', required=True)
code = fields.Char('Code', required=True)
ind_volume = fields.Float('Required volume')
uom = fields.Many2One('product.uom', 'UoM')
kind = fields.Selection([
('int', 'Internal'),
('ext', 'External'),
('rack', 'Rack'),
], 'Kind', sort=False, required=True)
product_types = fields.Many2Many('lims.aliquot.type-product.type',
'aliquot_type', 'product_type', 'Product types',
depends=['kind'], states={
'invisible': Eval('kind') != 'rack',
'required': Eval('kind') == 'rack',
})
laboratory = fields.Many2One('party.party', 'Destination Laboratory',
depends=['kind'], states={
'invisible': Eval('kind') != 'ext',
'required': Eval('kind') == 'ext',
})
preparation = fields.Boolean('Preparation',
depends=['kind'], states={
'invisible': Eval('kind') != 'int',
})
class AliquotTypeProductType(ModelSQL):
'Equipment Template - Component Type'
__name__ = 'lims.aliquot.type-product.type'
_table = 'lims_aliquot_type_product_type'
aliquot_type = fields.Many2One('lims.aliquot.type', 'Aliquot type',
required=True, ondelete='CASCADE', select=True)
product_type = fields.Many2One('lims.product.type', 'Product type',
required=True, ondelete='CASCADE', select=True)
class Analysis(metaclass=PoolMeta):
__name__ = 'lims.analysis'
aliquot_type = fields.Many2One('lims.aliquot.type', 'Aliquot type')
ind_volume = fields.Float('Required volume')
@fields.depends('aliquot_type')
def on_change_aliquot_type(self):
if self.aliquot_type:
self.ind_volume = self.aliquot_type.ind_volume

View file

@ -109,39 +109,6 @@
<field name="name">product_type_form</field>
</record>
<!-- Aliquot Type -->
<record model="ir.ui.view" id="aliquot_type_view_list">
<field name="model">lims.aliquot.type</field>
<field name="type">tree</field>
<field name="name">aliquot_type_list</field>
</record>
<record model="ir.ui.view" id="aliquot_type_view_form">
<field name="model">lims.aliquot.type</field>
<field name="type">form</field>
<field name="name">aliquot_type_form</field>
</record>
<record model="ir.action.act_window" id="act_aliquot_type">
<field name="name">Aliquot Types</field>
<field name="res_model">lims.aliquot.type</field>
</record>
<record model="ir.action.act_window.view"
id="act_aliquot_type_view_list">
<field name="sequence" eval="10"/>
<field name="view" ref="aliquot_type_view_list"/>
<field name="act_window" ref="act_aliquot_type"/>
</record>
<record model="ir.action.act_window.view"
id="act_aliquot_type_view_form">
<field name="sequence" eval="20"/>
<field name="view" ref="aliquot_type_view_form"/>
<field name="act_window" ref="act_aliquot_type"/>
</record>
<menuitem action="act_aliquot_type" id="menu_aliquot_type"
parent="lims.lims_config_base_tables" sequence="140"/>
<!-- Analysis/Set/Group -->
<record model="ir.ui.view" id="lims_analysis_view_form">
@ -149,11 +116,6 @@
<field name="inherit" ref="lims.lims_analysis_view_form"/>
<field name="name">analysis_form</field>
</record>
<record model="ir.ui.view" id="lims_analysis_view_list">
<field name="model">lims.analysis</field>
<field name="inherit" ref="lims.lims_analysis_view_list"/>
<field name="name">analysis_list</field>
</record>
</data>
</tryton>

View file

@ -1,96 +0,0 @@
# This file is part of lims_industry module for 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.pyson import Eval
from trytond.pool import Pool, PoolMeta
__all__ = ['Configuration', 'ConfigurationSequence', 'LabWorkYear',
'LabWorkYearSequence']
class Configuration(metaclass=PoolMeta):
__name__ = 'lims.configuration'
rack_sequence = fields.MultiValue(fields.Many2One(
'ir.sequence', 'Rack Sequence', required=True,
domain=[
('company', 'in',
[Eval('context', {}).get('company', -1), None]),
('code', '=', 'lims.planification'),
]))
@classmethod
def default_rack_sequence(cls, **pattern):
return cls.multivalue_model(
'rack_sequence').default_rack_sequence()
@classmethod
def multivalue_model(cls, field):
pool = Pool()
if field == 'rack_sequence':
return pool.get('lims.configuration.sequence')
return super(Configuration, cls).multivalue_model(field)
class ConfigurationSequence(metaclass=PoolMeta):
__name__ = 'lims.configuration.sequence'
rack_sequence = fields.Many2One('ir.sequence',
'Rack Sequence', depends=['company'], domain=[
('company', 'in', [Eval('company', -1), None]),
('code', '=', 'lims.planification'),
])
@classmethod
def default_rack_sequence(cls):
pool = Pool()
ModelData = pool.get('ir.model.data')
try:
return ModelData.get_id('lims.planification', 'seq_rack')
except KeyError:
return None
class LabWorkYear(metaclass=PoolMeta):
__name__ = 'lims.lab.workyear'
aliquot_sequence = fields.MultiValue(fields.Many2One(
'ir.sequence', 'Aliquot Sequence', required=True,
domain=[
('company', 'in',
[Eval('context', {}).get('company', -1), None]),
('code', '=', 'lims.aliquot'),
]))
@classmethod
def default_aliquot_sequence(cls, **pattern):
return cls.multivalue_model(
'aliquot_sequence').default_aliquot_sequence()
@classmethod
def multivalue_model(cls, field):
pool = Pool()
if field == 'aliquot_sequence':
return pool.get('lims.lab.workyear.sequence')
return super(LabWorkYear, cls).multivalue_model(field)
class LabWorkYearSequence(metaclass=PoolMeta):
__name__ = 'lims.lab.workyear.sequence'
aliquot_sequence = fields.Many2One('ir.sequence',
'Aliquot Sequence', depends=['company'], domain=[
('company', 'in', [Eval('company', -1), None]),
('code', '=', 'lims.aliquot'),
])
@classmethod
def default_aliquot_sequence(cls):
pool = Pool()
ModelData = pool.get('ir.model.data')
try:
return ModelData.get_id('lims.aliquot', 'seq_aliquot')
except KeyError:
return None

View file

@ -1,27 +0,0 @@
<?xml version="1.0"?>
<tryton>
<data>
<!-- Configuration -->
<record model="ir.ui.view" id="configuration_view_form">
<field name="model">lims.configuration</field>
<field name="inherit" ref="lims.lims_configuration_view"/>
<field name="name">configuration_form</field>
</record>
<!-- Work Year -->
<record model="ir.ui.view" id="workyear_view_form">
<field name="model">lims.lab.workyear</field>
<field name="inherit" ref="lims.lims_workyear_view_form"/>
<field name="name">workyear_form</field>
</record>
<record model="ir.ui.view" id="workyear_view_list">
<field name="model">lims.lab.workyear</field>
<field name="inherit" ref="lims.lims_workyear_view_list"/>
<field name="name">workyear_list</field>
</record>
</data>
</tryton>

View file

@ -2,150 +2,6 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:lims.aliquot,create_date:"
msgid "Create Date"
msgstr "Fecha creación"
msgctxt "field:lims.aliquot,create_uid:"
msgid "Create User"
msgstr "Usuario creación"
msgctxt "field:lims.aliquot,fraction:"
msgid "Fraction"
msgstr "Fracción"
msgctxt "field:lims.aliquot,id:"
msgid "ID"
msgstr "ID"
msgctxt "field:lims.aliquot,kind:"
msgid "Kind"
msgstr "Clase"
msgctxt "field:lims.aliquot,laboratory:"
msgid "Destination Laboratory"
msgstr "Laboratorio destino"
msgctxt "field:lims.aliquot,number:"
msgid "Number"
msgstr "Número"
msgctxt "field:lims.aliquot,preparation:"
msgid "Preparation"
msgstr "Preparación"
msgctxt "field:lims.aliquot,rec_name:"
msgid "Record Name"
msgstr "Nombre"
msgctxt "field:lims.aliquot,shipment_date:"
msgid "Shipment date"
msgstr "Fecha de envío"
msgctxt "field:lims.aliquot,type:"
msgid "Type"
msgstr "Tipo"
msgctxt "field:lims.aliquot,write_date:"
msgid "Write Date"
msgstr "Fecha modificación"
msgctxt "field:lims.aliquot,write_uid:"
msgid "Write User"
msgstr "Usuario modificación"
msgctxt "field:lims.aliquot.type,code:"
msgid "Code"
msgstr "Código"
msgctxt "field:lims.aliquot.type,create_date:"
msgid "Create Date"
msgstr "Fecha creación"
msgctxt "field:lims.aliquot.type,create_uid:"
msgid "Create User"
msgstr "Usuario creación"
msgctxt "field:lims.aliquot.type,id:"
msgid "ID"
msgstr "ID"
msgctxt "field:lims.aliquot.type,ind_volume:"
msgid "Required volume"
msgstr "Volumen requerido"
msgctxt "field:lims.aliquot.type,kind:"
msgid "Kind"
msgstr "Clase"
msgctxt "field:lims.aliquot.type,laboratory:"
msgid "Destination Laboratory"
msgstr "Laboratorio destino"
msgctxt "field:lims.aliquot.type,name:"
msgid "Name"
msgstr "Nombre"
msgctxt "field:lims.aliquot.type,preparation:"
msgid "Preparation"
msgstr "Preparación"
msgctxt "field:lims.aliquot.type,product_types:"
msgid "Product types"
msgstr "Tipos de producto"
msgctxt "field:lims.aliquot.type,rec_name:"
msgid "Record Name"
msgstr "Nombre"
msgctxt "field:lims.aliquot.type,uom:"
msgid "UoM"
msgstr "UdM"
msgctxt "field:lims.aliquot.type,write_date:"
msgid "Write Date"
msgstr "Fecha modificación"
msgctxt "field:lims.aliquot.type,write_uid:"
msgid "Write User"
msgstr "Usuario modificación"
msgctxt "field:lims.aliquot.type-product.type,aliquot_type:"
msgid "Aliquot type"
msgstr "Tipo de alícuota"
msgctxt "field:lims.aliquot.type-product.type,create_date:"
msgid "Create Date"
msgstr "Fecha creación"
msgctxt "field:lims.aliquot.type-product.type,create_uid:"
msgid "Create User"
msgstr "Usuario creación"
msgctxt "field:lims.aliquot.type-product.type,id:"
msgid "ID"
msgstr "ID"
msgctxt "field:lims.aliquot.type-product.type,product_type:"
msgid "Product type"
msgstr "Tipo de producto"
msgctxt "field:lims.aliquot.type-product.type,rec_name:"
msgid "Record Name"
msgstr "Nombre"
msgctxt "field:lims.aliquot.type-product.type,write_date:"
msgid "Write Date"
msgstr "Fecha modificación"
msgctxt "field:lims.aliquot.type-product.type,write_uid:"
msgid "Write User"
msgstr "Usuario modificación"
msgctxt "field:lims.analysis,aliquot_type:"
msgid "Aliquot type"
msgstr "Tipo de alícuota"
msgctxt "field:lims.analysis,ind_volume:"
msgid "Required volume"
msgstr "Volumen requerido"
@ -358,14 +214,6 @@ msgctxt "field:lims.component.type,write_uid:"
msgid "Write User"
msgstr "Usuario modificación"
msgctxt "field:lims.configuration,rack_sequence:"
msgid "Rack Sequence"
msgstr "Secuencia de Rack"
msgctxt "field:lims.configuration.sequence,rack_sequence:"
msgid "Rack Sequence"
msgstr "Secuencia de Rack"
msgctxt "field:lims.create_sample.start,attributes:"
msgid "Attributes"
msgstr "Atributos"
@ -638,74 +486,6 @@ msgctxt "field:lims.equipment.type,write_uid:"
msgid "Write User"
msgstr "Usuario modificación"
msgctxt "field:lims.lab.workyear,aliquot_sequence:"
msgid "Aliquot Sequence"
msgstr "Secuencia de Alícuota"
msgctxt "field:lims.lab.workyear.sequence,aliquot_sequence:"
msgid "Aliquot Sequence"
msgstr "Secuencia de Alícuota"
msgctxt "field:lims.planification,aliquot_type:"
msgid "Rack type"
msgstr "Tipo Rack"
msgctxt "field:lims.planification,positions:"
msgid "Positions"
msgstr "Posiciones"
msgctxt "field:lims.planification,rack_number:"
msgid "Rack number"
msgstr "Número Rack"
msgctxt "field:lims.planification,rack_state:"
msgid "Rack state"
msgstr "Estado Rack"
msgctxt "field:lims.planification,rack_user:"
msgid "Rack user"
msgstr "Usuario Rack"
msgctxt "field:lims.planification,type:"
msgid "Type"
msgstr "Tipo"
msgctxt "field:lims.planification.position,aliquot:"
msgid "Aliquot"
msgstr "Alícuota"
msgctxt "field:lims.planification.position,create_date:"
msgid "Create Date"
msgstr "Fecha creación"
msgctxt "field:lims.planification.position,create_uid:"
msgid "Create User"
msgstr "Usuario creación"
msgctxt "field:lims.planification.position,id:"
msgid "ID"
msgstr "ID"
msgctxt "field:lims.planification.position,planification:"
msgid "Planification"
msgstr "Planificación"
msgctxt "field:lims.planification.position,position:"
msgid "Position"
msgstr "Posición"
msgctxt "field:lims.planification.position,rec_name:"
msgid "Record Name"
msgstr "Nombre"
msgctxt "field:lims.planification.position,write_date:"
msgid "Write Date"
msgstr "Fecha modificación"
msgctxt "field:lims.planification.position,write_uid:"
msgid "Write User"
msgstr "Usuario modificación"
msgctxt "field:lims.plant,city:"
msgid "City"
msgstr "Ciudad"
@ -1090,14 +870,6 @@ msgctxt "help:lims.sample.attribute,selection_sorted:"
msgid "If the selection must be sorted on label"
msgstr "Si la selección debe ordenarse por la etiqueta"
msgctxt "model:ir.action,name:act_aliquot"
msgid "Aliquots"
msgstr "Alícuotas"
msgctxt "model:ir.action,name:act_aliquot_type"
msgid "Aliquot Types"
msgstr "Tipos de alícuota"
msgctxt "model:ir.action,name:act_brand"
msgid "Brands"
msgstr "Marcas"
@ -1142,10 +914,6 @@ msgctxt "model:ir.action,name:act_plant"
msgid "Plants"
msgstr "Plantas"
msgctxt "model:ir.action,name:act_rack_list"
msgid "Racks"
msgstr "Racks"
msgctxt "model:ir.action,name:act_sample_attribute"
msgid "Sample Attributes"
msgstr "Atributos de muestra"
@ -1158,41 +926,10 @@ msgctxt "model:ir.action,name:act_sampling_type"
msgid "Sampling Types"
msgstr "Tipos de muestreo"
msgctxt "model:ir.action,name:report_aliquot_external"
msgid "External Aliquots Shipping"
msgstr "Envío de Alícuotas externas"
msgctxt "model:ir.action,name:wiz_edit_sample"
msgid "Edit Samples"
msgstr "Modificar muestras"
msgctxt "model:ir.action.act_window.domain,name:act_rack_list_domain_all"
msgid "All"
msgstr "Todo"
msgctxt ""
"model:ir.action.act_window.domain,name:act_rack_list_domain_confirmed"
msgid "Confirmed"
msgstr "Confirmado"
msgctxt "model:ir.action.act_window.domain,name:act_rack_list_domain_draft"
msgid "Draft"
msgstr "Borrador"
msgctxt ""
"model:ir.action.act_window.domain,name:act_rack_list_domain_not_executed"
msgid "Not executed"
msgstr "No ejecutado"
msgctxt ""
"model:ir.action.act_window.domain,name:act_rack_list_domain_preplanned"
msgid "Pre-Planned"
msgstr "Pre-Planificado"
msgctxt "model:ir.message,text:lbl_aliquot_preparation"
msgid "Aliquot preparation"
msgstr "Preparación de Alícuota"
msgctxt "model:ir.message,text:lbl_component_missing_data"
msgid "Missing data in Component"
msgstr "Faltan datos en Componente"
@ -1213,10 +950,6 @@ msgctxt "model:ir.message,text:lbl_sample_missing_data"
msgid "Missing data in Sample"
msgstr "Faltan datos en Muestra"
msgctxt "model:ir.message,text:msg_aliquot_no_sequence"
msgid "There is no aliquot sequence for the work year \"%(work_year)s\"."
msgstr "No hay una secuencia de alícuotas para el año laboral «%(work_year)s»"
msgctxt "model:ir.message,text:msg_component_type_unique"
msgid "A component of the same type already exists for the equipment"
msgstr "Ya existe un componente del mismo tipo para el equipo"
@ -1237,42 +970,10 @@ msgctxt "model:ir.message,text:msg_party_no_tax_identifier"
msgid "Party \"%(party)s\" has no Tax Identifier"
msgstr "La entidad «%(party)s» no tiene identificador fiscal"
msgctxt "model:ir.message,text:msg_planification_position_unique"
msgid "Rack positions must be unique"
msgstr "Las posiciones del Rack deben ser únicas"
msgctxt "model:ir.message,text:msg_plant_name_unique"
msgid "There is already a plant with the same name for the party"
msgstr "Ya existe una planta con el mismo nombre para el tercero"
msgctxt "model:ir.message,text:msg_user_no_laboratory"
msgid "There is no laboratory for this user"
msgstr "No hay un Laboratorio por defecto para este usuario"
msgctxt "model:ir.sequence,name:seq_aliquot"
msgid "Aliquot"
msgstr "Alícuota"
msgctxt "model:ir.sequence,name:seq_rack"
msgid "Rack"
msgstr "Rack"
msgctxt "model:ir.sequence.type,name:seq_type_aliquot"
msgid "Aliquot"
msgstr "Alícuota"
msgctxt "model:ir.sequence.type,name:seq_type_rack"
msgid "Rack"
msgstr "Rack"
msgctxt "model:ir.ui.menu,name:menu_aliquot"
msgid "Aliquots"
msgstr "Alícuotas"
msgctxt "model:ir.ui.menu,name:menu_aliquot_type"
msgid "Aliquot Types"
msgstr "Tipos de alícuota"
msgctxt "model:ir.ui.menu,name:menu_brand"
msgid "Brands"
msgstr "Marcas"
@ -1317,10 +1018,6 @@ msgctxt "model:ir.ui.menu,name:menu_plant"
msgid "Plants"
msgstr "Plantas"
msgctxt "model:ir.ui.menu,name:menu_rack_list"
msgid "Racks"
msgstr "Racks"
msgctxt "model:ir.ui.menu,name:menu_sample_attribute"
msgid "Sample Attributes"
msgstr "Atributos de muestra"
@ -1333,18 +1030,6 @@ msgctxt "model:ir.ui.menu,name:menu_sampling_type"
msgid "Sampling Types"
msgstr "Tipos de muestreo"
msgctxt "model:lims.aliquot,name:"
msgid "Aliquot"
msgstr "Alícuota"
msgctxt "model:lims.aliquot.type,name:"
msgid "Aliquot Type"
msgstr "Tipo de alícuota"
msgctxt "model:lims.aliquot.type-product.type,name:"
msgid "Equipment Template - Component Type"
msgstr "Plantilla de equipo - Tipo de componente"
msgctxt "model:lims.brand,name:"
msgid "Brand"
msgstr "Marca"
@ -1381,10 +1066,6 @@ msgctxt "model:lims.equipment.type,name:"
msgid "Equipment Type"
msgstr "Tipo de componente"
msgctxt "model:lims.planification.position,name:"
msgid "Rack Position"
msgstr "Posición de Rack"
msgctxt "model:lims.plant,name:"
msgid "Plant"
msgstr "Planta"
@ -1409,46 +1090,6 @@ msgctxt "model:lims.sampling.type,name:"
msgid "Sampling Type"
msgstr "Muestreo"
msgctxt "selection:lims.aliquot,kind:"
msgid "External"
msgstr "Externa"
msgctxt "selection:lims.aliquot,kind:"
msgid "Internal"
msgstr "Interna"
msgctxt "selection:lims.aliquot,kind:"
msgid "Rack"
msgstr "Rack"
msgctxt "selection:lims.aliquot.type,kind:"
msgid "External"
msgstr "Externa"
msgctxt "selection:lims.aliquot.type,kind:"
msgid "Internal"
msgstr "Interna"
msgctxt "selection:lims.aliquot.type,kind:"
msgid "Rack"
msgstr "Rack"
msgctxt "selection:lims.planification,rack_state:"
msgid "Closed"
msgstr "Cerrado"
msgctxt "selection:lims.planification,rack_state:"
msgid "Open"
msgstr "Abierto"
msgctxt "selection:lims.planification,type:"
msgid "Normal"
msgstr "Normal"
msgctxt "selection:lims.planification,type:"
msgid "Rack"
msgstr "Rack"
msgctxt "selection:lims.sample.attribute,type_:"
msgid "Boolean"
msgstr "Boolean"
@ -1537,10 +1178,6 @@ msgctxt "view:lims.planification:"
msgid "Add RM/BMZ"
msgstr "Añadir RM/BMZ"
msgctxt "view:lims.planification:"
msgid "Aliquots"
msgstr "Alícuotas"
msgctxt "view:lims.planification:"
msgid "Comments"
msgstr "Observaciones"

View file

@ -1,9 +1,6 @@
<?xml version="1.0"?>
<tryton>
<data group="1">
<record model="ir.message" id="lbl_aliquot_preparation">
<field name="text">Aliquot preparation</field>
</record>
<record model="ir.message" id="lbl_component_missing_data">
<field name="text">Missing data in Component</field>
</record>
@ -19,9 +16,6 @@
<record model="ir.message" id="lbl_sample_missing_data">
<field name="text">Missing data in Sample</field>
</record>
<record model="ir.message" id="msg_aliquot_no_sequence">
<field name="text">There is no aliquot sequence for the work year "%(work_year)s".</field>
</record>
<record model="ir.message" id="msg_component_type_unique">
<field name="text">A component of the same type already exists for the equipment</field>
</record>
@ -40,11 +34,5 @@
<record model="ir.message" id="msg_plant_name_unique">
<field name="text">There is already a plant with the same name for the party</field>
</record>
<record model="ir.message" id="msg_user_no_laboratory">
<field name="text">There is no laboratory for this user</field>
</record>
<record model="ir.message" id="msg_planification_position_unique">
<field name="text">Rack positions must be unique</field>
</record>
</data>
</tryton>

View file

@ -1,168 +0,0 @@
# This file is part of lims_industry module for Tryton.
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
from trytond.model import ModelSQL, ModelView, fields, Unique
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Not, Bool, Equal, Eval
from trytond.transaction import Transaction
from trytond.exceptions import UserError
from trytond.i18n import gettext
__all__ = ['Rack', 'RackPosition']
class Rack(metaclass=PoolMeta):
__name__ = 'lims.planification'
type = fields.Selection([
('normal', 'Normal'),
('rack', 'Rack'),
], 'Type', required=True, sort=False)
rack_number = fields.Char('Rack number', readonly=True)
aliquot_type = fields.Many2One('lims.aliquot.type', 'Rack type',
states={'required': Eval('type') == 'rack'},
domain=[('kind', '=', 'rack')],
depends=['type'])
rack_state = fields.Selection([
(None, ''),
('open', 'Open'),
('closed', 'Closed'),
], 'Rack state', sort=False,
states={'required': Eval('type') == 'rack'},
depends=['type'])
rack_user = fields.Many2One('res.user', 'Rack user',
states={'required': Eval('type') == 'rack'},
depends=['type'])
positions = fields.One2Many('lims.planification.position',
'planification', 'Positions',
states={'readonly': Not(Bool(Equal(Eval('state'), 'draft')))},
depends=['state'])
@classmethod
def __setup__(cls):
super(Rack, cls).__setup__()
cls.details.context.update({'planification_type': Eval('type')})
@staticmethod
def default_type():
return 'normal'
@staticmethod
def default_rack_user():
return int(Transaction().user)
@classmethod
def create(cls, vlist):
pool = Pool()
Config = pool.get('lims.configuration')
Sequence = pool.get('ir.sequence')
AliquotType = pool.get('lims.aliquot.type')
vlist = [x.copy() for x in vlist]
config = Config(1)
for values in vlist:
if values['type'] != 'rack':
continue
number = '%s' % values['date'].strftime("%Y%m%d")
number += '-%s' % AliquotType(values['aliquot_type']).code
number += '-%s' % Sequence.get_id(config.rack_sequence.id)
values['rack_number'] = number
return super(Rack, cls).create(vlist)
@classmethod
def plan_aliquot(cls, aliquot, analysis):
pool = Pool()
PlanificationPosition = pool.get('lims.planification.position')
PlanificationDetail = pool.get('lims.planification.detail')
Date = pool.get('ir.date')
if aliquot.type.kind != 'rack':
return
laboratory = Transaction().context.get('laboratory', None)
if not laboratory:
raise UserError(gettext('lims_industry.msg_user_no_laboratory'))
# Rack
create_new_rack = True
position = 1
open_racks = cls.search([
('type', '=', 'rack'),
('laboratory', '=', laboratory),
('rack_user', '=', int(Transaction().user)),
('aliquot_type', '=', aliquot.type),
('rack_state', '=', 'open'),
])
for open_rack in open_racks:
if len(open_rack.positions) >= 20:
open_rack.rack_state = 'closed'
open_rack.save()
continue
rack = open_rack
position += len(rack.positions)
create_new_rack = False
break
if create_new_rack:
today = Date.today()
rack = cls(
laboratory=laboratory,
date=today,
date_from=today,
date_to=today,
state='draft',
type='rack',
aliquot_type=aliquot.type.id,
rack_state='open',
rack_user=int(Transaction().user),
)
rack.save()
# Rack position
rack_position = PlanificationPosition(
planification=rack.id,
position=position,
aliquot=aliquot.id,
)
rack_position.save()
if position == 20:
rack.rack_state = 'closed'
rack.save()
# Fraction to plan
rack_services = []
for analysis_id in analysis:
if not PlanificationDetail.search([
('planification', '=', rack.id),
('fraction', '=', aliquot.fraction.id),
('service_analysis', '=', analysis_id),
]):
rack_service = PlanificationDetail(
planification=rack.id,
fraction=aliquot.fraction.id,
service_analysis=analysis_id,
)
rack_services.append(rack_service)
PlanificationDetail.save(rack_services)
class RackPosition(ModelSQL, ModelView):
'Rack Position'
__name__ = 'lims.planification.position'
planification = fields.Many2One('lims.planification', 'Planification',
ondelete='CASCADE', select=True, required=True)
position = fields.Integer('Position', required=True,
domain=[('position', '>=', 1), ('position', '<=', 20)])
aliquot = fields.Many2One('lims.aliquot', 'Aliquot', required=True)
@classmethod
def __setup__(cls):
super(RackPosition, cls).__setup__()
cls._order.insert(0, ('position', 'ASC'))
t = cls.__table__()
cls._sql_constraints += [
('position_uniq', Unique(t, t.planification, t.position),
'lims_industry.msg_planification_position_unique'),
]

View file

@ -1,122 +0,0 @@
<?xml version="1.0"?>
<tryton>
<data>
<!-- Planification -->
<record model="ir.action.act_window" id="lims.act_lims_planification_list">
<field name="domain" eval="[('type', '=', 'normal')]" pyson="1"/>
</record>
<!-- Rack -->
<record model="ir.ui.view" id="rack_view_form">
<field name="model">lims.planification</field>
<field name="type">form</field>
<field name="name">rack_form</field>
</record>
<record model="ir.ui.view" id="rack_view_list">
<field name="model">lims.planification</field>
<field name="type">tree</field>
<field name="name">rack_list</field>
</record>
<record model="ir.action.act_window" id="act_rack_list">
<field name="name">Racks</field>
<field name="res_model">lims.planification</field>
<field name="domain" eval="[('type', '=', 'rack')]" pyson="1"/>
</record>
<record model="ir.action.act_window.view" id="act_rack_view_list">
<field name="sequence" eval="10"/>
<field name="view" ref="rack_view_list"/>
<field name="act_window" ref="act_rack_list"/>
</record>
<record model="ir.action.act_window.view" id="act_rack_view_form">
<field name="sequence" eval="20"/>
<field name="view" ref="rack_view_form"/>
<field name="act_window" ref="act_rack_list"/>
</record>
<record model="ir.action.act_window.domain"
id="act_rack_list_domain_draft">
<field name="name">Draft</field>
<field name="sequence" eval="10"/>
<field name="domain"
eval="[('state', '=', 'draft')]"
pyson="1"/>
<field name="act_window" ref="act_rack_list"/>
</record>
<record model="ir.action.act_window.domain"
id="act_rack_list_domain_preplanned">
<field name="name">Pre-Planned</field>
<field name="sequence" eval="20"/>
<field name="domain"
eval="[('state', '=', 'preplanned')]"
pyson="1"/>
<field name="act_window" ref="act_rack_list"/>
</record>
<record model="ir.action.act_window.domain"
id="act_rack_list_domain_confirmed">
<field name="name">Confirmed</field>
<field name="sequence" eval="30"/>
<field name="domain"
eval="[('state', '=', 'confirmed')]"
pyson="1"/>
<field name="act_window" ref="act_rack_list"/>
</record>
<record model="ir.action.act_window.domain"
id="act_rack_list_domain_not_executed">
<field name="name">Not executed</field>
<field name="sequence" eval="40"/>
<field name="domain"
eval="[('state', '=', 'not_executed')]"
pyson="1"/>
<field name="act_window" ref="act_rack_list"/>
</record>
<record model="ir.action.act_window.domain"
id="act_rack_list_domain_all">
<field name="name">All</field>
<field name="sequence" eval="9999"/>
<field name="domain"></field>
<field name="act_window" ref="act_rack_list"/>
</record>
<menuitem action="act_rack_list" id="menu_rack_list"
parent="lims.lims_laboratory" sequence="25"
icon="lims-planification"/>
<!-- Rack Position -->
<record model="ir.ui.view" id="planification_position_view_form">
<field name="model">lims.planification.position</field>
<field name="type">form</field>
<field name="name">planification_position_form</field>
</record>
<record model="ir.ui.view" id="planification_position_view_list">
<field name="model">lims.planification.position</field>
<field name="type">tree</field>
<field name="name">planification_position_list</field>
</record>
</data>
<data noupdate="1">
<!-- Sequence for Rack -->
<record model="ir.sequence.type" id="seq_type_rack">
<field name="name">Rack</field>
<field name="code">lims.planification</field>
</record>
<record model="ir.sequence.type-res.group"
id="seq_type_rack_group_admin">
<field name="sequence_type" ref="seq_type_rack"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence" id="seq_rack">
<field name="name">Rack</field>
<field name="code">lims.planification</field>
<field name="padding" eval="8"/>
</record>
</data>
</tryton>

View file

@ -1,248 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
<office:meta><meta:creation-date>2019-10-09T17:38:31.284224136</meta:creation-date><meta:editing-cycles>0</meta:editing-cycles><meta:editing-duration>P0D</meta:editing-duration><meta:generator>LibreOffice/6.0.7.3$Linux_X86_64 LibreOffice_project/00m0$Build-3</meta:generator><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="0" meta:word-count="0" meta:character-count="0" meta:non-whitespace-character-count="0"/></office:meta>
<office:settings>
<config:config-item-set config:name="ooo:view-settings">
<config:config-item config:name="ViewAreaTop" config:type="long">0</config:config-item>
<config:config-item config:name="ViewAreaLeft" config:type="long">0</config:config-item>
<config:config-item config:name="ViewAreaWidth" config:type="long">22250</config:config-item>
<config:config-item config:name="ViewAreaHeight" config:type="long">8821</config:config-item>
<config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item>
<config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item>
<config:config-item-map-indexed config:name="Views">
<config:config-item-map-entry>
<config:config-item config:name="ViewId" config:type="string">view2</config:config-item>
<config:config-item config:name="ViewLeft" config:type="long">2625</config:config-item>
<config:config-item config:name="ViewTop" config:type="long">2501</config:config-item>
<config:config-item config:name="VisibleLeft" config:type="long">0</config:config-item>
<config:config-item config:name="VisibleTop" config:type="long">0</config:config-item>
<config:config-item config:name="VisibleRight" config:type="long">22248</config:config-item>
<config:config-item config:name="VisibleBottom" config:type="long">8819</config:config-item>
<config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
<config:config-item config:name="ViewLayoutColumns" config:type="short">0</config:config-item>
<config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item>
<config:config-item config:name="ZoomFactor" config:type="short">120</config:config-item>
<config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item>
<config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item>
</config:config-item-map-entry>
</config:config-item-map-indexed>
</config:config-item-set>
<config:config-item-set config:name="ooo:configuration-settings">
<config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintFaxName" config:type="string"/>
<config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintTextPlaceholder" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item>
<config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item>
<config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item>
<config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrinterSetup" config:type="base64Binary"/>
<config:config-item config:name="CollapseEmptyCellPara" config:type="boolean">true</config:config-item>
<config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/>
<config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">false</config:config-item>
<config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item>
<config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item>
<config:config-item config:name="TreatSingleColumnBreakAsPageBreak" config:type="boolean">false</config:config-item>
<config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item>
<config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item>
<config:config-item config:name="RsidRoot" config:type="int">827680</config:config-item>
<config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item>
<config:config-item config:name="TableRowKeep" config:type="boolean">false</config:config-item>
<config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item>
<config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item>
<config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item>
<config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item>
<config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item>
<config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item>
<config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item>
<config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item>
<config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item>
<config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">false</config:config-item>
<config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item>
<config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">false</config:config-item>
<config:config-item config:name="ApplyUserData" config:type="boolean">false</config:config-item>
<config:config-item config:name="StylesNoDefault" config:type="boolean">false</config:config-item>
<config:config-item config:name="EmbeddedDatabaseName" config:type="string"/>
<config:config-item config:name="FloattableNomargins" config:type="boolean">false</config:config-item>
<config:config-item config:name="BackgroundParaOverDrawings" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrinterName" config:type="string"/>
<config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item>
<config:config-item config:name="TabOverMargin" config:type="boolean">false</config:config-item>
<config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item>
<config:config-item config:name="CurrentDatabaseDataSource" config:type="string"/>
<config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item>
<config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item>
<config:config-item config:name="SmallCapsPercentage66" config:type="boolean">false</config:config-item>
<config:config-item config:name="CurrentDatabaseCommand" config:type="string"/>
<config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item>
<config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item>
<config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">false</config:config-item>
<config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item>
<config:config-item config:name="DoNotCaptureDrawObjsOnPage" config:type="boolean">false</config:config-item>
<config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item>
<config:config-item config:name="DisableOffPagePositioning" config:type="boolean">true</config:config-item>
<config:config-item config:name="SurroundTextWrapSmall" config:type="boolean">false</config:config-item>
<config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">false</config:config-item>
<config:config-item config:name="TabAtLeftIndentForParagraphsInList" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item>
<config:config-item config:name="Rsid" config:type="int">923240</config:config-item>
<config:config-item config:name="MathBaselineAlignment" config:type="boolean">true</config:config-item>
<config:config-item config:name="MsWordCompTrailingBlanks" config:type="boolean">false</config:config-item>
<config:config-item config:name="InvertBorderSpacing" config:type="boolean">false</config:config-item>
<config:config-item config:name="EmbedFonts" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item>
<config:config-item config:name="TabOverflow" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item>
<config:config-item config:name="PropLineSpacingShrinksFirstLine" config:type="boolean">true</config:config-item>
<config:config-item config:name="UnbreakableNumberings" config:type="boolean">false</config:config-item>
<config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item>
<config:config-item config:name="ClippedPictures" config:type="boolean">false</config:config-item>
<config:config-item config:name="EmbedSystemFonts" config:type="boolean">false</config:config-item>
<config:config-item config:name="ApplyParagraphMarkFormatToNumbering" config:type="boolean">false</config:config-item>
<config:config-item config:name="SubtractFlysAnchoredAtFlys" config:type="boolean">false</config:config-item>
<config:config-item config:name="AddVerticalFrameOffsets" config:type="boolean">false</config:config-item>
<config:config-item config:name="ProtectForm" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintEmptyPages" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintHiddenText" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item>
<config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item>
</config:config-item-set>
</office:settings>
<office:scripts>
<office:script script:language="ooo:Basic">
<ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink"/>
</office:script>
</office:scripts>
<office:font-face-decls>
<style:font-face style:name="Lohit Devanagari1" svg:font-family="&apos;Lohit Devanagari&apos;"/>
<style:font-face style:name="Liberation Serif" svg:font-family="&apos;Liberation Serif&apos;" style:font-family-generic="roman" style:font-pitch="variable"/>
<style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/>
<style:font-face style:name="Lohit Devanagari" svg:font-family="&apos;Lohit Devanagari&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
<style:font-face style:name="Noto Sans CJK SC" svg:font-family="&apos;Noto Sans CJK SC&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
</office:font-face-decls>
<office:styles>
<style:default-style style:family="graphic">
<style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
<style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:font-independent-line-spacing="false">
<style:tab-stops/>
</style:paragraph-properties>
<style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="es" fo:country="AR" style:letter-kerning="true" style:font-name-asian="Noto Sans CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
</style:default-style>
<style:default-style style:family="paragraph">
<style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
<style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="es" fo:country="AR" style:letter-kerning="true" style:font-name-asian="Noto Sans CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
</style:default-style>
<style:default-style style:family="table">
<style:table-properties table:border-model="collapsing"/>
</style:default-style>
<style:default-style style:family="table-row">
<style:table-row-properties fo:keep-together="auto"/>
</style:default-style>
<style:style style:name="Standard" style:family="paragraph" style:class="text"/>
<style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
<style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" loext:contextual-spacing="false" fo:keep-with-next="always"/>
<style:text-properties style:font-name="Liberation Sans" fo:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable" fo:font-size="14pt" style:font-name-asian="Noto Sans CJK SC" style:font-family-asian="&apos;Noto Sans CJK SC&apos;" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="14pt" style:font-name-complex="Lohit Devanagari" style:font-family-complex="&apos;Lohit Devanagari&apos;" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="14pt"/>
</style:style>
<style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
<style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.247cm" loext:contextual-spacing="false" fo:line-height="115%"/>
</style:style>
<style:style style:name="List" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="list">
<style:text-properties style:font-size-asian="12pt" style:font-name-complex="Lohit Devanagari1" style:font-family-complex="&apos;Lohit Devanagari&apos;"/>
</style:style>
<style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
<style:paragraph-properties fo:margin-top="0.212cm" fo:margin-bottom="0.212cm" loext:contextual-spacing="false" text:number-lines="false" text:line-number="0"/>
<style:text-properties fo:font-size="12pt" fo:font-style="italic" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-name-complex="Lohit Devanagari1" style:font-family-complex="&apos;Lohit Devanagari&apos;" style:font-size-complex="12pt" style:font-style-complex="italic"/>
</style:style>
<style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index">
<style:paragraph-properties text:number-lines="false" text:line-number="0"/>
<style:text-properties style:font-size-asian="12pt" style:font-name-complex="Lohit Devanagari1" style:font-family-complex="&apos;Lohit Devanagari&apos;"/>
</style:style>
<text:outline-style style:name="Outline">
<text:outline-level-style text:level="1" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="2" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="3" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="4" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="5" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="6" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="7" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="8" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="9" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="10" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
</text:outline-style>
<text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
<text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
<text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/>
</office:styles>
<office:automatic-styles>
<style:page-layout style:name="pm1">
<style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm">
<style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
</style:page-layout-properties>
<style:header-style/>
<style:footer-style/>
</style:page-layout>
</office:automatic-styles>
<office:master-styles>
<style:master-page style:name="Standard" style:page-layout-name="pm1"/>
</office:master-styles>
<office:body>
<office:text>
<office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
<text:sequence-decls>
<text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
<text:sequence-decl text:display-outline-level="0" text:name="Table"/>
<text:sequence-decl text:display-outline-level="0" text:name="Text"/>
<text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
</text:sequence-decls>
<text:p text:style-name="Standard"/>
</office:text>
</office:body>
</office:document>

View file

@ -2,18 +2,14 @@
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
from trytond.model import ModelSQL, ModelView, fields
from trytond.model import ModelView, fields
from trytond.wizard import Wizard, StateTransition, StateView, Button
from trytond.report import Report
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Eval, Bool
from trytond.pyson import Eval
from trytond.transaction import Transaction
from trytond.exceptions import UserError
from trytond.i18n import gettext
__all__ = ['Entry', 'Sample', 'CreateSampleStart', 'CreateSample',
'EditSampleStart', 'EditSample', 'Fraction', 'Aliquot',
'AliquotExternalReport']
'EditSampleStart', 'EditSample']
class Entry(metaclass=PoolMeta):
@ -369,162 +365,3 @@ class EditSample(Wizard):
entry.state = 'draft'
entry.save()
return entry
class Fraction(metaclass=PoolMeta):
__name__ = 'lims.fraction'
@classmethod
def confirm(cls, fractions):
super(Fraction, cls).confirm(fractions)
for fraction in fractions:
fraction.create_aliquots()
fraction.plan_aliquots()
def create_aliquots(self):
pool = Pool()
EntryDetailAnalysis = pool.get('lims.entry.detail.analysis')
Aliquot = pool.get('lims.aliquot')
aliquot_types = []
analysis_detail = EntryDetailAnalysis.search([
('fraction', '=', self.id)])
for detail in analysis_detail:
if detail.analysis.aliquot_type:
aliquot_types.append(detail.analysis.aliquot_type.id)
aliquots = []
for type in list(set(aliquot_types)):
aliquot = Aliquot()
aliquot.fraction = self.id
aliquot.type = type
aliquots.append(aliquot)
if aliquots:
Aliquot.save(aliquots)
def plan_aliquots(self):
pool = Pool()
Service = pool.get('lims.service')
Aliquot = pool.get('lims.aliquot')
Planification = pool.get('lims.planification')
analysis_ids = []
services = Service.search([('fraction', '=', self.id)])
for service in services:
analysis_ids.append(service.analysis.id)
analysis = list(set(analysis_ids))
aliquots = Aliquot.search([('fraction', '=', self.id)])
for aliquot in aliquots:
Planification.plan_aliquot(aliquot, analysis)
class Aliquot(ModelSQL, ModelView):
'Aliquot'
__name__ = 'lims.aliquot'
_rec_name = 'number'
number = fields.Char('Number', select=True, readonly=True)
fraction = fields.Many2One('lims.fraction', 'Fraction', required=True,
ondelete='CASCADE', select=True, depends=['number'],
states={'readonly': Bool(Eval('number'))})
type = fields.Many2One('lims.aliquot.type', 'Type', required=True)
kind = fields.Function(fields.Selection([
('int', 'Internal'),
('ext', 'External'),
('rack', 'Rack'),
], 'Kind'), 'get_type_field')
shipment_date = fields.Date('Shipment date',
states={'invisible': Eval('kind') != 'ext'},
depends=['kind'])
laboratory = fields.Function(fields.Many2One('party.party',
'Destination Laboratory',
states={'invisible': Eval('kind') != 'ext'},
depends=['kind']), 'get_type_field')
preparation = fields.Function(fields.Boolean('Preparation',
states={'invisible': Eval('kind') != 'int'},
depends=['kind']), 'get_type_field')
@classmethod
def __setup__(cls):
super(Aliquot, cls).__setup__()
cls._order.insert(0, ('number', 'DESC'))
@fields.depends('type')
def on_change_with_kind(self, name=None):
if self.type:
result = self.get_type_field((self,), ('kind',))
return result['kind'][self.id]
return None
@fields.depends('type')
def on_change_with_laboratory(self, name=None):
if self.type:
result = self.get_type_field((self,), ('laboratory',))
return result['laboratory'][self.id]
return None
@fields.depends('type')
def on_change_with_preparation(self, name=None):
if self.type:
result = self.get_type_field((self,), ('preparation',))
return result['preparation'][self.id]
return None
@classmethod
def get_type_field(cls, aliquots, names):
result = {}
for name in names:
result[name] = {}
if name == 'laboratory':
for a in aliquots:
field = getattr(a.type, name, None)
result[name][a.id] = field.id if field else None
else:
for a in aliquots:
result[name][a.id] = getattr(a.type, name, None)
return result
@classmethod
def create(cls, vlist):
pool = Pool()
LabWorkYear = pool.get('lims.lab.workyear')
Sequence = pool.get('ir.sequence')
TaskTemplate = Pool().get('lims.administrative.task.template')
workyear_id = LabWorkYear.find()
workyear = LabWorkYear(workyear_id)
sequence = workyear.get_sequence('aliquot')
if not sequence:
raise UserError(gettext('lims_industry.msg_aliquot_no_sequence',
work_year=workyear.rec_name))
vlist = [x.copy() for x in vlist]
for values in vlist:
values['number'] = Sequence.get_id(sequence.id)
aliquots = super(Aliquot, cls).create(vlist)
TaskTemplate.create_tasks('aliquot_preparation',
cls._for_task_preparation(aliquots))
return aliquots
@classmethod
def _for_task_preparation(cls, aliquots):
AdministrativeTask = Pool().get('lims.administrative.task')
res = []
for aliquot in aliquots:
if not aliquot.preparation:
continue
if AdministrativeTask.search([
('type', '=', 'aliquot_preparation'),
('origin', '=', '%s,%s' % (cls.__name__, aliquot.id)),
('state', 'not in', ('done', 'discarded')),
]):
continue
res.append(aliquot)
return res
class AliquotExternalReport(Report):
'External Aliquots Shipping'
__name__ = 'lims.aliquot.external.report'

View file

@ -41,71 +41,5 @@
<field name="action" ref="wiz_edit_sample"/>
</record>
<!-- Aliquot -->
<record model="ir.ui.view" id="aliquot_view_list">
<field name="model">lims.aliquot</field>
<field name="type">tree</field>
<field name="name">aliquot_list</field>
</record>
<record model="ir.ui.view" id="aliquot_view_form">
<field name="model">lims.aliquot</field>
<field name="type">form</field>
<field name="name">aliquot_form</field>
</record>
<record model="ir.action.act_window" id="act_aliquot">
<field name="name">Aliquots</field>
<field name="res_model">lims.aliquot</field>
</record>
<record model="ir.action.act_window.view" id="act_aliquot_view_list">
<field name="sequence" eval="10"/>
<field name="view" ref="aliquot_view_list"/>
<field name="act_window" ref="act_aliquot"/>
</record>
<record model="ir.action.act_window.view" id="act_aliquot_view_form">
<field name="sequence" eval="20"/>
<field name="view" ref="aliquot_view_form"/>
<field name="act_window" ref="act_aliquot"/>
</record>
<menuitem action="act_aliquot" id="menu_aliquot"
parent="lims.lims_entry_board_menu" sequence="45"/>
<!-- External Aliquots Shipping Report -->
<record model="ir.action.report" id="report_aliquot_external">
<field name="name">External Aliquots Shipping</field>
<field name="model">lims.aliquot</field>
<field name="report_name">lims.aliquot.external.report</field>
<field name="report">lims_industry/report/aliquot_external.fodt</field>
</record>
<record model="ir.action.keyword" id="report_aliquot_external_keyword">
<field name="keyword">form_print</field>
<field name="model">lims.aliquot,-1</field>
<field name="action" ref="report_aliquot_external"/>
</record>
</data>
<data noupdate="1">
<!-- Sequence for Aliquot -->
<record model="ir.sequence.type" id="seq_type_aliquot">
<field name="name">Aliquot</field>
<field name="code">lims.aliquot</field>
</record>
<record model="ir.sequence.type-res.group"
id="seq_type_aliquot_group_admin">
<field name="sequence_type" ref="seq_type_aliquot"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence" id="seq_aliquot">
<field name="name">Aliquot</field>
<field name="code">lims.aliquot</field>
<field name="padding" eval="8"/>
</record>
</data>
</tryton>

View file

@ -24,8 +24,6 @@ class AdministrativeTaskTemplate(metaclass=PoolMeta):
gettext('lims_industry.lbl_sample_missing_data')))
types.append(('sample_insufficient_volume',
gettext('lims_industry.lbl_sample_insufficient_volume')))
types.append(('aliquot_preparation',
gettext('lims_industry.lbl_aliquot_preparation')))
return types
@ -40,6 +38,5 @@ class AdministrativeTask(metaclass=PoolMeta):
'lims.component',
'party.party',
'lims.sample',
'lims.aliquot',
])
return origins

View file

@ -8,6 +8,4 @@ xml:
analysis.xml
sample.xml
party.xml
planification.xml
configuration.xml
message.xml

View file

@ -1,17 +0,0 @@
<?xml version="1.0"?>
<form>
<label name="number"/>
<field name="number"/>
<label name="fraction"/>
<field name="fraction"/>
<label name="type"/>
<field name="type"/>
<label name="kind"/>
<field name="kind"/>
<label name="shipment_date"/>
<field name="shipment_date"/>
<label name="laboratory"/>
<field name="laboratory"/>
<label name="preparation"/>
<field name="preparation"/>
</form>

View file

@ -1,10 +0,0 @@
<?xml version="1.0"?>
<tree>
<field name="number"/>
<field name="fraction"/>
<field name="type"/>
<field name="kind"/>
<field name="shipment_date"/>
<field name="laboratory"/>
<field name="preparation"/>
</tree>

View file

@ -1,20 +0,0 @@
<?xml version="1.0"?>
<form>
<label name="name"/>
<field name="name"/>
<label name="code"/>
<field name="code"/>
<label name="ind_volume"/>
<field name="ind_volume"/>
<label name="uom"/>
<field name="uom"/>
<label name="kind"/>
<field name="kind"/>
<group id="laboratory_preparation" colspan="2" col="2">
<label name="laboratory"/>
<field name="laboratory"/>
<label name="preparation"/>
<field name="preparation"/>
</group>
<field name="product_types" colspan="4"/>
</form>

View file

@ -1,6 +0,0 @@
<?xml version="1.0"?>
<tree>
<field name="name" expand="1"/>
<field name="code"/>
<field name="kind"/>
</tree>

View file

@ -2,8 +2,6 @@
<data>
<xpath expr="/form/field[@name='disable_as_individual']"
position="after">
<label name="aliquot_type"/>
<field name="aliquot_type"/>
<label name="ind_volume"/>
<field name="ind_volume"/>
</xpath>

View file

@ -1,6 +0,0 @@
<?xml version="1.0"?>
<data>
<xpath expr="/tree/field[@name='formula']" position="after">
<field name="aliquot_type"/>
</xpath>
</data>

View file

@ -1,9 +0,0 @@
<?xml version="1.0"?>
<data>
<xpath
expr="/form/notebook/page[@id='general']/field[@name='planification_sequence']"
position="after">
<label name="rack_sequence"/>
<field name="rack_sequence"/>
</xpath>
</data>

View file

@ -1,7 +0,0 @@
<?xml version="1.0"?>
<form>
<label name="position"/>
<field name="position"/>
<label name="aliquot"/>
<field name="aliquot"/>
</form>

View file

@ -1,5 +0,0 @@
<?xml version="1.0"?>
<tree>
<field name="position"/>
<field name="aliquot"/>
</tree>

View file

@ -1,68 +0,0 @@
<?xml version="1.0"?>
<form>
<group col="6" colspan="4" id="header_holder">
<label name="laboratory"/>
<field name="laboratory"/>
<group col="4" colspan="2" id="header_holder">
<label name="start_date"/>
<field name="start_date"/>
<label name="date"/>
<field name="date"/>
</group>
<label name="code"/>
<field name="code"/>
<label name="rack_user"/>
<field name="rack_user"/>
<label name="aliquot_type"/>
<field name="aliquot_type"/>
<label name="rack_number"/>
<field name="rack_number"/>
</group>
<notebook>
<page string="General" id="general">
<group col="6" colspan="4" id="analysis_holder">
<label name="date_from"/>
<field name="date_from"/>
<label name="date_to"/>
<field name="date_to"/>
</group>
<field name="analysis" colspan="4" mode="tree,form"
view_ids="lims.lims_analysis_pending_view_list,lims.lims_analysis_view_form"/>
</page>
<page string="Aliquots" id="aliquots">
<field name="positions" colspan="4"/>
</page>
<page string="Technicians" id="technicians">
<field name="technicians" colspan="4"/>
<group col="6" colspan="4" id="technicians_holder">
<button name="relate_technicians" string="Relate technicians"/>
<button name="unlink_technicians" string="Unlink technicians"/>
<button name="replace_technician" string="Replace technician"/>
</group>
</page>
<page string="Controls" id="controls">
<field name="controls" colspan="4"/>
<group col="6" colspan="4" id="controls_holder">
<button name="add_fraction_con" string="Add Control"/>
<button name="add_fraction_rm_bmz" string="Add RM/BMZ"/>
<button name="add_fraction_bre" string="Add BRE"/>
<button name="add_fraction_mrt" string="Add MRT"/>
<button name="remove_control" string="Remove Control"/>
</group>
</page>
<page string="Comments" id="comments">
<field name="comments" colspan="4"/>
</page>
</notebook>
<field name="details" colspan="4"/>
<group col="5" colspan="4" id="state_holder">
<label name="rack_state"/>
<field name="rack_state"/>
<label name="state"/>
<field name="state"/>
<group colspan="1" id="buttons_holder">
<button name="preplan" string="Pre-Plan"/>
<button name="confirm" string="Confirm"/>
</group>
</group>
</form>

View file

@ -1,14 +0,0 @@
<?xml version="1.0"?>
<tree>
<field name="code"/>
<field name="date"/>
<field name="laboratory"/>
<field name="start_date"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="state"/>
<field name="rack_number"/>
<field name="aliquot_type"/>
<field name="rack_state"/>
<field name="comments"/>
</tree>

View file

@ -1,8 +0,0 @@
<?xml version="1.0"?>
<data>
<xpath expr="/form/field[@name='sample_sequence']"
position="after">
<label name="aliquot_sequence"/>
<field name="aliquot_sequence"/>
</xpath>
</data>

View file

@ -1,7 +0,0 @@
<?xml version="1.0"?>
<data>
<xpath expr="/tree/field[@name='sample_sequence']"
position="after">
<field name="aliquot_sequence"/>
</xpath>
</data>