-
-
Notifications
You must be signed in to change notification settings - Fork 621
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_financial_report: Migration to 16.0 #939
[16.0][MIG] account_financial_report: Migration to 16.0 #939
Conversation
d8a8874
to
0473404
Compare
Hi @ramiadavid , Can you fix red pre-commit and add report_xlsx to test-requirements.txt to fix runboat and tests? Inspiration can be found there Thanks! |
39c8677
to
547240c
Compare
@RodrigoBM Ok, runboad and tests fixed but pre-commit gives an error
|
pre-commit fixed in #957 You can rebase. The temporary PR put for report_xlsx seems to not be the definitive one though. |
* dynamize general ledger
…ort. This commit includes move lines on the report date by default. These lines shouldn't be considered in the futur.
…with hierarchy. Update indentation, remove empty lines from header. Update test. Update pylint. Remove company_id on computing accounts, since account.group is not a company based model, filtering accounts is done on trial balance report. Update account variables. Improve condition in padding on accounts. Add option to print hierarchy based on defined accounts/computed accounts. Add VAT report, hierarchy from tax tags ans taxes. Fix pylint, xlsx report generation header. Update code to select code_prefix or name. Update code to select code_prefix or name. Update code to select code_prefix or name. Fix domain in base amounts in vat report. Change trial balance code_prefix or name. Update trail balance, add tests for vat report. Update pylint, amounts as monetary, many2one option on generation excels. Update pulint. Add VAT Report in readme. Add VAT Report in readme. Update array_agg. Update array_agg. Update array_agg. Add option in VAT Report to be printed on Tax Tags - Tax Groups. Add widget to hierarchy_on on trial balance.
Translated using Weblate (Arabic) Currently translated at 95.7% (177 of 185 strings) Translation: account-financial-reporting-11.0/account-financial-reporting-11.0-account_financial_report Translate-URL: https://translation.odoo-community.org/projects/account-financial-reporting-11-0/account-financial-reporting-11-0-account_financial_report/ar/
Some changes in the databases been made in OCA#403, but no migration is needed.
When this module is installed along with other chart account different from generic one, the number of expected accounts and the computation change (for example, in Spain, the unaffected earnings account is 129000, choking with group with code prefix 1). This commit makes the tests resistent to these changes.
To general ledger
When there are a lot of account.move.line (several millions) and print any of the Qweb reports, that will generate also a lot of transient objects. As these objects are created with an "insert" query, the cleaning normally triggered by the count of the records in transient tables is not done, so only the cleaning based on the age of the records is processed (by default, records older than 1 hours are deleted), but the cron task is only ran one time per day. For large setups this can lead to memory errors at that point. This change prevents the memory error by executing the transient record cleanup for the report models in this module in SQL.
Currently translated at 73.9% (215 of 291 strings) Translation: account-financial-reporting-11.0/account-financial-reporting-11.0-account_financial_report Translate-URL: https://translation.odoo-community.org/projects/account-financial-reporting-11-0/account-financial-reporting-11-0-account_financial_report/de/
Currently translated at 50.2% (146 of 291 strings) Translation: account-financial-reporting-11.0/account-financial-reporting-11.0-account_financial_report Translate-URL: https://translation.odoo-community.org/projects/account-financial-reporting-11-0/account-financial-reporting-11-0-account_financial_report/es/
Currently translated at 96.2% (178 of 185 strings) Translation: account-financial-reporting-11.0/account-financial-reporting-11.0-account_financial_report Translate-URL: https://translation.odoo-community.org/projects/account-financial-reporting-11-0/account-financial-reporting-11-0-account_financial_report/ar/
Currently translated at 100.0% (291 of 291 strings) Translation: account-financial-reporting-11.0/account-financial-reporting-11.0-account_financial_report Translate-URL: https://translation.odoo-community.org/projects/account-financial-reporting-11-0/account-financial-reporting-11-0-account_financial_report/es/
Currently translated at 83.5% (243 of 291 strings) Translation: account-financial-reporting-11.0/account-financial-reporting-11.0-account_financial_report Translate-URL: https://translation.odoo-community.org/projects/account-financial-reporting-11-0/account-financial-reporting-11-0-account_financial_report/nl/
Currently translated at 100.0% (291 of 291 strings) Translation: account-financial-reporting-11.0/account-financial-reporting-11.0-account_financial_report Translate-URL: https://translation.odoo-community.org/projects/account-financial-reporting-11-0/account-financial-reporting-11-0-account_financial_report/es/
Done |
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 OK
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.
The analytic conversion doesn't seem correct to me, as it involves an stored m2m field that is going to provoke a bottleneck both on install and on daily work. Data should be extracted on the fly from the new data model. And tags equivalent is lost.
|
||
|
||
class AccountMoveLine(models.Model): | ||
_inherit = "account.move.line" | ||
|
||
analytic_account_ids = fields.Many2many( | ||
"account.analytic.account", compute="_compute_analytic_account_ids", store=True |
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.
You must avoid this new stored field that will be triggered on module installation. Imagine if you already have millions of journal items...
Why is this needed?
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.
@pedrobaeza
The analytic_account_id field has been changed to analytic_distribution which is a JSON.
I've created this new field because, in order to filter by Analytical Account, I don't know any other way to do it with a JSON field in a domain. And that created field has to be stored to be able to use it in a domain.
This is used in reports/general_ledger.py#L278
You know some way?
Thinking now, i think that we could use the analytic lines analytic_line_ids
field to filter using the domain ('analytic_line_ids.account_id', 'in, 'xxx')
. But these lines are not created until the invoice is published, and I don't know if this is a problem for a report
117d2e5
to
21cc200
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.
Thanks for the efforts done, David.
2 things I have found reviewing the final result:
- I see good to have a different color for the clickable elements, but the blue is too light and difficult a bit the reading. Can you put a darker blue?
- This is outside of the migration work, but I see awkward (and also risky) that an invoicing user is able to see all the financial reports, so I think we should restrict them to "show full account" group. This can be made in a separate commit to be backported to previous versions.
21cc200
to
c47b644
Compare
Hello @pedrobaeza I have not made any changes regarding the colors, it is the default color for the links in the Odoo reports, maybe they have changed it for v16. I assign a darker color by modifying the report.css. tell me how you see it now Regarding the change of permissions, and in order not to make a mistake, it would only be to delete the first group, correct?
|
c47b644
to
36c5b35
Compare
Yes, David, the naming of the groups is terrible, as |
…Show Full Accounting Features'
@pedrobaeza access group changed, but I don't know what is the procedure to make a backport to other versions, is it necessary to do a PR to each one of them with that commit? I guess when this PR is merged It remains to be seen what to do with the analytic_account_ids field |
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.
Let's keep it for now as is with the analytic thing and others can do further pull requests to make more improvements.
About the backport, you have to cherry-pick the commit in a new branch and make the pull request.
/ocabot merge nobump
On my way to merge this fine PR! |
Congratulations, your PR was merged at a49f70c. Thanks a lot for contributing to OCA. ❤️ |
@pedrobaeza @ramiadavid The introduction of the new field should have at least been set with an init hook as on existing database, it is too bulky ! I will do it. Moreover, that field IMHO should have been set in another module... |
Well, sometimes the side effects can't be anticipated. I didn't realize about it when reviewing. |
I am migrating this module and it requires some changes:
General ledger:
This depends on OCA/reporting-engine#654 which is pending to be merged