[IMP] Add upload state tracking on EBICS payment files

account_ebics:
- Add pain_state and ebics_order_number to ebics.file
- Set these fields after a successful upload
- Add neutralized property to api.Environment

account_ebics_batch_payment:
- Add EBICS notebook page with upload info to batch payment form
- Post chatter message with OrderID after upload

account_ebics_payment_order:
- Fix broken postprocess: replace deprecated active_model/active_id
  context keys with model/id
This commit is contained in:
Luc De Meyer committed 2026-11-30 20:58:21 +01:00
1 parent 37e65b30fa
commit 921a7a366f
3 files changed
+46 -3

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
{ {
"name": "EBICS - Batch Payments (Odoo Enterprise)", "name": "EBICS - Batch Payments (Odoo Enterprise)",
"summary": "Send an Odoo Enterprise batch payment to the bank over EBICS", "summary": "Send an Odoo Enterprise batch payment to the bank over EBICS",
"version": "19.0.1.2.0", "version": "19.0.1.3.0",
"license": "LGPL-3", "license": "LGPL-3",
"author": "Noviat", "author": "Noviat",
"website": "https://www.noviat.com/", "website": "https://www.noviat.com/",
@@ -8,19 +8,47 @@ from odoo.exceptions import UserError
class AccountBatchPayment(models.Model): class AccountBatchPayment(models.Model):
_inherit = "account.batch.payment" _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( hide_ebics_upload = fields.Boolean(
compute="_compute_hide_ebics_upload", default=True 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): def _compute_hide_ebics_upload(self):
for rec in self: for rec in self:
rec.hide_ebics_upload = ( 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 not rec.file_generation_enabled
or rec.state != "sent" 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): def ebics_upload(self):
self.ensure_one() self.ensure_one()
ctx = self.env.context.copy() ctx = self.env.context.copy()
@@ -38,6 +66,8 @@ class AccountBatchPayment(models.Model):
"default_upload_data": self.export_file, "default_upload_data": self.export_file,
"default_upload_fname": self.export_filename, "default_upload_fname": self.export_filename,
"origin": origin, "origin": origin,
"model": self._name,
"id": self.id,
} }
) )
@@ -14,6 +14,19 @@
class="oe_highlight" class="oe_highlight"
/> />
</button> </button>
<notebook position="inside">
<page
string="EBICS upload info"
name="ebics"
invisible="not ebics_config_id"
>
<group name="ebics_info">
<field name="ebics_file_id" string="Upload File" />
<field name="ebics_pain_state" string="Upload Status" />
<field name="ebics_order_number" />
</group>
</page>
</notebook>
</field> </field>
</record> </record>
</odoo> </odoo>