coopiteasy / addons

Various modules that extend or improve Odoo Community.
GNU Affero General Public License v3.0
21 stars 17 forks source link

[FIX] Do not call _recompute_balance in the tests, but set the call i… #292

Closed legalsylvain closed 1 year ago

legalsylvain commented 1 year ago

…n the correct place to make the field recomputed correctly

Description

Odoo task (if applicable)

Checklist before approval

codecov-commenter commented 1 year ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (16.0-mig-account_customer_wallet@46a39a2). Click here to learn what that means. The diff coverage is n/a.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@                         Coverage Diff                         @@
##             16.0-mig-account_customer_wallet     #292   +/-   ##
===================================================================
  Coverage                                    ?   97.77%           
===================================================================
  Files                                       ?       13           
  Lines                                       ?      225           
  Branches                                    ?       32           
===================================================================
  Hits                                        ?      220           
  Misses                                      ?        0           
  Partials                                    ?        5           

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

legalsylvain commented 1 year ago

I'm also not certain whether it's possible to append to api.depends when overriding a compute function (e.g. in pos_customer_wallet). Do you need to list all the depends again?

It's possible to write @api.depends(lambda self: self._customer_wallet_balance_depends()) see : https://github.com/odoo/odoo/blob/16.0/odoo/addons/base/models/res_partner.py#L396

Make _compute_customer_wallet_balance depend on move_lines, move_lines.parent_state, move_lines.balance, move_lines.account_id, parent_id, and child_ids (maybe more?)

Should depends on parent_id.customer_wallet_balance and child_ids.customer_wallet_balance ?

However, couldn't we do the "proper" thing and do something like:

don't know. Do you want to make a try ?

For my part, I would like to have an answer to this issue ;-) https://github.com/odoo/odoo/issues/104202

carmenbianca commented 1 year ago

don't know. Do you want to make a try ?

I will give this a spin.

carmenbianca commented 1 year ago

Gave it a spin. It works! See recent commits to #290