Jinja template extention

Hi, i wonder how i can add some jinja extension

i want to add jinja2.ext.do

Thanks

1 Like

I wonder too :smile:

Can you explain clearly what you want to do.

@rmehta yaa. i want to add “do” extension…because i want i can set parameter at loop and use it outside of the loop

Please guide…^^

Thanks…

Never worked with do extension. Have you tried to google? Where are you stuck?

item that sold is in 1 UOM , and i want to add total UOM included in deliverry note print format…

but i do not need this to be custom field for this actually…

@rmehta how is it?.. can i add new extension…

Where are you stuck? You can always create a new print format

@rmehta ta just want to add some logic into print format with DO extension…

Hi, do you were able to achieve this? I need to use “do” extension as wello" extension as well.

Hi @bobzz_zone, @federico_calvo,

if I understand correctly you want a variable in Jinja to count with. Have you tried something like this:

Define variable

 {% set vars = {'uom_count': 0} %} 

Update (the if construct makes Jinja execute the update function :wink:)

 {% if vars.update({'uom_count': vars.uom_count + 1}) %}{% endif %}

Use

{{ vars.uom_count }}

Hope this helps.

2 Likes

A little bit hacky but it works well.

Thank you!