Skip to content

Instantly share code, notes, and snippets.

@sharoonthomas
Created January 1, 2018 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sharoonthomas/7163e890176c668d3e55ace54adc1641 to your computer and use it in GitHub Desktop.
Save sharoonthomas/7163e890176c668d3e55ace54adc1641 to your computer and use it in GitHub Desktop.
Jinja2 template for rendering PO lines as a CSV file on fulfil.io
"Po number","Ship to Name","Ship to address","Ship to phone number","Product name","Our SKU","Your SKU","Quantity","Amount"
{% for record in records -%}
{% for line in record.lines %}"{{ [
line.purchase.number,
line.purchase.customer and line.purchase.customer.name,
line.purchase.customer and line.purchase.delivery_address.full_address.replace('\r\n', ','),
line.purchase.customer and line.purchase.customer.phone,
line.supplier_product_name or line.description,
line.product and line.product.code,
line.supplier_product_code or '',
line.quantity,
line.amount
]|join('","') }}"
{% endfor %}
{%- endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment