mollie / mollie-odoo

Mollie Payments plugin for Odoo - an open source CRM and ERP
29 stars 50 forks source link

15.0 res.country is not JSON serializable #146

Closed jwaes closed 6 months ago

jwaes commented 11 months ago

Running odoo 15.0 on odoo.sh and getting this error with a stacktrace resulting in a failing payment

payment_mollie_official is 15.0.0.4

2023-12-08 18:38:40,781 29917 INFO mydatabase odoo.addons.payment.models.payment_transaction: generic and acquirer-specific processing values for transaction with id 118:
{'acquirer_id': 5,
 'amount': 552.38,
 'currency_id': 1,
 'partner_id': 1291,
 'provider': 'mollie',
 'reference': 'S00675-1'} 
2023-12-08 18:38:40,805 29917 ERROR mydatabase  odoo.http: Exception during JSON request handling. 
Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/home/odoo/src/odoo/odoo/http.py", line 698, in dispatch
    result = self._call_function(**self.params)
  File "/home/odoo/src/odoo/odoo/http.py", line 368, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/odoo/src/odoo/odoo/http.py", line 357, in checked_call
    result = self.endpoint(*a, **kw)
  File "/home/odoo/src/odoo/odoo/http.py", line 921, in __call__
    return self.method(*args, **kw)
  File "/home/odoo/src/odoo/odoo/http.py", line 546, in response_wrap
    response = f(*args, **kw)
File "/home/odoo/src/odoo/addons/payment/controllers/portal.py", line 219, in payment_transaction
    return tx_sudo._get_processing_values()
  File "/home/odoo/src/odoo/addons/payment/models/payment_transaction.py", line 497, in _get_processing_values
    rendering_values = self._get_specific_rendering_values(processing_values)
  File "/home/odoo/src/user/mollie/mollie-odoo/payment_mollie_official/models/payment_transaction.py", line 111, in _get_specific_rendering_values
    payment_data = self._create_mollie_order_or_payment()
  File "/home/odoo/src/user/mollie/mollie-odoo/payment_mollie_official/models/payment_transaction.py", line 254, in _create_mollie_order_or_payment
    result = self._mollie_create_payment_record('order', silent_errors=True)
  File "/home/odoo/src/user/mollie/mollie-odoo/payment_mollie_official/models/payment_transaction.py", line 271, in _mollie_create_payment_record
    result = self.acquirer_id._api_mollie_create_payment_record(api_type, payment_data, params=params, silent_errors=silent_errors)
  File "/home/odoo/src/user/mollie/mollie-odoo/payment_mollie_official/models/payment_acquirer.py", line 344, in _api_mollie_create_payment_record
    return self._mollie_make_request(endpoint, data=payment_data, params=params, method="POST", silent_errors=silent_errors)
  File "/home/odoo/src/user/mollie/mollie-odoo/payment_mollie_official/models/payment_acquirer.py", line 287, in _mollie_make_request
    data = json.dumps(data)
  File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/http.py", line 654, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/odoo/src/odoo/odoo/http.py", line 301, in _handle_exception
    raise exception.with_traceback(None) from new_cause
TypeError: Object of type res.country is not JSON serializable
odoo-mvds commented 6 months ago

Hello,

Thank you for reporting the issue.

Issue has been fixed in 15.0.0.6 and released on Odoo app store. Please use latest module.