Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
15127 มุมมอง

I want to create a new record which contains Many2many fields using data file. Can someone please point me to an example of how to set Many2many field from data file?

I tried the following code.


<record id="account_journal_check" model="account.journal">

    <field name="name">Check</field>

    <field name="type">bank</field>

    <field name="code">BNK3</field>

    <field name="sequence_id">50</field>

    <field name="default_debit_account_id">186</field>

    <field name="default_credit_account_id">186</field>

    <field name="inbound_payment_method_ids">(4, [1])</field>

    <field name="outbound_payment_method_ids">(4, [2,3])</field>

    <field name="show_on_dashboard">True</field>

    <field name="bank_statements_source">manual</field>

    <field name="journal_user">True</field>

</record>


Here the fields "inbound_payment_method_ids" and "outbound_payment_method_ids" are the Many2many field. All other fields values get populated in my form. But these two fields values are not get populated.

Any Help?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello,

You can check example here

Hope this could help

อวตาร
ละทิ้ง
ผู้เขียน

Thanks Ahmed M.Elmubarak, It helped

คำตอบที่ดีที่สุด

I still didn't understand...I'm trying to use the first option of my many2many field, but It won't work.  

อวตาร
ละทิ้ง