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"
|
||||
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:"
|
||||
msgid "Minimum quantity of sample"
|
||||
msgstr "Cantidad mínima de muestra"
|
||||
|
@ -252,6 +248,10 @@ msgctxt "field:lims.project.deviation_amendment,description:"
|
|||
msgid "Description"
|
||||
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:"
|
||||
msgid "Document Type"
|
||||
msgstr "Tipo de documento"
|
||||
|
|
|
@ -116,13 +116,7 @@ class Project(metaclass=PoolMeta):
|
|||
'project', 'Samples in custody', states=STATES, depends=DEPENDS)
|
||||
stp_deviation_and_amendment = fields.One2Many(
|
||||
'lims.project.deviation_amendment', 'project',
|
||||
'Deviations and Amendments', context={
|
||||
'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')
|
||||
'Deviations and Amendments', states=STATES, depends=DEPENDS)
|
||||
stp_state = fields.Selection([
|
||||
('', ''),
|
||||
('canceled', 'Canceled'),
|
||||
|
@ -358,14 +352,6 @@ class Project(metaclass=PoolMeta):
|
|||
return pp.professional.id
|
||||
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):
|
||||
Sample = Pool().get('lims.sample')
|
||||
samples = Sample.search([
|
||||
|
@ -691,9 +677,12 @@ class ProjectDeviationAndAmendment(ModelSQL, ModelView):
|
|||
professionals = fields.One2Many(
|
||||
'lims.project.deviation_amendment.professional',
|
||||
'deviation_amendment', 'Staff involved', context={
|
||||
'dev_amnd_prof_domain': Eval('context', {}).get(
|
||||
'dev_amnd_prof_domain', []),
|
||||
})
|
||||
'dev_amnd_prof_domain': Eval('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
|
||||
def __setup__(cls):
|
||||
|
@ -724,6 +713,14 @@ class ProjectDeviationAndAmendment(ModelSQL, ModelView):
|
|||
number += count
|
||||
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):
|
||||
'Deviation/Amendment Professional'
|
||||
|
@ -887,8 +884,8 @@ class CreateSample(metaclass=PoolMeta):
|
|||
sample_weight = (hasattr(self.start, 'sample_weight') and
|
||||
getattr(self.start, 'sample_weight') or None)
|
||||
balance_id = None
|
||||
if (hasattr(self.start, 'balance')
|
||||
and getattr(self.start, 'balance')):
|
||||
if (hasattr(self.start, 'balance') and
|
||||
getattr(self.start, 'balance')):
|
||||
balance_id = getattr(self.start, 'balance').id
|
||||
cultivation_zone = (hasattr(self.start, 'cultivation_zone') and
|
||||
getattr(self.start, 'cultivation_zone') or None)
|
||||
|
@ -1392,7 +1389,7 @@ class ProjectGLPReport06(Report):
|
|||
report_context['objects'] = objects
|
||||
|
||||
return report_context
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_position_professional(cls, project_id):
|
||||
cursor = Transaction().connection.cursor()
|
||||
|
@ -1415,6 +1412,7 @@ class ProjectGLPReport06(Report):
|
|||
res = position[0]
|
||||
return res
|
||||
|
||||
|
||||
class ProjectGLPReport07(Report):
|
||||
'Table 1- Study plan'
|
||||
__name__ = 'lims.project.glp_report.07'
|
||||
|
@ -1687,8 +1685,8 @@ class ProjectGLPReport10Print(Wizard):
|
|||
'date_from': self.start.date_from,
|
||||
'date_to': self.start.date_to,
|
||||
'stp_state': self.start.stp_state,
|
||||
'professional': (self.start.professional
|
||||
and self.start.professional.id or None),
|
||||
'professional': (self.start.professional and
|
||||
self.start.professional.id or None),
|
||||
}
|
||||
return action, data
|
||||
|
||||
|
@ -1731,8 +1729,8 @@ class ProjectGLPReport10(Report):
|
|||
objects = []
|
||||
for project in projects:
|
||||
if data['professional']:
|
||||
if (project.stp_study_director and
|
||||
data['professional'] == project.stp_study_director.id):
|
||||
if (project.stp_study_director and
|
||||
data['professional'] == project.stp_study_director.id):
|
||||
objects.append({
|
||||
'stp_number': project.stp_number,
|
||||
'stp_code': project.code,
|
||||
|
@ -1832,6 +1830,7 @@ class ProjectGLPReport10(Report):
|
|||
res = position[0]
|
||||
return res
|
||||
|
||||
|
||||
class ProjectGLPReport11(Report):
|
||||
'Reference/Test elements (FOR)'
|
||||
__name__ = 'lims.project.glp_report.11'
|
||||
|
@ -2030,10 +2029,8 @@ class ProjectGLPReportStudyPlan(Report):
|
|||
report_context['stp_proposal_start_date'] = (
|
||||
project.stp_proposal_start_date)
|
||||
report_context['stp_proposal_end_date'] = project.stp_proposal_end_date
|
||||
report_context['stp_test_method'] = str(project.stp_test_method
|
||||
or '')
|
||||
report_context['stp_test_system'] = str(project.stp_test_system
|
||||
or '')
|
||||
report_context['stp_test_method'] = str(project.stp_test_method or '')
|
||||
report_context['stp_test_system'] = str(project.stp_test_system or '')
|
||||
report_context['stp_study_director'] = None
|
||||
report_context['stp_study_director_date'] = None
|
||||
report_context['stp_quality_unit'] = None
|
||||
|
@ -2145,8 +2142,7 @@ class ProjectGLPReportFinalRP(Report):
|
|||
cls.get_experimental_end_date(project.id))
|
||||
report_context['stp_lims_sample_input'] = (
|
||||
cls.get_lims_sample_input(project.id))
|
||||
report_context['stp_test_method'] = str(project.stp_test_method
|
||||
or '')
|
||||
report_context['stp_test_method'] = str(project.stp_test_method or '')
|
||||
report_context['stp_solvents_and_reagents'] = (
|
||||
project.stp_solvents_and_reagents)
|
||||
report_context['stp_results_reports_list'] = ', '.join([
|
||||
|
@ -2395,8 +2391,7 @@ class ProjectGLPReportFinalFOR(Report):
|
|||
cls.get_lims_sample_input(project.id))
|
||||
report_context['stp_all_professionals'] = (
|
||||
cls.get_laboratory_professionals(project.id))
|
||||
report_context['stp_test_method'] = str(project.stp_test_method
|
||||
or '')
|
||||
report_context['stp_test_method'] = str(project.stp_test_method or '')
|
||||
report_context['stp_reference_elements'] = [e for e in
|
||||
project.stp_reference_elements if e.type == 'reference']
|
||||
report_context['stp_solvents_and_reagents'] = (
|
||||
|
@ -2635,8 +2630,7 @@ class ProjectGLPReportAnalyticalPhase(Report):
|
|||
cls.get_lims_sample_input(project.id))
|
||||
report_context['stp_all_professionals'] = (
|
||||
cls.get_laboratory_professionals(project.id))
|
||||
report_context['stp_test_method'] = str(project.stp_test_method
|
||||
or '')
|
||||
report_context['stp_test_method'] = str(project.stp_test_method or '')
|
||||
report_context['stp_solvents_and_reagents'] = (
|
||||
project.stp_solvents_and_reagents)
|
||||
report_context['stp_results_reports_list'] = ', '.join([
|
||||
|
|
Loading…
Reference in a new issue