Skip to content

Conversation

@ntsirintanis
Copy link

No description provided.

@thomaspaulb
Copy link

So to discuss about the methodology (source: this doc):

  1. What the current version 16.0 module does, before this PR, is to create an unstructured address block with no TwnNm and just a Ctry and two AdrLine blocks. I understand that this has become forbidden.
  2. In the new situation we can choose the structured address block, however, unless OCA's base_address_extended is installed and all fields of the partner duly filled, it's pretty hard to get this right
  3. So, it is more realistic to aim to generate the hybrid address block, where PstCd is optional, TwnNm and Ctry are mandatory and the address is complemented by two 70-character-max AdrLine blocks.

What we have implemented now is that when the "enforce hybrid mode" checkbox is checked, it adds TwnNm and Ctry and does not include any AdrLine blocks.

Perhaps what's even better is that we always assume hybrid mode and:

  • Always add TwnNm, eg if partner.city is empty, raise an error or fully omit the address block
  • Always try adding PstCd from the "zip" field in Odoo
  • Still add AdrLine blocks, but don't repeat any information in it eg don't put post code and city there

if bank_id:
bank = self.env["res.bank"].browse(bank_id)
else:
po_id = self.env.context.get("payment_order_id")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ntsirintanis I can't find anywhere where the payment_order_id is passed to the context.

In anycase, self should get you the current payment order.
So bank = po.journal_id.bank_account_id.bank_id should work also.

)
if bank:
self = self.with_context(export_bank_id=bank.id)
return super().generate_payment_file()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ntsirintanis This is not reached when using the account_banking_sepa_credit_transfer or the account_banking_sepa_direct_debit.

It would be better to inject the bank_id to open2generated() instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is an api.model so self may or may not be an empty recordset

@ntsirintanis ntsirintanis force-pushed the 16.0-account_banking_pain_base_sepa_hybrid branch from 386ff1c to 722010f Compare November 13, 2025 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants