Я пытаюсь добавить поле many2one на странице настроек в odoo11. Я могу добавить поле char или integer на странице настроек, но с полем Many2one я получаю ошибку.
Ошибка:
psycopg2.DataError: invalid input syntax for integer:"double.accounts(406,)"
LINE 1: ...FROM "double_accounts" WHERE "double_accounts".id IN ('double.acco...
вот мой код:
класс AccountSetting (models.TransientModel):
_inherit = 'res.config.settings'
authtoken_module = fields.Char(default_model='account.move')
organization_module = fields.Char(default_model='account.move')
double_accounts_id = fields.Many2one('double.accounts', string="double Entery", default_model='account.move')
def get_values(self):
res = super(AccountSetting, self).get_values()
res.update({
'authtoken_module': self.env['ir.config_parameter'].sudo().get_param('account.authtoken_module', default=''),
'organization_module': self.env['ir.config_parameter'].sudo().get_param('account.organization_module'),
#### the error that i am facing from this line
'double_accounts_id': self.env['ir.config_parameter'].sudo().get_param('account.double_accounts_id', default=''),
####
})
return res
def set_values(self):
super(AccountSetting, self).set_values()
self.env['ir.config_parameter'].sudo().set_param('account.authtoken_module', (self.authtoken_module or ''))
self.env['ir.config_parameter'].sudo().set_param('account.organization_module', (self.organization_module or ''))
self.env['ir.config_parameter'].sudo().set_param('account.double_accounts_id', (self.double_accounts_id or ''))