Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] account_payment_partner: keep the default value for partner_bank_id #1418

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

sbidoul
Copy link
Member

@sbidoul sbidoul commented Feb 11, 2025

The Odoo default computation for partner_bank_id on customer invoices sets the first bank account of the company.

The override in account_payment_partner resets it to false if there is no payment mode defined.

Since for customer invoices we usually don't define a payment mode (unless when using direct debit), this partner_bank_id field is therefore emptied.

This is problematic for instance when generating UBL invoices with the official Odoo module, because the bank account is mandatory to create a valid Peppol document.

Therefore I propose to keep the default behaviour if there is no payment mode on the invoice.

…k_id

The Odoo default computation for partner_bank_id on customer invoices sets
the first bank account of the company.

The override in account_payment_partner resets it to false if there is no payment mode defined.

Since for customer invoices we usually don't define a payment mode (unless when using direct debit),
this partner_bank_id field is therefore emptied.

This is problematic for instance when generating UBL invoices with the official Odoo module,
because the bank account is mandatory to create a valid Peppol document.
@sbidoul
Copy link
Member Author

sbidoul commented Feb 11, 2025

This is a more focused fix for #1408

@grindtildeath
Copy link
Contributor

@sbidoul I forward ported this change to v17.0 and fixed the test in #1423

@pedrobaeza
Copy link
Member

The idea behind the else part is for avoiding Odoo assigning a partner bank automatically, which does harm, as the payment/debit order auto-selection mechanism won't select the more suitable one, and you can see by the red CI that this is something intended.

@Tisho99
Copy link
Contributor

Tisho99 commented Feb 20, 2025

@grindtildeath

Yes, my module is based on the feature that an invoice does not have to have a bank account if it does not have a payment mode.

If this is going to be merged, my test and my module will need a little refactor to edit the default bank account if there is not a payment mode.

However, i think the best is waiting for the original v16 PR to be merged and resolve Pedro's comments

@grindtildeath
Copy link
Contributor

grindtildeath commented Feb 26, 2025

@pedrobaeza
This is actually breaking a core behaviour of Odoo. Although this might not suit your needs, it's breaking the swiss localization and we have to fix that.

IMO if someone wants to deactivate this assignation done by Odoo, which I can understand, I would suggest to add a setting (eg on the journal) so that the computation can rely on this setting to remove the automatically assigned value.

Please consider payment mode can be installed on an instance where it's not used by all the companies, in that case, it shouldn't break default behaviours as is the case with this compute.

@Tisho99 what do you think about adding such a setting?

@pedrobaeza
Copy link
Member

pedrobaeza commented Feb 27, 2025

Please specify which is the issue in the Swiss localization for determining if there are options to solve it.

@Tisho99
Copy link
Contributor

Tisho99 commented Feb 27, 2025

@grindtildeath

At first glance, I think that adding a configuration option is a good idea. If the default operation is left as it is now (setting the bank account to false if there is no payment method), it will not be necessary to refectorize other modules, just activate the option with Swiss accounting.

@sbidoul
Copy link
Member Author

sbidoul commented Feb 27, 2025

@pedrobaeza this is not only Swiss accounting. See the description of this issue. The default Odoo behaviour of selecting the company bank account on customer invoices is disabled, so various standard Odoo behaviours that depend on having the bank account populated do not work anymore. Peppol invoice generation is an example. Adding QR code to the invoices is another.

My question is why it is necessary to disable the default Odoo behaviour when there is no payment mode. I could not determine that by reading the code and the tests.

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.

4 participants