[9.0] mis_builder Sorrento #189

Merged
merged 182 commits into from May 24, 2016

Conversation

Projects
None yet
@sbidoul
Member

sbidoul commented Apr 29, 2016

This is the work done on mis_builder at the Sorrento Sprint.

Thanks to all who contributed code and ideas! It was a great event.

This branch should be usable as is, although not yet perfect.

Sprinters (in particular @adrienpeiffer @sebastienbeau @gfcapalbo), feel free to commit your last small changes here if any.

Then let's review and merge fast so the work in account_financial_report_qweb that depends on this can continue.

sbidoul and others added some commits Oct 21, 2015

no more parent_id, no more consolidation children
Code is simpler too but here we really lose functionality.
[ADD] AccountingNone (singleton) to differentiate balances among whic…
…h the debit and the credit are zero and balances among which debit and credit nullify
[IMP] mis_builder: refactor the compute method
The main computation entry point is now on mis.report instead of
mis.report.instance.period so it can easily be reused by other
module who need to evaluate mis.report's on without creating
full-fledge persistant mis.report.instance (such as a wizard
that allows the user to select the period for a one-off run).
@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls May 17, 2016

Coverage Status

Coverage remained the same at 78.034% when pulling c1adf83 on oca-sorrento:9.0-mis_builder-sorrento into be32b21 on OCA:9.0.

coveralls commented May 17, 2016

Coverage Status

Coverage remained the same at 78.034% when pulling c1adf83 on oca-sorrento:9.0-mis_builder-sorrento into be32b21 on OCA:9.0.

@sbidoul

This comment has been minimized.

Show comment
Hide comment
@sbidoul

sbidoul May 17, 2016

Member

@moylop260 great work you are doing on this lint stuff!

Can you look at this crash in pylint-odoo ? https://travis-ci.org/OCA/account-financial-reporting/jobs/130776237#L508

Member

sbidoul commented May 17, 2016

@moylop260 great work you are doing on this lint stuff!

Can you look at this crash in pylint-odoo ? https://travis-ci.org/OCA/account-financial-reporting/jobs/130776237#L508

@moylop260

This comment has been minimized.

Show comment
Hide comment

@sbidoul thank you
Yes the fix is: OCA/pylint-odoo#30

@moylop260

This comment has been minimized.

Show comment
Hide comment
@moylop260

moylop260 May 17, 2016

@sbidoul fixed, now you have the last messages here
I detected a valid case of copy method without a super
mis_builder/models/mis_report_style.py:18: [W8106(method-required-super), PropertyDict.copy] Missingsupercall in "copy" method.
For this case you can use: pylint: disable=method-required-super,other_check...

moylop260 commented May 17, 2016

@sbidoul fixed, now you have the last messages here
I detected a valid case of copy method without a super
mis_builder/models/mis_report_style.py:18: [W8106(method-required-super), PropertyDict.copy] Missingsupercall in "copy" method.
For this case you can use: pylint: disable=method-required-super,other_check...

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls May 17, 2016

Coverage Status

Coverage remained the same at 78.034% when pulling 343a570 on oca-sorrento:9.0-mis_builder-sorrento into be32b21 on OCA:9.0.

coveralls commented May 17, 2016

Coverage Status

Coverage remained the same at 78.034% when pulling 343a570 on oca-sorrento:9.0-mis_builder-sorrento into be32b21 on OCA:9.0.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls May 17, 2016

Coverage Status

Coverage remained the same at 77.786% when pulling 3e68d3d on oca-sorrento:9.0-mis_builder-sorrento into be32b21 on OCA:9.0.

coveralls commented May 17, 2016

Coverage Status

Coverage remained the same at 77.786% when pulling 3e68d3d on oca-sorrento:9.0-mis_builder-sorrento into be32b21 on OCA:9.0.

@sbidoul

This comment has been minimized.

Show comment
Hide comment
@sbidoul

sbidoul May 17, 2016

Member

@moylop260 I'm still lost with the hanging indent errors.

I installed the latest flake8 locally in a fresh virtualenv and run it without errors. Do you have a suggestion?

