<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import wizard
#import netsvc
#import ir
import pooler

retrieve_form = '''<?xml version="1.0"?>
<form string="Recuperar CP">
	<label string="¿Desea recuperar los datos de ubicación existentes antes de instalar el módulo city?." colspan="4" align="0.0"/>
</form>'''

retrieve_done = '''<?xml version="1.0"?>
<form string="Datos recuperados">
	<separator string="Resultado:" colspan="4"/>
	<label string="La recuperación de datos de ubicación a concluido." colspan="4" align="0.0"/>
</form>'''

class city_recuperar_cpostal(wizard.interface):
	def _recuperar_cpostal(self, cr, uid, data, context):
		cr.execute("select id, zip from res_partner_address where location IS NULL")
		zipcodes = cr.dictfetchall()
		for zipcode in zipcodes:
			if zipcode['zip']:
				cr.execute("select id from city_city where zipcode = %s" %zipcode['zip'])
				city_id = cr.fetchall()
				if len(city_id) > 0:
					print "city_id y zip", str(city_id[0][0]), str(zipcode['id'])
					cr.execute("update res_partner_address SET location = %i WHERE id = %i" %(city_id[0][0], zipcode['id']))
		return {}

	states = {
        'init' : {
            'actions' : [],
            'result' : {'type' : 'form',
                    'arch' : retrieve_form,
                    'fields' : {},
                    'state' : [('end', 'Cancel'),('retrieve', 'Aceptar', 'gtk-ok') ]}
        },
		'retrieve': {
			'actions': [_recuperar_cpostal],
			'result': {
				'type':'form',
				'arch':retrieve_done,
				'fields': {},
				'state':[('end', 'Aceptar', 'gtk-ok'),]
			}<commit_msg>Se borra un 'print' en el módulo city<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import wizard
#import netsvc
#import ir
import pooler

retrieve_form = '''<?xml version="1.0"?>
<form string="Recuperar CP">
	<label string="¿Desea recuperar los datos de ubicación existentes antes de instalar el módulo city?." colspan="4" align="0.0"/>
</form>'''

retrieve_done = '''<?xml version="1.0"?>
<form string="Datos recuperados">
	<separator string="Resultado:" colspan="4"/>
	<label string="La recuperación de datos de ubicación a concluido." colspan="4" align="0.0"/>
</form>'''

class city_recuperar_cpostal(wizard.interface):
	def _recuperar_cpostal(self, cr, uid, data, context):
		cr.execute("select id, zip from res_partner_address where location IS NULL")
		zipcodes = cr.dictfetchall()
		for zipcode in zipcodes:
			if zipcode['zip']:
				cr.execute("select id from city_city where zipcode = %s" %zipcode['zip'])
				city_id = cr.fetchall()
				if len(city_id) > 0:
					cr.execute("update res_partner_address SET location = %i WHERE id = %i" %(city_id[0][0], zipcode['id']))
		return {}

	states = {
        'init' : {
            'actions' : [],
            'result' : {'type' : 'form',
                    'arch' : retrieve_form,
                    'fields' : {},
                    'state' : [('end', 'Cancel'),('retrieve', 'Aceptar', 'gtk-ok') ]}
        },
		'retrieve': {
			'actions': [_recuperar_cpostal],
			'result': {
				'type':'form',
				'arch':retrieve_done,
				'fields': {},
				'state':[('end', 'Aceptar', 'gtk-ok'),]
			}
{'fraction_non_alphanumeric': 0.18388625592417063, 'fraction_numerical': 0.010110584518167456, 'mean_word_length': 3.403337969401947, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 4, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '397376', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1109, 'n_words': 271}