Skip to content
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_move_update_analytic: Update analytic tax distribution #726

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

hbrunn
Copy link
Member

@hbrunn hbrunn commented Dec 10, 2024

If you have a tax with the analytic flag enabled and change a line's analytic distribution with that tax, you'll depending on the odoo receive an error message or an empty analytic distribution without this patch.

I took the opportunity to add extensive tests for the module.

@OCA-git-bot
Copy link
Contributor

Hi @Shide, @remi-filament,
some modules you are maintaining are being modified, check this out!

@hbrunn hbrunn marked this pull request as draft December 10, 2024 11:43
@hbrunn hbrunn force-pushed the 16.0-account_move_update_analytic-fix-analytic-taxes branch 3 times, most recently from f6640af to cce0be9 Compare December 10, 2024 16:48
@hbrunn hbrunn changed the title [16.0][FIX] account_move_update_analytic: Don't choke with analytic taxes [16.0][FIX] account_move_update_analytic: Update analytic tax distribution Dec 10, 2024
@hbrunn hbrunn marked this pull request as ready for review December 10, 2024 16:52
Copy link

@remi-filament remi-filament left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hbrunn for the extra tests and the fix.

I have 2 issues when testing on runboat :

  1. (not related to this module) A JS error which comes from account_analytic_distribution_manual module when all modules from this repo are installed : when I select a new distribution as before in the update wizard, I get a
    TypeError: this.fields[fieldName] is undefined
    update@http://oca-account-analytic-16-0-74a4fdd973b5.runboat.odoo-community.org/web/assets/802-c885ccf/web.assets_backend.min.js:2381:368

  2. When testing with an invoice with 2 lines on the same tax (with analytic boolean set to True), if you validate your invoice without analytic distribution on any line you end up with only one line of tax (without analytic distribution). Now if I want to assign to each product line a different analytic distribution using this module wizard, only the first one will be reflected on the tax. When you do that before validating the invoice, Odoo would split the tax line into 2 tax lines : 1 per product with corresponding analytic distribution.

The proper solution here would be to split tax account.move.line per product as per Odoo default behaviour but then we are not only updating analytic but also account move, which I am not sure is a good idea !

Therefore I am not sure what is better : to not have the fix and update tax line manually, or to have the fix and not acknowledging that some distribution are not properly applied on taxes ?

@hbrunn
Copy link
Member Author

hbrunn commented Dec 12, 2024

I think we need to do the tax line splitting after all - if you manually assign some analytic distribution to the tax line, it will be wrong too. How about for now allowing only the simple case (=there's no other line with the same tax in the move), raising for the complex case and adding a TODO in the readme?

@remi-filament
Copy link

I think we need to do the tax line splitting after all - if you manually assign some analytic distribution to the tax line, it will be wrong too. How about for now allowing only the simple case (=there's no other line with the same tax in the move), raising for the complex case and adding a TODO in the readme?

You could still recalculate it on your own and assign manually correctly, but yes, it makes sense as a first step to manage simple case where there tax belongs only to the line being modified, showing a Warning for the other cases !

@hbrunn hbrunn force-pushed the 16.0-account_move_update_analytic-fix-analytic-taxes branch from cce0be9 to 01bec2b Compare December 17, 2024 15:53
@hbrunn
Copy link
Member Author

hbrunn commented Dec 17, 2024

@remi-filament my customer needs this case after all, so I'll set this to draft until I come up with a solution

after quite some tinkering I got it to work

@hbrunn hbrunn marked this pull request as draft December 17, 2024 18:00
@hbrunn hbrunn marked this pull request as ready for review December 17, 2024 21:27
@hbrunn hbrunn force-pushed the 16.0-account_move_update_analytic-fix-analytic-taxes branch 2 times, most recently from 9a4cbb1 to df436b1 Compare December 17, 2024 22:30
@hbrunn hbrunn force-pushed the 16.0-account_move_update_analytic-fix-analytic-taxes branch from df436b1 to 796b38f Compare December 31, 2024 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants