mirror of
https://github.com/Kalenis/kalenislims.git
synced 2023-12-14 07:13:04 +01:00
lims: planification: avoid multiple execution of confirmation wizard
This commit is contained in:
parent
79b0a0be2f
commit
b5841364bd
3 changed files with 25 additions and 0 deletions
|
@ -3901,6 +3901,10 @@ msgctxt "field:lims.planification,waiting_process:"
|
|||
msgid "Waiting process"
|
||||
msgstr "Esperando procesamiento"
|
||||
|
||||
msgctxt "field:lims.planification,wizard_executed:"
|
||||
msgid "Wizard executed"
|
||||
msgstr "Asistente ejecutado"
|
||||
|
||||
msgctxt "field:lims.planification-analysis,analysis:"
|
||||
msgid "Analysis"
|
||||
msgstr "Análisis"
|
||||
|
@ -8194,6 +8198,10 @@ msgctxt "model:ir.message,text:msg_waiting_process"
|
|||
msgid "Planification \"%(planification)s\" is still waiting for processing"
|
||||
msgstr "La planificación «%(planification)s» aún está en procesamiento"
|
||||
|
||||
msgctxt "model:ir.message,text:msg_wizard_executed"
|
||||
msgid "Wizard already executed. Please wait."
|
||||
msgstr "Asistente ya ejecutado. Espere por favor."
|
||||
|
||||
msgctxt "model:ir.message,text:msg_workyear_overlaps"
|
||||
msgid "Work year \"%(first)s\" and \"%(second)s\" overlap."
|
||||
msgstr "Los años laborales «%(first)s» y «%(second)s» se superponen"
|
||||
|
|
|
@ -193,6 +193,9 @@
|
|||
<record model="ir.message" id="msg_invoice_address">
|
||||
<field name="text">There is already a address with invoice type</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_wizard_executed">
|
||||
<field name="text">Wizard already executed. Please wait.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_not_start_date">
|
||||
<field name="text">The planification must have a start date</field>
|
||||
</record>
|
||||
|
|
|
@ -63,6 +63,7 @@ class Planification(Workflow, ModelSQL, ModelView):
|
|||
('not_executed', 'Not executed'),
|
||||
], 'State', required=True, readonly=True)
|
||||
waiting_process = fields.Boolean('Waiting process')
|
||||
wizard_executed = fields.Boolean('Wizard executed')
|
||||
method_domain = fields.Function(fields.One2Many('lims.lab.method',
|
||||
None, 'Method domain'),
|
||||
'on_change_with_method_domain', setter='set_method_domain')
|
||||
|
@ -142,6 +143,10 @@ class Planification(Workflow, ModelSQL, ModelView):
|
|||
def default_waiting_process():
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def default_wizard_executed():
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def default_date():
|
||||
Date = Pool().get('ir.date')
|
||||
|
@ -271,9 +276,16 @@ class Planification(Workflow, ModelSQL, ModelView):
|
|||
@ModelView.button_action('lims.wiz_lims_technicians_qualification')
|
||||
def confirm(cls, planifications):
|
||||
for planification in planifications:
|
||||
planification.check_wizard_executed()
|
||||
planification.check_start_date()
|
||||
planification.check_technicians()
|
||||
|
||||
def check_wizard_executed(self):
|
||||
if self.wizard_executed:
|
||||
raise UserError(gettext('lims.msg_wizard_executed'))
|
||||
self.wizard_executed = True
|
||||
self.save()
|
||||
|
||||
def check_start_date(self):
|
||||
if not self.start_date:
|
||||
raise UserError(gettext('lims.msg_not_start_date'))
|
||||
|
@ -4924,6 +4936,8 @@ class TechniciansQualification(Wizard):
|
|||
'lims.planification.qualification.situation')
|
||||
|
||||
planification = Planification(Transaction().context['active_id'])
|
||||
planification.wizard_executed = False
|
||||
planification.save()
|
||||
|
||||
planification_details = PlanificationServiceDetail.search([
|
||||
('planification', '=', planification.id),
|
||||
|
|
Loading…
Reference in a new issue