Skip to Content
Menu
This question has been flagged
2 Replies
1477 Views

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

Avatar
Discard
Best Answer

Hello Denny,

Please find code in comment.

I hope this will help you. 

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

Avatar
Discard

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)]"/>

Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
2
Apr 23
1451
2
May 24
35808
1
Feb 22
6687
2
Dec 21
2706
0
Oct 21
1371