Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
2707 Weergaven

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
Annuleer
Beste antwoord

Hello Denny,

Please find code in comment.

I hope this will help you. 

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

Avatar
Annuleer

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

Beste antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
apr. 23
2633
2
feb. 25
40143
1
feb. 22
7736
2
dec. 21
3984
0
okt. 21
2158