I'm fairly new to Odoo and new to this forum, I'm also not a programmer so please bear with me.
I have numerous products which can be purchased from multiple vendors and often these vendors will have different buy quantities and obviously different prices. I would like to have the vendor list sorted for each product by price and then by quantity because there are numerous instances of vendors supplying product in higher quantities but also being more expensive.
I have seen other community questions address this same issue and I followed the instructions suggested: created a Scheduled Action, disabled the "Drag Handles" and ensured the sequence on the existing supplier price records all are set to 1.
However, when I run the scheduled action the following error
occurs and the vendor list remains sorted via quantity first and price second:
Error:
Odoo Server Error
Traceback (most recent call last):
File "C:\Odoo 13.0\server\odoo\tools\safe_eval.py", line 349, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'seller_ids'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Odoo 13.0\server\odoo\http.py", line 619, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "C:\Odoo 13.0\server\odoo\http.py", line 309, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "C:\Odoo 13.0\server\odoo\tools\pycompat.py", line 14, in reraise
raise value
File "C:\Odoo 13.0\server\odoo\http.py", line 664, in dispatch
result = self._call_function(**self.params)
File "C:\Odoo 13.0\server\odoo\http.py", line 345, in _call_function
return checked_call(self.db, *args, **kwargs)
File "C:\Odoo 13.0\server\odoo\service\model.py", line 93, in wrapper
return f(dbname, *args, **kwargs)
File "C:\Odoo 13.0\server\odoo\http.py", line 338, in checked_call
result = self.endpoint(*a, **kw)
File "C:\Odoo 13.0\server\odoo\http.py", line 910, in __call__
return self.method(*args, **kw)
File "C:\Odoo 13.0\server\odoo\http.py", line 510, in response_wrap
response = f(*args, **kw)
File "C:\Odoo 13.0\server\odoo\addons\web\controllers\main.py", line 1324, in call_button
action = self._call_kw(model, method, args, kwargs)
File "C:\Odoo 13.0\server\odoo\addons\web\controllers\main.py", line 1312, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "C:\Odoo 13.0\server\odoo\api.py", line 387, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "C:\Odoo 13.0\server\odoo\api.py", line 374, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "C:\Odoo 13.0\server\odoo\addons\base\models\ir_cron.py", line 76, in method_direct_trigger
self.with_user(cron.user_id).ir_actions_server_id.run()
File "C:\Odoo 13.0\server\odoo\addons\base\models\ir_actions.py", line 545, in run
res = func(action, eval_context=eval_context)
File "C:\Odoo 13.0\server\odoo\addons\website\models\ir_actions.py", line 59, in run_action_code_multi
res = super(ServerAction, self).run_action_code_multi(action, eval_context)
File "C:\Odoo 13.0\server\odoo\addons\base\models\ir_actions.py", line 430, in run_action_code_multi
safe_eval(action.sudo().code.strip(), eval_context, mode="exec", nocopy=True) # nocopy allows to return 'action'
File "C:\Odoo 13.0\server\odoo\tools\safe_eval.py", line 372, in safe_eval
pycompat.reraise(ValueError, ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr)), exc_info[2])
File "C:\Odoo 13.0\server\odoo\tools\pycompat.py", line 13, in reraise
raise value.with_traceback(tb)
File "C:\Odoo 13.0\server\odoo\tools\safe_eval.py", line 349, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "", line 1, in <module>
ValueError: <class 'AttributeError'>: "'NoneType' object has no attribute 'seller_ids'" while evaluating
"if record.seller_ids:\n record['seller_ids'] = record.seller_ids.sorted(key = lambda s: (s.price,s.min_qty))"
Any advice on what I am doing wrong would be greatly appreciated!