Skip to content

Commit

Permalink
[FIX] inrim anagrafiche
Browse files Browse the repository at this point in the history
  • Loading branch information
archetipo committed Dec 9, 2024
1 parent 49c6526 commit 592d41d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
2 changes: 2 additions & 0 deletions inrim_anagrafiche/models/ca_work_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ def _check_date(self):
def check_update_state(self):
now = fields.Date.today()
self.ensure_one()
if not self.date_start or not self.date_end:
return
if self.date_start <= now <= self.date_end:
self.state = 'active'
elif self.date_start > now:
Expand Down
19 changes: 17 additions & 2 deletions inrim_controllo_accessi/data/ir.cron.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,25 @@
<data noupdate="1">

<record id="ir_cron_check_reader_person_validity" model="ir.cron">
<field name="name">INRIM: Check Reader Person Validity</field>
<field name="name">INRIM: Check Reader Person Validity</field>
<field name="model_id" ref="model_ca_lettore_persona"/>
<field name="type">ir.action.server</field>
<field name="code">model._cron_check_validity_person_reader()</field>
<field name="code">model._cron_check_validity_person_reader()
</field>
<field name="interval_type">minutes</field>
<field name="interval_number">10</field>
<field name="numbercall">-1</field>
<field name="priority">5</field>
<field name="doall">False</field>
<field name="active">True</field>
</record>


<record id="ir_cron_check_tag_reader_validity" model="ir.cron">
<field name="name">INRIM: Check Tag Reader Validity</field>
<field name="model_id" ref="model_ca_tag_lettore"/>
<field name="type">ir.action.server</field>
<field name="code">model._cron_check_validity_tag_reader()</field>
<field name="interval_type">minutes</field>
<field name="interval_number">10</field>
<field name="numbercall">-1</field>
Expand Down
2 changes: 2 additions & 0 deletions inrim_controllo_accessi/models/ca_punto_accesso.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ class CaPuntoAccesso(models.Model):
tz = fields.Selection(
related='ente_azienda_id.tz', store=True, string="Timezone", readonly=True)

##TODO add cron to check and detach local_access tags if expired

@api.constrains('date_start', 'date_end')
def _check_date(self):
for record in self:
Expand Down
2 changes: 1 addition & 1 deletion inrim_controllo_accessi/models/ca_tag_lettore.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def check_update_by_date_valididty(self):
if tag_reader:
tag_reader.check_update_state()

def _cron_check_validity_winfo(self):
def _cron_check_validity_tag_reader(self):
self.check_update_by_date_valididty()

@api.depends('ca_lettore_id', 'ca_tag_id')
Expand Down

0 comments on commit 592d41d

Please sign in to comment.