Skip to Content
Menu
This question has been flagged
1 Reply
2979 Views

Hello Community,

I am using odoo 14 and added one2many field in 'res.config.settings'. But this field value show false when save this res.config.settings form.

Below is my code:-

class ProjectResConfigSettings(models.TransientModel):
    _inherit = 'res.config.settings'

    hide_export_field = fields.One2many('export.hide', 'res_id', string='Hide Field')


    def set_values(self):
        super(ProjectResConfigSettings, self).set_values()
        IrDefault = self.env['ir.default'].sudo()
        IrDefault.set('res.config.settings', 'hide_export_field', self.hide_export_field.ids)


class ExportHideFields(models.Model):
    _name = "export.hide"

    res_id = fields.Integer(string="Resend wizard")
    model_ids = fields.Many2one('ir.model', string='Model')
    field_for_hide = fields.Many2many('ir.model.fields', string='Field For Hide')


Thanks in advance.

Avatar
Discard
Best Answer

Hello Pawan Sharma,

def set_values(self):

        super(ProjectResConfigSettings, self).set_values()

        IrDefault = self.env['ir.default'].sudo()

        IrDefault.set('res.config.settings', 'hide_export_field', self.hide_export_field.ids)

In your set_values method .set will be 

 IrDefault.set('export.hide', 'hide_export_field', self.hide_export_field.ids)

Thanks

Regards,




Email:      odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

   

Avatar
Discard
Author

Hi Jainesh, thanks for reply.

this solution also not working. i think with this we have to also add another parameter but don't know which one?

Related Posts Replies Views Activity
1
May 24
1435
0
Sep 23
144
2
Aug 23
19747
1
Apr 24
23290
3
May 23
1795