mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[ADD] Added small information log.
This commit is contained in:
committed by
Dario Lodeiros
parent
8a314bb002
commit
43fa28c864
@@ -36,6 +36,7 @@ class PoliceWizard(models.TransientModel):
|
|||||||
txt_filename = fields.Char()
|
txt_filename = fields.Char()
|
||||||
txt_binary = fields.Binary()
|
txt_binary = fields.Binary()
|
||||||
txt_message = fields.Char()
|
txt_message = fields.Char()
|
||||||
|
log_police = fields.Char()
|
||||||
|
|
||||||
@api.one
|
@api.one
|
||||||
def generate_file(self):
|
def generate_file(self):
|
||||||
@@ -50,13 +51,14 @@ class PoliceWizard(models.TransientModel):
|
|||||||
content += datetime.datetime.now().strftime("%Y%m%d|%H%M")
|
content += datetime.datetime.now().strftime("%Y%m%d|%H%M")
|
||||||
content += "|"+str(len(lines)) + """
|
content += "|"+str(len(lines)) + """
|
||||||
"""
|
"""
|
||||||
|
log_police = 0
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if ((line.partner_id.document_type is not False)
|
if ((line.partner_id.document_type is not False)
|
||||||
and (line.partner_id.document_number is not False)
|
and (line.partner_id.document_number is not False)
|
||||||
and (line.partner_id.firstname is not False)
|
and (line.partner_id.firstname is not False)
|
||||||
and (line.partner_id.lastname is not False)):
|
and (line.partner_id.lastname is not False)):
|
||||||
|
|
||||||
|
log_police += 1
|
||||||
if len(line.partner_id.code_ine_id.code) == 5:
|
if len(line.partner_id.code_ine_id.code) == 5:
|
||||||
content += "2|"+line.partner_id.document_number.upper(
|
content += "2|"+line.partner_id.document_number.upper(
|
||||||
) + "||"
|
) + "||"
|
||||||
@@ -104,8 +106,11 @@ class PoliceWizard(models.TransientModel):
|
|||||||
Checkin without data, \
|
Checkin without data, \
|
||||||
or incorrect data: - ' +
|
or incorrect data: - ' +
|
||||||
line.partner_id.name)})
|
line.partner_id.name)})
|
||||||
|
log_police = str(log_police) + _(' records added from ')
|
||||||
|
log_police += str(len(lines)) + _(' records processed.')
|
||||||
return self.write({
|
return self.write({
|
||||||
'txt_filename': company.police_number + '.' + self.download_num,
|
'txt_filename': company.police_number + '.' + self.download_num,
|
||||||
|
'log_police': log_police,
|
||||||
'txt_message': _(
|
'txt_message': _(
|
||||||
'Generated file. Download it and give it to the police.'),
|
'Generated file. Download it and give it to the police.'),
|
||||||
'txt_binary': base64.encodestring(content.encode("iso-8859-1"))
|
'txt_binary': base64.encodestring(content.encode("iso-8859-1"))
|
||||||
|
|||||||
@@ -23,9 +23,10 @@
|
|||||||
<field name="txt_filename" invisible="1"/>
|
<field name="txt_filename" invisible="1"/>
|
||||||
<field name="txt_binary" filename="txt_filename" readonly="1" style="margin-left: 20px;"/>
|
<field name="txt_binary" filename="txt_filename" readonly="1" style="margin-left: 20px;"/>
|
||||||
</div>
|
</div>
|
||||||
<group>
|
<group colspan="1">
|
||||||
<div>
|
<div>
|
||||||
<field name="txt_message" readonly="1"/>
|
<p><field name="log_police" readonly="1"/></p>
|
||||||
|
<p><field name="txt_message" readonly="1"/></p>
|
||||||
</div>
|
</div>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
|
|||||||
Reference in New Issue
Block a user