mirror of
https://github.com/Kalenis/kalenislims.git
synced 2023-12-14 07:13:04 +01:00
lims: Planification: facilitate wizard extension
This commit is contained in:
parent
0f255509cf
commit
8abbc4d65f
|
@ -562,7 +562,8 @@ class PlanificationTechnician(ModelSQL, ModelView):
|
||||||
])
|
])
|
||||||
details = fields.Function(fields.One2Many(
|
details = fields.Function(fields.One2Many(
|
||||||
'lims.planification.technician.detail', 'technician',
|
'lims.planification.technician.detail', 'technician',
|
||||||
'Fractions to plan'), 'get_details', setter='set_details')
|
'Fractions to plan', readonly=True),
|
||||||
|
'get_details', setter='set_details')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
|
@ -1340,23 +1341,12 @@ class RelateTechnicians(Wizard):
|
||||||
return RelateTechniciansDetail3.create(to_create)
|
return RelateTechniciansDetail3.create(to_create)
|
||||||
|
|
||||||
def transition_relate(self):
|
def transition_relate(self):
|
||||||
pool = Pool()
|
PlanificationServiceDetail = Pool().get(
|
||||||
Planification = pool.get('lims.planification')
|
|
||||||
PlanificationServiceDetail = pool.get(
|
|
||||||
'lims.planification.service_detail')
|
'lims.planification.service_detail')
|
||||||
|
|
||||||
planification = Planification(Transaction().context['active_id'])
|
planification_id = Transaction().context['active_id']
|
||||||
|
details = self._get_details(planification_id)
|
||||||
if self.start.grouping == 'none':
|
if not details:
|
||||||
details = self._get_details1(planification.id,
|
|
||||||
self.start.exclude_relateds)
|
|
||||||
elif self.start.grouping == 'origin_method':
|
|
||||||
details = self._get_details2(planification.id,
|
|
||||||
self.start.exclude_relateds)
|
|
||||||
elif self.start.grouping == 'origin':
|
|
||||||
details = self._get_details3(planification.id,
|
|
||||||
self.start.exclude_relateds)
|
|
||||||
else:
|
|
||||||
return 'end'
|
return 'end'
|
||||||
|
|
||||||
PlanificationServiceDetail.write(details, {
|
PlanificationServiceDetail.write(details, {
|
||||||
|
@ -1369,6 +1359,19 @@ class RelateTechnicians(Wizard):
|
||||||
})
|
})
|
||||||
return 'end'
|
return 'end'
|
||||||
|
|
||||||
|
def _get_details(self, planification_id):
|
||||||
|
details = []
|
||||||
|
if self.start.grouping == 'none':
|
||||||
|
details = self._get_details1(planification_id,
|
||||||
|
self.start.exclude_relateds)
|
||||||
|
elif self.start.grouping == 'origin_method':
|
||||||
|
details = self._get_details2(planification_id,
|
||||||
|
self.start.exclude_relateds)
|
||||||
|
elif self.start.grouping == 'origin':
|
||||||
|
details = self._get_details3(planification_id,
|
||||||
|
self.start.exclude_relateds)
|
||||||
|
return details
|
||||||
|
|
||||||
def _get_details1(self, planification_id, exclude_relateds):
|
def _get_details1(self, planification_id, exclude_relateds):
|
||||||
cursor = Transaction().connection.cursor()
|
cursor = Transaction().connection.cursor()
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
|
|
Loading…
Reference in a new issue