[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) <jcb@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
This commit is contained in:
pedrambiria
2023-06-13 22:58:13 +02:00
parent 9da1f5c990
commit 01b42985f7
+2 -2
View File
@@ -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