Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0] hr_employee_firstname: Traceback when loading timesheet #990

Closed
luisg123v opened this issue May 7, 2021 · 2 comments
Closed

[14.0] hr_employee_firstname: Traceback when loading timesheet #990

luisg123v opened this issue May 7, 2021 · 2 comments

Comments

@luisg123v
Copy link
Contributor

Impacted versions:

  • 14.0

Steps to reproduce:

  • Install module hr_timesheet
  • Go to timesheets -> My timesheet
  • Pres the "A" key to add a new timesheet

Current behavior:

The following traceback is raised

Error:
Odoo Server Error

Traceback (most recent call last):
  File "/.repo_requirements/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/.repo_requirements/odoo/odoo/http.py", line 683, in dispatch
    result = self._call_function(**self.params)
  File "/.repo_requirements/odoo/odoo/http.py", line 359, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/.repo_requirements/odoo/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/.repo_requirements/odoo/odoo/http.py", line 347, in checked_call
    result = self.endpoint(*a, **kw)
  File "/.repo_requirements/odoo/odoo/http.py", line 912, in __call__
    return self.method(*args, **kw)
  File "/.repo_requirements/odoo/odoo/http.py", line 531, in response_wrap
    response = f(*args, **kw)
  File "/.repo_requirements/odoo/addons/web/controllers/main.py", line 1389, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/.repo_requirements/odoo/addons/web/controllers/main.py", line 1381, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/.repo_requirements/odoo/odoo/api.py", line 394, in call_kw
    result = _call_kw_model_create(method, model, args, kwargs)
  File "/.repo_requirements/odoo/odoo/api.py", line 374, in _call_kw_model_create
    result = method(recs, *args, **kwargs)
  File "<decorator-gen-359>", line 2, in create
  File "/.repo_requirements/odoo/odoo/api.py", line 323, in _model_create_single
    return create(self, arg)
  File "/home/odoo/build/vauxoo/instance/vauxoo/models/account_analytic_line.py", line 62, in create
    res = super().create(vals)
  File "<decorator-gen-317>", line 2, in create
  File "/.repo_requirements/odoo/odoo/api.py", line 344, in _model_create_multi
    return create(self, [arg])
  File "/home/odoo/enterprise/timesheet_grid/models/analytic.py", line 305, in create
    analytic_lines = super(AnalyticLine, self).create(vals_list)
  File "<decorator-gen-289>", line 2, in create
  File "/.repo_requirements/odoo/odoo/api.py", line 345, in _model_create_multi
    return create(self, arg)
  File "/.repo_requirements/odoo/addons/hr_timesheet/models/hr_timesheet.py", line 89, in create
    user_map = {employee.user_id.id: employee.id for employee in employees}
  File "/.repo_requirements/odoo/addons/hr_timesheet/models/hr_timesheet.py", line 89, in <dictcomp>
    user_map = {employee.user_id.id: employee.id for employee in employees}
  File "/.repo_requirements/odoo/odoo/fields.py", line 2483, in __get__
    return super().__get__(records, owner)
  File "/.repo_requirements/odoo/odoo/fields.py", line 996, in __get__
    recs._fetch_field(self)
  File "/.repo_requirements/odoo/odoo/models.py", line 3069, in _fetch_field
    self._read(fnames)
  File "/.repo_requirements/odoo/addons/hr/models/hr_employee.py", line 135, in _read
    res = self.env['hr.employee.public'].browse(self.ids).read(fields)
  File "/.repo_requirements/odoo/odoo/models.py", line 3009, in read
    raise ValueError("Invalid field %r on model %r" % (name, self._name))
Exception

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

Traceback (most recent call last):
  File "/.repo_requirements/odoo/odoo/http.py", line 639, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/.repo_requirements/odoo/odoo/http.py", line 315, in _handle_exception
    raise exception.with_traceback(None) from new_cause
ValueError: Invalid field 'firstname' on model 'hr.employee.public'

Expected behavior:

No traceback.

AFAIK, this is because when this module was migrated to 14.0, new models were not considered. In 14.0, the employee model was split into three different models:

  • Public employees (hr.employee.public)
  • Private employees (hr.employee)
  • ANd a common one for both (hr.employee.base)

I think fields should:

  • Either moved to the base model
  • Or the group hr.group_hr_user should be added to fields defined on this module

However I have not digged too much into it.

@luisg123v
Copy link
Contributor Author

CC @luistorresm @lescobarvx

luisg123v added a commit to Vauxoo/hr that referenced this issue Jun 12, 2021
Starting from 14.0, employee model was split into three models:
- `hr.employee.public`
- `hr.employee.private`
- `hr.employee` (a common model)

When this module was migrated, such  split was not taken into account.

This commit moves fields to the common model, so they don't fail when
read from the public employee model.

Closes OCA#990

Co-Authored-By: Luis González <[email protected]>
luisg123v added a commit to Vauxoo/hr that referenced this issue Jun 12, 2021
Starting from 14.0, employee model was split into three models:
- `hr.employee.public`
- `hr.employee.private`
- `hr.employee` (a common model)

When this module was migrated, such  split was not taken into account.

This commit moves fields to the common model, so they don't fail when
read from the public employee model.

Closes OCA#990

Co-Authored-By: Luis González <[email protected]>
hugho-ad added a commit to Vauxoo/hr that referenced this issue Jun 12, 2021
Starting from 14.0, employee model was split into three models:
- `hr.employee.public`
- `hr.employee.private`
- `hr.employee` (a common model)

When this module was migrated, such  split was not taken into account.

This commit moves fields to the common model, so they don't fail when
read from the public employee model.

Closes OCA#990

Co-Authored-By: Luis González <[email protected]>
@luisg123v
Copy link
Contributor Author

