Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
2796 Visualizzazioni

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
Abbandona
Risposta migliore

Hello Denny,

Please find code in comment.

I hope this will help you. 

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

Avatar
Abbandona

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

Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
apr 23
2712
2
feb 25
40409
1
feb 22
7829
2
dic 21
4078
0
ott 21
2246