odoo/odoo#143046

Created by fw-bot
Merged at 9974f00b2ae7facb03314e728b66f095e2ef10a5

Statuses:

label
odoo-dev:saas-16.3-15.0-sentry-4588277341-typeerror-fix-omra-qwtG-fw
head
de0acfe278e60d9c497848695987bc5d040b0fed
merged
1 year ago by Sofie Gvaladze (sgv)
odoo/odoo
15.0 #140857
saas-15.2 #141232
16.0 #141246
saas-16.1 #141825
saas-16.2 #143034
saas-16.3 #143046
saas-16.4 #143055
17.0 #143065
saas-17.4
18.0
saas-18.1
saas-18.2
saas-18.3
master #143077

[FW][FIX] website_hr_recruitment: make the job location field not editable

This issue arises when attempting to edit the job location field for a remote job or when there is no value in the job location, try to edit and save record.

Steps to produce :
- Install website_hr_recruitment module.
- Open a job position that has a remote job location or no value in the job location.
- Open editor > Edit that field and save the record.
- Error will be generated.

see the traceback:

TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
  File "odoo/http.py", line 2139, in __call__
    response = request._serve_db()
  File "odoo/http.py", line 1715, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "odoo/service/model.py", line 133, in retrying
    result = func()
  File "odoo/http.py", line 1742, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "odoo/http.py", line 1943, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "addons/website/models/ir_http.py", line 235, in _dispatch
    response = super()._dispatch(endpoint)
  File "odoo/addons/base/models/ir_http.py", line 191, in _dispatch
    result = endpoint(**request.params)
  File "odoo/http.py", line 717, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "addons/web/controllers/dataset.py", line 30, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "addons/web/controllers/dataset.py", line 26, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "odoo/api.py", line 466, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "odoo/api.py", line 453, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "addons/website/models/ir_ui_view.py", line 485, in save
    super(View, self).save(value, xpath=xpath)
  File "addons/web_editor/models/ir_ui_view.py", line 175, in save
    self.save_embedded_field(arch_section)
  File "addons/web_editor/models/ir_ui_view.py", line 46, in save_embedded_field
    value = converter.from_html(Model, Model._fields[field], el)
  File "addons/web_editor/models/ir_qweb_fields.py", line 230, in from_html
    many2one_id = int(element.get('data-oe-many2one-id'))

This issue occurs because here
https://github.com/odoo/odoo/blob/5e0f5c98330ca1b5d0696c109c9e3a2050a6210c/addons/web_editor/models/ir_qweb.py#L215 it will get None and then when it will try to convert in int than error occurs.

after this commit user will not be able to edit the job location field.

sentry-4588277341


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #141825
Forward-Port-Of: #140857