Skip to Content
Menu
This question has been flagged
4 Replies
9162 Views

class Abc(models.Model):

    _inherit = 'product.template'

    bank = fields.Many2many(comodel_name='bank.bank',string='Bank')

----------------------------------------------------------------------------------------------------------------

<field name="bank" widget="many2many_tags" />

----------------------------------------------------------------------------------------------------------------

<tr>

<td>

BHK

</td>

<td>

<span t-field="product.bank" />

</td>

</tr>


It Gives Output like,

bank.bank(1, 3)

I want Output Like, bankname1, banname2...

Avatar
Discard

Thank You ,

Its worked ,

Best Answer

Hi,

Here you have to use a for loop, try the below code,

Replace,

<span t-field="product.bank" />


above line with the below,


<t t-foreach="product.bank" t-as="bank">
<span t-field="bank.name" />
</t>


Hope there is a field named 'name' inside the model 'bank.bank', if not change as per your case.


Thanks

Avatar
Discard
Author Best Answer

How can i add a space between two values ?

in the same case.

Avatar
Discard
Related Posts Replies Views Activity
6
Jan 21
11299
0
Jul 24
225
1
Feb 24
839
1
Sep 23
708
1
Jun 23
1873