mirror of
https://github.com/brain-tec/account_ebics.git
synced 2026-04-25 23:26:50 +00:00
[MIG] account_ebics: Migration to 19.0
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
{
|
||||
"name": "EBICS banking protocol",
|
||||
"version": "18.0.1.1.2",
|
||||
"version": "19.0.1.0.0",
|
||||
"license": "LGPL-3",
|
||||
"author": "Noviat",
|
||||
"website": "https://www.noviat.com/",
|
||||
@@ -22,7 +22,6 @@
|
||||
"wizards/ebics_admin_order.xml",
|
||||
"views/menu.xml",
|
||||
],
|
||||
"installable": True,
|
||||
"application": True,
|
||||
"external_dependencies": {
|
||||
"python": [
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo noupdate="1">
|
||||
<!-- Download formats -->
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<odoo>
|
||||
<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>
|
||||
</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>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -1,81 +0,0 @@
|
||||
# Copyright 2009-2020 Noviat.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
import os
|
||||
|
||||
from openupgradelib import openupgrade # pylint: disable=W7936
|
||||
|
||||
|
||||
@openupgrade.migrate()
|
||||
def migrate(env, version):
|
||||
_ebics_config_upgrade(env, version)
|
||||
_noupdate_changes(env, version)
|
||||
|
||||
|
||||
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"]
|
||||
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"
|
||||
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,
|
||||
}
|
||||
)
|
||||
|
||||
user_vals = {
|
||||
"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",
|
||||
]:
|
||||
if cfg_data.get(fld):
|
||||
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"
|
||||
else:
|
||||
user_vals[fld] = cfg_data[fld]
|
||||
ebics_userid = env["ebics.userid"].create(user_vals)
|
||||
env.cr.execute(
|
||||
f"""
|
||||
UPDATE ir_attachment
|
||||
SET res_model = 'ebics.userid', res_id = {ebics_userid.id}
|
||||
WHERE name in ('ebics_ini_letter', 'ebics_public_bank_keys');
|
||||
"""
|
||||
)
|
||||
|
||||
if len(cfg_datas) == 1:
|
||||
env.cr.execute(f"UPDATE ebics_file SET ebics_userid_id = {ebics_userid.id}")
|
||||
|
||||
|
||||
def _noupdate_changes(env, version):
|
||||
openupgrade.load_data(
|
||||
env.cr, "account_ebics", "migrations/13.0.1.1/noupdate_changes.xml"
|
||||
)
|
||||
@@ -1,9 +0,0 @@
|
||||
# Copyright 2009-2020 Noviat.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
|
||||
cr.execute("DELETE FROM ebics_xfer;")
|
||||
@@ -1,42 +0,0 @@
|
||||
# Copyright 2009-2020 Noviat.
|
||||
# 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",
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
for ff in _FILE_FORMATS:
|
||||
_update_file_format(cr, ff)
|
||||
|
||||
|
||||
def _update_file_format(cr, ff):
|
||||
cr.execute( # pylint: disable=E8103
|
||||
"""
|
||||
SELECT res_id FROM ir_model_data
|
||||
WHERE module='account_ebics' AND name='{}'
|
||||
""".format(ff["xml_id_name"])
|
||||
)
|
||||
res = cr.fetchone()
|
||||
if res:
|
||||
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]
|
||||
)
|
||||
)
|
||||
@@ -1,75 +0,0 @@
|
||||
# Copyright 2009-2020 Noviat.
|
||||
# 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",
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
|
||||
for ff in _FILE_FORMATS:
|
||||
_update_file_format(cr, ff)
|
||||
|
||||
|
||||
def _update_file_format(cr, ff):
|
||||
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"])
|
||||
)
|
||||
res = cr.fetchone()
|
||||
if res:
|
||||
query = """
|
||||
UPDATE ir_model_data
|
||||
SET name='{new_xml_id_name}'
|
||||
WHERE id={xml_id};
|
||||
""".format(new_xml_id_name=ff["new_xml_id_name"], xml_id=res[0])
|
||||
if ff.get("new_name"):
|
||||
query += """
|
||||
UPDATE ebics_file_format
|
||||
SET name='{new_name}'
|
||||
WHERE id={ff_id};
|
||||
""".format(new_name=ff["new_name"], ff_id=res[1])
|
||||
cr.execute(query) # pylint: disable=E8103
|
||||
@@ -1,54 +0,0 @@
|
||||
# Copyright 2009-2022 Noviat.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
|
||||
cr.execute("select id from ebics_config")
|
||||
cfg_ids = [x[0] for x in cr.fetchall()]
|
||||
for cfg_id in cfg_ids:
|
||||
cr.execute(
|
||||
"""
|
||||
SELECT DISTINCT aj.company_id
|
||||
FROM account_journal_ebics_config_rel rel
|
||||
JOIN account_journal aj ON rel.account_journal_id = aj.id
|
||||
WHERE ebics_config_id = %s
|
||||
""",
|
||||
(cfg_id,),
|
||||
)
|
||||
new_cpy_ids = [x[0] for x in cr.fetchall()]
|
||||
cr.execute(
|
||||
"""
|
||||
SELECT DISTINCT res_company_id
|
||||
FROM ebics_config_res_company_rel
|
||||
WHERE ebics_config_id = %s
|
||||
""",
|
||||
(cfg_id,),
|
||||
)
|
||||
old_cpy_ids = [x[0] for x in cr.fetchall()]
|
||||
|
||||
to_add = []
|
||||
for cid in new_cpy_ids:
|
||||
if cid in old_cpy_ids:
|
||||
old_cpy_ids.remove(cid)
|
||||
else:
|
||||
to_add.append(cid)
|
||||
if old_cpy_ids:
|
||||
cr.execute(
|
||||
"""
|
||||
DELETE FROM ebics_config_res_company_rel
|
||||
WHERE res_company_id IN %s
|
||||
""",
|
||||
(tuple(old_cpy_ids),),
|
||||
)
|
||||
if to_add:
|
||||
for cid in to_add:
|
||||
cr.execute(
|
||||
"""
|
||||
INSERT INTO ebics_config_res_company_rel(ebics_config_id, res_company_id)
|
||||
VALUES (%s, %s);
|
||||
""",
|
||||
(cfg_id, cid),
|
||||
)
|
||||
@@ -1,15 +0,0 @@
|
||||
# Copyright 2009-2025 Noviat.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
cr.execute( # pylint: disable=E8103
|
||||
"""
|
||||
UPDATE ebics_file ef
|
||||
SET state = 'done'
|
||||
FROM ebics_file_format eff
|
||||
WHERE ef.format_id = eff.id
|
||||
AND eff.type = 'down'
|
||||
AND eff.download_process_method IS NULL;
|
||||
"""
|
||||
)
|
||||
@@ -126,7 +126,7 @@ class EbicsConfig(models.Model):
|
||||
|
||||
@api.model
|
||||
def _default_ebics_keys(self):
|
||||
return "/".join(["/etc/odoo/ebics_keys", self._cr.dbname])
|
||||
return "/".join(["/etc/odoo/ebics_keys", self.env.cr.dbname])
|
||||
|
||||
@api.constrains("ebics_key_bitlength")
|
||||
def _check_ebics_key_bitlength(self):
|
||||
@@ -178,7 +178,7 @@ class EbicsConfig(models.Model):
|
||||
def unlink(self):
|
||||
for ebics_config in self:
|
||||
if ebics_config.state == "active":
|
||||
raise UserError(
|
||||
raise UserError( # pylint: disable=no-raise-unlink
|
||||
self.env._("You cannot remove active EBICS configurations.")
|
||||
)
|
||||
return super().unlink()
|
||||
@@ -214,8 +214,8 @@ class EbicsConfig(models.Model):
|
||||
if not os.path.exists(dirname):
|
||||
raise UserError(
|
||||
self.env._(
|
||||
"EBICS Keys Root Directory %s is not available."
|
||||
"\nPlease contact your system administrator."
|
||||
"EBICS Keys Root Directory %(dir)s is not available."
|
||||
"\nPlease contact your system administrator.",
|
||||
dir=dirname,
|
||||
)
|
||||
% dirname
|
||||
)
|
||||
|
||||
@@ -23,13 +23,10 @@ class EbicsFile(models.Model):
|
||||
_name = "ebics.file"
|
||||
_description = "Object to store EBICS Data Files"
|
||||
_order = "date desc"
|
||||
_sql_constraints = [
|
||||
(
|
||||
"name_uniq",
|
||||
"unique (name, format_id)",
|
||||
"This File has already been down- or uploaded !",
|
||||
)
|
||||
]
|
||||
_name_uniq = models.Constraint(
|
||||
"unique (name, format_id)",
|
||||
"This File has already been down- or uploaded !",
|
||||
)
|
||||
|
||||
name = fields.Char(string="Filename")
|
||||
data = fields.Binary(string="File", readonly=True)
|
||||
@@ -63,7 +60,6 @@ class EbicsFile(models.Model):
|
||||
)
|
||||
user_id = fields.Many2one(
|
||||
comodel_name="res.users",
|
||||
string="User",
|
||||
default=lambda self: self.env.user,
|
||||
readonly=True,
|
||||
)
|
||||
@@ -89,7 +85,7 @@ class EbicsFile(models.Model):
|
||||
ff_methods = self._file_format_methods()
|
||||
for ebics_file in self:
|
||||
if ebics_file.state == "done":
|
||||
raise UserError(
|
||||
raise UserError( # pylint: disable=no-raise-unlink
|
||||
self.env._("You can only remove EBICS files in state 'Draft'.")
|
||||
)
|
||||
# execute format specific actions
|
||||
@@ -637,7 +633,7 @@ class EbicsFile(models.Model):
|
||||
self.env._(
|
||||
"The current version of the 'account_ebics' module "
|
||||
"has no support to automatically process EBICS files "
|
||||
"with format %s."
|
||||
"with format %s.",
|
||||
self.format_id.name,
|
||||
)
|
||||
% self.format_id.name
|
||||
)
|
||||
|
||||
@@ -475,7 +475,9 @@ class EbicsUserID(models.Model):
|
||||
if cc in ["FR", "DE"]:
|
||||
lang = cc
|
||||
else:
|
||||
lang = self.env.user.lang or self.env["res.lang"].search([])[0].code
|
||||
lang = (
|
||||
self.env.user.lang or self.env["res.lang"].search([], limit=1)[0].code
|
||||
)
|
||||
lang = lang[:2]
|
||||
lang = lang.lower()
|
||||
lang = lang if lang in INI_LETTER_LANGS else "en"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record model="res.groups" id="group_ebics_manager">
|
||||
<record id="group_ebics_manager" model="res.groups">
|
||||
<field name="name">EBICS Manager</field>
|
||||
<field name="category_id" ref="base.module_category_hidden" />
|
||||
<field name="privilege_id" ref="account.res_groups_privilege_accounting" />
|
||||
</record>
|
||||
|
||||
<data noupdate="1">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="ebics_config_view_list" model="ir.ui.view">
|
||||
<field name="name">ebics.config.list</field>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="ebics_file_format_view_search" model="ir.ui.view">
|
||||
<field name="name">ebics.file.format.search</field>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="ebics_file_view_search" model="ir.ui.view">
|
||||
<field name="name">ebics.file.search</field>
|
||||
@@ -21,7 +21,7 @@
|
||||
domain="[('state', '=', 'draft')]"
|
||||
/>
|
||||
<filter string="Done" name="done" domain="[('state', '=', 'done')]" />
|
||||
<group expand="0" string="Group By">
|
||||
<group>
|
||||
<filter
|
||||
string="File Format"
|
||||
name="file_format"
|
||||
@@ -81,7 +81,7 @@
|
||||
<record id="ebics_file_view_form" model="ir.ui.view">
|
||||
<field name="name">ebics.file.form</field>
|
||||
<field name="model">ebics.file</field>
|
||||
<field name="priority">1</field>
|
||||
<field name="priority" eval="1" />
|
||||
<field name="arch" type="xml">
|
||||
<form create="false">
|
||||
<header>
|
||||
@@ -173,7 +173,7 @@
|
||||
<record id="ebics_file_view_form_result" model="ir.ui.view">
|
||||
<field name="name">ebics.file.process.result</field>
|
||||
<field name="model">ebics.file</field>
|
||||
<field name="priority">100</field>
|
||||
<field name="priority" eval="100" />
|
||||
<field name="arch" type="xml">
|
||||
<form string="Process EBICS File">
|
||||
<separator colspan="4" string="Results :" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="ebics_userid_view_list" model="ir.ui.view">
|
||||
<field name="name">ebics.userid.list</field>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<menuitem
|
||||
id="ebics_processing_menu"
|
||||
|
||||
@@ -37,9 +37,9 @@ class EbicsAdminOrder(models.TransientModel):
|
||||
self.ensure_one()
|
||||
client = self._setup_client()
|
||||
if not client:
|
||||
self.note += (
|
||||
self.env._("EBICS client setup failed for connection '%s'")
|
||||
% self.ebics_config_id.name
|
||||
self.note += self.env._(
|
||||
"EBICS client setup failed for connection '%s'",
|
||||
self.ebics_config_id.name,
|
||||
)
|
||||
else:
|
||||
try:
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="ebics_admin_order_view_form" model="ir.ui.view">
|
||||
<field name="name">EBICS Administrative Order</field>
|
||||
<field name="model">ebics.admin.order</field>
|
||||
<field name="inherit_id" ref="ebics_xfer_view_form_download" />
|
||||
<field name="priority">1</field>
|
||||
<field name="priority" eval="1" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="date_from" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
@@ -31,7 +31,7 @@
|
||||
<record id="ebics_admin_order_view_form_result" model="ir.ui.view">
|
||||
<field name="name">EBICS Administrative Order result</field>
|
||||
<field name="model">ebics.admin.order</field>
|
||||
<field name="priority">2</field>
|
||||
<field name="priority" eval="2" />
|
||||
<field name="arch" type="xml">
|
||||
<form string="EBICS Administrative Order result">
|
||||
<separator colspan="4" string="Results :" />
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="ebics_change_passphrase_view_form" model="ir.ui.view">
|
||||
<field name="name">EBICS Keys Change Passphrase</field>
|
||||
<field name="model">ebics.change.passphrase</field>
|
||||
<field name="priority">1</field>
|
||||
<field name="priority" eval="1" />
|
||||
<field name="arch" type="xml">
|
||||
<form string="EBICS Keys Change Passphrase">
|
||||
<group>
|
||||
@@ -40,7 +40,7 @@
|
||||
<record id="ebics_change_passphrase_view_form_result" model="ir.ui.view">
|
||||
<field name="name">EBICS Keys Change Passphrase</field>
|
||||
<field name="model">ebics.change.passphrase</field>
|
||||
<field name="priority">2</field>
|
||||
<field name="priority" eval="2" />
|
||||
<field name="arch" type="xml">
|
||||
<form string="EBICS Keys Change Passphrase">
|
||||
<separator colspan="4" string="Results :" />
|
||||
|
||||
@@ -196,7 +196,7 @@ class EbicsXfer(models.TransientModel):
|
||||
|
||||
def ebics_upload(self):
|
||||
self.ensure_one()
|
||||
ctx = self._context.copy()
|
||||
ctx = self.env.context.copy()
|
||||
ebics_file = self._ebics_upload()
|
||||
if ebics_file:
|
||||
ctx["ebics_file_id"] = ebics_file.id
|
||||
@@ -221,9 +221,9 @@ class EbicsXfer(models.TransientModel):
|
||||
client = self._setup_client()
|
||||
if not client:
|
||||
err_cnt += 1
|
||||
self.note += (
|
||||
self.env._("EBICS client setup failed for connection '%s'")
|
||||
% self.ebics_config_id.name
|
||||
self.note += self.env._(
|
||||
"EBICS client setup failed for connection '%s'",
|
||||
self.ebics_config_id.name,
|
||||
)
|
||||
else:
|
||||
download_formats = (
|
||||
@@ -332,11 +332,8 @@ class EbicsXfer(models.TransientModel):
|
||||
if ebics_files:
|
||||
self.note += "\n"
|
||||
for f in ebics_files:
|
||||
self.note += (
|
||||
self.env._(
|
||||
"EBICS File '%s' is available for further processing."
|
||||
)
|
||||
% f.name
|
||||
self.note += self.env._(
|
||||
"EBICS File '%s' is available for further processing.", f.name
|
||||
)
|
||||
self.note += "\n"
|
||||
|
||||
@@ -360,7 +357,7 @@ class EbicsXfer(models.TransientModel):
|
||||
act = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
f"{module}.ebics_file_action_download"
|
||||
)
|
||||
act["domain"] = [("id", "in", self._context["ebics_file_ids"])]
|
||||
act["domain"] = [("id", "in", self.env.context["ebics_file_ids"])]
|
||||
return act
|
||||
|
||||
def _ebics_upload(self):
|
||||
@@ -402,14 +399,13 @@ class EbicsXfer(models.TransientModel):
|
||||
OrderID = client.upload(order_type, upload_data)
|
||||
if OrderID:
|
||||
self.note += "\n"
|
||||
self.note += (
|
||||
self.env._("EBICS File has been uploaded (OrderID %s).")
|
||||
% OrderID
|
||||
self.note += self.env._(
|
||||
"EBICS File has been uploaded (OrderID %s).", OrderID
|
||||
)
|
||||
ef_note = self.env._("EBICS OrderID: %s") % OrderID
|
||||
ef_note = self.env._("EBICS OrderID: %s", OrderID)
|
||||
if self.env.context.get("origin"):
|
||||
ef_note += (
|
||||
"\n" + self.env._("Origin: %s") % self._context["origin"]
|
||||
ef_note += "\n" + self.env._(
|
||||
"Origin: %s", self.env.context["origin"]
|
||||
)
|
||||
suffix = self.format_id.suffix
|
||||
fn = self.upload_fname
|
||||
@@ -421,7 +417,7 @@ class EbicsXfer(models.TransientModel):
|
||||
"date": fields.Datetime.now(),
|
||||
"format_id": self.format_id.id,
|
||||
"state": "done",
|
||||
"user_id": self._uid,
|
||||
"user_id": self.env.uid,
|
||||
"ebics_userid_id": self.ebics_userid_id.id,
|
||||
"note": ef_note,
|
||||
"company_ids": [
|
||||
@@ -598,9 +594,9 @@ class EbicsXfer(models.TransientModel):
|
||||
self.env._(
|
||||
"EBICS File with name '%s' has already been downloaded."
|
||||
"\nPlease check this file and rename in case there is "
|
||||
"no risk on duplicate transactions."
|
||||
"no risk on duplicate transactions.",
|
||||
fn,
|
||||
)
|
||||
% fn
|
||||
)
|
||||
data = base64.encodebytes(data)
|
||||
ef_vals = {
|
||||
@@ -611,7 +607,7 @@ class EbicsXfer(models.TransientModel):
|
||||
"date_to": self.date_to,
|
||||
"format_id": file_format.id,
|
||||
"state": file_format.download_process_method and "draft" or "done",
|
||||
"user_id": self._uid,
|
||||
"user_id": self.env.uid,
|
||||
"ebics_userid_id": self.ebics_userid_id.id,
|
||||
"company_ids": self.ebics_config_id.company_ids.ids,
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="ebics_xfer_view_form_download" model="ir.ui.view">
|
||||
<field name="name">EBICS File Download</field>
|
||||
<field name="model">ebics.xfer</field>
|
||||
<field name="priority">1</field>
|
||||
<field name="priority" eval="1" />
|
||||
<field name="arch" type="xml">
|
||||
<form string="EBICS File Download">
|
||||
<group>
|
||||
@@ -55,7 +55,7 @@
|
||||
<record id="ebics_xfer_view_form_upload" model="ir.ui.view">
|
||||
<field name="name">EBICS File Upload</field>
|
||||
<field name="model">ebics.xfer</field>
|
||||
<field name="priority">1</field>
|
||||
<field name="priority" eval="1" />
|
||||
<field name="arch" type="xml">
|
||||
<form string="EBICS File Upload">
|
||||
<group>
|
||||
@@ -120,7 +120,7 @@
|
||||
<record id="ebics_xfer_view_form_result" model="ir.ui.view">
|
||||
<field name="name">EBICS File Transfer</field>
|
||||
<field name="model">ebics.xfer</field>
|
||||
<field name="priority">2</field>
|
||||
<field name="priority" eval="2" />
|
||||
<field name="arch" type="xml">
|
||||
<form string="EBICS File Transfer">
|
||||
<separator colspan="4" string="Results :" />
|
||||
|
||||
Reference in New Issue
Block a user