Many2one field in a Custom Setting page in OdooProper way to declare custom exceptions in modern Python?domain filter for many2one fields in odoo?sqlalchemy.exc.DataError while executing the update query in PostgresqlHow to use onchange with many2one in odoo(formally openerp)odoo many2one as selection fieldodoo many2one as selection field in comboboxHow to update “comodel_name” attribute of inheriting model's Many2one fields in Odoo?Sales - Reporting - Sales: psycopg2.DataError: division by zeroOne record in Many2one field having another multiple records in Many2one field in OdooDomain in Many2one Odoo 11

How do you pronounce the letter "t" before "h"?

Hit the Bulls Eye with T in the Center

King or Queen-Which piece is which?

Why isn't my calculation that we should be able to see the sun well beyond the observable universe valid?

What can I do with a research project that is my university’s intellectual property?

Constitutionality of U.S. Democratic Presidential Candidate's Supreme Court Suggestion

What are Elsa's reasons for selecting the Holy Grail on behalf of Donovan?

What do they call philosophers in China?

How many people are necessary to maintain modern civilisation?

What's currently blocking the construction of the wall between Mexico and the US?

Dates on degrees don’t make sense – will people care?

Is declining an undergraduate award which causes me discomfort appropriate?

Should I include an appendix for inessential, yet related worldbuilding to my story?

Loss of power when I remove item from the outlet

Why does Linux list NVMe drives as /dev/nvme0 instead of /dev/sda?

What does it mean to not be able to take the derivative of a function multiple times?

How to execute a command when ALL of the players are close enough

Do I have to explain the mechanical superiority of the player-character within the fiction of the game?

Too early in the morning to have SODA?

What happened to Steve's Shield in Iron Man 2?

Why is oilcloth made with linseed oil?

Music theory behind A chord in the key of G

`-` in tar xzf -

Greeting with "Ho"



Many2one field in a Custom Setting page in Odoo


Proper way to declare custom exceptions in modern Python?domain filter for many2one fields in odoo?sqlalchemy.exc.DataError while executing the update query in PostgresqlHow to use onchange with many2one in odoo(formally openerp)odoo many2one as selection fieldodoo many2one as selection field in comboboxHow to update “comodel_name” attribute of inheriting model's Many2one fields in Odoo?Sales - Reporting - Sales: psycopg2.DataError: division by zeroOne record in Many2one field having another multiple records in Many2one field in OdooDomain in Many2one Odoo 11






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I am trying to add many2one field in a setting page in odoo11. I am able to add char or integer field in a setting page but with Many2one field I get an error.



The Error :



 psycopg2.DataError: invalid input syntax for integer:"double.accounts(406,)"
LINE 1: ...FROM "double_accounts" WHERE "double_accounts".id IN ('double.acco...


here is my code :



class 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 ''))









share|improve this question

















  • 1





    I think this what you need to do set the value to id not the record set it self. self.env['ir.config_parameter'].sudo().set_param('account.double_accounts_id', (self.double_accounts_id.id or '')) --> self.double_accounts_id.id

    – EasyOdoo
    Mar 25 at 19:30











  • I got odoo server error (Database fetch misses ids (('395',)) and has extra ids ((395,)), may be caused by a type incoherence in a previous request )

    – Alqebaiti
    Mar 27 at 5:53

















1















I am trying to add many2one field in a setting page in odoo11. I am able to add char or integer field in a setting page but with Many2one field I get an error.



The Error :



 psycopg2.DataError: invalid input syntax for integer:"double.accounts(406,)"
LINE 1: ...FROM "double_accounts" WHERE "double_accounts".id IN ('double.acco...


here is my code :



class 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 ''))









share|improve this question

















  • 1





    I think this what you need to do set the value to id not the record set it self. self.env['ir.config_parameter'].sudo().set_param('account.double_accounts_id', (self.double_accounts_id.id or '')) --> self.double_accounts_id.id

    – EasyOdoo
    Mar 25 at 19:30











  • I got odoo server error (Database fetch misses ids (('395',)) and has extra ids ((395,)), may be caused by a type incoherence in a previous request )

    – Alqebaiti
    Mar 27 at 5:53













1












1








1








I am trying to add many2one field in a setting page in odoo11. I am able to add char or integer field in a setting page but with Many2one field I get an error.



The Error :



 psycopg2.DataError: invalid input syntax for integer:"double.accounts(406,)"
LINE 1: ...FROM "double_accounts" WHERE "double_accounts".id IN ('double.acco...


here is my code :



class 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 ''))









share|improve this question














I am trying to add many2one field in a setting page in odoo11. I am able to add char or integer field in a setting page but with Many2one field I get an error.



The Error :



 psycopg2.DataError: invalid input syntax for integer:"double.accounts(406,)"
LINE 1: ...FROM "double_accounts" WHERE "double_accounts".id IN ('double.acco...


here is my code :



class 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 ''))






python odoo odoo-11 erp






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 7:37









AlqebaitiAlqebaiti

375




375







  • 1





    I think this what you need to do set the value to id not the record set it self. self.env['ir.config_parameter'].sudo().set_param('account.double_accounts_id', (self.double_accounts_id.id or '')) --> self.double_accounts_id.id

    – EasyOdoo
    Mar 25 at 19:30











  • I got odoo server error (Database fetch misses ids (('395',)) and has extra ids ((395,)), may be caused by a type incoherence in a previous request )

    – Alqebaiti
    Mar 27 at 5:53












  • 1





    I think this what you need to do set the value to id not the record set it self. self.env['ir.config_parameter'].sudo().set_param('account.double_accounts_id', (self.double_accounts_id.id or '')) --> self.double_accounts_id.id

    – EasyOdoo
    Mar 25 at 19:30











  • I got odoo server error (Database fetch misses ids (('395',)) and has extra ids ((395,)), may be caused by a type incoherence in a previous request )

    – Alqebaiti
    Mar 27 at 5:53







