[FIX] account_payment_partner: keep the default value for partner_bank_id#1418
[FIX] account_payment_partner: keep the default value for partner_bank_id#1418
Conversation
|
This is a more focused fix for #1408 |
|
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. |
|
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 |
|
@pedrobaeza 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? |
|
Please specify which is the issue in the Swiss localization for determining if there are options to solve it. |
|
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. |
|
@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. |
|
The reasoning for emptying the bank account is to keep the "non deterministic" state until the payment/debit order is done. Check this use case (which is more usual than you think):
Having the bank account fixed on invoice creation, provokes returns due to the invalid bank account number. And a lot of users don't have decided yet on invoice issuing the payment mode, so they don't set it. That's why we try to always keep it empty. In fact, we never mark the I also remember a glitch that puts the bank account without this part on the invoice creation, but this may changed over the versions. Removing this part, it will affect installations relying on that behavior. Something we can do is to add a company flag |
|
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
|
@pedrobaeza @sbidoul How can we unblock this PR? It's a shame having to integrate this in all our 16.0+17.0 instances when account_payment_partner is installed |
|
Nobody has answered my comment at #1418 (comment), and anyway, this CI is red. |
|
Hi @pedrobaeza I think that the issue you describe in #1418 (comment) is valid for bills and out payments, but is not so relevant for customer invoices and in payment where what we want to add on account.move is our own bank account, not the one from the customer which can be calculated (this was already my proposal here : #1290 (comment)) |
|
@remi-filament having only one field for the bank account, if you add your own bank account in there, the payment order will be issued incorrectly. Why is not OK to have that data dynamically populated in the invoice report? That's already the case. Do you know it? |
|
You mean here : https://github.com/odoo/odoo/blob/9ab9e254cb0658e38dc0b9c4fe54c317e184bb04/addons/account/views/report_invoice.xml#L207 ? The point is that if you do not use any payment mode on customer invoices, the field is not filled anymore, so you need to fill it manually for each customer invoice you issue (even worse when using contracts where invoices are auto-generated and you do not expect to have to go to each to set your bank account) |
|
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
|
hi @sbidoul is it possible to fix this pr or rebase this one ? this PR block others prs, perhaps we can go with this solutions no ? |
…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.
7435d4c to
dbc8ff5
Compare
|
@cyrilmanuel I rebased, but this PR is blocked by #1418 (comment). I still think this PR provides a better behaviour that respects how standard Odoo works, though. |
|
Pedro wrote:
Is this something that would be acceptable? Could we contribute this to your pull request? |
@gurneyalex Feel free to pick up this PR, of course. |
…thout payment mode Add a company-level setting keep_partner_bank_without_payment_mode (default True) that controls whether partner_bank_id is preserved or cleared when no payment mode is set on an invoice. When enabled (default), invoices without a payment mode keep the bank account auto-selected by Odoo core. When disabled, the bank account is cleared (legacy behavior). This resolves the long-standing disagreement in OCA#1418 by letting each company choose the behavior that fits their workflow.
|
Merging #1555 that includes this, but through a configurable option. |
…thout payment mode Add a company-level setting keep_partner_bank_without_payment_mode (default True) that controls whether partner_bank_id is preserved or cleared when no payment mode is set on an invoice. When enabled (default), invoices without a payment mode keep the bank account auto-selected by Odoo core. When disabled, the bank account is cleared (legacy behavior). This resolves the long-standing disagreement in OCA#1418 by letting each company choose the behavior that fits their workflow.
…thout payment mode Add a company-level setting keep_partner_bank_without_payment_mode (default True) that controls whether partner_bank_id is preserved or cleared when no payment mode is set on an invoice. When enabled (default), invoices without a payment mode keep the bank account auto-selected by Odoo core. When disabled, the bank account is cleared (legacy behavior). This resolves the long-standing disagreement in OCA#1418 by letting each company choose the behavior that fits their workflow.
…thout payment mode Add a company-level setting keep_partner_bank_without_payment_mode (default True) that controls whether partner_bank_id is preserved or cleared when no payment mode is set on an invoice. When enabled (default), invoices without a payment mode keep the bank account auto-selected by Odoo core. When disabled, the bank account is cleared (legacy behavior). This resolves the long-standing disagreement in OCA#1418 by letting each company choose the behavior that fits their workflow.
…thout payment mode Add a company-level setting keep_partner_bank_without_payment_mode (default True) that controls whether partner_bank_id is preserved or cleared when no payment mode is set on an invoice. When enabled (default), invoices without a payment mode keep the bank account auto-selected by Odoo core. When disabled, the bank account is cleared (legacy behavior). This resolves the long-standing disagreement in OCA#1418 by letting each company choose the behavior that fits their workflow.
…thout payment mode Add a company-level setting keep_partner_bank_without_payment_mode (default True) that controls whether partner_bank_id is preserved or cleared when no payment mode is set on an invoice. When enabled (default), invoices without a payment mode keep the bank account auto-selected by Odoo core. When disabled, the bank account is cleared (legacy behavior). This resolves the long-standing disagreement in OCA#1418 by letting each company choose the behavior that fits their workflow.
…thout payment mode Add a company-level setting keep_partner_bank_without_payment_mode (default True) that controls whether partner_bank_id is preserved or cleared when no payment mode is set on an invoice. When enabled (default), invoices without a payment mode keep the bank account auto-selected by Odoo core. When disabled, the bank account is cleared (legacy behavior). This resolves the long-standing disagreement in OCA#1418 by letting each company choose the behavior that fits their workflow.
…thout payment mode Add a company-level setting keep_partner_bank_without_payment_mode (default True) that controls whether partner_bank_id is preserved or cleared when no payment mode is set on an invoice. When enabled (default), invoices without a payment mode keep the bank account auto-selected by Odoo core. When disabled, the bank account is cleared (legacy behavior). This resolves the long-standing disagreement in OCA#1418 by letting each company choose the behavior that fits their workflow.
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.