[16.0] sale_manual_delivery : AttributeError: '_unknown' object has no attribute 'id'
dhp-denero opened this issue · 0 comments
dhp-denero commented
Module
sale_manual_delivery
Describe the bug
RPC_ERROR Odoo Server Error : AttributeError: '_unknown' object has no attribute 'id'
On Sale Order --> Create Delivery button Clicked, instead of showing popup window, I am getting Odoo Server Error with bellow trace
Traceback (most recent call last):
File "/home/odooagency/odoo16/odoo/odoo/http.py", line 1587, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/home/odooagency/odoo16/odoo/odoo/service/model.py", line 134, in retrying
result = func()
File "/home/odooagency/odoo16/odoo/odoo/http.py", line 1614, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/home/odooagency/odoo16/odoo/odoo/http.py", line 1811, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "/home/odooagency/odoo16/odoo/addons/website/models/ir_http.py", line 235, in _dispatch
response = super()._dispatch(endpoint)
File "/home/odooagency/odoo16/odoo/odoo/addons/base/models/ir_http.py", line 154, in _dispatch
result = endpoint(**request.params)
File "/home/odooagency/odoo16/odoo/odoo/http.py", line 700, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/home/odooagency/odoo16/odoo/addons/web/controllers/dataset.py", line 42, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/home/odooagency/odoo16/odoo/addons/web/controllers/dataset.py", line 33, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/odooagency/odoo16/odoo/odoo/api.py", line 461, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/home/odooagency/odoo16/odoo/odoo/api.py", line 448, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/home/odooagency/odoo16/odoo/odoo/models.py", line 6524, in onchange
result['value'] = snapshot1.diff(snapshot0, force=first_call)
File "/home/odooagency/odoo16/odoo/odoo/models.py", line 6343, in diff
result[name] = field.convert_to_onchange(self[name], record, {})
File "/home/odooagency/odoo16/odoo/odoo/fields.py", line 3005, in convert_to_onchange
return super().convert_to_onchange(value._origin, record, names)
File "/home/odooagency/odoo16/odoo/odoo/fields.py", line 970, in convert_to_onchange
return self.convert_to_read(value, record)
File "/home/odooagency/odoo16/odoo/odoo/fields.py", line 2981, in convert_to_read
return value.id
AttributeError: '_unknown' object has no attribute 'id'
The above server error caused the following client error:
null
To Reproduce
Affected versions:
Version 16.0
Steps to reproduce the behavior:
- Create Sale Quotation with Manual Delivery checkbox checked
- Confirm Sales Order
- Click On Create Delivery Button
Expected behavior
Expecting a Popup Window of Create Manual Delivery Action.
Additional context
I found that it is due to wrong model set on route_id field to manual.delivery.
route_id = fields.Many2one(
"stock.location.route",
string="Use specific Route",
domain=[("sale_selectable", "=", True)],
ondelete="cascade",
help="Leave it blank to use the same route that is in the sale line",
)
This should be change to stock.route
route_id = fields.Many2one(
"stock.route",
string="Use specific Route",
domain=[("sale_selectable", "=", True)],
ondelete="cascade",
help="Leave it blank to use the same route that is in the sale line",
)