Skip to content

Commit

Permalink
[FIX] Registra Ospite
Browse files Browse the repository at this point in the history
  • Loading branch information
archetipo committed Nov 13, 2024
1 parent 4401af2 commit 6922c0d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions inrim_anagrafiche/views/ca_persona_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
domain="[('type_ids', 'ilike', 'esterno')]"/>
<filter name="type_ids"/>
<filter name="display_name"/>
<filter name="fiscalcode"/>
</search>
</field>
</record>
Expand Down
21 changes: 20 additions & 1 deletion inrim_controllo_accessi/wizard/ca_registra_ospite.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ def populate_person(self, rec):
self.eval_ente_azienda_id(
rec.ca_ente_azienda_ids.ids[0] if rec.ca_ente_azienda_ids else []
)
current_winfo = self.persona_id.get_current_winfo()
self.ca_work_info_type_id = current_winfo.work_info_type_id.id
self.ca_title_id = current_winfo.ca_title_id.id

def reset_person(self):
self.ensure_one()
Expand Down Expand Up @@ -135,13 +138,19 @@ def _compute_tag_id_number(self):
for record in self:
record.work_id_number = record.ca_tag_id.default_id_number

@api.onchange('persona_id')
def _compute_tag_id_number(self):
for record in self:
if record.persona_id:
self.populate_person(record.persona_id)

@api.onchange('email')
def _compute_available_email(self):
for record in self:
if not record.email:
return
persona_ids = self.env['ca.persona'].search([
('email', 'ilike', record.email)])
('email', 'ilike', record.email)], limit=1)
if len(persona_ids) == 1:
self.populate_person(persona_ids[0])
else:
Expand Down Expand Up @@ -178,6 +187,16 @@ def action_confirm(self):
"ca_ente_azienda_ids": self.ente_azienda.ids
}
)
self.env['ca.work_info'].create(
{
'ca_persona_id': self.persona_id.id,
'work_id_number': self.freshman,
'ca_work_info_type_id': self.ca_work_info_type_id.id,
'ca_title_id': self.ca_title_id.id,
'date_start':self.date_start.split(" ")[0],
'date_end':self.date_end.split(" ")[0]
}
)
else:
vals = {
"freshman": self.freshman,
Expand Down
6 changes: 3 additions & 3 deletions inrim_controllo_accessi/wizard/ca_registra_ospite_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
<field name="arch" type="xml">
<form>
<sheet>
<field name="persona_id" invisible="0"/>

<field name="ente_azienda" invisible="0"/>
<field name="ente_interno" invisible="0"/>
<group>

<group>
<field name="persona_id"/>
<separator string="Nominativo"/>
<field name="fiscalcode" class=""/>
<field name="lastname" string="Cognome"/>
<field name="name" string="Nome"/>
<field name="fiscalcode" class=""/>
<field name="freshman"/>
<field name="email"/>
<field name="mobile"/>
Expand Down

0 comments on commit 6922c0d

Please sign in to comment.