[ADD] Gender control and partner link in police generator error

This commit is contained in:
Jose Luis
2019-03-22 19:14:25 +01:00
parent 69b8a2733d
commit b9c1159b37
2 changed files with 7 additions and 3 deletions

View File

@@ -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({

View File

@@ -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>