Member

sbidoul commented May 17, 2016

@moylop260 I'm still lost with the hanging indent errors.

I installed the latest flake8 locally in a fresh virtualenv and run it without errors. Do you have a suggestion?

@ThomasBinsfeld

This comment has been minimized.

Show comment
Hide comment
@ThomasBinsfeld

ThomasBinsfeld May 17, 2016

@sbidoul Launch flake8 with --ignore ("flake8 --ignore E128 " for example) and it will show the under/over-indented lines

@sbidoul Launch flake8 with --ignore ("flake8 --ignore E128 " for example) and it will show the under/over-indented lines

@sbidoul

This comment has been minimized.

Show comment
Hide comment
@sbidoul

sbidoul May 17, 2016

Member

@ThomasBinsfeld thanks! I would not have thought ignoring an error would raise others.

Member

sbidoul commented May 17, 2016

@ThomasBinsfeld thanks! I would not have thought ignoring an error would raise others.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls May 17, 2016

Coverage Status

Coverage remained the same at 77.77% when pulling 022b8a8 on oca-sorrento:9.0-mis_builder-sorrento into be32b21 on OCA:9.0.

coveralls commented May 17, 2016

Coverage Status

Coverage remained the same at 77.77% when pulling 022b8a8 on oca-sorrento:9.0-mis_builder-sorrento into be32b21 on OCA:9.0.

@sbidoul

This comment has been minimized.

Show comment
Hide comment
@sbidoul

sbidoul May 17, 2016

Member

Ok, so now I consider the code is much cleaner and maintainable with a proper separation of concerns:

  • mis_report.py: the core module providing the report templates and computation logic relying on a bunch of lower level features (aep, accounting_none, simple_array, mis_report_style)
  • mis_report_instance.py: providing instanciation of report templates for given time periods
  • the various renderings: widget, qweb-pdf, xslx

There is full feature parity across the 3 renderings.

For more information on new features and fixes compared to the v8 version, see the changelog: https://github.com/oca-sorrento/account-financial-reporting/blob/022b8a8998d7f38fb40f0e82185211b2f044ab62/mis_builder/CHANGES.rst

The test coverage is reasonably complete (78%, with the AccoutingExpressionProcessor fully tested except some error cases).

I still have plenty of ideas for improvements and features, but I'll stop here for now!

Happy reviewing!

Member

sbidoul commented May 17, 2016

Ok, so now I consider the code is much cleaner and maintainable with a proper separation of concerns:

  • mis_report.py: the core module providing the report templates and computation logic relying on a bunch of lower level features (aep, accounting_none, simple_array, mis_report_style)
  • mis_report_instance.py: providing instanciation of report templates for given time periods
  • the various renderings: widget, qweb-pdf, xslx

There is full feature parity across the 3 renderings.

For more information on new features and fixes compared to the v8 version, see the changelog: https://github.com/oca-sorrento/account-financial-reporting/blob/022b8a8998d7f38fb40f0e82185211b2f044ab62/mis_builder/CHANGES.rst

The test coverage is reasonably complete (78%, with the AccoutingExpressionProcessor fully tested except some error cases).

I still have plenty of ideas for improvements and features, but I'll stop here for now!

Happy reviewing!

@moylop260

This comment has been minimized.

Show comment
Hide comment
@moylop260

moylop260 May 17, 2016

Should we fix the duplicated csv id?

mis_builder/__init__.py:1: [W7906(duplicate-id-csv), ] Duplicate id "access_mis_report_kpi_expression" in ir.model.access.csv file
mis_builder/__init__.py:1: [W7906(duplicate-id-csv), ] Duplicate id "access_mis_report_subkpi" in ir.model.access.csv file
mis_builder/__init__.py:1: [W7906(duplicate-id-csv), ] Duplicate id "access_mis_report_style" in ir.model.access.csv file

moylop260 commented May 17, 2016

Should we fix the duplicated csv id?

