Skip to content

Instantly share code, notes, and snippets.

@foxcarlos
Created November 11, 2020 15:59
Show Gist options
  • Save foxcarlos/8ac241c5918a38a5cedfc5778b0d3a16 to your computer and use it in GitHub Desktop.
Save foxcarlos/8ac241c5918a38a5cedfc5778b0d3a16 to your computer and use it in GitHub Desktop.
fix bug
def _import_data(self):
persons = self.search([])
for record in persons:
record.l10n_latam_identification_type_id.name = 'VAT'
rp_copy = record
rp_id = record.partner_id.id if record.partner_id else ''
rp = self.env['res.partner'].search([('id', '=', rp_id)])
rp_copy.copy()
record.unlink()
rp.unlink()
persons._cr.commit()
rp._cr.commit()
{'name': 'Persona', 'lastname': 'Persona', 'identification_type': '5', 'vat': '95617657', 'birthday': '2020-11-11',
'street': 'sma', 'state_id': '567', 'city': 'sma', 'email': 'persona@gmail.com', 'mobile': '01124029458',
'sector_id': ['2', '6', '5', '3'], 'education_id': ['8'], 'twitter': '@turismoSMAndes', 'facebook': 'usuariofacebook',
'instagram': '@usuarioinstagram', 'linkedin': 'ususariolinkedin',
'intervention_ids': [' Sostenibilidad - Sostenibilidad de Paz y Justicia ', ' Tecnologías de Información y Comunicación ', ' Transporte '],
'adherence_protocol': 'on', 'adherence_version': '', 'privacy_policies': 'on', 'privacy_version': ''}
{'name': 'Persona', 'lastname': 'Persona', 'identification_type': 5, 'vat': '95660280', 'birthday': datetime.date(2020, 11, 11),
'street': 'sma', 'state_id': 567, 'city': 'sma', 'mobile': '01124029458', 'email': 'persona@gmail.com',
'sector_id': [9, 10, 11, 12], 'education_id': 8, 'twitter': '@ususariotuiter', 'facebook': 'usuariofacebook',
'instagram': '@usuarioinstagram', 'linkedin': 'ususariolinkedin', 'intervention_ids': [1, 8, 17],
'adherence_protocol': True, 'privacy_policies': True}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment