From 4b8a3fe484066cf9fbb806c4febe02309fb5917c Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Wed, 31 May 2023 15:33:29 +0000 Subject: [PATCH] [IMP] sale: allow grouping report by customer zipcode closes odoo/odoo#123146 Signed-off-by: Victor Feyens (vfe) --- addons/pos_sale/report/sale_report.py | 2 ++ addons/sale/report/sale_report.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/addons/pos_sale/report/sale_report.py b/addons/pos_sale/report/sale_report.py index 46d6de5ad11..3320641944d 100644 --- a/addons/pos_sale/report/sale_report.py +++ b/addons/pos_sale/report/sale_report.py @@ -66,6 +66,7 @@ class SaleReport(models.Model): p.product_tmpl_id, partner.country_id AS country_id, partner.industry_id AS industry_id, + partner.zip AS zip, partner.commercial_partner_id AS commercial_partner_id, (SUM(p.weight) * l.qty / u.factor) AS weight, (SUM(p.volume) * l.qty / u.factor) AS volume, @@ -134,6 +135,7 @@ class SaleReport(models.Model): p.product_tmpl_id, partner.country_id, partner.industry_id, + partner.zip, partner.commercial_partner_id, u.factor, pos.crm_team_id, diff --git a/addons/sale/report/sale_report.py b/addons/sale/report/sale_report.py index 8f71eb6a03f..3c392eafa45 100644 --- a/addons/sale/report/sale_report.py +++ b/addons/sale/report/sale_report.py @@ -39,6 +39,7 @@ class SaleReport(models.Model): team_id = fields.Many2one('crm.team', 'Sales Team', readonly=True) country_id = fields.Many2one('res.country', 'Customer Country', readonly=True) industry_id = fields.Many2one('res.partner.industry', 'Customer Industry', readonly=True) + zip = fields.Char('Customer ZIP', readonly=True) commercial_partner_id = fields.Many2one('res.partner', 'Customer Entity', readonly=True) state = fields.Selection([ ('draft', 'Draft Quotation'), @@ -121,6 +122,7 @@ class SaleReport(models.Model): p.product_tmpl_id, partner.country_id AS country_id, partner.industry_id AS industry_id, + partner.zip AS zip, partner.commercial_partner_id AS commercial_partner_id, CASE WHEN l.product_id IS NOT NULL THEN SUM(p.weight * l.product_uom_qty / u.factor * u2.factor) ELSE 0 END AS weight, CASE WHEN l.product_id IS NOT NULL THEN SUM(p.volume * l.product_uom_qty / u.factor * u2.factor) ELSE 0 END AS volume, @@ -195,6 +197,7 @@ class SaleReport(models.Model): p.product_tmpl_id, partner.country_id, partner.industry_id, + partner.zip, partner.commercial_partner_id, l.discount, s.id,