for each="sale in records"
replace text:p="set_lang(sale.party.lang)"
replace text:p="sale.set_lang(sale.party.lang)"
for each="line in sale.report_address.splitlines()"
line
/for
if test="sale.party.tax_identifier"
sale.party.tax_identifier.type_string: sale.party.tax_identifier.code
/if
choose test=""
when test="sale.state == 'draft'"
Draft Sale Order
/when
when test="sale.state == 'quotation'"
Quotation No: sale.full_number
/when
otherwise test=""
Sale Order No: sale.full_number
/otherwise
/choose
Description: sale.description or ''
Reference: sale.reference or ''
Date: format_date((sale.quotation_date if sale.state in ['draft', 'quotation'] and sale.quotation_date else sale.sale_date) or today, sale.party.lang)
if test="sale.state in ['draft', 'quotation'] and sale.quotation_expire"
Expiration Date: format_date(sale.quotation_expire, sale.party.lang)
/if
Delivery Address:
for each="line in sale.delivery_full_address.splitlines()"
line
/for
Description	Quantity	Unit Price	Taxes	Amount
for each="line in sale.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, sale.party.lang, line.unit, digits=line.unit.digits) if line.unit else format_number(line.quantity, sale.party.lang)	format_currency(line.unit_price, sale.party.lang, sale.currency, digits=line.__class__.unit_price.digits[1])	for each="tax in line.taxes" tax.description /for	format_currency(line.amount, sale.party.lang, sale.currency)
/when
when test="line.type == 'subtotal'"
for each="description in (line.description or '').split('\n')" description /for				format_currency(line.amount, sale.party.lang, sale.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(sale.untaxed_amount, sale.party.lang, sale.currency) Taxes: format_currency(sale.tax_amount, sale.party.lang, sale.currency) Total: format_currency(sale.total_amount, sale.party.lang, sale.currency)
for each="comment in (sale.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')"