Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
2 Respostas
178 Visualizações

We're facing a persistent RPC_ERROR on our Odoo 18 Enterprise staging server during the "Create Invoice" action from the "Create Invoices" wizard (`sale.advance.payment.inv`). This is the traceback:


(psycopg2.ProgrammingError: can't adapt type 'res.partner' 

...see full traceback below...)


**Key points:**

- The error occurs when using the "Create Invoices" button on a sales order.

- We are on Odoo 18 Enterprise, latest build, no custom code running (all custom modules uninstalled, server restarted, still persists).

- Error also happens after restoring database and running on fresh staging.


**Traceback (full):**

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/http.py", line 2122, in _transactioning
    return service_model.retrying(func, env=self.env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/odoo/service/model.py", line 156, in retrying
    result = func()
             ^^^^^^
  File "/home/odoo/src/odoo/odoo/http.py", line 2089, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/odoo/http.py", line 2337, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 333, in _dispatch
    result = endpoint(**request.params)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/odoo/http.py", line 754, in route_wrapper
    result = endpoint(self, *args, **params_ok)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/addons/web/controllers/dataset.py", line 42, in call_button
    action = call_kw(request.env[model], method, args, kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/odoo/api.py", line 533, in call_kw
    result = getattr(recs, name)(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/addons/sale/wizard/sale_make_invoice_advance.py", line 136, in create_invoices
    invoices = self._create_invoices(self.sale_order_ids)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/enterprise/industry_fsm_sale/wizard/sale_make_invoice_advance.py", line 11, in _create_invoices
    invoices = super()._create_invoices(sale_orders)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/enterprise/sale_timesheet_enterprise/wizard/sale_make_invoice_advance.py", line 42, in _create_invoices
    return super()._create_invoices(sale_orders)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/addons/sale_timesheet/wizard/sale_make_invoice_advance.py", line 51, in _create_invoices
    return super()._create_invoices(sale_orders)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/enterprise/sale_subscription/wizard/sale_make_invoice_advance.py", line 13, in _create_invoices
    return super(SaleAdvancePaymentInv, self)._create_invoices(sale_orders)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/addons/sale/wizard/sale_make_invoice_advance.py", line 170, in _create_invoices
    invoice = self.env['account.move'].sudo().create(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<decorator-gen-283>", line 2, in create
  File "/home/odoo/src/odoo/odoo/api.py", line 495, in _model_create_multi
    return create(self, [arg])
           ^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/addons/purchase/models/account_invoice.py", line 167, in create
    moves = super(AccountMove, self).create(vals_list)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<decorator-gen-144>", line 2, in create
  File "/home/odoo/src/odoo/odoo/api.py", line 496, in _model_create_multi
    return create(self, arg)
           ^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/addons/account/models/account_move.py", line 3193, in create
    moves = super().create(vals_list)
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<decorator-gen-50>", line 2, in create
  File "/home/odoo/src/odoo/odoo/api.py", line 496, in _model_create_multi
    return create(self, arg)
           ^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/addons/mail/models/mail_thread.py", line 278, in create
    threads = super(MailThread, self).create(vals_list)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<decorator-gen-0>", line 2, in create
  File "/home/odoo/src/odoo/odoo/api.py", line 496, in _model_create_multi
    return create(self, arg)
           ^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/odoo/models.py", line 5017, in create
    records = self._create(data_list)
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/odoo/models.py", line 5201, in _create
    cr.execute(SQL(
  File "/home/odoo/src/odoo/odoo/sql_db.py", line 354, in execute
    res = self._obj.execute(query, params)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/psycopg2/extensions.py", line 113, in getquoted
    pobjs = [adapt(o) for o in self._seq]
             ^^^^^^^^
psycopg2.ProgrammingError: can't adapt type 'res.partner'


**Request:**

- What could be causing this error?

- Is this related to data integrity, an internal bug, or a known issue with partner record assignment in Odoo 18?

- Any steps to debug or hotfix?


Thanks for your support.



Avatar
Cancelar

[Paste traceback as text, but *remove any http links/images* to avoid karma filter]
Also, unless you can reproduce this issue in runbot.odoo.com, this most likely is not related to core Odoo.

In general,
can't adapt type 'res.partner'
usually means a field expecting an id got set an object instead.

Ok, since traceback is available now, nothing obvious meets the eye. Would be interesting to see what the final values to be set in the create() method actually are to identify the problematic field (could be partner_id but could anything else either).
Studio customization? Automated actions?

Autor

Automated actions page i am unable to see under setting -> Technical -> Automation  -> Only I can see Automation rules, Scheduled Actions, Scheduled action triggers. Did not even done any odoo studio customization. What If I wanted to double check how to see my odoo studio views creations that are done by me.

Autor Melhor resposta

Doesn't work what to do now please help me out from this  Cybrosys Techno Solutions Pvt.Ltd

Avatar
Cancelar
Melhor resposta

Hi,

The error message can't adapt type 'res.partner' means:

Somewhere in the call stack, Odoo is passing a full res.partner recordset instead of its id when creating an invoice (i.e., a value like partner_id: partner_record instead of partner_id: partner_record.id). If you have already uninstalled your custom module, please upgrade the sale and account modules to ensure the system works correctly.


Hope it helps

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
1
jul. 25
159
2
jun. 25
495
2
mai. 25
510
1
mai. 25
683
1
mar. 25
808