[MIG] account_ebics: Migration to 17.0

This commit is contained in:
Luc De Meyer
2024-01-26 22:36:02 +01:00
parent e22fb104ea
commit d2af2cfe8e
11 changed files with 81 additions and 151 deletions

View File

@@ -1,4 +1,4 @@
# Copyright 2009-2023 Noviat.
# Copyright 2009-2024 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl).
import logging
@@ -22,23 +22,17 @@ class EbicsConfig(models.Model):
_order = "name"
name = fields.Char(
readonly=True,
states={"draft": [("readonly", False)]},
required=True,
)
journal_ids = fields.Many2many(
comodel_name="account.journal",
relation="account_journal_ebics_config_rel",
readonly=True,
states={"draft": [("readonly", False)]},
string="Bank Accounts",
domain="[('type', '=', 'bank')]",
)
ebics_host = fields.Char(
string="EBICS HostID",
required=True,
readonly=True,
states={"draft": [("readonly", False)]},
help="Contact your bank to get the EBICS HostID."
"\nIn France the BIC is usually allocated to the HostID "
"whereas in Germany it tends to be an institute specific string "
@@ -47,8 +41,6 @@ class EbicsConfig(models.Model):
ebics_url = fields.Char(
string="EBICS URL",
required=True,
readonly=True,
states={"draft": [("readonly", False)]},
help="Contact your bank to get the EBICS URL.",
)
ebics_version = fields.Selection(
@@ -58,16 +50,12 @@ class EbicsConfig(models.Model):
("H005", "H005 (3.0)"),
],
string="EBICS protocol version",
readonly=True,
states={"draft": [("readonly", False)]},
required=True,
default="H004",
)
ebics_partner = fields.Char(
string="EBICS PartnerID",
required=True,
readonly=True,
states={"draft": [("readonly", False)]},
help="Organizational unit (company or individual) "
"that concludes a contract with the bank. "
"\nIn this contract it will be agreed which order types "
@@ -81,8 +69,6 @@ class EbicsConfig(models.Model):
comodel_name="ebics.userid",
inverse_name="ebics_config_id",
string="EBICS UserID",
readonly=True,
states={"draft": [("readonly", False)]},
help="Human users or a technical system that is/are "
"assigned to a customer. "
"\nOn the EBICS bank server it is identified "
@@ -96,8 +82,6 @@ class EbicsConfig(models.Model):
ebics_keys = fields.Char(
string="EBICS Keys Root",
required=True,
readonly=True,
states={"draft": [("readonly", False)]},
default=lambda self: self._default_ebics_keys(),
help="Root Directory for storing the EBICS Keys.",
)
@@ -105,15 +89,11 @@ class EbicsConfig(models.Model):
selection=[("A005", "A005 (RSASSA-PKCS1-v1_5)"), ("A006", "A006 (RSASSA-PSS)")],
string="EBICS key version",
default="A006",
readonly=True,
states={"draft": [("readonly", False)]},
help="The key version of the electronic signature.",
)
ebics_key_bitlength = fields.Integer(
string="EBICS key bitlength",
default=2048,
readonly=True,
states={"draft": [("readonly", False)]},
help="The bit length of the generated keys. "
"\nThe value must be between 1536 and 4096.",
)
@@ -122,19 +102,15 @@ class EbicsConfig(models.Model):
column1="config_id",
column2="format_id",
string="EBICS File Format",
readonly=True,
states={"draft": [("readonly", False)]},
)
state = fields.Selection(
[("draft", "Draft"), ("confirm", "Confirmed")],
selection=[("draft", "Draft"), ("confirm", "Confirmed")],
default="draft",
required=True,
readonly=True,
)
order_number = fields.Char(
size=4,
readonly=True,
states={"draft": [("readonly", False)]},
help="Specify the number for the next order."
"\nThis number should match the following pattern : "
"[A-Z]{1}[A-Z0-9]{3}",

View File

@@ -1,4 +1,4 @@
# Copyright 2009-2023 Noviat.
# Copyright 2009-2024 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl).
from odoo import api, fields, models
@@ -110,11 +110,10 @@ class EbicsFileFormat(models.Model):
if self.type == "up":
self.download_process_method = False
def name_get(self):
res = []
@api.depends("ebics_version", "name", "btf_message", "description")
def _compute_display_name(self):
for rec in self:
name = rec.ebics_version == "2" and rec.name or rec.btf_message
if rec.description:
name += " - " + rec.description
res.append((rec.id, name))
return res
rec.display_name = name

View File

@@ -47,8 +47,6 @@ class EbicsUserID(models.Model):
name = fields.Char(
string="EBICS UserID",
required=True,
readonly=True,
states={"draft": [("readonly", False)]},
help="Human users or a technical system that is/are "
"assigned to a customer. "
"\nOn the EBICS bank server it is identified "
@@ -71,14 +69,10 @@ class EbicsUserID(models.Model):
help="Users who are allowed to use this EBICS UserID for "
" bank transactions.",
)
# Currently only a single signature class per user is supported
# Classes A and B are not yet supported.
signature_class = fields.Selection(
selection=[("E", "Single signature"), ("T", "Transport signature")],
required=True,
default="T",
readonly=True,
states={"draft": [("readonly", False)]},
help="Default signature class."
"This default can be overriden for specific "
"EBICS transactions (cf. File Formats).",
@@ -152,44 +146,28 @@ class EbicsUserID(models.Model):
# create self-signed X.509 certificates
ebics_key_x509 = fields.Boolean(
string="X509 support",
readonly=True,
states={"draft": [("readonly", False)]},
help="Set this flag in order to work with " "self-signed X.509 certificates",
)
ebics_key_x509_dn_cn = fields.Char(
string="Common Name [CN]",
readonly=True,
states={"draft": [("readonly", False)]},
)
ebics_key_x509_dn_o = fields.Char(
string="Organization Name [O]",
readonly=True,
states={"draft": [("readonly", False)]},
)
ebics_key_x509_dn_ou = fields.Char(
string="Organizational Unit Name [OU]",
readonly=True,
states={"draft": [("readonly", False)]},
)
ebics_key_x509_dn_c = fields.Char(
string="Country Name [C]",
readonly=True,
states={"draft": [("readonly", False)]},
)
ebics_key_x509_dn_st = fields.Char(
string="State Or Province Name [ST]",
readonly=True,
states={"draft": [("readonly", False)]},
)
ebics_key_x509_dn_l = fields.Char(
string="Locality Name [L]",
readonly=True,
states={"draft": [("readonly", False)]},
)
ebics_key_x509_dn_e = fields.Char(
string="Email Address",
readonly=True,
states={"draft": [("readonly", False)]},
)
state = fields.Selection(
[