Skip to content

Commit

Permalink
[FIX] l10n_es_partner: ajustes para PEP8
Browse files Browse the repository at this point in the history
  • Loading branch information
Ismael Calvo committed Dec 2, 2014
1 parent c4ed7d9 commit 1187828
Showing 1 changed file with 31 additions and 17 deletions.
48 changes: 31 additions & 17 deletions l10n_es_partner/gen_src/gen_data_banks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2014 Factor Libre S.L (http://www.factorlibre.com)
# Ismael Calvo <ismael.calvo@factorlibre.com>
# Ismael Calvo <ismael.calvo@factorlibre.com>
# $Id$
#
# 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
# 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,
Expand All @@ -35,28 +35,42 @@
sheet = book.sheet_by_index(0)

# Prepara el archivo resultante
output = codecs.open("../wizard/data_banks.xml", mode='w', encoding='utf-8')
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)
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])
name = "city_bank_" + row[40].lower().replace(
' ', '_').replace(u'\xf1', 'n')
street = row[7] + '. ' + row[8] + ', ' + row[9] + ' ' + row[10]
output.write(' <record id="%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' % (
street))
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(' <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")
Expand Down

0 comments on commit 1187828

Please sign in to comment.