Skip to content

product_pricelist_fixed_currency_rate - Odoo 18: unexpected keyword argument 'currency' error #1831

@bvassy

Description

@bvassy

Module

product_pricelist_fixed_currency_rate

Describe the bug

After setup on Odoo 18 I can't use any pricelist configured using the module. If I use pricelists that don't use the fixed currency rate, everything works ok. Once I switch to a pricelist configured using the fixed currency rate, I get the following errors:

On any ecommerce product page, once I switch to a pricelist configured with the fixed currency rate:

500: Internal Server Error
Traceback
Traceback (most recent call last):
  File "/opt/odoo18/odoo/http.py", line 1997, in _transactioning
    return service_model.retrying(func, env=self.env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/odoo/service/model.py", line 137, in retrying
    result = func()
             ^^^^^^
  File "/opt/odoo18/odoo/http.py", line 1964, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/odoo/http.py", line 2127, in dispatch
    return self.request.registry['ir.http']._dispatch(endpoint)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/odoo/addons/base/models/ir_http.py", line 334, in _dispatch
    result = endpoint(**request.params)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/odoo/http.py", line 733, in route_wrapper
    result = endpoint(self, *args, **params_ok)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/addons/website_sale/controllers/main.py", line 716, in pricelist_change
    order_sudo._cart_update_pricelist(pricelist_id=pricelist.id)
  File "/opt/odoo18/addons/website_sale/models/sale_order.py", line 291, in _cart_update_pricelist
    self._recompute_prices()
  File "/opt/odoo18/addons/sale_management/models/sale_order.py", line 181, in _recompute_prices
    super()._recompute_prices()
  File "/opt/odoo18/addons/sale_loyalty/models/sale_order.py", line 728, in _recompute_prices
    super()._recompute_prices()
  File "/opt/odoo18/addons/sale/models/sale_order.py", line 1306, in _recompute_prices
    lines_to_recompute.with_context(force_price_recomputation=True)._compute_price_unit()
  File "/opt/odoo18/addons/sale_management/models/sale_order_line.py", line 38, in _compute_price_unit
    super(SaleOrderLine, self - lines_without_price_recomputation)._compute_price_unit()
  File "/opt/odoo18/addons/sale/models/sale_order_line.py", line 557, in _compute_price_unit
    price = line._get_display_price()
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/addons/sale_loyalty/models/sale_order_line.py", line 47, in _get_display_price
    return super()._get_display_price()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/addons/sale/models/sale_order_line.py", line 582, in _get_display_price
    return self._get_display_price_ignore_combo()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/addons/sale/models/sale_order_line.py", line 599, in _get_display_price_ignore_combo
    base_price = self._get_pricelist_price_before_discount()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/addons/sale/models/sale_order_line.py", line 653, in _get_pricelist_price_before_discount
    return self.pricelist_item_id._compute_price_before_discount(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/addons/product/models/product_pricelist_item.py", line 608, in _compute_price_before_discount
    return pricelist_item._compute_base_price(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ProductPricelist._compute_base_price() got an unexpected keyword argument 'currency'

On quotations, once I switch to a pricelist configured with the fixed currency rate and add a product to the quotation:

RPC_ERROR
Odoo Server Error

Occured on cutii-transport.ro on model sale.order.line and id 19 on 2025-01-04 07:09:38 GMT

Traceback (most recent call last):
  File "/opt/odoo18/odoo/http.py", line 1997, in _transactioning
    return service_model.retrying(func, env=self.env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/odoo/service/model.py", line 137, in retrying
    result = func()
             ^^^^^^
  File "/opt/odoo18/odoo/http.py", line 1964, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/odoo/http.py", line 2214, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/odoo/addons/base/models/ir_http.py", line 334, in _dispatch
    result = endpoint(**request.params)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/odoo/http.py", line 733, in route_wrapper
    result = endpoint(self, *args, **params_ok)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/addons/web/controllers/dataset.py", line 31, in call_kw
    return call_kw(request.env[model], method, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/odoo/service/model.py", line 62, in call_kw
    result = getattr(recs, name)(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/addons/web/models/models.py", line 1014, in onchange
    if field_name not in done and snapshot0.has_changed(field_name)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/addons/web/models/models.py", line 1126, in has_changed
    return self[field_name] != self.record[field_name]
                               ~~~~~~~~~~~^^^^^^^^^^^^
  File "/opt/odoo18/odoo/orm/models.py", line 6883, in __getitem__
    return self._fields[key].__get__(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/odoo/orm/fields.py", line 1373, in __get__
    self.recompute(record)
  File "/opt/odoo18/odoo/orm/fields.py", line 1572, in recompute
    apply_except_missing(self.compute_value, recs)
  File "/opt/odoo18/odoo/orm/fields.py", line 1545, in apply_except_missing
    func(records)
  File "/opt/odoo18/odoo/orm/fields.py", line 1594, in compute_value
    records._compute_field_value(self)
  File "/opt/odoo18/odoo/orm/models.py", line 5058, in _compute_field_value
    determine(field.compute, self)
  File "/opt/odoo18/odoo/orm/fields.py", line 70, in determine
    return needle(*args)
           ^^^^^^^^^^^^^
  File "/opt/odoo18/addons/sale_management/models/sale_order_line.py", line 38, in _compute_price_unit
    super(SaleOrderLine, self - lines_without_price_recomputation)._compute_price_unit()
  File "/opt/odoo18/addons/sale/models/sale_order_line.py", line 557, in _compute_price_unit
    price = line._get_display_price()
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/addons/sale_loyalty/models/sale_order_line.py", line 47, in _get_display_price
    return super()._get_display_price()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/addons/sale/models/sale_order_line.py", line 582, in _get_display_price
    return self._get_display_price_ignore_combo()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/addons/sale/models/sale_order_line.py", line 599, in _get_display_price_ignore_combo
    base_price = self._get_pricelist_price_before_discount()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/addons/sale/models/sale_order_line.py", line 653, in _get_pricelist_price_before_discount
    return self.pricelist_item_id._compute_price_before_discount(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/addons/product/models/product_pricelist_item.py", line 608, in _compute_price_before_discount
    return pricelist_item._compute_base_price(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ProductPricelist._compute_base_price() got an unexpected keyword argument 'currency'

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
    RPC_ERROR
        at makeErrorFromResponse (https://cutii-transport.ro/web/assets/1/debug/web.assets_web.js:30672:19)
        at XMLHttpRequest.<anonymous> (https://cutii-transport.ro/web/assets/1/debug/web.assets_web.js:30726:27)

To Reproduce

Affected versions: 18.0

Steps to reproduce the behavior:

  1. Install the product_pricelist_fixed_currency_rate and configure a pricelist based on another currency using the fixed currency rate (please see image below, I have EUR pricelist configured to be based on RON currency with a fixed currency rate). It doesn't matter if using Discount or Formula for price calculation, the error is the same.
  2. On a product page on the website try to change to the pricelist and you get error.
  3. In quotation, after selecting a pricelist configured using the fixed currency rate, try to add a product to the quotation and you get error.
Screenshot 2025-01-04 at 09 08 00

Additional context
Ubuntu 24
Odoo 18
Please note that I restored an working version of Odoo without the module, so the links in the error are no longer working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions