mirror of
https://github.com/brain-tec/account_ebics.git
synced 2025-08-14 14:45:36 +00:00
[14.0]black, isort, prettier
This commit is contained in:
@@ -3,16 +3,20 @@
|
||||
|
||||
<record id="ebics_config_comp_rule" model="ir.rule">
|
||||
<field name="name">EBICS Configuration model company rule</field>
|
||||
<field name="model_id" ref="model_ebics_config"/>
|
||||
<field eval="True" name="global"/>
|
||||
<field name="domain_force">['|', ('company_ids', '=', False), ('company_ids', 'in', user.company_ids.ids)]</field>
|
||||
<field name="model_id" ref="model_ebics_config" />
|
||||
<field eval="True" name="global" />
|
||||
<field
|
||||
name="domain_force"
|
||||
>['|', ('company_ids', '=', False), ('company_ids', 'in', user.company_ids.ids)]</field>
|
||||
</record>
|
||||
|
||||
<record id="ebics_file_comp_rule" model="ir.rule">
|
||||
<field name="name">EBICS File model company rule</field>
|
||||
<field name="model_id" ref="model_ebics_file"/>
|
||||
<field eval="True" name="global"/>
|
||||
<field name="domain_force">['|', ('company_ids', '=', False), ('company_ids', 'in', user.company_ids.ids)]</field>
|
||||
<field name="model_id" ref="model_ebics_file" />
|
||||
<field eval="True" name="global" />
|
||||
<field
|
||||
name="domain_force"
|
||||
>['|', ('company_ids', '=', False), ('company_ids', 'in', user.company_ids.ids)]</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
@@ -1,9 +1,10 @@
|
||||
# Copyright 2009-2020 Noviat.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openupgradelib import openupgrade # pylint: disable=W7936
|
||||
import os
|
||||
|
||||
from openupgradelib import openupgrade # pylint: disable=W7936
|
||||
|
||||
|
||||
@openupgrade.migrate()
|
||||
def migrate(env, version):
|
||||
@@ -16,58 +17,67 @@ def _ebics_config_upgrade(env, version):
|
||||
env.cr.execute("SELECT * FROM ebics_config")
|
||||
cfg_datas = env.cr.dictfetchall()
|
||||
for cfg_data in cfg_datas:
|
||||
cfg = env['ebics.config'].browse(cfg_data['id'])
|
||||
journal = env['account.journal'].search(
|
||||
[('bank_account_id', '=', cfg_data['bank_id'])])
|
||||
keys_fn_old = cfg_data['ebics_keys']
|
||||
cfg = env["ebics.config"].browse(cfg_data["id"])
|
||||
journal = env["account.journal"].search(
|
||||
[("bank_account_id", "=", cfg_data["bank_id"])]
|
||||
)
|
||||
keys_fn_old = cfg_data["ebics_keys"]
|
||||
ebics_keys_root = os.path.dirname(keys_fn_old)
|
||||
if os.path.isfile(keys_fn_old):
|
||||
keys_fn = ebics_keys_root + '/' + cfg_data['ebics_user'] + '_keys'
|
||||
keys_fn = ebics_keys_root + "/" + cfg_data["ebics_user"] + "_keys"
|
||||
os.rename(keys_fn_old, keys_fn)
|
||||
state = cfg_data['state'] == 'active' and 'confirm' or 'draft'
|
||||
cfg.write({
|
||||
'company_ids': [(6, 0, [cfg_data['company_id']])],
|
||||
'journal_ids': [(6, 0, journal.ids)],
|
||||
'ebics_keys': ebics_keys_root,
|
||||
'state': state,
|
||||
})
|
||||
state = cfg_data["state"] == "active" and "confirm" or "draft"
|
||||
cfg.write(
|
||||
{
|
||||
"company_ids": [(6, 0, [cfg_data["company_id"]])],
|
||||
"journal_ids": [(6, 0, journal.ids)],
|
||||
"ebics_keys": ebics_keys_root,
|
||||
"state": state,
|
||||
}
|
||||
)
|
||||
|
||||
user_vals = {
|
||||
'ebics_config_id': cfg_data['id'],
|
||||
'name': cfg_data['ebics_user'],
|
||||
"ebics_config_id": cfg_data["id"],
|
||||
"name": cfg_data["ebics_user"],
|
||||
}
|
||||
for fld in [
|
||||
'signature_class', 'ebics_passphrase',
|
||||
'ebics_ini_letter_fn', 'ebics_public_bank_keys_fn',
|
||||
'ebics_key_x509', 'ebics_key_x509_dn_cn',
|
||||
'ebics_key_x509_dn_o', 'ebics_key_x509_dn_ou',
|
||||
'ebics_key_x509_dn_c', 'ebics_key_x509_dn_st',
|
||||
'ebics_key_x509_dn_l', 'ebics_key_x509_dn_e',
|
||||
'ebics_file_format_ids', 'state']:
|
||||
"signature_class",
|
||||
"ebics_passphrase",
|
||||
"ebics_ini_letter_fn",
|
||||
"ebics_public_bank_keys_fn",
|
||||
"ebics_key_x509",
|
||||
"ebics_key_x509_dn_cn",
|
||||
"ebics_key_x509_dn_o",
|
||||
"ebics_key_x509_dn_ou",
|
||||
"ebics_key_x509_dn_c",
|
||||
"ebics_key_x509_dn_st",
|
||||
"ebics_key_x509_dn_l",
|
||||
"ebics_key_x509_dn_e",
|
||||
"ebics_file_format_ids",
|
||||
"state",
|
||||
]:
|
||||
if cfg_data.get(fld):
|
||||
if fld == 'ebics_file_format_ids':
|
||||
if fld == "ebics_file_format_ids":
|
||||
user_vals[fld] = [(6, 0, cfg_data[fld])]
|
||||
elif fld == 'state' and cfg_data['state'] == 'active':
|
||||
user_vals['state'] = 'active_keys'
|
||||
elif fld == "state" and cfg_data["state"] == "active":
|
||||
user_vals["state"] = "active_keys"
|
||||
else:
|
||||
user_vals[fld] = cfg_data[fld]
|
||||
ebics_userid = env['ebics.userid'].create(user_vals)
|
||||
ebics_userid = env["ebics.userid"].create(user_vals)
|
||||
env.cr.execute(
|
||||
"""
|
||||
UPDATE ir_attachment
|
||||
SET res_model = 'ebics.userid', res_id = %s
|
||||
WHERE name in ('ebics_ini_letter', 'ebics_public_bank_keys');
|
||||
"""
|
||||
% ebics_userid.id)
|
||||
% ebics_userid.id
|
||||
)
|
||||
|
||||
if len(cfg_datas) == 1:
|
||||
env.cr.execute(
|
||||
"UPDATE ebics_file SET ebics_userid_id = %s" % ebics_userid.id)
|
||||
env.cr.execute("UPDATE ebics_file SET ebics_userid_id = %s" % ebics_userid.id)
|
||||
|
||||
|
||||
def _noupdate_changes(env, version):
|
||||
openupgrade.load_data(
|
||||
env.cr,
|
||||
'account_ebics',
|
||||
'migrations/13.0.1.1/noupdate_changes.xml'
|
||||
env.cr, "account_ebics", "migrations/13.0.1.1/noupdate_changes.xml"
|
||||
)
|
||||
|
@@ -2,16 +2,18 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
_FILE_FORMATS = [
|
||||
{'xml_id_name': 'ebics_ff_C52',
|
||||
'download_process_method': 'camt.052',
|
||||
},
|
||||
{'xml_id_name': 'ebics_ff_C53',
|
||||
'download_process_method': 'camt.053',
|
||||
},
|
||||
{'xml_id_name': 'ebics_ff_FDL_camt_xxx_cfonb120_stm',
|
||||
'download_process_method': 'cfonb120',
|
||||
},
|
||||
|
||||
{
|
||||
"xml_id_name": "ebics_ff_C52",
|
||||
"download_process_method": "camt.052",
|
||||
},
|
||||
{
|
||||
"xml_id_name": "ebics_ff_C53",
|
||||
"download_process_method": "camt.053",
|
||||
},
|
||||
{
|
||||
"xml_id_name": "ebics_ff_FDL_camt_xxx_cfonb120_stm",
|
||||
"download_process_method": "cfonb120",
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@@ -21,21 +23,22 @@ def migrate(cr, version):
|
||||
|
||||
|
||||
def _update_file_format(cr, ff):
|
||||
cr.execute(
|
||||
cr.execute( # pylint: disable=E8103
|
||||
"""
|
||||
SELECT res_id FROM ir_model_data
|
||||
WHERE module='account_ebics' AND name='{}'
|
||||
""".format(ff['xml_id_name'])
|
||||
""".format(
|
||||
ff["xml_id_name"]
|
||||
)
|
||||
)
|
||||
res = cr.fetchone()
|
||||
if res:
|
||||
cr.execute(
|
||||
cr.execute( # pylint: disable=E8103
|
||||
"""
|
||||
UPDATE ebics_file_format
|
||||
SET download_process_method='{download_process_method}'
|
||||
WHERE id={ff_id};
|
||||
""".format(
|
||||
download_process_method=ff['download_process_method'],
|
||||
ff_id=res[0]
|
||||
)
|
||||
download_process_method=ff["download_process_method"], ff_id=res[0]
|
||||
)
|
||||
)
|
||||
|
@@ -2,36 +2,45 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
_FILE_FORMATS = [
|
||||
{'old_xml_id_name': 'ebics_ff_camt_052_001_02_stm',
|
||||
'new_xml_id_name': 'ebics_ff_C52',
|
||||
'new_name': 'camt.052',
|
||||
},
|
||||
{'old_xml_id_name': 'ebics_ff_camt_053_001_02_stm',
|
||||
'new_xml_id_name': 'ebics_ff_C53',
|
||||
'new_name': 'camt.053',
|
||||
},
|
||||
{'old_xml_id_name': 'ebics_ff_camt_xxx_cfonb120_stm',
|
||||
'new_xml_id_name': 'ebics_ff_FDL_camt_xxx_cfonb120_stm',
|
||||
},
|
||||
{'old_xml_id_name': 'ebics_ff_pain_001_001_03_sct',
|
||||
'new_xml_id_name': 'ebics_ff_CCT',
|
||||
},
|
||||
{'old_xml_id_name': 'ebics_ff_pain_001',
|
||||
'new_xml_id_name': 'ebics_ff_XE2',
|
||||
'new_name': 'pain.001.001.03',
|
||||
},
|
||||
{'old_xml_id_name': 'ebics_ff_pain_008_001_02_sdd',
|
||||
'new_xml_id_name': 'ebics_ff_CDD',
|
||||
},
|
||||
{'old_xml_id_name': 'ebics_ff_pain_008',
|
||||
'new_xml_id_name': 'ebics_ff_XE3',
|
||||
},
|
||||
{'old_xml_id_name': 'ebics_ff_pain_008_001_02_sbb',
|
||||
'new_xml_id_name': 'ebics_ff_CDB',
|
||||
},
|
||||
{'old_xml_id_name': 'ebics_ff_pain_001_001_02_sct',
|
||||
'new_xml_id_name': 'ebics_ff_FUL_pain_001_001_02_sct',
|
||||
},
|
||||
{
|
||||
"old_xml_id_name": "ebics_ff_camt_052_001_02_stm",
|
||||
"new_xml_id_name": "ebics_ff_C52",
|
||||
"new_name": "camt.052",
|
||||
},
|
||||
{
|
||||
"old_xml_id_name": "ebics_ff_camt_053_001_02_stm",
|
||||
"new_xml_id_name": "ebics_ff_C53",
|
||||
"new_name": "camt.053",
|
||||
},
|
||||
{
|
||||
"old_xml_id_name": "ebics_ff_camt_xxx_cfonb120_stm",
|
||||
"new_xml_id_name": "ebics_ff_FDL_camt_xxx_cfonb120_stm",
|
||||
},
|
||||
{
|
||||
"old_xml_id_name": "ebics_ff_pain_001_001_03_sct",
|
||||
"new_xml_id_name": "ebics_ff_CCT",
|
||||
},
|
||||
{
|
||||
"old_xml_id_name": "ebics_ff_pain_001",
|
||||
"new_xml_id_name": "ebics_ff_XE2",
|
||||
"new_name": "pain.001.001.03",
|
||||
},
|
||||
{
|
||||
"old_xml_id_name": "ebics_ff_pain_008_001_02_sdd",
|
||||
"new_xml_id_name": "ebics_ff_CDD",
|
||||
},
|
||||
{
|
||||
"old_xml_id_name": "ebics_ff_pain_008",
|
||||
"new_xml_id_name": "ebics_ff_XE3",
|
||||
},
|
||||
{
|
||||
"old_xml_id_name": "ebics_ff_pain_008_001_02_sbb",
|
||||
"new_xml_id_name": "ebics_ff_CDB",
|
||||
},
|
||||
{
|
||||
"old_xml_id_name": "ebics_ff_pain_001_001_02_sct",
|
||||
"new_xml_id_name": "ebics_ff_FUL_pain_001_001_02_sct",
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@@ -44,11 +53,13 @@ def migrate(cr, version):
|
||||
|
||||
|
||||
def _update_file_format(cr, ff):
|
||||
cr.execute(
|
||||
cr.execute( # pylint: disable=E8103
|
||||
"""
|
||||
SELECT id, res_id FROM ir_model_data
|
||||
WHERE module='account_ebics' AND name='{}'
|
||||
""".format(ff['old_xml_id_name'])
|
||||
""".format(
|
||||
ff["old_xml_id_name"]
|
||||
)
|
||||
)
|
||||
res = cr.fetchone()
|
||||
if res:
|
||||
@@ -59,7 +70,7 @@ def _update_file_format(cr, ff):
|
||||
""".format(
|
||||
new_xml_id_name=ff["new_xml_id_name"], xml_id=res[0]
|
||||
)
|
||||
if ff.get('new_name'):
|
||||
if ff.get("new_name"):
|
||||
query += """
|
||||
UPDATE ebics_file_format
|
||||
SET name='{new_name}'
|
||||
@@ -67,4 +78,4 @@ def _update_file_format(cr, ff):
|
||||
""".format(
|
||||
new_name=ff["new_name"], ff_id=res[1]
|
||||
)
|
||||
cr.execute(query)
|
||||
cr.execute(query) # pylint: disable=E8103
|
||||
|
Reference in New Issue
Block a user