mis_builder/__init__.py:1: [W7906(duplicate-id-csv), ] Duplicate id "access_mis_report_kpi_expression" in ir.model.access.csv file
mis_builder/__init__.py:1: [W7906(duplicate-id-csv), ] Duplicate id "access_mis_report_subkpi" in ir.model.access.csv file
mis_builder/__init__.py:1: [W7906(duplicate-id-csv), ] Duplicate id "access_mis_report_style" in ir.model.access.csv file
@sbidoul

This comment has been minimized.

Show comment
Hide comment
@sbidoul

sbidoul May 17, 2016

Member

@moylop260 perhaps, perhaps. I don't know (yet) what this warning means.

Member

sbidoul commented May 17, 2016

@moylop260 perhaps, perhaps. I don't know (yet) what this warning means.

@moylop260

This comment has been minimized.

Show comment
Hide comment
@moylop260

moylop260 May 17, 2016

Help me to use a clearer message for the following case:
csv

duplicate-id-csv

moylop260 commented May 17, 2016

Help me to use a clearer message for the following case:
csv

duplicate-id-csv

@moylop260

This comment has been minimized.

Show comment
Hide comment
@moylop260

moylop260 May 17, 2016

If you have a proposal for this message you could comment here: OCA/pylint-odoo#32

If you have a proposal for this message you could comment here: OCA/pylint-odoo#32

@sbidoul

This comment has been minimized.

Show comment
Hide comment
@sbidoul

sbidoul May 17, 2016

Member

@moylop260 the message is just fine. Useful check, thanks! Fixed.

Member

sbidoul commented May 17, 2016

@moylop260 the message is just fine. Useful check, thanks! Fixed.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls May 17, 2016

Coverage Status

Coverage remained the same at 77.77% when pulling 910cd1e on oca-sorrento:9.0-mis_builder-sorrento into be32b21 on OCA:9.0.

coveralls commented May 17, 2016

Coverage Status

Coverage remained the same at 77.77% when pulling 910cd1e on oca-sorrento:9.0-mis_builder-sorrento into be32b21 on OCA:9.0.

@moylop260

This comment has been minimized.

Show comment
Hide comment

Thanks @sbidoul
👍

mis_builder/datas/ir_cron.xml
+ <data noupdate="1">
+
+ <record id="ir_cron_crm_action" model="ir.cron">
+ <field name="name">Vaccum temporary report</field>

This comment has been minimized.

@lepistone

lepistone May 23, 2016

Member

Vacuum

mis_builder/datas/ir_cron.xml
+<openerp>
+ <data noupdate="1">
+
+ <record id="ir_cron_crm_action" model="ir.cron">

This comment has been minimized.

@lepistone

lepistone May 23, 2016

Member

better XMLID?

@lepistone

lepistone May 23, 2016

Member

better XMLID?

mis_builder/models/aep.py
+ # as it does not make sense to distinguish 0 from "no data"
+ if v is not AccountingNone and \
+ mode in (self.MODE_INITIAL, self.MODE_UNALLOCATED) and \
+ float_is_zero(v, precision_rounding=2):

This comment has been minimized.

@lepistone

lepistone May 23, 2016

Member

Is it correct to hardcode 2 here?

@lepistone

lepistone May 23, 2016

Member

Is it correct to hardcode 2 here?

This comment has been minimized.

@sbidoul

sbidoul May 23, 2016

Member

Well, ideally it should come from the kpi style which itself defaults to the report style. But bringing that value down here is a lot of code for very little benefit (this only serves to distinguish 0 from null in the initial balance).

I think I'll change 2 to 4 so be on the safe side and we'll see if it creates problems in practice (I bet not).

@sbidoul

sbidoul May 23, 2016

Member

Well, ideally it should come from the kpi style which itself defaults to the report style. But bringing that value down here is a lot of code for very little benefit (this only serves to distinguish 0 from null in the initial balance).

I think I'll change 2 to 4 so be on the safe side and we'll see if it creates problems in practice (I bet not).

This comment has been minimized.

@elicoidal

elicoidal May 24, 2016

Is there any reason not to take the decimal precision set up for accounting?

@elicoidal

elicoidal May 24, 2016

Is there any reason not to take the decimal precision set up for accounting?

This comment has been minimized.

