[IMP] point_of_sale: sort report by product name

Instead of undeterministic order on a dictionnary
This commit is contained in:
Martin Trigaux
2016-10-20 16:52:30 +02:00
parent feffa2efce
commit 83fb76e4c0
+2 -2
View File
@@ -817,7 +817,7 @@ class ReportSaleDetails(models.AbstractModel):
'payments': payments,
'company_name': self.env.user.company_id.name,
'taxes': taxes.values(),
'products': [{
'products': sorted([{
'product_id': product.id,
'product_name': product.name[:20],
'code': product.default_code,
@@ -825,7 +825,7 @@ class ReportSaleDetails(models.AbstractModel):
'price_unit': price_unit,
'discount': discount,
'uom': product.uom_id.name
} for (product, price_unit, discount), qty in products_sold.items()]
} for (product, price_unit, discount), qty in products_sold.items()], key=lambda l: l['product_name'])
}
@api.multi