-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] handling tags and readers, updare access register
- Loading branch information
Showing
22 changed files
with
236 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
controllo_accessi_inrim_app/models/ca_anag_registro_accesso.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import pytz | ||
from odoo import models, fields | ||
|
||
_tzs = [(tz, tz) for tz in sorted(pytz.all_timezones, | ||
key=lambda tz: tz if not tz.startswith( | ||
'Etc/') else '_')] | ||
|
||
|
||
def _tz_get(self): | ||
return _tzs | ||
|
||
|
||
class CaAnagRegistroAccesso(models.Model): | ||
_inherit = 'ca.anag_registro_accesso' | ||
|
||
codice_lettore_grum = fields.Integer( | ||
string='Codice Lettore GRUM', | ||
) | ||
work_id_number = fiels.Char(string='ID Number') | ||
state = fields.Selection([ | ||
('to_sync', 'To Sync'), | ||
('sync_done', 'Sync Done'), | ||
('sync_error', 'Sync Error'), | ||
], string="Sync State", readonly=True) | ||
|
||
def aggiungi_riga_accesso( | ||
self, ca_punto_accesso_id, | ||
ca_tag_persona_id, datetime_event, type='manual', access_allowed=True, | ||
tz="" | ||
): | ||
res = super().aggiungi_riga_accesso( | ||
ca_punto_accesso_id, ca_tag_persona_id, datetime_event, type=type, | ||
access_allowed=access_allowed, tz=tz) | ||
todo = {} | ||
if res and ca_punto_accesso_id.typology == 'stamping' and res.access_allowed: | ||
todo['codice_lettore_grum'] = ca_punto_accesso_id.codice_lettore_grum | ||
winfo = ca_tag_persona_id.ca_persona_id.get_current_winfo() | ||
if winfo.ca_work_info_type_id.structured: | ||
todo['work_id_number'] = winfo.work_id_number | ||
todo['state'] = 'to_sync' | ||
res.write(todo) | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
controllo_accessi_inrim_app/views/ca_registro_accesso_views.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="ca_anag_registro_accesso_view_tree_inherit" model="ir.ui.view"> | ||
<field name="name">ca.registro_accesso.view.tree.inherit</field> | ||
<field name="model">ca.anag_registro_accesso</field> | ||
<field name="inherit_id" | ||
ref="inrim_controllo_accessi.ca_anag_registro_accesso_view_tree"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='ca_punto_accesso_id']" | ||
position="after"> | ||
<field name="codice_lettore_grum"/> | ||
</xpath> | ||
<xpath expr="//field[@name='person_display_name']" | ||
position="after"> | ||
<field name="work_id_number"/> | ||
</xpath> | ||
<xpath expr="//field[@name='system_error']" | ||
position="after"> | ||
<field name="state"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.