コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
13645 ビュー

Hi,

in my form i added two fields for attachment work but this code could not save two different attachement in each field,  it just save automatically  the same attachement in both of them. how plz can i resolve this.

this my code in .py : 

identity_card = fields.Many2many('ir.attachment', string="Identity card")
Contract = fields.Many2many('ir.attachment', string="Contract")
in xml :
<field name="identity_card" widget="many2many_binary"/>
<field name="Contract" widget="many2many_binary"/>

Screenshot : 
Regards



アバター
破棄
最善の回答

Hi Medmars,

Would this solve your problem?

Regards,

-make

identity_card= fields.Many2many(comodel_name="ir.attachment", 
                                relation="m2m_ir_identity_card_rel",
                                column1="m2m_id",
                                column2="attachment_id",
                                string="Identity Card")
contract = fields.Many2many(comodel_name="ir.attachment",
                                relation="m2m_ir_contract_rel".
                                column1="m2m_id",
                                column2="attachment_id",
                                string="Contract")
<field name="identity_card" widget="many2many_binary"/>
<field name="contract" widget="many2many_binary"/>
アバター
破棄
著作者

Perfect answer ! Thanks

This man deserves Nobel prize :)

関連投稿 返信 ビュー 活動
1
9月 20
10752
2
7月 25
4511
2
12月 24
7683
2
11月 24
28443
2
5月 24
7419