@sbidoul

sbidoul May 24, 2016

Member

@elicoidal you are right! in this area of mis_builder, we rely on accounting precision, not the precision set in the styles. So I changed to use the decimal places of the company currency, and adapted the AEP api to pass the company in the constructor instead of moving it around in each method.

@sbidoul

sbidoul May 24, 2016

Member

@elicoidal you are right! in this area of mis_builder, we rely on accounting precision, not the precision set in the styles. So I changed to use the decimal places of the company currency, and adapted the AEP api to pass the company in the constructor instead of moving it around in each method.

This comment has been minimized.

@elicoidal

elicoidal May 24, 2016

my very little piece for a huge job that you have produced so far!

@elicoidal

elicoidal May 24, 2016

my very little piece for a huge job that you have produced so far!

This comment has been minimized.

@sbidoul

sbidoul May 24, 2016

Member

Thanks. As we say every little bit helps. And I'm glad to have had new contributors in Sorrento.

@sbidoul

sbidoul May 24, 2016

Member

Thanks. As we say every little bit helps. And I'm glad to have had new contributors in Sorrento.

mis_builder/models/aep.py
+ @classmethod
+ def get_balances_variation(cls, company, date_from, date_to,
+ target_move='posted'):
+ """ A convenience method to obtain the variantion of the

This comment has been minimized.

@lepistone

lepistone May 23, 2016

Member

variation

@lepistone

lepistone May 23, 2016

Member

variation

sbidoul added some commits May 23, 2016

[IMP] mis_builder: change precision rounding from 2 to 4 to distingui…
…sh 0 from null in initial balances

This should be slightly on the safer side. Ideally, this rounding precision
should come from the kpi style (which defaults to the report style), but
that would be a lot of code for little benefits.
@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls May 24, 2016

Coverage Status

Coverage remained the same at 77.786% when pulling 5319238 on oca-sorrento:9.0-mis_builder-sorrento into be32b21 on OCA:9.0.

coveralls commented May 24, 2016

Coverage Status

Coverage remained the same at 77.786% when pulling 5319238 on oca-sorrento:9.0-mis_builder-sorrento into be32b21 on OCA:9.0.

+# -*- coding: utf-8 -*-
+# © 2014-2015 ACSONE SA/NV (<http://acsone.eu>)
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
+""" A trivial immutable array that supports basic arithmetic operations.

This comment has been minimized.

@lepistone

lepistone May 24, 2016

Member

This is somewhat like numpy.array without pulling all of numpy, am I right?

@lepistone

lepistone May 24, 2016

Member

This is somewhat like numpy.array without pulling all of numpy, am I right?

This comment has been minimized.

@sbidoul

sbidoul May 24, 2016

Member

@lepistone it is. I kind of thought pulling numpy was not appropriate 😉
In the end SimpleArray does a bit more wrt exception handling (DataError).

@sbidoul

sbidoul May 24, 2016

Member

@lepistone it is. I kind of thought pulling numpy was not appropriate 😉
In the end SimpleArray does a bit more wrt exception handling (DataError).

This comment has been minimized.

@lepistone

lepistone May 24, 2016

Member

OK!

@lepistone

This comment has been minimized.

Show comment
Hide comment
@lepistone

lepistone May 24, 2016

Member

Great work, thanks! 👍

I think I can merge this!

Member

lepistone commented May 24, 2016

Great work, thanks! 👍

I think I can merge this!

@lepistone lepistone merged commit 568fbb6 into OCA:9.0 May 24, 2016

3 checks passed

ci/runbot runbot build 3147595-189-531923 (runtime 64s)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 77.786%
Details

@moylop260 moylop260 referenced this pull request in OCA/maintainer-quality-tools Jun 10, 2016

Closed

[IMP] Avoid console.log in JS code via flake8 #335

@moylop260 moylop260 referenced this pull request in OCA/maintainer-quality-tools Jul 26, 2016

Closed

Add ESLint to the bots #344

@pedrobaeza pedrobaeza referenced this pull request Sep 24, 2016

Open

Migration to version 9.0 #125

7 of 10 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment