-
-
Notifications
You must be signed in to change notification settings - Fork 577
[16.0][FIX] account_payment_order: Keep partner_bank_id correct value on payments belonging to payment order #1213
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
This PR has the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really see the use case for the re-triggering you are talking about, and the tests are just launching manually the compute method.
d5694f6 to
c45d43e
Compare
| # fields value doesn't change | ||
| with Form(payment) as payment_form: | ||
| payment_form.partner_id = self.env["res.partner"] | ||
| payment_form.partner_id = payment_line.partner_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test case is still a non real one and doesn't reflect a business case. What are you trying to accomplish? Maybe what we have to do is to forbid changing account.payment linked to payment orders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified tests to a more "likely" use case un which a user can accidentaly modify a field on account.payment model's form view. partner_bank_id field would get an incorrect value.
I recorded a video reproducing the issue. In this case field turns to False because journal has no bank:
Odoo.-.PAY0001.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @pedrobaeza is it ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the video. I think the proper fix should be to block any change (through an override in the write method of the account.payment) if it's linked to a payment order.
c45d43e to
7d2ad66
Compare
2468389 to
d825924
Compare
d825924 to
e8670c1
Compare
…en compute method is triggered When account module's _compute_available_partner_bank_ids method was executed over payments belonging to a payment order an incorrect value for partner_bank_id field was set. This module now overrides _compute_available_partner_bank_ids function so that payments belonging to a payment order keep their partner_bank_id value
e8670c1 to
c11242d
Compare
|
This is better fixed IMO here: #1346 Do you have anyway the trigger conditions? |
A trigger condicion can be seen in the video I recorded for this PR a few months ago |
|
But I wasn't able to reproduce it on the same conditions, @aritzolea. It seems something that depends on the module stack. Did you do it on runboat? Anyway, as said, the other PR is more focused IMO. |
|
Do you agree then to switch to the other PR? |
I was able to reproduce the error in 16.0 runboat, and the solution in your PR's runboat |
|
OK, then are you ok with continuing with the other PR? |
Yes, it can be continued on the other PR. |
|
Thanks. |
Payments (
account.payment) belonging to a payment order (account.payment.order) are assigned the partner bank account on their creation which doesn't follow the pattern defined on the_compute_available_partner_bank_idsfrom theaccountmodule.This is not important while the compute method is not triggered, but if it gets triggered the original partner_bank_id value gets replaced by the value defined in the compute method (journal's bank in case of incoming payment orders). This affects to the creation of sepa files, because the bank accounts listed in the file are not correct.
This fix overrides
_compute_available_partner_bank_idsfunction onaccount_payment_ordermodule. For payments which belong to a payment order and are generated from payment lines (account.payment.line), it assigns the partner_bank_id from the origin payment lines.