Skip to content

Commit

Permalink
[IMP] l10n_it_fatturapa_in: black, isort, prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMule71 committed Jun 9, 2021
1 parent a9e23c1 commit c7061f5
Show file tree
Hide file tree
Showing 27 changed files with 2,242 additions and 1,916 deletions.
5 changes: 4 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ exclude: |
(l10n_it_fatturapa/data/fatturaordinaria_v1.2.1.xsl)|
(l10n_it_fatturapa/data/FoglioStileAssoSoftware_v1.1.xsl)|
# XML tests should not be reformatted
^l10n_it_fatturapa_out/tests/data
^l10n_it_fatturapa_out/tests/data|
^l10n_it_fatturapa_in/tests/data
default_language_version:
python: python3
node: "14.13.0"
Expand Down Expand Up @@ -134,11 +135,13 @@ repos:
args:
- --rcfile=.pylintrc
- --exit-zero
- --ignore=l10n_it_fatturapa_in/tests/data/
verbose: true
additional_dependencies: &pylint_deps
- pylint-odoo==3.5.0
- id: pylint
name: pylint with mandatory checks
args:
- --rcfile=.pylintrc-mandatory
- --ignore=l10n_it_fatturapa_in/tests/data/
additional_dependencies: *pylint_deps
1 change: 0 additions & 1 deletion l10n_it_fatturapa_in/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from . import models
from . import tests
from . import wizard
46 changes: 20 additions & 26 deletions l10n_it_fatturapa_in/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,29 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'ITA - Fattura elettronica - Ricezione',
'version': '12.0.2.1.3',
"name": "ITA - Fattura elettronica - Ricezione",
"version": "12.0.2.1.3",
"development_status": "Beta",
'category': 'Localization/Italy',
'summary': 'Ricezione fatture elettroniche',
'author': 'Agile Business Group, Innoviu, '
'Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/l10n-italy/tree/12.0/'
'l10n_it_fatturapa_in',
'license': 'AGPL-3',
"category": "Localization/Italy",
"summary": "Ricezione fatture elettroniche",
"author": "Agile Business Group, Innoviu, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-italy" "l10n_it_fatturapa_in",
"license": "AGPL-3",
"depends": [
'l10n_it_fatturapa',
'l10n_it_withholding_tax_causali',
],
"l10n_it_fatturapa",
"l10n_it_withholding_tax_causali",
],
"data": [
'views/account_view.xml',
'views/partner_view.xml',
'wizard/wizard_import_fatturapa_view.xml',
'wizard/link_to_existing_invoice.xml',
'views/company_view.xml',
'security/ir.model.access.csv',
'security/rules.xml',
"views/account_view.xml",
"views/partner_view.xml",
"wizard/wizard_import_fatturapa_view.xml",
"wizard/link_to_existing_invoice.xml",
"views/company_view.xml",
"security/ir.model.access.csv",
"security/rules.xml",
],
"installable": True,
'external_dependencies': {
'python': [
'elementpath',
'xmlschema',
'asn1crypto'
],
}
"external_dependencies": {
"python": ["elementpath", "xmlschema", "asn1crypto"],
},
}
4 changes: 2 additions & 2 deletions l10n_it_fatturapa_in/migrations/12.0.1.15.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from odoo import api, SUPERUSER_ID
from odoo import SUPERUSER_ID, api


def migrate(cr, version):
if not version:
return
with api.Environment.manage():
env = api.Environment(cr, SUPERUSER_ID, {})
invoices = env['account.invoice'].search([])
invoices = env["account.invoice"].search([])
# in order to prevent error messages in old invoices,
# where ftpa_withholding_amount is 0
for invoice in invoices:
Expand Down
36 changes: 21 additions & 15 deletions l10n_it_fatturapa_in/migrations/12.0.2.0.0/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,37 @@ def create_withholding_data_lines(env):
Create ftpa_withholding_ids from ftpa_withholding_type
and ftpa_withholding_amount
"""
column_wht_amount = openupgrade.get_legacy_name('ftpa_withholding_amount')
column_wht_type = openupgrade.get_legacy_name('ftpa_withholding_type')
exists = openupgrade.column_exists(env.cr, 'account_invoice', column_wht_amount)
column_wht_amount = openupgrade.get_legacy_name("ftpa_withholding_amount")
column_wht_type = openupgrade.get_legacy_name("ftpa_withholding_type")
exists = openupgrade.column_exists(env.cr, "account_invoice", column_wht_amount)
mapping = {
'name': 'ai.{ftpa_withholding_type}'.format(
ftpa_withholding_type=column_wht_type),
'invoice_id': 'ai.id',
'create_uid': 'ai.create_uid',
'create_date': 'ai.create_date',
'write_date': 'ai.write_date',
'write_uid': 'ai.write_uid',
"name": "ai.{ftpa_withholding_type}".format(
ftpa_withholding_type=column_wht_type
),
"invoice_id": "ai.id",
"create_uid": "ai.create_uid",
"create_date": "ai.create_date",
"write_date": "ai.write_date",
"write_uid": "ai.write_uid",
}
if exists:
mapping.update(
{'amount': 'ai.{ftpa_withholding_amount}'.format(
ftpa_withholding_amount=column_wht_amount)})
{
"amount": "ai.{ftpa_withholding_amount}".format(
ftpa_withholding_amount=column_wht_amount
)
}
)
query = """
INSERT INTO withholding_data_line
({columns})
SELECT {values}
FROM account_invoice AS ai
WHERE ai.{ftpa_withholding_type} IS NOT NULL;""".format(
columns=','.join(mapping.keys()),
values=','.join(mapping.values()),
ftpa_withholding_type=column_wht_type)
columns=",".join(mapping.keys()),
values=",".join(mapping.values()),
ftpa_withholding_type=column_wht_type,
)
openupgrade.logged_query(env.cr, sql.SQL(query))


Expand Down
26 changes: 16 additions & 10 deletions l10n_it_fatturapa_in/migrations/12.0.2.0.0/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@
@openupgrade.migrate()
def migrate(env, version):
cr = env.cr
if openupgrade.column_exists(env.cr, 'account_invoice', 'ftpa_withholding_amount'):
openupgrade.copy_columns(cr, {
'account_invoice': [
('ftpa_withholding_amount', None, None),
if openupgrade.column_exists(env.cr, "account_invoice", "ftpa_withholding_amount"):
openupgrade.copy_columns(
cr,
{
"account_invoice": [
("ftpa_withholding_amount", None, None),
],
},
)
openupgrade.copy_columns(
cr,
{
"account_invoice": [
("ftpa_withholding_type", None, None),
],
})
openupgrade.copy_columns(cr, {
'account_invoice': [
('ftpa_withholding_type', None, None),
],
})
},
)
1 change: 0 additions & 1 deletion l10n_it_fatturapa_in/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from . import attachment
from . import account
from . import partner
Expand Down
Loading

0 comments on commit c7061f5

Please sign in to comment.