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

[10.0]account_analytic_parent. Debit, credit and balance computation is super slow. #198

Closed
AaronHForgeFlow opened this issue Oct 26, 2018 · 8 comments

Comments

@AaronHForgeFlow
Copy link
Contributor

When overriding the method that computes those fields here: https://github.com/OCA/account-analytic/blob/10.0/account_analytic_parent/models/account_analytic_account.py#L24 Odoo calls the same method for all the children and it gets extremely slow when the number of analytic accounts grow, specially with many children.

We can make those fields stored but then we have to make sure it is recomputed everytime its needed and it's complex.

Any ideas are welcome! 🤗

@pedrobaeza
Copy link
Member

Use read_group for computing them. Your colleague @mreficent made something similar in contracts.

@AaronHForgeFlow
Copy link
Contributor Author

Ok thanks, @mreficent can you point me to that change? I could not find it in contracts.

@MiquelRForgeFlow
Copy link
Contributor

@AaronHForgeFlow
Copy link
Contributor Author

Thanks @mreficent

@AaronHForgeFlow
Copy link
Contributor Author

AaronHForgeFlow commented Oct 26, 2018

Cannot group_by non stored fields. And read group does not return the values that are not in the group_by. I'll go for a query instead.

edit:I can read_group the analytic lines but that would be duplicating the core method

@pedrobaeza
Copy link
Member

@aheficent this has nothing to do with stored/non stored. Please use read_group properly.

@AaronHForgeFlow
Copy link
Contributor Author

AaronHForgeFlow commented Oct 26, 2018

Do you mean to read_group in the analytic lines and not call super instead?
update: I think I got it...

@pedrobaeza
Copy link
Member

Well, you limit the read_group in the domain to the self.ids scope.

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

No branches or pull requests

3 participants