Skip to content

Commit

Permalink
[FIX] Make sure pre-commit without errors
Browse files Browse the repository at this point in the history
  • Loading branch information
NL66278 committed May 1, 2023
1 parent 2ad9811 commit debf177
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 36 deletions.
6 changes: 3 additions & 3 deletions l10n_nl_account_tax_unece/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def _l10n_nl_get_external_tax_id_map(self, taxes):
('model', '=', 'account.tax'),
('res_id', 'in', taxes.ids)
], ['name', 'res_id'])
map = {}
tax_map = {}
for item in tax_data:
map[item['res_id']] = item['name']
return map
tax_map[item['res_id']] = item['name']
return tax_map
2 changes: 1 addition & 1 deletion l10n_nl_bank/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"category": "Localisation",
"license": "AGPL-3",
"author": "Odoo Experts, Odoo Community Association (OCA)",
"website": "https://www.odooexperts.nl",
"website": "https://github.com/OCA/l10n-netherlands",
"depends": [
"base",
],
Expand Down
1 change: 1 addition & 0 deletions l10n_nl_country_states/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"name": "Dutch country states (Provincies)",
"version": "11.0.1.0.1",
"author": "Therp BV, Odoo Community Association (OCA)",
'website': 'https://github.com/OCA/l10n-netherlands',
"license": "AGPL-3",
"category": "Localization",
"depends": [
Expand Down
35 changes: 18 additions & 17 deletions l10n_nl_country_states/examples/generate_postcode_regios.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/python
# this script is compatible with a python3 interpreter
# this script generates the data file for postcode state mapping
"""
This expected input is an .xls file, passed as argument.
The .xls file should contain the mapping of postcodes-provinces.
Note: the records of the .xls MUST be sorted by postcode number!
"""

import argparse
import xlrd

'''
This expected input is an .xls file, passed as argument.
The .xls file should contain the mapping of postcodes-provinces.
Note: the records of the .xls MUST be sorted by postcode number!
'''

parser = argparse.ArgumentParser()
parser.add_argument('file', type=open)
Expand All @@ -23,17 +23,18 @@

def get_record_txt():
global province
return str('<record id="zip_%s_%s" model="res.country.state.nl.zip">\n'
' <field name="min_zip">%s</field>\n'
' <field name="max_zip">%s</field>\n'
' <field name="state_id" ref="state_%s" />\n'
'</record>\n'
) % (
str(last_min_zip),
str(last_max_zip),
str(last_min_zip),
str(last_max_zip),
province,
return str(
'<record id="zip_%s_%s" model="res.country.state.nl.zip">\n'
' <field name="min_zip">%s</field>\n'
' <field name="max_zip">%s</field>\n'
' <field name="state_id" ref="state_%s" />\n'
'</record>\n'
) % (
str(last_min_zip),
str(last_max_zip),
str(last_min_zip),
str(last_max_zip),
province,
)


Expand Down Expand Up @@ -63,4 +64,4 @@ def get_record_txt():
last_province = prov

result_text += get_record_txt()
print(result_text)
print(result_text) # pylint: disable=print-used
6 changes: 3 additions & 3 deletions l10n_nl_country_states/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ResPartner(models.Model):
_inherit = 'res.partner'

@api.model
def _get_state_for_zip(self, country_id, state_id, zip):
def _get_state_for_zip(self, country_id, state_id, postal_code):
"""Get state for zip.
If not Netherlands, just return present state, unless state is
Expand All @@ -28,8 +28,8 @@ def _get_state_for_zip(self, country_id, state_id, zip):
# Check whether we can find state for zip, if we find one, any
# state present in record will be overwritten
zip_digits = 0
if zip:
zip_digits = int(''.join([n for n in zip if n.isdigit()]))
if postal_code:
zip_digits = int(''.join([n for n in postal_code if n.isdigit()]))
if not zip_digits:
return state_id
return StateModel.search([
Expand Down
1 change: 1 addition & 0 deletions l10n_nl_partner_name/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'version': '11.0.0.0.0',
'author': 'Therp BV, Odoo Community Association (OCA)',
'category': 'Contact management',
'website': 'https://github.com/OCA/l10n-netherlands',
'depends': [
'partner_firstname',
'base_view_inheritance_extension',
Expand Down
2 changes: 1 addition & 1 deletion l10n_nl_partner_name/scripts/guess_names.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
# Copyright 2017 Therp BV <https://therp.nl>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
# pylint: disable=eval-used,eval-referenced,print-used

import argparse
import xmlrpclib
Expand Down
2 changes: 1 addition & 1 deletion l10n_nl_partner_salutation/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'author': 'Therp BV, Odoo Community Association (OCA)',
'category': 'Contact management',
'license': 'AGPL-3',
'website': 'https://github.com/oca/l10n-netherlands.git',
'website': 'https://github.com/OCA/l10n-netherlands',
'depends': [
'partner_contact_gender',
'l10n_nl_partner_name',
Expand Down
2 changes: 1 addition & 1 deletion l10n_nl_tax_invoice_basis/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'version': '11.0.1.0.0',
'category': 'Localization',
'author': 'Onestein, Odoo Community Association (OCA)',
'website': 'http://www.onestein.eu',
'website': 'https://github.com/OCA/l10n-netherlands',
'license': 'AGPL-3',
'depends': [
'account',
Expand Down
29 changes: 20 additions & 9 deletions l10n_nl_tax_statement/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,23 @@ def pre_init_hook(cr):
is required, as all values are empty).
"""
logger = logging.getLogger(__name__)
table = "account_move_line"
for column, datatype in (
("l10n_nl_vat_statement_id", "INTEGER"),
("l10n_nl_vat_statement_include", "BOOLEAN")):
if not column_exists(cr, table, column):
logger.info("Precreating %s.%s", table, column)
cr.execute(
"ALTER TABLE {} ADD COLUMN {} {}".format(
table, column, datatype))
if not column_exists(cr, "account_move_line", "l10n_nl_vat_statement_id"):
logger.info(
"Precreating %s.%s",
"account_move_line",
"l10n_nl_vat_statement_id"
)
cr.execute(
"ALTER TABLE account_move_line"
" ADD COLUMN l10n_nl_vat_statement_id INTEGER"
)
if not column_exists(cr, "account_move_line", "l10n_nl_vat_statement_include"):
logger.info(
"Precreating %s.%s",
"account_move_line",
"l10n_nl_vat_statement_include"
)
cr.execute(
"ALTER TABLE account_move_line"
" ADD COLUMN l10n_nl_vat_statement_include BOOLEAN"
)
1 change: 1 addition & 0 deletions l10n_nl_xaf_auditfile_export/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"name": "XAF auditfile export",
"version": "11.0.1.3.0",
"author": "Therp BV, Odoo Community Association (OCA)",
'website': 'https://github.com/OCA/l10n-netherlands',
"license": "AGPL-3",
"category": "Accounting & Finance",
"summary": "Export XAF auditfiles for Dutch tax authorities",
Expand Down
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# generated from manifests external_dependencies
mako
pyPostcode
python-stdnum

0 comments on commit debf177

Please sign in to comment.