coopiteasy / addons

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

[IMP] account_customer_wallet : make the module working with global partners #291

Closed legalsylvain closed 1 year ago

legalsylvain commented 1 year ago

hi @carmenbianca : looks more simple to me. Say me if it's OK for you !

carmenbianca commented 1 year ago

Ah, I wasn't aware this was a PR against 16.0.

This PR confuses me a little bit. Do you get a different output of the computation depending on the active company? Is that good behaviour?

legalsylvain commented 1 year ago

Well

before

the computation is based on that account customer_wallet_account_id = fields.Many2one(related="company_id.customer_wallet_account_id")

so, if you have a "global" partner, there is no company so no account, and the wallet feature will not work.

After

The computation is based on wallet_account = self.env.company.customer_wallet_account_id. so it depends on the context. It will work for global partners, (no company_id) the value will depend on the current context. (that makes sense in my opinion). If you are in a company A, you have a CoA A and you have a wallet A amount. if you are in a company B, you have a coA B and you have a wallet B amount.

carmenbianca commented 1 year ago

Makes sense, thank you.

carmenbianca commented 1 year ago

Merged this in a cherry-pick commit. Thank you Sylvain! You have a very good eye for this.