Here are some important very useful tags that can help you definitely while creating various kinds of reports:
[[ repeatIn(objects,'o') ]]: To add loop on the object selected, example [[ repeatIn(objects,'invoice') ]].
[[ repeatIn(o.invoice_line,'l') ]]: To add loop on each line of the object or an invoice, example [[ repeatIn(o,order_line,'l') ]], adds a loop on lines of a sale order.
[[ (o.prop=='value')and 'YES' or 'NO' ]]: Prints Yes or No according to the condition, example [[ (invoice.state=='cancel')and 'Canceled' or '' ]], adds Canceled where an invoice is canceled.
[[ round(o.length * o.breadth * 2, 2) ]]: Prints a calculated value on fields rounded to two decimal precision, example [[ round(line.price * line.quantity, 2) ]], prints subtotal for a line in an order or an invoice.
[[ reduce(lambda x, obj: x+obj.qty , list , 0 ) ]]: Prints sum of the quantity in a list, example [[ reduce(lambda x, obj: x+obj.amount_total , objects , 0 ) ]], sum of the total amounts from a list of invoices.
[[ setLang(o.partner_id.lang) ]]: For localized printing, setting the language for the report like English, French etc.
[[ formatLang(o.date_invoice,date=True) ]]: For printing date in a format that is used in the defined setLang, for example in India, we use a date in dd/mm/yy format.
[[ time.strftime('%d/%m/%Y') ]]: Prints the date in dd/mm/yy format from a time string.
[[ time.ctime() ]]: Prints the current date and time.
[[ user.name ]]: Prints the user of the OpenERP database.
0 Comment(s)