[16.0][REF] sale_triple_discount: Consolidate discount in std field#2885
[16.0][REF] sale_triple_discount: Consolidate discount in std field#2885grindtildeath wants to merge 9 commits intoOCA:16.0from
Conversation
chienandalu
left a comment
There was a problem hiding this comment.
I like the approach 👍 (we don't maintain this module currently though)
|
@grindtildeath any plan to bring this to completion? |
|
@francesco-ooops I didn't have any time during the last few weeks and I'm going on holidays the next 2 ones, so I won't be able to work on it before some time. IMO the issue to get this merged is recomputation of old moves in periods closed by fiscal year lock date as discussed in OCA/account-invoicing#1638 |
df96298 to
2f51a8e
Compare
|
Hi @grindtildeath We've created this module before this OCA one and never migrate to use the OCA one due to lack of time but also because somewhow we like more our approach (same as you share). Last thing, I believe this kind of changes are not good to be done on an already working version since long time. Maybe better for 17 or 18? |
3448e15 to
c8738c5
Compare
|
@jjscarafia Thanks for sharing your work. It's not easy finding a good solution while the |
08d3d97 to
76d01fa
Compare
60a54a8 to
cd48539
Compare
ef15d5c to
fb3cb93
Compare
|
@legalsylvain rebased |
|
fb3cb93 to
3d147e3
Compare
|
@legalsylvain I'm sorry but I don't have any time left to spend on that 😞 I still did rebase this PR on 16.0 and dropped changes in test requirements/oca dependencies. However I tried cherry-picking your commits and there are conflicts on Maybe you can fix the conflict and open a PR targeting this branch? I'll merge it as soon as possible. Otherwise feel free to open a new PR and take over this work if it's easier for you. |
…ibles and can not work together by design. similar to account_invoice_fixed_discount and account_invoice_triple_discount
|
Hi @grindtildeath. Thanks for your time.
No worry with test.yml, it is an autogenerated file. you can recreate it with
That's not possible. I don't use sale_triple_discount. i just want to unblock many PRs that are stucked, since account_triple_discount refactor has been merged and not this one. |
|
Can we unlock this? Another possibility will be to exclude these modules from the CI because they are locked to different PRs. |
…herry-pick [FIX] sale_fixed_discount, sale_triple_discount: modules are incompatibles and can not work together by design.
|
@grindtildeath @legalsylvain Due to : OCA/account-invoicing#1840 All repos depending on them are not running tests. We should land on this. |
|
@grindtildeath My question: shouldn't it be possible to make both modules compatible after refactor? |
|
This is still pending, is there any proposal to correct tests? |
|
@legalsylvain In fact, this is quite bad that OCA/account-invoicing#1840 has been merged and not this one... I think I will try to make current sale_triple_discount to work with a freezed version of account_triple_discount (before refactor). |
Indeed ! It's a pity. Thanks for your quick fix. |
|
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. |
| # Copy of Odoo function to change field being assigned from discount to discount1 | ||
| @api.depends("product_id", "product_uom", "product_uom_qty") | ||
| def _compute_discount(self): | ||
| for line in self: | ||
| if not line.product_id or line.display_type: | ||
| line.discount1 = 0.0 |
There was a problem hiding this comment.
@grindtildeath does this not break every _compute_discount that inherits the base Odoo one? they either won't run, will error or won't write onto discount since it isn't its compute anymore
any reason for this approach here and not on the invoice version?
regardless I will continue looking into bringing this up to date as I know you don't have time
|
I made a new PR #3907 based on this one to take another look at this refactoring, there are some different changes compared to this one but the general idea is the same |
|
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. |
|
Closed in favour of #3907 |
Until now, the triple discount feature did use the standard Odoo field as the first discount field, adding only extra fields for the second and the third discount. This implied we had to override any function using discount to consider the other discounts properly.
By adding an extra field discount1 to store the first discount, it allows to redefine the standard discount field to a computed field that will consolidate the triple discount from the other fields, and avoid the need to redefine anything relying on the discount field as it will already consider the triple discounts.
Relates to: