mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[ADD] Gender control and partner link in police generator error
This commit is contained in:
@@ -37,6 +37,7 @@ class PoliceWizard(models.TransientModel):
|
|||||||
txt_binary = fields.Binary()
|
txt_binary = fields.Binary()
|
||||||
txt_message = fields.Char()
|
txt_message = fields.Char()
|
||||||
log_police = fields.Char()
|
log_police = fields.Char()
|
||||||
|
error_partner = fields.Many2one('res.partner')
|
||||||
|
|
||||||
@api.one
|
@api.one
|
||||||
def generate_file(self):
|
def generate_file(self):
|
||||||
@@ -56,6 +57,7 @@ class PoliceWizard(models.TransientModel):
|
|||||||
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.gender is not False)
|
||||||
and (line.partner_id.lastname is not False)):
|
and (line.partner_id.lastname is not False)):
|
||||||
|
|
||||||
log_police += 1
|
log_police += 1
|
||||||
@@ -101,11 +103,13 @@ class PoliceWizard(models.TransientModel):
|
|||||||
content += """
|
content += """
|
||||||
"""
|
"""
|
||||||
else:
|
else:
|
||||||
|
self.error_partner = line.partner_id
|
||||||
|
|
||||||
return self.write({
|
return self.write({
|
||||||
|
'error_partner': line.partner_id.id,
|
||||||
'txt_message': _('Problem generating the file. \
|
'txt_message': _('Problem generating the file. \
|
||||||
Checkin without data, \
|
Checkin without data, \
|
||||||
or incorrect data: - ' +
|
or incorrect data: ')})
|
||||||
line.partner_id.name)})
|
|
||||||
log_police = str(log_police) + _(' records added from ')
|
log_police = str(log_police) + _(' records added from ')
|
||||||
log_police += str(len(lines)) + _(' records processed.')
|
log_police += str(len(lines)) + _(' records processed.')
|
||||||
return self.write({
|
return self.write({
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<group colspan="1">
|
<group colspan="1">
|
||||||
<div>
|
<div>
|
||||||
<p><field name="log_police" readonly="1"/></p>
|
<p><field name="log_police" readonly="1"/></p>
|
||||||
<p><field name="txt_message" readonly="1"/></p>
|
<p><field name="txt_message" readonly="1"/><strong><field name="error_partner" readonly="1"/></strong></p>
|
||||||
</div>
|
</div>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
|
|||||||
Reference in New Issue
Block a user