-
-
Notifications
You must be signed in to change notification settings - Fork 526
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
[16.0][FIX] account_payment_sale: Force add payment mode in invoice vals #1268
base: 16.0
Are you sure you want to change the base?
Conversation
@rousseldenis can you confirm the issue? |
2669200
to
21380e0
Compare
@francesco-ooops I have added a test to see the error |
Pre-commit fails due to another module: |
@ramiadavid Can you rebase? This might fix the pre-commit error |
21380e0
to
f2a04c8
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 Review: LGTM
Although I agree there should be a solution, the intention of no setting such vals is to keep the partner's payment mode in the moment of the invoice creation, so what about assigning such payment mode following the same rules as if you select the partner in the invoice? |
I'll check but indeed this seems correct. |
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.
Please check my comment
Because payment mode could be set manually on the order side and should be kept. If I have understood your question |
It's not a direct question, but how to implement the fix. |
I clarify more: I'm asking for not putting
which is what happens currently. |
The other option is to strip out the vals entry before creation if False for letting the computed to act. This can be more optimal for avoiding to duplicate code. |
Yes, I've just seen it. @ramiadavid Could you maybe try to remove the get_payment_mode_vals() function and override the compute methods defined in account_payment_partner instead ? |
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. |
Since this PR #1246 was added, an error occurs when there are orders without payment_mode_id along with others that do have them when comparing None > int
`TypeError: '<' not supported between instances of 'NoneType' and 'int'
The error occurs here:
https://github.com/odoo/odoo/blob/fe2fb05892e273587996a2f68cd53fc4f8604c6e/addons/sale/models/sale_order.py#L1149-L1156
Fixed by forcing payment_mode_id to be added even if it is empty because False can be compared with integer