A onchange method that try to modify the inherited domain and presents me the following error, this is the code I'm using and the new api..
File "/usr/lib/python2.7/dist-packages/psycopg2/extensions.py", line 129, in getquoted
pobjs = [adapt(o) for o in self._seq]
ProgrammingError: can't adapt type 'account.journal'
@api.multi
def onchange_company_id(self, company_id, part_id, type, invoice_line, currency_id):
result = super(account_invoice, self).onchange_company_id(company_id, part_id, type, invoice_line, currency_id)
obj_jrnl = self.env['account.journal']
jrnl_ids = result['domain']['journal_id']
jrd = []
for jrnl_id in jrnl_ids:
for lst in jrnl_id[2]:
jrnl = obj_jrnl.search([('id','=',lst)])
for rec_jrnl in obj_jrnl.browse(jrnl):
if type in ('out_invoice', 'in_invoice'):
if rec_jrnl.type_doc.main_doc: # <-- Line Error
jrd.append(lst)
else:
if not rec_jrnl.cat_doc.void:
jrd.append(lst)
if jrd:
result['value'] = {'journal_id': jrd[0]}
result['domain'] = {'journal_id': [('id', 'in', jrd)]}
return result
The field is many2one type_doc to another table and main_doc is a boolean field, this method works flawlessly in 6.1 and 7.0