1




1





I think this what you need to do set the value to id not the record set it self. self.env['ir.config_parameter'].sudo().set_param('account.double_accounts_id', (self.double_accounts_id.id or '')) --> self.double_accounts_id.id

– EasyOdoo
Mar 25 at 19:30





I think this what you need to do set the value to id not the record set it self. self.env['ir.config_parameter'].sudo().set_param('account.double_accounts_id', (self.double_accounts_id.id or '')) --> self.double_accounts_id.id

– EasyOdoo
Mar 25 at 19:30













I got odoo server error (Database fetch misses ids (('395',)) and has extra ids ((395,)), may be caused by a type incoherence in a previous request )

– Alqebaiti
Mar 27 at 5:53





I got odoo server error (Database fetch misses ids (('395',)) and has extra ids ((395,)), may be caused by a type incoherence in a previous request )

– Alqebaiti
Mar 27 at 5:53












1 Answer
1






active

oldest

votes


















0














Haven't looked very well into it. But it seems you get a recordset out of your parameter instead of an ID. So a simple solution is to put a .id to the end of the marked line. But that isn't the full solution, cause your default has to be changed to self.sudo().env['account.double_accounts_id'], where .id will work, too.



I'm really wondering why you get a recordset, maybe someone can answer that.






share|improve this answer























  • your solution does not work... I am still getting record set with no value psycopg2.DataError: invalid input syntax for integer: "double.accounts()"

    – Alqebaiti
    Mar 25 at 10:02











  • Did you change the default of get_param?

    – CZoellner
    Mar 25 at 10:04











  • yes, i have changed it to what you suggest

    – Alqebaiti
    Mar 25 at 10:09











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55333116%2fmany2one-field-in-a-custom-setting-page-in-odoo%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Haven't looked very well into it. But it seems you get a recordset out of your parameter instead of an ID. So a simple solution is to put a .id to the end of the marked line. But that isn't the full solution, cause your default has to be changed to self.sudo().env['account.double_accounts_id'], where .id will work, too.



I'm really wondering why you get a recordset, maybe someone can answer that.






share|improve this answer























  • your solution does not work... I am still getting record set with no value psycopg2.DataError: invalid input syntax for integer: "double.accounts()"

    – Alqebaiti
    Mar 25 at 10:02











  • Did you change the default of get_param?

    – CZoellner
    Mar 25 at 10:04











  • yes, i have changed it to what you suggest

    – Alqebaiti
    Mar 25 at 10:09















0














Haven't looked very well into it. But it seems you get a recordset out of your parameter instead of an ID. So a simple solution is to put a .id to the end of the marked line. But that isn't the full solution, cause your default has to be changed to self.sudo().env['account.double_accounts_id'], where .id will work, too.



I'm really wondering why you get a recordset, maybe someone can answer that.






share|improve this answer























  • your solution does not work... I am still getting record set with no value psycopg2.DataError: invalid input syntax for integer: "double.accounts()"

    – Alqebaiti
    Mar 25 at 10:02











  • Did you change the default of get_param?

    – CZoellner
    Mar 25 at 10:04











  • yes, i have changed it to what you suggest

    – Alqebaiti
    Mar 25 at 10:09













0












0








0







Haven't looked very well into it. But it seems you get a recordset out of your parameter instead of an ID. So a simple solution is to put a .id to the end of the marked line. But that isn't the full solution, cause your default has to be changed to self.sudo().env['account.double_accounts_id'], where .id will work, too.



I'm really wondering why you get a recordset, maybe someone can answer that.






share|improve this answer













Haven't looked very well into it. But it seems you get a recordset out of your parameter instead of an ID. So a simple solution is to put a .id to the end of the marked line. But that isn't the full solution, cause your default has to be changed to self.sudo().env['account.double_accounts_id'], where .id will work, too.



I'm really wondering why you get a recordset, maybe someone can answer that.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 25 at 8:47









CZoellnerCZoellner

7,89631630




7,89631630












  • your solution does not work... I am still getting record set with no value psycopg2.DataError: invalid input syntax for integer: "double.accounts()"

    – Alqebaiti
    Mar 25 at 10:02











  • Did you change the default of get_param?

    – CZoellner
    Mar 25 at 10:04











  • yes, i have changed it to what you suggest

    – Alqebaiti
    Mar 25 at 10:09

















  • your solution does not work... I am still getting record set with no value psycopg2.DataError: invalid input syntax for integer: "double.accounts()"

    – Alqebaiti
    Mar 25 at 10:02











  • Did you change the default of get_param?

    – CZoellner
    Mar 25 at 10:04











  • yes, i have changed it to what you suggest

    – Alqebaiti
    Mar 25 at 10:09
















your solution does not work... I am still getting record set with no value psycopg2.DataError: invalid input syntax for integer: "double.accounts()"

– Alqebaiti
Mar 25 at 10:02





your solution does not work... I am still getting record set with no value psycopg2.DataError: invalid input syntax for integer: "double.accounts()"

– Alqebaiti
Mar 25 at 10:02













Did you change the default of get_param?

– CZoellner
Mar 25 at 10:04





Did you change the default of get_param?

– CZoellner
Mar 25 at 10:04













yes, i have changed it to what you suggest

– Alqebaiti
Mar 25 at 10:09





yes, i have changed it to what you suggest

– Alqebaiti
Mar 25 at 10:09



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55333116%2fmany2one-field-in-a-custom-setting-page-in-odoo%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해