Group by products margins computations to reduce SQL queries sent to postgre server, improving overall performances. Replace setattr for loop by product.write to reduce the number of write queries. closes odoo/odoo#74556 X-original-commit: 4884a2b0d035cb58d21cdee481cff3c636825020 Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com> Signed-off-by: William André (wan) <wan@odoo.com>