mirror of
https://github.com/Kalenis/kalenislims.git
synced 2023-12-14 07:13:04 +01:00
lims_project_study_plan: fix Professional domain in Deviations/Amendments
This commit is contained in:
parent
37d8817216
commit
20e2db1bd1
2 changed files with 33 additions and 39 deletions
|
@ -76,10 +76,6 @@ msgctxt "field:lims.lab.workyear,project_study_plan_sequence:"
|
||||||
msgid "Study plan Projects Sequence"
|
msgid "Study plan Projects Sequence"
|
||||||
msgstr "Secuencia de Proyectos Plan de estudio"
|
msgstr "Secuencia de Proyectos Plan de estudio"
|
||||||
|
|
||||||
msgctxt "field:lims.project,dev_amnd_prof_domain:"
|
|
||||||
msgid "Professional domain"
|
|
||||||
msgstr "Dominio para Profesional"
|
|
||||||
|
|
||||||
msgctxt "field:lims.project,min_qty_sample:"
|
msgctxt "field:lims.project,min_qty_sample:"
|
||||||
msgid "Minimum quantity of sample"
|
msgid "Minimum quantity of sample"
|
||||||
msgstr "Cantidad mínima de muestra"
|
msgstr "Cantidad mínima de muestra"
|
||||||
|
@ -252,6 +248,10 @@ msgctxt "field:lims.project.deviation_amendment,description:"
|
||||||
msgid "Description"
|
msgid "Description"
|
||||||
msgstr "Descripción"
|
msgstr "Descripción"
|
||||||
|
|
||||||
|
msgctxt "field:lims.project.deviation_amendment,dev_amnd_prof_domain:"
|
||||||
|
msgid "Professional domain"
|
||||||
|
msgstr "Dominio para Profesional"
|
||||||
|
|
||||||
msgctxt "field:lims.project.deviation_amendment,document_type:"
|
msgctxt "field:lims.project.deviation_amendment,document_type:"
|
||||||
msgid "Document Type"
|
msgid "Document Type"
|
||||||
msgstr "Tipo de documento"
|
msgstr "Tipo de documento"
|
||||||
|
|
|
@ -116,13 +116,7 @@ class Project(metaclass=PoolMeta):
|
||||||
'project', 'Samples in custody', states=STATES, depends=DEPENDS)
|
'project', 'Samples in custody', states=STATES, depends=DEPENDS)
|
||||||
stp_deviation_and_amendment = fields.One2Many(
|
stp_deviation_and_amendment = fields.One2Many(
|
||||||
'lims.project.deviation_amendment', 'project',
|
'lims.project.deviation_amendment', 'project',
|
||||||
'Deviations and Amendments', context={
|
'Deviations and Amendments', states=STATES, depends=DEPENDS)
|
||||||
'dev_amnd_prof_domain': Eval('dev_amnd_prof_domain'),
|
|
||||||
},
|
|
||||||
states=STATES, depends=['dev_amnd_prof_domain', 'stp_state'])
|
|
||||||
dev_amnd_prof_domain = fields.Function(fields.Many2Many(
|
|
||||||
'lims.laboratory.professional', None, None, 'Professional domain'),
|
|
||||||
'on_change_with_dev_amnd_prof_domain')
|
|
||||||
stp_state = fields.Selection([
|
stp_state = fields.Selection([
|
||||||
('', ''),
|
('', ''),
|
||||||
('canceled', 'Canceled'),
|
('canceled', 'Canceled'),
|
||||||
|
@ -358,14 +352,6 @@ class Project(metaclass=PoolMeta):
|
||||||
return pp.professional.id
|
return pp.professional.id
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@fields.depends('stp_laboratory_professionals')
|
|
||||||
def on_change_with_dev_amnd_prof_domain(self, name=None):
|
|
||||||
professionals = []
|
|
||||||
if self.stp_laboratory_professionals:
|
|
||||||
professionals = [pp.professional.id for pp in
|
|
||||||
self.stp_laboratory_professionals if pp.professional]
|
|
||||||
return professionals
|
|
||||||
|
|
||||||
def get_stp_samples(self, name=None):
|
def get_stp_samples(self, name=None):
|
||||||
Sample = Pool().get('lims.sample')
|
Sample = Pool().get('lims.sample')
|
||||||
samples = Sample.search([
|
samples = Sample.search([
|
||||||
|
@ -691,9 +677,12 @@ class ProjectDeviationAndAmendment(ModelSQL, ModelView):
|
||||||
professionals = fields.One2Many(
|
professionals = fields.One2Many(
|
||||||
'lims.project.deviation_amendment.professional',
|
'lims.project.deviation_amendment.professional',
|
||||||
'deviation_amendment', 'Staff involved', context={
|
'deviation_amendment', 'Staff involved', context={
|
||||||
'dev_amnd_prof_domain': Eval('context', {}).get(
|
'dev_amnd_prof_domain': Eval('dev_amnd_prof_domain'),
|
||||||
'dev_amnd_prof_domain', []),
|
},
|
||||||
})
|
depends=['dev_amnd_prof_domain'])
|
||||||
|
dev_amnd_prof_domain = fields.Function(fields.Many2Many(
|
||||||
|
'lims.laboratory.professional', None, None, 'Professional domain'),
|
||||||
|
'on_change_with_dev_amnd_prof_domain')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
|
@ -724,6 +713,14 @@ class ProjectDeviationAndAmendment(ModelSQL, ModelView):
|
||||||
number += count
|
number += count
|
||||||
return str(number)
|
return str(number)
|
||||||
|
|
||||||
|
@fields.depends('_parent_project.stp_laboratory_professionals')
|
||||||
|
def on_change_with_dev_amnd_prof_domain(self, name=None):
|
||||||
|
professionals = []
|
||||||
|
if self.project.stp_laboratory_professionals:
|
||||||
|
professionals = [pp.professional.id for pp in
|
||||||
|
self.project.stp_laboratory_professionals if pp.professional]
|
||||||
|
return professionals
|
||||||
|
|
||||||
|
|
||||||
class ProjectDeviationAndAmendmentProfessional(ModelSQL, ModelView):
|
class ProjectDeviationAndAmendmentProfessional(ModelSQL, ModelView):
|
||||||
'Deviation/Amendment Professional'
|
'Deviation/Amendment Professional'
|
||||||
|
@ -887,8 +884,8 @@ class CreateSample(metaclass=PoolMeta):
|
||||||
sample_weight = (hasattr(self.start, 'sample_weight') and
|
sample_weight = (hasattr(self.start, 'sample_weight') and
|
||||||
getattr(self.start, 'sample_weight') or None)
|
getattr(self.start, 'sample_weight') or None)
|
||||||
balance_id = None
|
balance_id = None
|
||||||
if (hasattr(self.start, 'balance')
|
if (hasattr(self.start, 'balance') and
|
||||||
and getattr(self.start, 'balance')):
|
getattr(self.start, 'balance')):
|
||||||
balance_id = getattr(self.start, 'balance').id
|
balance_id = getattr(self.start, 'balance').id
|
||||||
cultivation_zone = (hasattr(self.start, 'cultivation_zone') and
|
cultivation_zone = (hasattr(self.start, 'cultivation_zone') and
|
||||||
getattr(self.start, 'cultivation_zone') or None)
|
getattr(self.start, 'cultivation_zone') or None)
|
||||||
|
@ -1415,6 +1412,7 @@ class ProjectGLPReport06(Report):
|
||||||
res = position[0]
|
res = position[0]
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
class ProjectGLPReport07(Report):
|
class ProjectGLPReport07(Report):
|
||||||
'Table 1- Study plan'
|
'Table 1- Study plan'
|
||||||
__name__ = 'lims.project.glp_report.07'
|
__name__ = 'lims.project.glp_report.07'
|
||||||
|
@ -1687,8 +1685,8 @@ class ProjectGLPReport10Print(Wizard):
|
||||||
'date_from': self.start.date_from,
|
'date_from': self.start.date_from,
|
||||||
'date_to': self.start.date_to,
|
'date_to': self.start.date_to,
|
||||||
'stp_state': self.start.stp_state,
|
'stp_state': self.start.stp_state,
|
||||||
'professional': (self.start.professional
|
'professional': (self.start.professional and
|
||||||
and self.start.professional.id or None),
|
self.start.professional.id or None),
|
||||||
}
|
}
|
||||||
return action, data
|
return action, data
|
||||||
|
|
||||||
|
@ -1832,6 +1830,7 @@ class ProjectGLPReport10(Report):
|
||||||
res = position[0]
|
res = position[0]
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
class ProjectGLPReport11(Report):
|
class ProjectGLPReport11(Report):
|
||||||
'Reference/Test elements (FOR)'
|
'Reference/Test elements (FOR)'
|
||||||
__name__ = 'lims.project.glp_report.11'
|
__name__ = 'lims.project.glp_report.11'
|
||||||
|
@ -2030,10 +2029,8 @@ class ProjectGLPReportStudyPlan(Report):
|
||||||
report_context['stp_proposal_start_date'] = (
|
report_context['stp_proposal_start_date'] = (
|
||||||
project.stp_proposal_start_date)
|
project.stp_proposal_start_date)
|
||||||
report_context['stp_proposal_end_date'] = project.stp_proposal_end_date
|
report_context['stp_proposal_end_date'] = project.stp_proposal_end_date
|
||||||
report_context['stp_test_method'] = str(project.stp_test_method
|
report_context['stp_test_method'] = str(project.stp_test_method or '')
|
||||||
or '')
|
report_context['stp_test_system'] = str(project.stp_test_system or '')
|
||||||
report_context['stp_test_system'] = str(project.stp_test_system
|
|
||||||
or '')
|
|
||||||
report_context['stp_study_director'] = None
|
report_context['stp_study_director'] = None
|
||||||
report_context['stp_study_director_date'] = None
|
report_context['stp_study_director_date'] = None
|
||||||
report_context['stp_quality_unit'] = None
|
report_context['stp_quality_unit'] = None
|
||||||
|
@ -2145,8 +2142,7 @@ class ProjectGLPReportFinalRP(Report):
|
||||||
cls.get_experimental_end_date(project.id))
|
cls.get_experimental_end_date(project.id))
|
||||||
report_context['stp_lims_sample_input'] = (
|
report_context['stp_lims_sample_input'] = (
|
||||||
cls.get_lims_sample_input(project.id))
|
cls.get_lims_sample_input(project.id))
|
||||||
report_context['stp_test_method'] = str(project.stp_test_method
|
report_context['stp_test_method'] = str(project.stp_test_method or '')
|
||||||
or '')
|
|
||||||
report_context['stp_solvents_and_reagents'] = (
|
report_context['stp_solvents_and_reagents'] = (
|
||||||
project.stp_solvents_and_reagents)
|
project.stp_solvents_and_reagents)
|
||||||
report_context['stp_results_reports_list'] = ', '.join([
|
report_context['stp_results_reports_list'] = ', '.join([
|
||||||
|
@ -2395,8 +2391,7 @@ class ProjectGLPReportFinalFOR(Report):
|
||||||
cls.get_lims_sample_input(project.id))
|
cls.get_lims_sample_input(project.id))
|
||||||
report_context['stp_all_professionals'] = (
|
report_context['stp_all_professionals'] = (
|
||||||
cls.get_laboratory_professionals(project.id))
|
cls.get_laboratory_professionals(project.id))
|
||||||
report_context['stp_test_method'] = str(project.stp_test_method
|
report_context['stp_test_method'] = str(project.stp_test_method or '')
|
||||||
or '')
|
|
||||||
report_context['stp_reference_elements'] = [e for e in
|
report_context['stp_reference_elements'] = [e for e in
|
||||||
project.stp_reference_elements if e.type == 'reference']
|
project.stp_reference_elements if e.type == 'reference']
|
||||||
report_context['stp_solvents_and_reagents'] = (
|
report_context['stp_solvents_and_reagents'] = (
|
||||||
|
@ -2635,8 +2630,7 @@ class ProjectGLPReportAnalyticalPhase(Report):
|
||||||
cls.get_lims_sample_input(project.id))
|
cls.get_lims_sample_input(project.id))
|
||||||
report_context['stp_all_professionals'] = (
|
report_context['stp_all_professionals'] = (
|
||||||
cls.get_laboratory_professionals(project.id))
|
cls.get_laboratory_professionals(project.id))
|
||||||
report_context['stp_test_method'] = str(project.stp_test_method
|
report_context['stp_test_method'] = str(project.stp_test_method or '')
|
||||||
or '')
|
|
||||||
report_context['stp_solvents_and_reagents'] = (
|
report_context['stp_solvents_and_reagents'] = (
|
||||||
project.stp_solvents_and_reagents)
|
project.stp_solvents_and_reagents)
|
||||||
report_context['stp_results_reports_list'] = ', '.join([
|
report_context['stp_results_reports_list'] = ', '.join([
|
||||||
|
|
Loading…
Reference in a new issue