[IMP] sale: allow grouping report by customer zipcode

closes odoo/odoo#123146

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
ferdymercury
2023-06-02 14:30:11 +02:00
committed by Victor Feyens
parent 68983675cf
commit 4b8a3fe484
2 changed files with 5 additions and 0 deletions
+2
View File
@@ -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,
+3
View File
@@ -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,