title: Programming error: can't adapt type 'account.account' - Odoo v8
body: <p>I have this method:</p>
  
  <pre><code>@api.multi
  @api.depends('order_picking', 'order_picking.isbn', 'contract_worksheet', 'state')
  def accounting_scenarios(self):
      for record in self:
          if not len(record.transporter):
              raise Warning('Please Enter Transporter !')
          elif not len(record.transporter.transp_transit):
              raise Warning('Please assign transit account to the transporter !')
          if record.state in ('awaitingraw'): #('cancel', 'done')
              record.temp = record.contract_worksheet.total_alles - record.contract_worksheet.total_totals
              acc_move = self.env['account.move'] 
              move_lines = [
                  (0, 0, {
                      'name': 'name', # a label so accountant can understand where this line come from
                      'debit': record.temp or 0.0, # amount of debit
                      'credit': 0, # amount of credit
                      'account_id': record.transporter.transp_transit, 
                      'date': date,
                      'partner_id': record.transporter, 
                      #'currency_id': currency_id or (account.currency_id.id or False),
                  }),
              ]
  
              journal_id = False
              if record.transporter.transp_transit:
                  journals = self.env['account.journal'].search([
                      ('default_debit_account_id', '=', record.transporter.transp_transit.id)
                  ])
                  if journals:
                      journal_id = journals[0].id
                      acc_move.create({
                      #'period_id': period_id, #Fiscal period
                          'journal_id': journal_id, 
                          'date': fields.Date.today(),
                          'state': 'draft',
                          'line_id': move_lines, 
                      })
          elif record.state in ('work_in_progress'):
              record.temp2 = record.contract_worksheet.total_totals
          elif record.state in ('delivered'):
              record.transporter.transp_transit.debit = record.contract_worksheet.total_alles
  </code></pre>
  
  <p>I've realised the problem with <code>debit</code> and <code>credit</code> fields, the problem was that the journal hadn't the account (<code>transp_transit</code>) as default debit or credit account.</p>
  
  <p>Anyways, right now it seems to be trying to do the <code>account.move</code> but it throws me this:</p>
  
  <pre><code>2017-12-14 00:44:34,438 2736 INFO hasta_cuandooo_def werkzeug: 127.0.0.1 - - 
  [14/Dec/2017 00:44:34] "POST /web/dataset/call_button HTTP/1.1" 200 -
  2017-12-14 00:44:38,177 2736 ERROR hasta_cuandooo_def openerp.sql_db: 
  Programming error: can't adapt type 'account.account', in query  SELECT 
  "account_account"."id","account_account"."active" FROM "account_account"
                      WHERE "account_account".id IN %s  ORDER BY "account_account"."parent_left"  
  
  2017-12-14 00:44:38,177 2736 ERROR hasta_cuandooo_def openerp.http: Exception during JSON request handling.
  Traceback (most recent call last):
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\http.py", line 546, in _handle_exception
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\http.py", line 583, in dispatch
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\http.py", line 319, in _call_function
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\service\model.py", line 118, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\http.py", line 316, in checked_call
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\http.py", line 812, in __call__
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\http.py", line 412, in response_wrap
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\openerp\addons\web\controllers\main.py", line 948, in call_button
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\openerp\addons\web\controllers\main.py", line 936, in _call_kw
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 268, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 399, in old_api
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\openerp\addons\bsi\models\models.py", line 1472, in check_quantity
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\openerp\addons\bsi\models\models.py", line 1400, in write
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 3789, in write
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 592, in new_api
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 4048, in _write
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 5773, in recompute
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 5773, in &lt;dictcomp&gt;
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 5654, in __getitem__
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\fields.py", line 835, in __get__
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\fields.py", line 913, in determine_value
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\fields.py", line 893, in compute_value
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\fields.py", line 885, in _compute_value
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\openerp\addons\bsi\models\models.py", line 1390, in accounting_scenarios
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 508, in new_api
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\openerp\addons\account\account.py", line 1388, in create
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 268, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 372, in old_api
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 4101, in create
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 508, in new_api
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 4292, in _create
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\osv\fields.py", line 799, in set
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 268, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\openerp\addons\account\account_move_line.py", line 1276, in create
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 268, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 3148, in read
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 3183, in read
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 3312, in _read_from_database
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\sql_db.py", line 171, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\sql_db.py", line 247, in execute
  File "psycopg2\extensions.pyc", line 129, in getquoted
  ProgrammingError: can't adapt type 'account.account'
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have this field on my class:</p>
  
  <pre><code>transporter = fields.Many2one('res.partner', string="Transporter", domain="[('type_of_supplier','=','transporter')]")
  </code></pre>
  
  <p>And on <code>res.partner</code> (transporter):</p>
  
  <pre><code>transp_transit = fields.Many2one('account.account', string='Transporter Transit Account')
  </code></pre>