Odoo Help

0

0
1 Answer
0
Marco Martínez
1/25/19, 3:21 PM

Hello, Michael.

I think we can't set a domain like that, the first parameter should be a field od the model, the second is the operator and the third one is the value.

So, if you want to hide the field depending on the availability of a value in the records of the one2many field, I recommend to create a new field in the model, maybe "type_event_invisible" of type Boolean.

I would define a method with @api.onchange('type_event') as decorator, this method should change the value of type_event_invisible field of the record. As I've tested, all onchange methods get executed at form loading.

Then, the domain for invisible attribute should be {'invisible':[('type_event_invisible', '=', True)]}

I'm not really good explaining, but I hope it can helps. Greetings.

1 Comment
Michael Douglas
1/26/19, 7:18 AM

That way I would create disposable fields in the database, so I did it this way:

ciencia = fields.Boolean(

compute='compute_display_view',

store=False,

default=False

)

confirmacao = fields.Boolean(

compute='compute_display_view',

store=False,

default=False

)

desconhecimento = fields.Boolean(

compute='compute_display_view',

store=False,

default=False

)

nao_realizada = fields.Boolean(

compute='compute_display_view',

store=False,

default=False

)

xml_entrada = fields.Boolean(

compute='compute_display_view',

store=False,

default=False

)

def compute_display_view(self):

for record in self:

for x in record.events:

if x.type_event == '210200':

record.confirmacao = True

record.ciencia = True

if x.type_event == '210220':

record.desconhecimento = True

record.ciencia = True

if x.type_event == '210240':

record.nao_realizada = True

record.ciencia = True

if x.type_event == '210210':

record.ciencia = True

for x in record.nsu:

if x.type_response == '1':

record.xml_entrada = True

Ask a Question
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now