fix recap sort
All checks were successful
Deploy Amap / deploy (push) Successful in 15s

This commit is contained in:
Julien Aldon
2026-03-09 10:01:10 +01:00
parent 71839b0ccf
commit 6a4de725b5

View File

@@ -421,7 +421,7 @@ def generate_recap(
product for product in first_contract.products product for product in first_contract.products
if product.product.type == models.ProductType.RECCURENT if product.product.type == models.ProductType.RECCURENT
], ],
key=lambda x: x.product.name key=lambda x: (x.product.name, x.product.quantity)
) )
recurrents = [ recurrents = [
f'{pr.product.name}{f' - {pr.product.quantity}{pr.product.quantity_unit}' f'{pr.product.name}{f' - {pr.product.quantity}{pr.product.quantity_unit}'
@@ -515,7 +515,7 @@ def generate_recap(
product for product in contract.products product for product in contract.products
if product.product.type == models.ProductType.RECCURENT if product.product.type == models.ProductType.RECCURENT
], ],
key=lambda x: x.product.name key=lambda x: (x.product.name, x.product.quantity)
) )
main_data.append([ main_data.append([
@@ -581,8 +581,6 @@ def generate_recap(
4, 4,
5, 5,
6, 6,
len(info_header) + len(payment_header),
len(info_header) + len(payment_header) + 1 + len(occasionnals),
] ]
) )
doc.body.append(sheet) doc.body.append(sheet)