跳至內容
選單
此問題已被標幟
2 回覆
2799 瀏覽次數

Hello, how to set field record to invisible from field bank_from_journal_id when changing company_id.

bank_from_journal_id = fields.Many2one('account.journal', domain="[('type', 'in', ('bank', 'cash'))]",string="Bank From", tracking=True)
company_id = fields.Many2one('res.company', string='Company', tracking=True,default=lambdaself: self.env.company.id)

Like example, i create 'bank xxx' for 'tesla company' and then i want to make bank xxx invisible/hide when changing to another company. So the bank record is appeared when company is same as its created and hide when changing to another company.


Thanks

頭像
捨棄
最佳答案

Hello Denny,

Please find code in comment.

I hope this will help you. 

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

頭像
捨棄

Please find below code it may help you to resolve this issue,

<field name="company_id"/>
<field name="bank_from_journal_id" domain="[('company_id','=',company_id)]"/>

最佳答案

Hi,

As the question description, you need to filter the bank accounts shown for the field bank_from_journal_id based on the company selected.You can achieve this by using domain for the field bank_from_journal_id.Change the field definition of bank_from_journal_id with the domain given.

domain = "[('company_id', '=', company_id), ('type', 'in', ('bank', 'cash'))]"

Regards

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
4月 23
2717
2
2月 25
40417
1
2月 22
7835
2
12月 21
4087
0
10月 21
2247