Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
2716 Vistas

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
Descartar
Mejor respuesta

Hello Denny,

Please find code in comment.

I hope this will help you. 

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

Avatar
Descartar

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

Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
abr 23
2635
2
feb 25
40173
1
feb 22
7745
2
dic 21
3994
0
oct 21
2166