Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
2731 Zobrazení

I need to understand why the many2one field ignore the attrs invisible and required in odoo 10.

I have a field account_account_id that is many2one field and the invisible property is not working, please help.

class AccountAccountReport(models.Model):
_name = 'account.account.report'

name = fields.Char(string='Nombre')
document_type = fields.Selection(string="Tipo de reporte", selection=TYPE_REPORT)
account_account_id = fields.Many2one('account.account', string='Cuenta contable')
date_from = fields.Date(string='Fecha desde')
date_to = fields.Date(string='Fecha hasta')
excel_file = fields.Binary()
file_name = fields.Char()
<field name="account_account_id" attrs="{'invislble': [('document_type','not in', ['report_account_ledger']), ('document_type', '=', False)]}"/>
Avatar
Zrušit
Nejlepší odpověď

Hi,

Seems the field will get invisible only if the both the given condition get satisfied, right now you have given as following the field must be invisible if the document_type is not report_account_ledger and document_type = False.


So if the document_type contains any value the field will not get invisible, also given condition seems to have some issue. If you looking to hide the field if any of the given condition is satisfied you can use OR.

<field name="account_account_id" attrs="{'invislble': ['|', ('document_type','not in', ['report_account_ledger']), ('document_type', '=', False)]}"/>


Thanks

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
úno 18
3873
3
pro 17
4200
2
srp 17
5941
2
čvc 25
4774
2
úno 25
5964