Fixed on #1001

luistorresm pushed a commit to vauxoo-dev/hr that referenced this issue Oct 18, 2021
Starting from 14.0, employee model was split into three models:
- `hr.employee.public`
- `hr.employee.private`
- `hr.employee` (a common model)

When this module was migrated, such  split was not taken into account.

This commit moves fields to the common model, so they don't fail when
read from the public employee model.

Closes OCA#990

Co-Authored-By: Luis González <[email protected]>
luistorresm pushed a commit to vauxoo-dev/hr that referenced this issue Oct 19, 2021
Starting from 14.0, employee model was split into three models:
- `hr.employee.public`
- `hr.employee.private`
- `hr.employee` (a common model)

When this module was migrated, such  split was not taken into account.

This commit moves fields to the common model, so they don't fail when
read from the public employee model.

Closes OCA#990

Co-Authored-By: Luis González <[email protected]>
luistorresm pushed a commit to vauxoo-dev/hr that referenced this issue Oct 19, 2021
Starting from 14.0, employee model was split into three models:
- `hr.employee.public`
- `hr.employee.private`
- `hr.employee` (a common model)

When this module was migrated, such  split was not taken into account.

This commit moves fields to the common model, so they don't fail when
read from the public employee model.

Closes OCA#990

Co-Authored-By: Luis González <[email protected]>
luistorresm pushed a commit to vauxoo-dev/hr that referenced this issue Nov 5, 2022
Starting from 14.0, employee model was split into three models:
- `hr.employee.public`
- `hr.employee.private`
- `hr.employee` (a common model)

When this module was migrated, such  split was not taken into account.

This commit moves fields to the common model, so they don't fail when
read from the public employee model.

Closes OCA#990

Co-Authored-By: Luis González <[email protected]>
andreagidaltig pushed a commit to vauxoo-dev/hr that referenced this issue Nov 6, 2023
Starting from 14.0, employee model was split into three models:
- `hr.employee.public`
- `hr.employee.private`
- `hr.employee` (a common model)

When this module was migrated, such  split was not taken into account.

This commit moves fields to the common model, so they don't fail when
read from the public employee model.

Closes OCA#990

Co-Authored-By: Luis González <[email protected]>
andreagidaltig pushed a commit to vauxoo-dev/hr that referenced this issue Nov 8, 2023
Starting from 14.0, employee model was split into three models:
- `hr.employee.public`
- `hr.employee.private`
- `hr.employee` (a common model)

When this module was migrated, such  split was not taken into account.

This commit moves fields to the common model, so they don't fail when
read from the public employee model.

Closes OCA#990

Co-Authored-By: Luis González <[email protected]>
andreagidaltig pushed a commit to vauxoo-dev/hr that referenced this issue Nov 8, 2023
Starting from 14.0, employee model was split into three models:
- `hr.employee.public`
- `hr.employee.private`
- `hr.employee` (a common model)

When this module was migrated, such  split was not taken into account.

This commit moves fields to the common model, so they don't fail when
read from the public employee model.

Closes OCA#990

Co-Authored-By: Luis González <[email protected]>
andreagidaltig pushed a commit to vauxoo-dev/hr that referenced this issue Nov 8, 2023
Starting from 14.0, employee model was split into three models:
- `hr.employee.public`
- `hr.employee.private`
- `hr.employee` (a common model)

When this module was migrated, such  split was not taken into account.

This commit moves fields to the common model, so they don't fail when
read from the public employee model.

Closes OCA#990

Co-Authored-By: Luis González <[email protected]>
luisg123v added a commit to Vauxoo/hr that referenced this issue Nov 14, 2023
Starting from 14.0, employee model was split into three models:
- `hr.employee.public`
- `hr.employee.private`
- `hr.employee` (a common model)

When this module was migrated, such  split was not taken into account.

This commit moves fields to the common model, so they don't fail when
read from the public employee model.

Closes OCA#990

Co-Authored-By: Luis González <[email protected]>
andreagidaltig pushed a commit to vauxoo-dev/hr that referenced this issue Nov 16, 2023
Starting from 14.0, employee model was split into three models:
- `hr.employee.public`
- `hr.employee.private`
- `hr.employee` (a common model)

When this module was migrated, such  split was not taken into account.

This commit moves fields to the common model, so they don't fail when
read from the public employee model.

Closes OCA#990

Co-Authored-By: Luis González <[email protected]>
andreagidaltig pushed a commit to vauxoo-dev/hr that referenced this issue Nov 16, 2023
Starting from 14.0, employee model was split into three models:
- `hr.employee.public`
- `hr.employee.private`
- `hr.employee` (a common model)

When this module was migrated, such  split was not taken into account.

This commit moves fields to the common model, so they don't fail when
read from the public employee model.

Closes OCA#990

Co-Authored-By: Luis González <[email protected]>
andreagidaltig pushed a commit to vauxoo-dev/hr that referenced this issue Nov 16, 2023
Starting from 14.0, employee model was split into three models:
- `hr.employee.public`
- `hr.employee.private`
- `hr.employee` (a common model)

When this module was migrated, such  split was not taken into account.

This commit moves fields to the common model, so they don't fail when
read from the public employee model.

Closes OCA#990

Co-Authored-By: Luis González <[email protected]>
edy1192 pushed a commit to vauxoo-dev/hr that referenced this issue Oct 30, 2024
Starting from 14.0, employee model was split into three models:
- `hr.employee.public`
- `hr.employee.private`
- `hr.employee` (a common model)

When this module was migrated, such  split was not taken into account.

This commit moves fields to the common model, so they don't fail when
read from the public employee model.

Closes OCA#990

Co-Authored-By: Luis González <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant