From d26dfed4bc2e9574faed4f0e3a5d7e25219ea7ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 1 Oct 2022 15:12:38 +0200 Subject: [PATCH] Add marketing_campaign module issue11587 review425381003 --- sale_reporting.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/sale_reporting.py b/sale_reporting.py index d6f51085f5..27a1e488a4 100644 --- a/sale_reporting.py +++ b/sale_reporting.py @@ -30,20 +30,26 @@ class AbstractMixin: .join(point, condition=sale.point == point.id) .select( (line.id * length + index).as_('id'), - line.product.as_('product'), - line.quantity.as_('quantity'), - line.unit_gross_price.as_('unit_price'), - Concat('sale.point.sale,', line.sale).as_('order'), - sale.date.as_('date'), - sale.company.as_('company'), - Literal(currency_id).as_('currency'), - Literal(None).as_('customer'), - point.storage_location.as_('location'), - point.address.as_('shipment_address'), + *cls._pos_sale_line_columns(line, point, sale, currency_id), where=sale.state.in_(cls._pos_sale_states()) & (sale.company == company_id), )) + @classmethod + def _pos_sale_line_columns(cls, line, point, sale, currency): + return [ + line.product.as_('product'), + line.quantity.as_('quantity'), + line.unit_gross_price.as_('unit_price'), + Concat('sale.point.sale,', line.sale).as_('order'), + sale.date.as_('date'), + sale.company.as_('company'), + Literal(currency).as_('currency'), + Literal(None).as_('customer'), + point.storage_location.as_('location'), + point.address.as_('shipment_address'), + ] + @classmethod def _lines(cls): return super()._lines() + [cls._pos_sale_line]