lims_project_implementation: add project professionals
This commit is contained in:
parent
63d27363f7
commit
680ee310ae
|
@ -11,6 +11,7 @@ def register():
|
||||||
Pool.register(
|
Pool.register(
|
||||||
configuration.Configuration,
|
configuration.Configuration,
|
||||||
project.Project,
|
project.Project,
|
||||||
|
project.ProjectProfessional,
|
||||||
project.ProjectSolventAndReagent,
|
project.ProjectSolventAndReagent,
|
||||||
project.Entry,
|
project.Entry,
|
||||||
project.Fraction,
|
project.Fraction,
|
||||||
|
|
|
@ -26,10 +26,26 @@ msgctxt "field:lims.project,mpi_product_types:"
|
||||||
msgid "Product types"
|
msgid "Product types"
|
||||||
msgstr "Tipos de producto"
|
msgstr "Tipos de producto"
|
||||||
|
|
||||||
|
msgctxt "field:lims.project,mpi_professionals:"
|
||||||
|
msgid "Professionals"
|
||||||
|
msgstr "Profesionales"
|
||||||
|
|
||||||
msgctxt "field:lims.project,mpi_services:"
|
msgctxt "field:lims.project,mpi_services:"
|
||||||
msgid "Requested analysis"
|
msgid "Requested analysis"
|
||||||
msgstr "Análisis requeridos"
|
msgstr "Análisis requeridos"
|
||||||
|
|
||||||
|
msgctxt "field:lims.project.mpi_professional,employee:"
|
||||||
|
msgid "Employee"
|
||||||
|
msgstr "Empleado"
|
||||||
|
|
||||||
|
msgctxt "field:lims.project.mpi_professional,position:"
|
||||||
|
msgid "Position"
|
||||||
|
msgstr "Posición"
|
||||||
|
|
||||||
|
msgctxt "field:lims.project.mpi_professional,project:"
|
||||||
|
msgid "Implementation project"
|
||||||
|
msgstr "Proyecto implementación"
|
||||||
|
|
||||||
msgctxt "field:lims.project.solvent_reagent,purchase_date:"
|
msgctxt "field:lims.project.solvent_reagent,purchase_date:"
|
||||||
msgid "Purchase date"
|
msgid "Purchase date"
|
||||||
msgstr "Fecha de compra"
|
msgstr "Fecha de compra"
|
||||||
|
@ -38,6 +54,10 @@ msgctxt "model:ir.action,name:report_implementation"
|
||||||
msgid "Implementation Projects"
|
msgid "Implementation Projects"
|
||||||
msgstr "Proyectos Implementación"
|
msgstr "Proyectos Implementación"
|
||||||
|
|
||||||
|
msgctxt "model:lims.project.mpi_professional,name:"
|
||||||
|
msgid "Project Professional"
|
||||||
|
msgstr "Profesional de proyecto"
|
||||||
|
|
||||||
msgctxt "report:lims.project.implementation_report:"
|
msgctxt "report:lims.project.implementation_report:"
|
||||||
msgid "("
|
msgid "("
|
||||||
msgstr "("
|
msgstr "("
|
||||||
|
@ -233,6 +253,10 @@ msgctxt "view:lims.project:"
|
||||||
msgid "General"
|
msgid "General"
|
||||||
msgstr "General"
|
msgstr "General"
|
||||||
|
|
||||||
|
msgctxt "view:lims.project:"
|
||||||
|
msgid "Professionals"
|
||||||
|
msgstr "Profesionales"
|
||||||
|
|
||||||
msgctxt "view:lims.project:"
|
msgctxt "view:lims.project:"
|
||||||
msgid "Samples"
|
msgid "Samples"
|
||||||
msgstr "Muestras"
|
msgstr "Muestras"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# The COPYRIGHT file at the top level of this repository contains
|
# The COPYRIGHT file at the top level of this repository contains
|
||||||
# the full copyright notices and license terms.
|
# the full copyright notices and license terms.
|
||||||
|
|
||||||
from trytond.model import fields
|
from trytond.model import ModelSQL, ModelView, fields
|
||||||
from trytond.report import Report
|
from trytond.report import Report
|
||||||
from trytond.pool import PoolMeta, Pool
|
from trytond.pool import PoolMeta, Pool
|
||||||
from trytond.pyson import Eval, Equal, Bool, Not
|
from trytond.pyson import Eval, Equal, Bool, Not
|
||||||
|
@ -23,6 +23,8 @@ class Project(metaclass=PoolMeta):
|
||||||
mpi_methods = fields.Function(fields.Text('Methods'), 'get_mpi_methods')
|
mpi_methods = fields.Function(fields.Text('Methods'), 'get_mpi_methods')
|
||||||
mpi_laboratory_date = fields.Date(
|
mpi_laboratory_date = fields.Date(
|
||||||
'Date of delivery of report and procedure to the laboratory',)
|
'Date of delivery of report and procedure to the laboratory',)
|
||||||
|
mpi_professionals = fields.One2Many(
|
||||||
|
'lims.project.mpi_professional', 'project', 'Professionals')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
|
@ -30,6 +32,9 @@ class Project(metaclass=PoolMeta):
|
||||||
project_type = ('implementation', 'Implementation')
|
project_type = ('implementation', 'Implementation')
|
||||||
if project_type not in cls.type.selection:
|
if project_type not in cls.type.selection:
|
||||||
cls.type.selection.append(project_type)
|
cls.type.selection.append(project_type)
|
||||||
|
cls.external_quality_control.states['invisible'] = Bool(
|
||||||
|
Equal(Eval('type'), 'implementation'))
|
||||||
|
cls.external_quality_control.depends = ['type']
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def view_attributes(cls):
|
def view_attributes(cls):
|
||||||
|
@ -74,11 +79,36 @@ class Project(metaclass=PoolMeta):
|
||||||
return '\n'.join(s.method.name for s in services if s.method)
|
return '\n'.join(s.method.name for s in services if s.method)
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectProfessional(ModelSQL, ModelView):
|
||||||
|
'Project Professional'
|
||||||
|
__name__ = 'lims.project.mpi_professional'
|
||||||
|
|
||||||
|
project = fields.Many2One('lims.project', 'Implementation project',
|
||||||
|
ondelete='CASCADE', select=True, required=True)
|
||||||
|
employee = fields.Many2One('company.employee', 'Employee', required=True)
|
||||||
|
position = fields.Many2One('lims.project.stp_professional.position',
|
||||||
|
'Position')
|
||||||
|
|
||||||
|
|
||||||
class ProjectSolventAndReagent(metaclass=PoolMeta):
|
class ProjectSolventAndReagent(metaclass=PoolMeta):
|
||||||
__name__ = 'lims.project.solvent_reagent'
|
__name__ = 'lims.project.solvent_reagent'
|
||||||
|
|
||||||
purchase_date = fields.Date('Purchase date')
|
purchase_date = fields.Date('Purchase date')
|
||||||
|
|
||||||
|
@fields.depends('lot')
|
||||||
|
def on_change_lot(self, name=None):
|
||||||
|
pool = Pool()
|
||||||
|
Move = pool.get('stock.move')
|
||||||
|
|
||||||
|
if not self.lot:
|
||||||
|
return
|
||||||
|
purchases = Move.search([
|
||||||
|
('lot', '=', self.lot),
|
||||||
|
('from_location.type', '=', 'supplier'),
|
||||||
|
], order=[('effective_date', 'ASC')], limit=1)
|
||||||
|
if purchases:
|
||||||
|
self.purchase_date = purchases[0].effective_date
|
||||||
|
|
||||||
|
|
||||||
class Entry(metaclass=PoolMeta):
|
class Entry(metaclass=PoolMeta):
|
||||||
__name__ = 'lims.entry'
|
__name__ = 'lims.entry'
|
||||||
|
@ -118,9 +148,9 @@ class ImplementationsReport(Report):
|
||||||
__name__ = 'lims.project.implementation_report'
|
__name__ = 'lims.project.implementation_report'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_context(cls, records, data):
|
def get_context(cls, records, header, data):
|
||||||
records = [r for r in records if r.type == 'implementation']
|
records = [r for r in records if r.type == 'implementation']
|
||||||
report_context = super().get_context(records, data)
|
report_context = super().get_context(records, header, data)
|
||||||
report_context['company'] = report_context['user'].company
|
report_context['company'] = report_context['user'].company
|
||||||
report_context['records'] = records
|
report_context['records'] = records
|
||||||
return report_context
|
return report_context
|
||||||
|
|
|
@ -10,6 +10,19 @@
|
||||||
<field name="name">project_form</field>
|
<field name="name">project_form</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- Project Professional-->
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="lims_project_mpi_professional_view_form">
|
||||||
|
<field name="model">lims.project.mpi_professional</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="name">project_mpi_professional_form</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="lims_project_mpi_professional_view_list">
|
||||||
|
<field name="model">lims.project.mpi_professional</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="name">project_mpi_professional_list</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<!-- Solvent and Reagent-->
|
<!-- Solvent and Reagent-->
|
||||||
|
|
||||||
<record model="ir.ui.view" id="lims_project_solvent_reagent_view_form">
|
<record model="ir.ui.view" id="lims_project_solvent_reagent_view_form">
|
||||||
|
|
|
@ -25,6 +25,9 @@
|
||||||
<field name="mpi_laboratory_date"/>
|
<field name="mpi_laboratory_date"/>
|
||||||
</group>
|
</group>
|
||||||
</page>
|
</page>
|
||||||
|
<page string="Professionals" id="mpi_professionals">
|
||||||
|
<field name="mpi_professionals" colspan="4"/>
|
||||||
|
</page>
|
||||||
<page string="Samples" id="samples">
|
<page string="Samples" id="samples">
|
||||||
<field name="stp_samples" colspan="4" mode="tree,form"
|
<field name="stp_samples" colspan="4" mode="tree,form"
|
||||||
view_ids="lims_project_study_plan.lims_sample_view_list,lims_project_study_plan.lims_sample_view_form"/>
|
view_ids="lims_project_study_plan.lims_sample_view_list,lims_project_study_plan.lims_sample_view_form"/>
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<form>
|
||||||
|
<label name="employee"/>
|
||||||
|
<field name="employee" colspan="3"/>
|
||||||
|
<label name="position"/>
|
||||||
|
<field name="position"/>
|
||||||
|
</form>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<tree>
|
||||||
|
<field name="employee"/>
|
||||||
|
<field name="position"/>
|
||||||
|
</tree>
|
|
@ -723,7 +723,7 @@ msgstr "Registro de cambios en proyecto"
|
||||||
|
|
||||||
msgctxt "model:lims.project.stp_professional,name:"
|
msgctxt "model:lims.project.stp_professional,name:"
|
||||||
msgid "Project Professional"
|
msgid "Project Professional"
|
||||||
msgstr "Profesional de laboratorio"
|
msgstr "Profesional de proyecto"
|
||||||
|
|
||||||
msgctxt "model:lims.project.stp_professional.position,name:"
|
msgctxt "model:lims.project.stp_professional.position,name:"
|
||||||
msgid "Professional Position"
|
msgid "Professional Position"
|
||||||
|
|
Loading…
Reference in New Issue