Vauxoo / odoo

Fork of Odoo (formerly OpenERP). [This project is not publically mantained just born for internal usage with some little patches] go to official repository on github.com/odoo/odoo
https://www.odoo.com
Other
9 stars 9 forks source link

[REF] account: don't duplicate *_rank fields and add them to summable… #537

Open fernandahf opened 1 year ago

fernandahf commented 1 year ago

Description of the issue/feature this PR addresses:

Module account is adding customer_rank and supplier_rank in res.partner for computing the amount of their generated incoming/outgoing account moves but they are copied when a partner is duplicated, IMHO those fields have not to be copied, and also there is a method called _get_summable_fields in base in order to get all fields that should be summed when partners are merged and those fields apply exactly for that.

Also, we set the context in copy method to simulate where was create the original record.

Video of runbot where customer_rank is copied when duplicating a partner

https://youtu.be/2EXF6urXcsQ

Current behavior before PR:

Fields *_rankare copied when a partner is duplicated and aren't summed when partners are merged.

Desired behavior after PR is merged:

Fields *_rank are set with 1 when the original partner has a rank in any of those fields and 0 when hasn't and they are added in summable fields.

-- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr