-
-
Notifications
You must be signed in to change notification settings - Fork 688
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][MIG] account_invoice_fixed_discount: Migration to 16.0 #1488
[16.0][MIG] account_invoice_fixed_discount: Migration to 16.0 #1488
Conversation
32df308
to
2720195
Compare
@PieterPaulussen are you still working on this migration? |
@CRogos Hi, sorry, left this PR a bit hanging at the moment. There are a few fixes that still need to be applied to the code. If you want, you can fork the repo and apply the fixes. I'll see if I can do it later this evening myself otherwise. |
Thank you for the quick response. If you can do it in the near future, I'll happy to wait. Contact me if you need some help or when you are ready for review. |
1469dc0
to
532213c
Compare
from odoo import api, fields, models | ||
|
||
|
||
class AccountMove(models.Model): |
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 think it would be better to split the file into two. The first for account_move and the second for account_move_line
@@ -22,12 +22,6 @@ | |||
> | |||
<field name="discount_fixed" groups="base.group_no_one" /> | |||
</xpath> | |||
<xpath |
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.
Why do you remove this?
from odoo.tests import TransactionCase | ||
from odoo.tests import SavepointCase | ||
|
||
|
||
class TestInvoiceFixedDiscount(TransactionCase): | ||
class TestInvoiceFixedDiscount(SavepointCase): |
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.
SavepointCase class is now deprecated, you should use TransactionCase instead.
Thanks for contributing @PieterPaulussen |
532213c
to
0f2a152
Compare
@PieterPaulussen This is a duplicate as there is already #1481 |
Thx for the link to the other PR. Didn't find it, too. But the test of the other PR are only green, because the were all deleted. Nevertheless there is some good changes which can be added here, too. |
@rousseldenis @CRogos I believe the other PR is insufficient. I'm testing the module locally for the migration and noticed that most of the upstream methods do not exist at all. So all the The implementation of the price fields has completely changed in V16.0 compared to the last version of this module by refactoring all the fields to computed fields with inverse onchanges. My interpretation of the module is that this serves as a 'convenience' module to the user to give explicit discounts. Therefor I'm going to suggest to change the implementation. By reverse calculating the discount percentage per line when setting the Any thoughts on that? |
Indeed, I've just saw that. A refactoring is needed. You take care of that ? |
@rousseldenis working on it now 👍 |
d2dc5cd
to
f06e932
Compare
5bbe096
to
97aeb01
Compare
/ocabot migration account_invoice_fixed_discount |
The migration issue (#1250) has not been updated to reference the current pull request because a previous pull request (#1481) is not closed. |
/ocabot migration account_invoice_fixed_discount |
3b073bd
to
85b6c40
Compare
Fixed in latest update. |
85b6c40
to
3bb50ca
Compare
@CRogos Same issue here as with the |
3bb50ca
to
b90fb4b
Compare
Great the tests are botched now because of the onchanges. Apparently the O2MForm class does not support inserting context values. I'll have to think of something else. |
oh no... I really appreciate all the effort you've already put here. Have you tried to make discount_fixed a computed attribute (non stored) with an inverse function setting discount? |
<xpath expr="//t[@t-set='display_discount']" position="after"> | ||
<t | ||
t-set="display_discount_fixed" | ||
t-value="any([l.discount_fixed for l in o.invoice_line_ids])" | ||
/> | ||
</xpath> | ||
<xpath expr="//th[@t-if='display_discount']" position="before"> | ||
<th | ||
t-if="display_discount_fixed" | ||
t-attf-class="text-end {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}" | ||
> | ||
<span>Disc. Fixed Amount</span> | ||
</th> | ||
</xpath> | ||
<xpath expr="//td[@t-if='display_discount']" position="before"> | ||
<td | ||
t-if="display_discount_fixed" | ||
t-attf-class="text-end {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}" | ||
> | ||
<span t-field="line.discount_fixed" /> | ||
</td> | ||
</xpath> |
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.
f5a9fd6
to
48cd1f5
Compare
@CRogos Another update for this module. I've refactored it to improve the usability and now the expected workflow should be supported. Had to dig deep into the tax calculation of Odoo to account for the rounding differences (similar to the behavior of the |
5c969a8
to
b98fa2a
Compare
@PieterPaulussen here are still the issues like in the sale OCA/sale-workflow#2614
|
b98fa2a
to
3384403
Compare
@CRogos Sorry, I made the changes to the code but never pushed it. You can re-test it now. |
@pedrobaeza I think this can be merged. |
OK, merging blindly due to reviews: /ocabot merge nobump |
On my way to merge this fine PR! |
Congratulations, your PR was merged at cbc9694. Thanks a lot for contributing to OCA. ❤️ |
No description provided.