for each="purchase in records"
replace text:p="set_lang(purchase.party.lang)"
replace text:p="purchase.set_lang(purchase.party.lang)"
for each="line in purchase.report_address.splitlines()"
line
/for
if test="purchase.party.tax_identifier"
purchase.party.tax_identifier.type_string: purchase.party.tax_identifier.code
/if
choose test=""
when test="purchase.state == 'draft'"
Draft Purchase Order
/when
when test="purchase.state == 'quotation'"
Request for Quotation No: purchase.full_number
/when
otherwise test=""
Purchase Order No: purchase.full_number
/otherwise
/choose
Description: purchase.description or ''
Reference: purchase.reference or ''
Customer Code: purchase.party.get_multivalue('customer_code', company=purchase.company.id) or ''
Date: format_date(purchase.purchase_date or today, purchase.party.lang)
Delivery Address:
for each="line in purchase.delivery_full_address.splitlines()"
line
/for
Description	Quantity	Unit Price	Taxes	Amount
for each="line in purchase.lines"
choose test=""
when test="line.type == 'line'"
if test="line.product_name" line.product_name /if if test="line.description" for each="description in line.description.split('\n')" description /for /if	format_number_symbol(line.quantity, purchase.party.lang, line.unit, digits=line.unit.digits) if line.unit else format_number(line.quantity, purchase.party.lang)	if test="line.unit_price is not None" format_currency(line.unit_price, purchase.party.lang, purchase.currency, digits=line.__class__.unit_price.digits[1]) /if	for each="tax in line.taxes" tax.description /for	if test="line.amount is not None" format_currency(line.amount, purchase.party.lang, purchase.currency) /if
/when
when test="line.type == 'subtotal'"
for each="description in (line.description or '').split('\n')" description /for				format_currency(line.amount, purchase.party.lang, purchase.currency)
/when
when test="line.type == 'title'"
for each="description in (line.description or '').split('\n')" description /for
/when
otherwise test=""
for each="description in (line.description or '').split('\n')" description /for
/otherwise
/choose
/for
	Total (excl. taxes): format_currency(purchase.untaxed_amount, purchase.party.lang, purchase.currency) Taxes: format_currency(purchase.tax_amount, purchase.party.lang, purchase.currency) Total: format_currency(purchase.total_amount, purchase.party.lang, purchase.currency)
for each="comment in (purchase.comment or '').split('\n')"
comment
/for
/for
if test="company and company.header"
for each="line in company.header_used.split('\n')"
line
/for
/if
choose
when test="company and company.logo"
/when
when test="company"
company.rec_name
/choose
if test="company and company.footer"
for each="line in company.footer_used.split('\n')"