Skip to Content
Menu
This question has been flagged
1 Reply
1377 Views

hi Experts

POS session wont close and i receive below error  :  any advices:


Error:

Odoo Server Error



Traceback (most recent call last):

File "/odoo/odoo-server/odoo/addons/base/models/ir_http.py", line 237, in _dispatch

result = request.dispatch()

File "/odoo/odoo-server/odoo/http.py", line 683, in dispatch

result = self._call_function(**self.params)

File "/odoo/odoo-server/odoo/http.py", line 359, in _call_function

return checked_call(self.db, *args, **kwargs)

File "/odoo/odoo-server/odoo/service/model.py", line 94, in wrapper

return f(dbname, *args, **kwargs)

File "/odoo/odoo-server/odoo/http.py", line 347, in checked_call

result = self.endpoint(*a, **kw)

File "/odoo/odoo-server/odoo/http.py", line 912, in __call__

return self.method(*args, **kw)

File "/odoo/odoo-server/odoo/http.py", line 531, in response_wrap

response = f(*args, **kw)

File "/odoo/odoo-server/addons/web/controllers/main.py", line 1381, in call_button

action = self._call_kw(model, method, args, kwargs)

File "/odoo/odoo-server/addons/web/controllers/main.py", line 1369, in _call_kw

return call_kw(request.env[model], method, args, kwargs)

File "/odoo/odoo-server/odoo/api.py", line 396, in call_kw

result = _call_kw_multi(method, model, args, kwargs)

File "/odoo/odoo-server/odoo/api.py", line 383, in _call_kw_multi

result = method(recs, *args, **kwargs)

File "/odoo/odoo-server/addons/point_of_sale/models/pos_session.py", line 266, in action_pos_session_closing_control

session.action_pos_session_close()

File "/odoo/odoo-server/addons/point_of_sale/models/pos_session.py", line 295, in action_pos_session_close

return self._validate_session()

File "/odoo/odoo-server/addons/point_of_sale/models/pos_session.py", line 318, in _validate_session

self.with_company(self.company_id)._create_account_move()

File "/odoo/odoo-server/addons/point_of_sale/models/pos_session.py", line 411, in _create_account_move

data = self._create_balancing_line(data)

File "/odoo/odoo-server/addons/point_of_sale/models/pos_session.py", line 362, in _create_balancing_line

balancing_vals = self._prepare_balancing_line_vals(imbalance_amount, self.move_id)

File "/odoo/odoo-server/addons/point_of_sale/models/pos_session.py", line 369, in _prepare_balancing_line_vals

account = self._get_balancing_account()

File "/odoo/odoo-server/addons/point_of_sale/models/pos_session.py", line 385, in _get_balancing_account

return self.company_id.account_default_pos_receivable_account_id or self.env['ir.property'].get('property_account_receivable_id', 'res.partner')

Exception



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



Traceback (most recent call last):

File "/odoo/odoo-server/odoo/http.py", line 639, in _handle_exception

return super(JsonRequest, self)._handle_exception(exception)

File "/odoo/odoo-server/odoo/http.py", line 315, in _handle_exception

raise exception.with_traceback(None) from new_cause

AttributeError: 'ir.property' object has no attribute 'get'

Avatar
Discard
Best Answer

Hi,

The reason is specified in the error message.

AttributeError: 'ir.property' object has no attribute 'get'.
Replace 'get' with '_get' in your code:

return self.company_id.account_default_pos_receivable_account_id or self.env['ir.property'].get('property_account_receivable_id', 'res.partner')
Or replace the method _get_balancing_account with:

def _get_balancing_account(self):
        propoerty_account = self.env['ir.property']._get('property_account_receivable_id', 'res.partner')
        return self.company_id.account_default_pos_receivable_account_id or propoerty_account or self.env['account.account']
This code is taken from the source code 

https://github.com/odoo/odoo/blob/14.0/addons/point_of_sale/models/pos_session.py#:~:text=def _get_balancing_account(self)%3A). 

Regards

Avatar
Discard