Merge lp://qastaging/~camptocamp/account-consolidation/account-consolidation-fix-mono-currency into lp://qastaging/~account-core-editors/account-consolidation/7.0

Proposed by Nicolas Bessi - Camptocamp
Status: Merged
Merged at revision: 17
Proposed branch: lp://qastaging/~camptocamp/account-consolidation/account-consolidation-fix-mono-currency
Merge into: lp://qastaging/~account-core-editors/account-consolidation/7.0
Diff against target: 722 lines (+333/-129)
13 files modified
account_consolidation/__init__.py (+4/-3)
account_consolidation/__openerp__.py (+37/-38)
account_consolidation/account.py (+10/-7)
account_consolidation/account_move_line.py (+51/-0)
account_consolidation/account_move_line_view.xml (+30/-0)
account_consolidation/account_view.xml (+4/-3)
account_consolidation/analysis_view.xml (+39/-0)
account_consolidation/company.py (+14/-6)
account_consolidation/company_view.xml (+2/-1)
account_consolidation/consolidation_menu.xml (+3/-0)
account_consolidation/data.xml (+13/-0)
account_consolidation/wizard/consolidation_base.py (+11/-8)
account_consolidation/wizard/consolidation_consolidate.py (+115/-63)
To merge this branch: bzr merge lp://qastaging/~camptocamp/account-consolidation/account-consolidation-fix-mono-currency
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp code review, no test Approve
Guewen Baconnier @ Camptocamp Needs Fixing
Review via email: mp+151966@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Typo lines 36,37:
s/currency_vale/currency_value/

Apart that, the fix seems correct to me.

review: Needs Fixing
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Hello,

Forget to merge a revision, here it is.

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Frédéric has detected some side effect to be fixed

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Add some fixes in lines generation.

Implement the hook to allows to manage consolidation difference.

Add some usability improvements:
-defaults value
-label improvement
-filtered view in move line
-missing tooltip

Add the possibility to group by subsidaries

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

> Add some fixes in lines generation.
>
> Implement the hook to allows to manage consolidation difference.
>
> Add some usability improvements:
> -defaults value
> -label improvement
> -filtered view in move line
> -missing tooltip
>
> Add the possibility to group by subsidaries

So what is the status of the MP? is it work in progress or can we review now?

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

It can be reviewed the status is not anymore "work in progress".

Regards

Nicolas

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

Can a renaming of consol_company_id be considered?

line 549: "if balance" I thing this could be wrong, because of rounding errors. Are you sure you don't need to use the rounding methods available in the framework, or float_is_zero + a precision here?

line 603: you can't return None in a "public" method which can be called from xmlrpc. Either return False, or rename the method.

review: Needs Fixing (code review, no test)
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Hello,

Thanks for the review.

For the consol_company_id I agree with you it should be subsidary_id but I do not want to alter data model.

For the rounding your right. There is no mean to create consolidation line for difference < than 0.01. I will extend the test.

34. By Nicolas Bessi - Camptocamp

[FIX] None return in public function + conso. differences smaller than cent will not be generated

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Add recommended fixes

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

0.01 does not represent the same amount according to the currency.
That's why the model res.currency has a method `is_zero`. This method uses `openerp.tools.float_is_zero` but uses the configuration of the currency for the precision.
Is it applicable here?

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

The goal of this function is to create the move line to manage rounding difference, transitory difference but when it is call the currency conversion has been done upstream and the move we want to adjust is already in "holding" currency.

But you remark is pertinent in the consolidate account method and I will keep it in mind when we will implement the support of auxiliay accounts split.

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

> The goal of this function is to create the move line to manage rounding
> difference, transitory difference but when it is call the currency conversion
> has been done upstream and the move we want to adjust is already in "holding"
> currency.

I don't speak about currency conversion.

You have to use `is_zero` on the holding's currency instead of `openerp.tools.float_is_zero`.

Here is the method I speak about:

    def is_zero(self, cr, uid, currency, amount):
        """Returns true if ``amount`` is small enough to be treated as
           zero according to ``currency``'s rounding rules.

           Warning: ``is_zero(amount1-amount2)`` is not always equivalent to
           ``compare_amounts(amount1,amount2) == 0``, as the former will round after
           computing the difference, while the latter will round before, giving
           different results for e.g. 0.006 and 0.002 at 2 digits precision.

           :param browse_record currency: currency for which we are rounding
           :param float amount: amount to compare with currency's zero
        """
        return float_is_zero(amount, precision_rounding=currency.rounding)

review: Needs Fixing
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Ok I get your point.
Yep, this seems to be the correct solution.

35. By Nicolas Bessi - Camptocamp

[FIX] Consolidation difference uses currency is_zero instead of float_is_zero
+ small style cleanup in method

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Consolidation difference uses currency is_zero instead of float_is_zero
+ small style cleanup in method

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) :
review: Approve (code review, no test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches