Skip to content

Commit

Permalink
[IMP] sale_report_delivered_subtotal: Use price_reduce field when pri…
Browse files Browse the repository at this point in the history
…ce_subtotal is zero
  • Loading branch information
carlosdauden committed Oct 20, 2023
1 parent 6234587 commit c7a4a22
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sale_report_delivered_subtotal/reports/sale_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ def _query(self, with_clause="", fields=None, groupby="", from_clause=""):
if fields is None:
fields = {}
select_str_price = """ ,
sum((l.price_subtotal /
coalesce(nullif(l.product_uom_qty, 0), 1)
) * l.qty_delivered)
as price_subtotal_delivered
sum(
CASE WHEN l.price_subtotal <> 0
THEN (l.price_subtotal / l.product_uom_qty)
ELSE l.price_reduce
END
* l.qty_delivered) as price_subtotal_delivered
"""
select_str_weight = """ ,
sum(p.weight * l.qty_delivered /
Expand Down

0 comments on commit c7a4a22

Please sign in to comment.