Odoo Help

0

0
1 Jawaban
3
Avatar

Manish Kumar Bohra India

--Manish Kumar Bohra--
11863
| 6 5 10
Bikaner, India
--Manish Kumar Bohra--


Manish Kumar Bohra India
17/10/17 08.02

Hello Jorge , 

Try this : 

field_names = fields.Many2many('ir.model.fields', string='Fields to use', domain="[('model_id', '=', model_names )]")

but this not auto select-fill all fields and not clear previous selection, if you expect?

UPDATE:

If you need auto fill, you additionaly add, like this (not tested):

@api.one
    @api.depends(
        'model_names',
        'model_names.field_id',
        'model_names.field_id.model_id',
    )
    def _get_names(self):
        self.field_names_computed = self.model_names.field_id.filtered(lambda l: l.model_id.id == self.model_names.id)    
    
     model_names = fields.Many2one('ir.model', 'Model to use')
    field_names_computed = fields.Many2many('ir.model.fields', compute='_get_names', string='Fields to use COMPUTED')   
    field_names = fields.Many2many('ir.model.fields', string='Fields to use', domain="[('model_id', '=', model_names )]")
    @api.onchange('field_names_computed')
    def do_stuff(self):
        self.field_names=self.field_names_computed

Thanks 

Mengajukan pertanyaan
Writer
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