-
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.
- Loading branch information
Showing
15 changed files
with
171 additions
and
43 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from . import ca_sposta_punto_accesso | ||
from . import ca_aggiungi_movimento_accesso | ||
from . import ca_registra_persona | ||
from . import ca_registra_doc_persona | ||
from . import ca_restituisci_badge |
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,36 @@ | ||
import logging | ||
|
||
from odoo import models, fields, api, _ | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class CaRegistraDocPersona(models.TransientModel): | ||
_name = 'ca.registra_doc_persona' | ||
_description = 'Registra Doc Persona' | ||
|
||
persona_id = fields.Many2one("ca.persona", readonly=True) | ||
tipo_documento_id = fields.Many2one('ca.tipo_doc_ident') | ||
validity_start_date = fields.Date() | ||
validity_end_date = fields.Date() | ||
document_code = fields.Char() | ||
issued_by = fields.Char() | ||
|
||
@api.constrains('date_start', 'date_end') | ||
def _check_date(self): | ||
for record in self: | ||
if record.date_end and record.date_start: | ||
if record.date_end <= record.date_start: | ||
raise UserError( | ||
_('Data fine deve essere maggiore della data di inizio')) | ||
|
||
def action_confirm(self): | ||
res = self.env['ca.documento'].create({ | ||
'ca_persona_id': self.persona_id.id, | ||
'tipo_documento_id': self.tipo_documento_id.id, | ||
'validity_start_date': self.validity_start_date, | ||
'validity_end_date': self.validity_end_date, | ||
'document_code': self.document_code, | ||
'issued_by': self.issued_by | ||
}) | ||
return {'type': 'ir.actions.act_window_close'} |
50 changes: 50 additions & 0 deletions
50
inrim_controllo_accessi/wizard/ca_registra_doc_persona_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,50 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="ca_registra_doc_persona_form" model="ir.ui.view"> | ||
<field name="name">ca.registra.doc.ospite.view.form</field> | ||
<field name="model">ca.registra_doc_persona</field> | ||
<field name="arch" type="xml"> | ||
<form> | ||
<sheet> | ||
<group> | ||
<group> | ||
<separator string="Persona"/> | ||
<field name="persona_id" | ||
options="{'no_create': True, 'no_quick_create': True}" | ||
readonly="1" | ||
/> | ||
<field name="tipo_documento_id" string="Tipo Doc." required="1"/> | ||
</group> | ||
</group> | ||
<separator string="Dati Documento"/> | ||
<group> | ||
<group> | ||
<field name="validity_start_date" string="Data Rilascio" required="1"/> | ||
<field name="document_code" string="Codice Doc" required="1"/> | ||
</group> | ||
<group> | ||
<field name="validity_end_date" string="Scadenza" required="1"/> | ||
<field name="issued_by" string="Rilasciato Da" required="1"/> | ||
</group> | ||
</group> | ||
|
||
</sheet> | ||
<footer> | ||
<button | ||
name="action_confirm" | ||
string="Completa" | ||
class="btn-primary" | ||
type="object" | ||
/> | ||
</footer> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
<record id="ca_registra_doc_persona_action" model="ir.actions.act_window"> | ||
<field name="name">Registra Doc Ospite</field> | ||
<field name="res_model">ca.registra_doc_persona</field> | ||
<field name="view_mode">form</field> | ||
<field name="target">new</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
Oops, something went wrong.