-
-
Notifications
You must be signed in to change notification settings - Fork 552
[16.0][IMP] Take allow_out_payment into account on payment order #1340
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
base: 16.0
Are you sure you want to change the base?
[16.0][IMP] Take allow_out_payment into account on payment order #1340
Conversation
9a523ec
to
386628a
Compare
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.
GJ 💪
Just a minor change 🙏
386628a
to
5f1064e
Compare
5f1064e
to
a02bcff
Compare
/ocabot merge minor |
Hey, thanks for contributing! Proceeding to merge this for you. |
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 have stopped the merge. AFAIK, @sbidoul commented that wants to be able to add the lines, but not to confirm the order, and this is pre-filtering the non-allowed bank accounts previously if I understand the code right.
@adrienpeiffer your merge command was aborted due to failed check(s), which you can inspect on this commit of 16.0-ocabot-merge-pr-1340-by-adrienpeiffer-bump-minor. After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red. |
@pedrobaeza Not sure to understand. The check is done in draft2open method. |
I mean this code for example: It's avoiding to include the lines in the order. |
Isn't that exactly the code approved in #1177 ? |
OK, I based my review in #1177 (comment). Let me check again. |
@lmarion-source Could you remove blank lines (cfr pedro's review) |
It is my impression that Odoo Enterprise works like that, and it makes sense to me, since the process of preparing payment orders is distinct from the process of validating bank accounts, and often done by different persons. So I think it's better to let both processes run in parallel and block at the last moment. Cherry on the cake would be a warning when an non validated bank account is used in a payment line, but that can be done in another PR. |
a02bcff
to
565a13b
Compare
Hmm, we solved this completely differently. I get the minimal touch here, but we made a seperate module that hit all the places Odoo gets this wrong, mostly purchase order and account move but also payment with a single function on bank to get a valid out payment bank account. Then overrode |
1cd2603
to
adb3c59
Compare
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. |
Reopening as I think it needs another review round after the last commits. What's the status of this? |
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 like the approach of letting the user making the payment order and block at the end in case of unvalidated account.
I would be really interested to get it merge soon as I'd need to forward-port it to v17.0
@lmarion-source Could you please resolve conflicts ? |
ping @lmarion-source |
092cb52
to
534deff
Compare
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.
Almost good, thanks!
A previous MR existed but only when payment order was triggered from invoices. We added the case also directement from confirm button on payment order original PR: OCA#1177
534deff
to
f97f52f
Compare
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.
Code LGTM
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
@pedrobaeza can you update your review here? |
.sudo() | ||
.get_param("account_payment_order.use_allow_out_payment") | ||
): | ||
payline._check_bank_allows_out_payments() |
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.
Don't we need to check that payment_type
is outbound
here? Because this check does not make sense for a debit order.
@@ -71,10 +71,10 @@ def _prepare_payment_line_vals(self, payment_order): | |||
# in this case | |||
if payment_order.payment_type == "outbound": | |||
amount_currency *= -1 | |||
partner_bank_id = self.partner_bank_id.id or first(self.partner_id.bank_ids).id | |||
partner_bank_id = self.partner_bank_id or first(self.partner_id.bank_ids) |
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.
partner_bank_id = self.partner_bank_id or first(self.partner_id.bank_ids) | |
partner_bank = self.partner_bank_id or first(self.partner_id.bank_ids) |
@lmarion-source can you please check the latest comments? |
A previous MR existed but only when payment order was triggered from invoices.
We added the case also directly from confirm button on payment order
Original PR: #1177
Closes #1330