diff --git a/README.md b/README.md
index c9e3a8b..a0977ab 100644
--- a/README.md
+++ b/README.md
@@ -15,12 +15,12 @@ Available addons
----------------
addon | version | maintainers | summary
--- | --- | --- | ---
-[account_ebics](account_ebics/) | 17.0.1.3.1 | | Download bank statements and upload payment files directly from Odoo, using the European EBICS standard
+[account_ebics](account_ebics/) | 17.0.1.4.0 | | Download bank statements and upload payment files directly from Odoo, using the European EBICS standard
[account_ebics_batch](account_ebics_batch/) | 17.0.1.0.1 | | Download and process your EBICS files automatically, on a schedule
-[account_ebics_batch_payment](account_ebics_batch_payment/) | 17.0.1.1.0 | | Send an Odoo Enterprise batch payment to the bank over EBICS
+[account_ebics_batch_payment](account_ebics_batch_payment/) | 17.0.1.2.0 | | Send an Odoo Enterprise batch payment to the bank over EBICS
[account_ebics_oca_statement_import](account_ebics_oca_statement_import/) | 17.0.1.0.1 | | Process EBICS statement files with the OCA bank statement import
[account_ebics_oe](account_ebics_oe/) | 17.0.1.0.0 | | Place the EBICS menus in the Odoo Enterprise accounting application
-[account_ebics_payment_order](account_ebics_payment_order/) | 17.0.1.2.0 | | Send an OCA payment order to the bank over EBICS
+[account_ebics_payment_order](account_ebics_payment_order/) | 17.0.1.2.1 | | Send an OCA payment order to the bank over EBICS
[//]: # (end addons)
diff --git a/account_ebics/__init__.py b/account_ebics/__init__.py
index 168985a..ecdeb04 100644
--- a/account_ebics/__init__.py
+++ b/account_ebics/__init__.py
@@ -1,5 +1,8 @@
+import functools
import logging
+from odoo import api
+
_logger = logging.getLogger(__name__)
try:
@@ -7,3 +10,22 @@ try:
from . import wizards
except Exception:
_logger.warning("Import Error, check if fintech lib has been installed")
+
+
+@functools.cached_property
+def neutralized(self):
+ return bool(
+ self["ir.config_parameter"].sudo().get_param("database.is_neutralized")
+ or self["ir.ui.view"]
+ .sudo()
+ .search_count(
+ [
+ ("key", "in", ("web.neutralize_banner", "website.neutralize_ribbon")),
+ ("active", "=", True),
+ ]
+ )
+ )
+
+
+api.Environment.neutralized = neutralized
+neutralized.__set_name__(api.Environment, "neutralized")
diff --git a/account_ebics/__manifest__.py b/account_ebics/__manifest__.py
index e44a5ba..60fc239 100644
--- a/account_ebics/__manifest__.py
+++ b/account_ebics/__manifest__.py
@@ -7,7 +7,7 @@
"Download bank statements and upload payment files directly from Odoo, "
"using the European EBICS standard"
),
- "version": "17.0.1.3.1",
+ "version": "17.0.1.4.0",
"license": "LGPL-3",
"author": "Noviat",
"website": "https://www.noviat.com/",
diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py
index 81aae3a..c9b9314 100644
--- a/account_ebics/models/ebics_file.py
+++ b/account_ebics/models/ebics_file.py
@@ -74,6 +74,12 @@ class EbicsFile(models.Model):
readonly=True,
)
note = fields.Text(string="Notes")
+ ebics_order_number = fields.Char(string="EBICS OrderID", readonly=True)
+ pain_state = fields.Selection(
+ [("draft", "Draft"), ("uploaded", "Uploaded"), ("error", "Error")],
+ default="draft",
+ readonly=True,
+ )
note_process = fields.Text(
string="Process Notes",
readonly=True,
diff --git a/account_ebics/views/ebics_file_views.xml b/account_ebics/views/ebics_file_views.xml
index 7fe4916..3a62ca8 100644
--- a/account_ebics/views/ebics_file_views.xml
+++ b/account_ebics/views/ebics_file_views.xml
@@ -71,7 +71,7 @@
ebics.file
1
-
diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py
index 8bb82d6..13dea76 100644
--- a/account_ebics/wizards/ebics_xfer.py
+++ b/account_ebics/wizards/ebics_xfer.py
@@ -406,9 +406,9 @@ class EbicsXfer(models.TransientModel):
self.note += (
_("EBICS File has been uploaded (OrderID %s).") % OrderID
)
- ef_note = _("EBICS OrderID: %s") % OrderID
+ ef_note = ""
if self.env.context.get("origin"):
- ef_note += "\n" + _("Origin: %s") % self._context["origin"]
+ ef_note = self.env._("Origin: %s", self.env.context["origin"])
suffix = self.format_id.suffix
fn = self.upload_fname
if suffix and not fn.endswith(suffix):
@@ -428,6 +428,9 @@ class EbicsXfer(models.TransientModel):
}
self._update_ef_vals(ef_vals)
ebics_file = self.env["ebics.file"].create(ef_vals)
+ ebics_file.write(
+ {"ebics_order_number": OrderID, "pain_state": "uploaded"}
+ )
except EbicsFunctionalError:
e = exc_info()
@@ -456,16 +459,32 @@ class EbicsXfer(models.TransientModel):
OrderID = self.ebics_config_id._get_order_number()
self.ebics_config_id.sudo()._update_order_number(OrderID)
- ebics_file and self._payment_order_postprocess(ebics_file)
+ ebics_file and self._payment_upload_postprocess(ebics_file)
return ebics_file
- def _payment_order_postprocess(self, ebics_file):
- active_model = self.env.context.get("model")
+ def _payment_upload_postprocess(self, ebics_file):
+ ctx = self.env.context
+ active_model = ctx.get("model")
+ active_id = ctx.get("id")
+ payment_doc = None
if active_model == "account.payment.order":
- order = self.env["account.payment.order"].browse(
- self.env.context["active_id"]
+ payment_doc = self.env["account.payment.order"].browse(active_id)
+ payment_doc.generated2uploaded()
+ elif active_model == "account.batch.payment":
+ payment_doc = self.env["account.batch.payment"].browse(active_id)
+ if payment_doc:
+ payment_doc.ebics_file_id = ebics_file
+ self._payment_upload_chatter_message(payment_doc, ebics_file)
+
+ def _payment_upload_chatter_message(self, payment_doc, ebics_file):
+ payment_doc.message_post(
+ body=self.env._(
+ "'%(filename)s' has been uploaded via EBICS"
+ " (OrderID: %(order_number)s).",
+ filename=ebics_file.name,
+ order_number=ebics_file.ebics_order_number,
)
- order.generated2uploaded()
+ )
def _setup_client(self):
self.ebics_config_id._check_ebics_keys()
diff --git a/account_ebics_batch_payment/__manifest__.py b/account_ebics_batch_payment/__manifest__.py
index 0ada3a8..f658341 100644
--- a/account_ebics_batch_payment/__manifest__.py
+++ b/account_ebics_batch_payment/__manifest__.py
@@ -4,7 +4,7 @@
{
"name": "EBICS - Batch Payments (Odoo Enterprise)",
"summary": "Send an Odoo Enterprise batch payment to the bank over EBICS",
- "version": "17.0.1.1.0",
+ "version": "17.0.1.2.0",
"license": "LGPL-3",
"author": "Noviat",
"website": "https://www.noviat.com/",
diff --git a/account_ebics_batch_payment/models/account_batch_payment.py b/account_ebics_batch_payment/models/account_batch_payment.py
index bdb891d..99697ac 100644
--- a/account_ebics_batch_payment/models/account_batch_payment.py
+++ b/account_ebics_batch_payment/models/account_batch_payment.py
@@ -8,19 +8,47 @@ from odoo.exceptions import UserError
class AccountBatchPayment(models.Model):
_inherit = "account.batch.payment"
+ ebics_config_id = fields.Many2one(
+ comodel_name="ebics.config",
+ related="journal_id.ebics_config_id",
+ )
+ ebics_file_id = fields.Many2one(
+ comodel_name="ebics.file",
+ string="EBICS Upload File",
+ readonly=True,
+ )
+ ebics_pain_state = fields.Selection(
+ related="ebics_file_id.pain_state",
+ string="EBICS Upload Status",
+ )
+ ebics_order_number = fields.Char(
+ related="ebics_file_id.ebics_order_number",
+ string="EBICS OrderID",
+ )
hide_ebics_upload = fields.Boolean(
compute="_compute_hide_ebics_upload", default=True
)
- @api.depends("journal_id.ebics_config_id", "file_generation_enabled", "state")
+ @api.depends(
+ "journal_id.ebics_config_id",
+ "file_generation_enabled",
+ "state",
+ "ebics_file_id.pain_state",
+ )
def _compute_hide_ebics_upload(self):
for rec in self:
rec.hide_ebics_upload = (
- not rec.journal_id.ebics_config_id
+ self.env.neutralized
+ or not rec.journal_id.ebics_config_id
or not rec.file_generation_enabled
or rec.state != "sent"
+ or rec.ebics_pain_state == "uploaded"
)
+ def export_batch_payment(self):
+ self.filtered("ebics_file_id").write({"ebics_file_id": False})
+ return super().export_batch_payment()
+
def ebics_upload(self):
self.ensure_one()
ctx = self.env.context.copy()
@@ -36,6 +64,8 @@ class AccountBatchPayment(models.Model):
"default_upload_data": self.export_file,
"default_upload_fname": self.export_filename,
"origin": origin,
+ "model": self._name,
+ "id": self.id,
}
)
diff --git a/account_ebics_batch_payment/views/account_batch_payment_views.xml b/account_ebics_batch_payment/views/account_batch_payment_views.xml
index ed9d7f0..8bf7832 100644
--- a/account_ebics_batch_payment/views/account_batch_payment_views.xml
+++ b/account_ebics_batch_payment/views/account_batch_payment_views.xml
@@ -14,8 +14,21 @@
invisible="hide_ebics_upload"
string="EBICS Upload"
/>
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/account_ebics_payment_order/__manifest__.py b/account_ebics_payment_order/__manifest__.py
index 374cf0e..b607894 100644
--- a/account_ebics_payment_order/__manifest__.py
+++ b/account_ebics_payment_order/__manifest__.py
@@ -4,7 +4,7 @@
{
"name": "EBICS - Payment Orders (OCA)",
"summary": "Send an OCA payment order to the bank over EBICS",
- "version": "17.0.1.2.0",
+ "version": "17.0.1.2.1",
"license": "LGPL-3",
"author": "Noviat",
"website": "https://www.noviat.com/",
diff --git a/account_ebics_payment_order/models/account_payment_order.py b/account_ebics_payment_order/models/account_payment_order.py
index f268734..37eff4d 100644
--- a/account_ebics_payment_order/models/account_payment_order.py
+++ b/account_ebics_payment_order/models/account_payment_order.py
@@ -29,7 +29,8 @@ class AccountPaymentOrder(models.Model):
)
ctx.update(
{
- "active_model": self._name,
+ "model": self._name,
+ "id": self.id,
"default_format_id": ebics_format_id.id,
}
)