-
-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IMP] l10n_es_partner: Añadido script para actualizar info bancos #90
Changes from 1 commit
047bcc0
90cbb40
c4ed7d9
1187828
bdc7177
4d04047
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (c) 2014 Factor Libre S.L (http://www.factorlibre.com) All Rights Reserved. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ismael, puedes quitar el "All Rights Reserved". Es una denominación anticuada, sin efecto "mercantil", y que además, sobrepasa los 80 caracteres del PEP8. |
||
# Ismael Calvo <ismael.calvo@factorlibre.com> | ||
# $Id$ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Esta línea puedes quitarla también, ya que su objetivo era para un generador de plantillas que sustituyera esa marca por un texto, pero no es el caso. |
||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
Utilidad para generar el archivo de bancos apartir de la información del Banco de España | ||
======================================================================================== | ||
|
||
1. Descargar el excel de las 'Entidades con establecimiento' de la web del | ||
Banco de España: | ||
http://www.bde.es/bde/es/secciones/servicios/Particulares_y_e/Registros_de_Ent/Datos_actuales/Registros_ofici_c6e37f3710fd821.html | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Esto sobrepasa también los 80 caracteres del PEP8. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ¿Cómo puedo dividir la url? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lo que yo suelo hacer es poner la URL en un acortador (goo.gl, T.co, etc), y pegar esa URL en lugar de la completa. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. Gracias! |
||
2. Mover el archivo descargado 'REGBANESP_CONESTAB_A.XLS' a la carpeta gen_src | ||
3. Ejecutar: | ||
python gen_data_banks.py | ||
4. Se generará un archivo data_banks.xml en la carpeta wizard que sustituirá el anterior | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Debes también indicar que se necesita la librería python xlrd. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ¿Con poner: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sí, me parece bien. Pon librería Python, eso sí |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (c) 2014 Factor Libre S.L (http://www.factorlibre.com) All Rights Reserved. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Quitar "All Rights Reserved" |
||
# Ismael Calvo <ismael.calvo@factorlibre.com> | ||
# $Id$ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eliminar |
||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
from xlrd import open_workbook | ||
import codecs | ||
|
||
if __name__ == "__main__": | ||
# Abre el archivo que contine la información de los bancos | ||
book = False | ||
try: | ||
book = open_workbook('REGBANESP_CONESTAB_A.XLS') | ||
except IOError: | ||
print "Archivo REGBANESP_CONESTAB_A.XLS no encontrado." | ||
|
||
if book: | ||
sheet = book.sheet_by_index(0) | ||
|
||
# Prepara el archivo resultante | ||
output = codecs.open("../wizard/data_banks.xml", mode='w', encoding='utf-8') | ||
output.write("<?xml version='1.0' encoding='UTF-8'?>\n") | ||
output.write("<openerp>\n") | ||
output.write(" <data noupdate='1'>\n") | ||
|
||
# Genera los nuevos registros de los bancos | ||
for row_index in range(1, sheet.nrows): | ||
row = sheet.row_values(row_index) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hay que pasar las líneas que sean de bancos ya no vigentes. Hay una columna que indica algo así como fecha de baja o similar que lo indica. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pedro, el problema es que si partimos de datos de bancos antiguos, podemos tener un problema con las cuentas viejas, dado que si mantenemos la opción de que "reconozca" el SWIFT del banco viejo dará error en la remesa al rechazarlo el banco. ¿Lo quieres crear como inactivo? No entiendo muy bien el uso de esto, la verdad :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Es que hay bancos muy muy antiguos. Me sigue quedando la duda de si los BIC viejos siguen activos. También dijimos que hay bancos que ya empiezan a no admitir los números de cuenta viejos, por lo que no sé si tiene sentido mantener esos bancos viejos. De todas formas, como mínimo habrá que purgar aquellos que no tengan BIC en el fichero. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. El problema es que no se ha seguido un criterio común, hay bancos que dieron cuentas nuevas a sus clientes y otros que ha permitido continuar con las antiguas (como Banesto). Pero creemos ver un patrón en el fichero, dado que si tiene SWIFT informado parece que es que sigue vigente, aunque en la línea ponga que está de baja, etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perfecto, por lo menos podemos aplicar ese criterio de filtro. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. He incluido solo los bancos que tienen BIC. Además relleno el campo bic que no sé por qué no lo puse. |
||
name = row[40].lower().replace(' ', '_').replace(u'\xf1', 'n') | ||
output.write(' <record id="city_bank_%s" model="city.city">\n' %name) | ||
output.write(' <field name="name">%s<field/>\n' %row[40]) | ||
output.write(' <field name="lname">%s<field/>\n' %row[4]) | ||
output.write(' <field name="code">%s<field/>\n' %row[1]) | ||
output.write(' <field name="vat">%s<field/>\n' %row[6]) | ||
output.write(' <field name="street">%s<field/>\n' %(row[7]+'. '+row[8]+', '+row[9]+' '+row[10])) | ||
output.write(' <field name="city">%s<field/>\n' %row[12]) | ||
output.write(' <field name="zip">%s<field/>\n' %row[11]) | ||
output.write(' <field name="phone">%s<field/>\n' %row[16]) | ||
output.write(' <field name="fax">%s<field/>\n' %row[18]) | ||
output.write(' <field eval="1" name="active"/>\n') | ||
output.write(' <field name="state" ref="l10n_es_topynyms.ES28"/>\n') | ||
output.write(' <field name="country_id" ref="base.es"/>\n') | ||
output.write(' </record>\n') | ||
output.write(" </data>\n") | ||
output.write("</openerp>\n") | ||
|
||
output.close() | ||
print "data_banks.xml generado correctamente." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ponle por favor extensión .rst para que GitHub lo reconozca, ahora que tenemos esa opción, y habrá que quitar la cabecera de la licencia.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
He puesto la extensión .rst y quitado la cabecera.