İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
5374 Görünümler

need to create many2many values in base.config.settings but when open already created that field empty,

please guide me how to use many2many field in configuration model


class BaseConfigSettingsInherit(models.TransientModel):
    _inherit = 'base.config.settings'
   
    res_model_email = fields.Many2many('ir.model','partner_email_conf_relat','config_id','model_id',string="Models", help="Here Selected model Internal Log not only send email to Specfied Group users", store=True)

Avatar
Vazgeç
En İyi Yanıt

Hello KLN,

try as below code into your inherited object

@api.model
def get_default_<your_fieldname>(self, fields):
        value = self.env['ir.config_parameter'].sudo().get_param('modulename.your_field_name')
        return {
            'your_fieldname': value # list of ids
        }

@api.multi
def set_<your_fieldname>(self):
    self.env['ir.config_parameter'].sudo().set_param('modulename.your_field_name', [(4, record_ids)])
Thanks
Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
May 17
11322
0
Tem 22
1659
1
Oca 22
11390
4
Şub 20
4430
1
Tem 19
6640