# Total Litres on Export Invoices

**URL:** <https://community.breww.com/t/total-litres-on-export-invoices/4802>\
**Category:** Ideas & feature requests\
**Created:** [21 August 2024 15:04 UTC](https://community.breww.com/t/total-litres-on-export-invoices/4802 "2024-08-21T15:04:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthew-denyer](https://community.breww.com/user_avatar/community.breww.com/matthew-denyer/32/1646_2.png) [@matthew-denyer](https://community.breww.com/u/matthew-denyer)\
**Post date:** [21 August 2024 15:04 UTC](https://community.breww.com/t/total-litres-on-export-invoices/4802/1 "2024-08-21T15:04:01Z")

</div>

We’ve just had an export order come in where the logistics service has requested the invoice contains at the end the total volume of litres in the shipment. I’m not sure why they need this, but would it be possible to implement this?

---

<div class="post-metadata">

**Author:** ![luke](https://community.breww.com/user_avatar/community.breww.com/luke/32/3636_2.png) [@luke](https://community.breww.com/u/luke)\
**Post date:** [22 August 2024 11:36 UTC](https://community.breww.com/t/total-litres-on-export-invoices/4802/2 "2024-08-22T11:36:17Z")

</div>

Thanks for the suggestion, Matthew. Please don’t forget to vote for it, as every vote counts 👍 For more on how we handle feature requests, please see [💡 Posting ideas & feature requests for Breww 💙](https://community.breww.com/t/posting-ideas-feature-requests-for-breww/22)

---

<div class="post-metadata">

**Author:** ![jon-kyme2](https://community.breww.com/user_avatar/community.breww.com/jon-kyme2/32/1926_2.png) [@jon-kyme2](https://community.breww.com/u/jon-kyme2)\
**Post date:** [22 August 2024 15:20 UTC](https://community.breww.com/t/total-litres-on-export-invoices/4802/3 "2024-08-22T15:20:55Z")

</div>

While we’re waiting for this 🙂 It’s maybe worth pointing out that this can be done (_fairly_ easily) in a custom invoice template. So if you’re happy hacking, or know someone who is…

---

<div class="post-metadata">

**Author:** ![matthew-denyer](https://community.breww.com/user_avatar/community.breww.com/matthew-denyer/32/1646_2.png) [@matthew-denyer](https://community.breww.com/u/matthew-denyer)\
**Post date:** [23 August 2024 08:44 UTC](https://community.breww.com/t/total-litres-on-export-invoices/4802/4 "2024-08-23T08:44:59Z")

</div>

Interesting! I’'ll have a look into this, thanks.

---

<div class="post-metadata">

**Author:** ![jon-kyme2](https://community.breww.com/user_avatar/community.breww.com/jon-kyme2/32/1926_2.png) [@jon-kyme2](https://community.breww.com/u/jon-kyme2)\
**Post date:** [23 August 2024 10:28 UTC](https://community.breww.com/t/total-litres-on-export-invoices/4802/6 "2024-08-23T10:28:45Z")

</div>

@matthew-denyer Wasn’t quite as easy as I thought, but I got it to work.  
Happy to provide snippets if you like.

---

<div class="post-metadata">

**Author:** ![matthew-denyer](https://community.breww.com/user_avatar/community.breww.com/matthew-denyer/32/1646_2.png) [@matthew-denyer](https://community.breww.com/u/matthew-denyer)\
**Post date:** [23 August 2024 11:29 UTC](https://community.breww.com/t/total-litres-on-export-invoices/4802/7 "2024-08-23T11:29:48Z")

</div>

Yes please, if you don’t mind

---

<div class="post-metadata">

**Author:** ![jon-kyme2](https://community.breww.com/user_avatar/community.breww.com/jon-kyme2/32/1926_2.png) [@jon-kyme2](https://community.breww.com/u/jon-kyme2)\
**Post date:** [23 August 2024 16:24 UTC](https://community.breww.com/t/total-litres-on-export-invoices/4802/8 "2024-08-23T16:24:21Z")

</div>

OK, in the body template, after

```
{# Product lines #}

```

I’ve added:

```
{% set ns = namespace(found=false) %}
{% set ns.total_volume = 0.0 %}

```

Then after

```
{% for line in lines %}

```

I’ve added

```
{% set ns.total_volume = ns.total_volume + (line.product_volume_total | replace(" L", "") | float ) %}

```

Then after  
{% if (is\_invoice and is\_export) or is\_delivery\_note %}  
I’ve added

```
<div class="notes_and_extra_text">
    <strong>Total product volume: </strong>{{ ns.total_volume if ns.total_volume else 'Unknown'}} L
</div>

```

Seems to work. Not sure all that mucking about is required… the namespace stuff seems to be because _scope_ (maybe if I moved things to the right place it wouldn’t be necessary)

If breww added a “total\_order\_volume” variable, most of this wouldn’t be needed

There may be an easier way to do this.

---

<div class="post-metadata">

**Author:** ![matthew-denyer](https://community.breww.com/user_avatar/community.breww.com/matthew-denyer/32/1646_2.png) [@matthew-denyer](https://community.breww.com/u/matthew-denyer)\
**Post date:** [28 August 2024 09:41 UTC](https://community.breww.com/t/total-litres-on-export-invoices/4802/9 "2024-08-28T09:41:21Z")

</div>

Thanks Jon, I’ll have a play! If it works though maybe it’ll be easy for Breww to incorporate.

---

<div class="post-metadata">

**Author:** ![jon-kyme2](https://community.breww.com/user_avatar/community.breww.com/jon-kyme2/32/1926_2.png) [@jon-kyme2](https://community.breww.com/u/jon-kyme2)\
**Post date:** [28 August 2024 09:43 UTC](https://community.breww.com/t/total-litres-on-export-invoices/4802/10 "2024-08-28T09:43:34Z")

</div>

You’re welcome. It does work. But, like you say, easier (for us) if Breww do it,. However, if you’re in a hurry…

That said, I’d most likely whip the calculator out and add it as a note, manually.

---

<div class="post-metadata">

**Author:** ![luke](https://community.breww.com/user_avatar/community.breww.com/luke/32/3636_2.png) [@luke](https://community.breww.com/u/luke)\
**Post date:** [28 August 2024 13:26 UTC](https://community.breww.com/t/total-litres-on-export-invoices/4802/11 "2024-08-28T13:26:27Z")

</div>

Great to see you’ve been able to handle this using custom templates for now (and thanks Jon for your help). We’re happy to keep this request open for votes and implementation into Breww one day in the future to save the need for custom templates.

Cheers!
