Python (RML) - create a list and then combine its elements into a string?

I am trying to generate a list in an RML report from a single field of several lines. There is a class sale.orderand sale.order.line(this refers to another class in which tax names are stored).

So, in the rml report, I tried something like this:

[[ ', '.join(list.append(x.name) for x in l.tax_id) ]]

Where l is equivalent order_line(this field belongs to the class sale.order.line), and tax_id refers to the tax table, where I need to get all the tax names and add them to the string. In rml, I cannot just define a list, and then try to add it, because it gives me the wrong syntax error.

After trying this line, I got this error:

TypeError: descriptor 'append' requires a 'list' object but received a 'unicode'

So, I tried wrapping x.namewith a list (), and then got this error:

TypeError: append() takes exactly one argument (0 given)

, , , - list(), . , - , , , ?

:

[[ ', '.join(map(lambda x: x.name, l.tax_id)) ]]

order line. , ( ). , , .

()

|id|name|
 1 | tax1
 2 | tax2
 3 | tax3

( order_line one2many, )

|id|order_line|
|1 |3,4|

|id|tax_id|
|3 |1,2
|4 |2,3

, , :

tax1, tax2, tax3 ( )

: tax2, tax3

+3
1

[[','.join(list (set (tax.name o.order_line .tax_id, )))]]

+1

All Articles