From 01b42985f7e7bb56e888f3d01a3e7dfa4074786a Mon Sep 17 00:00:00 2001 From: pedrambiria Date: Tue, 30 May 2023 15:10:29 +0000 Subject: [PATCH] [FIX] point_of_sale: open session with no Distribution for invoices Before this commit, if you used a tax that was using "Group of Taxes" for the "Tax Computation" in PoS, it would crash because it doesn't have Distribution for invoices. This issue also occurred for other taxes that lacked a "Distribution for invoices" line. opw-3341807 closes odoo/odoo#124904 X-original-commit: 03cb9ea055fff0a56d9cc9d3d87bff817bec9b9d Signed-off-by: Joseph Caburnay (jcb) Signed-off-by: Pedram Bi Ria (pebr) --- addons/point_of_sale/models/pos_session.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index 0c767e2db2b..3c077f267ea 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -1752,8 +1752,8 @@ class PosSession(models.Model): aggregates=["factor_percent:sum"], ) tax_id_to_factor_sum = {tax.id: factor_sum / 100 for tax, factor_sum in groups} - for tax in taxes: - tax['sum_repartition_factor'] = tax_id_to_factor_sum[tax['id']] + for tax in filter(lambda t: t['amount_type'] != 'group', taxes): + tax['sum_repartition_factor'] = tax_id_to_factor_sum.get(tax['id'], 0) return taxes