Skip to content
Snippets Groups Projects
  1. May 17, 2023
  2. Apr 12, 2023
  3. Mar 30, 2023
    • Victor Piryns (pivi)'s avatar
      [FIX] hr_timesheet: timesheet uom fallback when AAL's company is False · b39642bf
      Victor Piryns (pivi) authored
      
      Current behaviour:
      When creating a timesheet, if in the vals passed the AAL doesn't
      have a company (possible since it's not required), then the `uom`
      of the timesheet is False, which doesn't make sense.
      
      Expected behaviour:
      The timesheet `uom` should fallback on the uom of the company
      of the project.
      
      Steps to reproduce:
      - Install hr_timesheet, Accounting
      - Activate the AAL in the settings
      - Create a project with an AAL
      - Remove the company on the AAL of the project
      - In that project create a task and log some timesheet.
      - `uom` field should be empty
      
      Reason for the problem:
      When setting the `product_uom_id` in the vals when creating/writing
      a timesheet, we just take the `project_time_mode_id` on the company
      linked to the AAL. The problem is that the company on an AAL is not
      a required field, so it can be `False`, leading the setting the val
      for `product_uom_id` to `False`.
      
      Fix:
      In case the AAL has no company, we get the `uom` from the company
      linked to the project.
      
      Affected versions:
      - 14.0
      - 15.0
      - saas-15.2
      - 16.0
      - saas-16.1
      - saas-16.2
      - master
      
      opw-3245671
      
      closes odoo/odoo#117012
      
      Signed-off-by: default avatarXavier Bol (xbo) <xbo@odoo.com>
      b39642bf
  4. Oct 11, 2022
  5. Aug 29, 2022
    • Jinjiu Liu's avatar
      [FIX] hr_timesheet: calculate effective_hours on all users' hours · 2033f113
      Jinjiu Liu authored
      
      Reproduction:
      1. Install Timesheet, and Project, check the timesheet box in the
      setting of Project
      2. Go to Setting->manage users, set access right for Marc Demo, Project
      as “User”, Timesheets as “See own timesheets”, and Helpdesk	as “User”
      3. Go to Project, create a task and assign it to Marc Demo, go to the
      timesheet tab, set Initially Planned Hours as 20 hours, click save
      4. Open an incognito page and log in as Marc Demo, go to this new task->
      timesheet, edit, log 5 hours, save. Hour spent is now 5
      5. Switch back to Mitchell Admin, refresh the task page, edit, log 3
      hours, save. Hour spent is now 8.
      6. Switch to the incognito page of Marc Demo, edit, log 2 hours and save
      Hour spent is now 7, which doesn’t consider the hours logged by Mitchell
      The right result should be 10 hours.
      7. Switch back as Mitchell Demo, the spent hours are also wrong
      
      Reason: The cause is that effective_hours is a stored computed field.
      When Marc Demo logs hours after Mithcell Admin, the hours from Mitchell
      do not show for Marc Demo. Marc Demo cannot get the hours from other
      users because he can only see his own timesheet. Thus the computation is
      wrong and because it’s a stored computed field, it won’t change even
      after switching back to Mitchell Admin
      
      Fix: Use read_group to get the grouped by value of the amount spent on
      the task. This makes sure that the value of Hours spent is correctly
      computed after saving. It also allows the onchange to take the change
      made by the user into account before saving.
      
      opw-2909444
      
      closes odoo/odoo#97241
      
      Signed-off-by: default avatarLaurent Stukkens (ltu) <ltu@odoo.com>
      2033f113
    • mafo-odoo's avatar
      [FIX] hr_timesheet: avoid setting an archived employee to a timesheet in the form view · dd9dd0a8
      mafo-odoo authored
      
      Steps to reproduce:
      - Install timesheet
      - Archive an employee
      - Create a timesheet
      
      Current behavior:
      You can select the archived employee
      
      Expected behavior:
      You can not select the archived employee
      
      Explanation:
      In commit 17b2b07e76121ebb0be16637bf4082e457c2ac63 the employee_id
      field of the timesheet was set to have context active_test to false.
      To fix this issue we reset the context for this field in every
      timesheet form and we add user errors if the employee is not active
      while the timesheet is created or edited.
      
      backport of odoo/odoo#94308
      
      opw-2887727
      opw-2870739
      
      closes odoo/odoo#97760
      
      Related: odoo/enterprise#30271
      Signed-off-by: default avatarNasreddin Boulif (bon) <bon@odoo.com>
      dd9dd0a8
    • Audric Onockx (auon)'s avatar
      [FIX] hr_timesheet : register ts in multi-company environment · d01c2010
      Audric Onockx (auon) authored
      Steps :
      Install project and employee.
      Create 3 company and an employee for you user in 2 of them.
      Switch to the one without employee.
      Create a new project and task.
      Register a timesheet.
      
      Issue :
      The timesheet has no employee.
      
      Fix :
      Display start button and set an employee on the ts
      only if user has an employee in the company
      or has only one employee for all companies.
      
      backport of odoo/odoo#85780
      
      opw-2745733
      
      Part-of: odoo/odoo#97760
      d01c2010
    • Audric Onockx (auon)'s avatar
      [FIX] hr_timesheet : display archived employee on timesheet · bd6a6415
      Audric Onockx (auon) authored
      Steps :
      Archive your employee, go to your timesheets and add time on a task T line
      Go to task T and note that a line have been added without any employe
      
      Cause :
      By default, views do not show archived values.
      
      Fix :
      Show archived employees with context key 'test_active=False'.
      
      backport of odoo/odoo#85481
      
      opw-2740228
      
      Part-of: odoo/odoo#97760
      bd6a6415
    • Laurent Stukkens (LTU)'s avatar
      [FIX] hr_timesheet: select correct employee in create · 30bf69a2
      Laurent Stukkens (LTU) authored
      Prior to this commit:
      
          - The employee was the first one returned through a search that
            was not taking the company into account.
      
      After this commit:
      
          - The employee will be selected according to the company.
      
      This issue arose with b5b105ea
      
      backport of odoo/odoo#81693
      
      Part-of: odoo/odoo#97760
      30bf69a2
  6. Jun 22, 2022
    • Xavier BOL (xbo)'s avatar
      [FIX] hr_timesheet: ensure UoM is defined on timesheets · 6964e0c6
      Xavier BOL (xbo) authored
      
      Before this commit, if the user uses Studio app to customize the form
      view of timesheet and adds `product_uom_id` field in that view, then if
      for instance that field is invisible, it will be in in the vals when the
      user will create a timesheet. In that case, the value given to that
      field will be False since the field has no default value. Since in the
      compute of `total_timesheet_time` defined in project used that field to
      convert the `unit_amount` of each timesheet linked to this project in
      the right UoM, the `product_uom_id` field has to be defined if the AAL
      is a timesheet, otherwise, the timesheets without any UoM set on
      `product_uom_id` will be excluded in the compute.
      
      This commit fixes the issue by setting a UoM if the UoM is not in vals
      or if the value is False for a timesheet.
      
      opw-2884148
      
      closes odoo/odoo#94162
      
      Signed-off-by: default avatarLaurent Stukkens (ltu) <ltu@odoo.com>
      6964e0c6
  7. Apr 27, 2022
    • Adrien Peiffer's avatar
      [FIX] Use currency of analytic line · 7b603478
      Adrien Peiffer authored
      
      As the company is not mandatory on both the employee and the analytical account,
      if neither is filled in, it causes the application to crash.
      
      This commit ensures that the currency of the current analytical line's company
      is provided when no company is set on the analytic account.
      
      closes odoo/odoo#89923
      
      X-original-commit: e1c36901
      Signed-off-by: default avatarLaurent Stukkens (ltu) <ltu@odoo.com>
      7b603478
  8. Oct 21, 2021
    • Pierrot (prro)'s avatar
      [FIX] [hr,sale]_timesheet: update timesheet's partner from Task · ccf6973b
      Pierrot (prro) authored
      
      How to reproduce the problem:
      - Install hr_timesheet and create a project.
      - Create a task in the project, and assign a Partner as the Customer
      - In the Timesheet tab of the Task, add a new entry. Save the Task.
      - Edit the task again and change the Customer. Save again.
      -> the partner on the Timesheet entry did not change.
      
      With sale_timesheet, the Sales Order Item of the timesheet entry can
      be updated from the Sales Order Item of the Task, but it isn't the case
      with the partner, which is not logical.
      
      Solution : Now, the partner_id is computed and will automatically be
      updated from the Task's Customer/partner_id. If sale_timesheet is
      installed, it will first filter out the invoiced timesheet entry:
      we don't want to change an already invoiced entry.
      
      opw-2616784
      
      closes odoo/odoo#78577
      
      Signed-off-by: default avatarLTU-Odoo <IT-Ideas@users.noreply.github.com>
      ccf6973b
  9. Oct 04, 2021
    • Pierrot (prro)'s avatar
      [FIX] hr_timesheet: allow specific user to preview invoice · f7e3f7c2
      Pierrot (prro) authored
      How to reproduce the problem:
      - Go to Settings -> Users -> choose any user (example Laurie Poiret)
      - Note the ID of the res.user (example ID = 8)
      - Go to Contacts -> open the contact with that same ID.
      - Set that user as a company if not already one.
      - Go back to Settings -> Users
      - Open the related partner to the concerned user (visible in debug mode)
      - Set the parent company of that user as the contact modified before
      (contact with the ID = 8, in our example)
      - Log in with that user.
      - Go to Accounting -> Invoices -> open any invoice
      - Click on the preview button -> it will load forever.
      
      Cause of the problem : the system loops on a wrongly configured domain
      
      Solution : the system uses another domain for internal users.
      (fix inspired from
      https://github.com/odoo/odoo/commit/3378ca8252d3ac0e22a8aa1632ffc436864b26b7
      
      )
      
      opw-2543174
      
      closes odoo/odoo#77683
      
      Signed-off-by: default avatarLTU-Odoo <IT-Ideas@users.noreply.github.com>
      f7e3f7c2
  10. Apr 29, 2021
    • Goffin Simon's avatar
      [FIX] hr_timesheet: Analytic account without company · 44693ca2
      Goffin Simon authored
      
      Steps to reproduce the bug:
      
      - Let's consider a project P set with analytic account AA and company C
      - Allow timesheet on P
      - Let's consider a task T belonging to P
      - Set AA with comapny = False
      - Try to encode a timesheet on T
      
      Bug:
      
      A UserError was raised because the field company_id on account.analytic.line is required
      
      opw:2486034
      
      closes odoo/odoo#70071
      
      X-original-commit: b3dc922c
      Signed-off-by: default avatarSimon Goffin (sig) <sig@openerp.com>
      44693ca2
  11. Nov 30, 2020
  12. Oct 07, 2020
    • Dominik Rubo's avatar
      [FIX] hr_timesheet, project: let user disable Timesheets in config · 43db576b
      Dominik Rubo authored
      
      This change allows uninstallation of hr_timesheet from the configuration of
      Project.
      
      Previously, attempting to disable the Timesheets feature from the configuration
      of Project resulted in a user error that requested the user to first remove
      tasks in projects that were linked to analytic accounts. This was caused by the
      removal of demo data during the uninstallation of hr_timesheet, which attempted
      to unlink analytic accounts before unlinking the projects that were referencing
      those accounts. The order in which demo data are removed during uninstallation
      of a module is currently not fixed. This change avoids the problem by instead
      removing the explicit creation of analytic accounts as demo data.
      
      Furthermore, hr_timesheet would be immediately re-installed upon uninstallation
      through project_timesheet_synchro and project_timesheet_holidays. Disabling
      those modules along with hr_timesheet fixes this.
      
      Task 2339016
      
      closes odoo/odoo#58759
      
      Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
      43db576b
  13. Sep 29, 2020
  14. Sep 16, 2020
  15. Sep 02, 2020
    • jbm-odoo's avatar
      [FIX] hr_timesheet: Widget for planned hours · 5b380440
      jbm-odoo authored
      
      Before this commit:
      The field `planned_hours` and `subtask_planned_hours` are present
      twice. This causes problems with widget: different widgets are put
      on different fields, but only the last on was put on all of them.
      Code to edit label with hours/days is not flexible, we need to
      write each possibilities.
      
      After this commit:
      All fields are present only once in the view. A new widget is
      created to manage days with a factor. In this new widget, instead
      of having a toggle button, we can insert a float.
      When the widget timesheet_uom is set on a field, we modify his string
      with hours/days.
      
      closes odoo/odoo#56702
      
      Taskid: 2326216
      Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
      5b380440
  16. Sep 09, 2020
  17. Aug 31, 2020
    • Victor Feyens's avatar
      [IMP] various: improve code style and performance by improve ``all()`` usage · 1cc6bb12
      Victor Feyens authored
      
      PURPOSE
      
      Clean code. Be more performance oriented.
      
      SPECIFICATIONS
      
      Improvements applied in this commit
      
        * not all() --> any(not) for earlier returns;
        * all([generator]) --> all(generator) to avoid unnecessary list casting.
          This code construct is better managed by all;
      
      This commit will probably not have a big performance effect on standard
      production databases. However each performance and cleaning improvement
      is welcomed.
      
      LINKS
      
      Task ID-2328619
      
      closes odoo/odoo#56060
      
      Related: odoo/enterprise#12486
      Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
      1cc6bb12
  18. Aug 14, 2020
    • Victor Feyens's avatar
      [IMP] *: wrong any() usage · fdb23e28
      Victor Feyens authored
      
      Replace wrong usages of any(list|recordset), by any(generator)
      to speed up computations, avoiding list creations and/or looping twice on a recordset
      for nothing.
      
      any([generator]) => any(generator)
      any(filtered) => any(generator)
      
      closes odoo/odoo#55768
      
      Related: odoo/enterprise#12360
      Signed-off-by: default avatarVictor Feyens (vfe) <vfe@odoo.com>
      fdb23e28
  19. Aug 06, 2020
    • Jorge Pinna Puissant's avatar
      [FIX] hr_timesheet: wrong uom factor in widget · 09bfca4d
      Jorge Pinna Puissant authored
      
      - Install hr_timesheet and sales;
      - Create a product, set it as a service product with units of
        measurement in days.
      - Set the product as a task will be created from SO;
      - Add a timesheet for one day to a task in a project (8 hours for
        instance);
      - The smart button on the sales order shows the time logged for that
        project.
      
      Before this commit, when the timesheet encoding unit is 'Hours', the
      smart button shows the correct logged time (8 hours). But, when the
      timesheet encoding unit is changed to 'Days', the samrt button shows
      0.125 Days instead of 1 Day. This occurs because the uom used to create
      the uom factor for the widget is not the Timesheet encoding unit.
      
      opw-2301510
      
      closes odoo/odoo#55544
      
      X-original-commit: 2a7ec79c
      Signed-off-by: default avatarJorge Pinna Puissant (jpp) <jpp@odoo.com>
      09bfca4d
  20. Aug 04, 2020
  21. Jul 23, 2020
    • Anh Thao Pham (pta)'s avatar
      [IMP] hr_timesheet: hide the "Round timesheets" feature in the settings of... · 7e49130d
      Anh Thao Pham (pta) authored
      [IMP] hr_timesheet: hide the "Round timesheets" feature in the settings of Timesheets if encoding unit is Days
      
      [IMP] hr_timesheet: hide the "Timesheet Timer" feature in the project form if encoding unit is not Hours
      
      [IMP] hr_timesheet: clean display of Days for timesheets
      
      A computed field has to be added to retrieve the encoding uom of the current company and be used in the views.
      FieldTimesheetFactor field has to be registered to "float_factor" widget for the "planned_hours" field to work correctly with Days
      (for the conversion from hours to days to be computed and to be able to set a greater value than 1 day)
      
      If encoding unit for timesheets is set to Days:
      - Display Days instead of Hours in Portal > Timesheets
      - Display Days instead of Hours in Portal > Tasks
      - Display Days instead of Hours in Portal > Invoices & Bills
      - Display Days instead of Hours in Portal > Tickets
      
      [IMP] hr_timesheet: display clean duration in Timesheet Entries
      
      Display Days instead of Hours in Timesheet Entries (print action) if encoding unit for timesheets is set to Days
      
      [IMP] hr_timesheet: correctly display timesheets in Days if configured to
      
      - correctly display remaining days in project.task kanban and list view
      - hide timer start button if timesheet is configured in Days
      - update several column names
      
      [IMP] hr_timesheet: clean code
      
      [IMP] hr_timesheet: small improvements when displaying timesheets in days
      
      - Rename some labels
      - Fixes style
      - Prevent fields displayed with widget "timesheet_uom" to change when timer is on
      - Display correctly "Initially Planned Days" field in task creation form
      7e49130d
  22. Jul 31, 2020
    • Toufik Ben Jaa's avatar
      [FIX] hr_timesheet: allow leaves to be modified · e7dcf6ac
      Toufik Ben Jaa authored
      
      - The HR staff may not be able to accept/refuse/cancel leaves if the
        module `project_timesheet_holidays` is installed.
      
        This is due to the commit c9da1571
        introducing a manual check on the current user's group without
        checking if the current environment is in superuser mode.
      
      - Also fix the test verifying the access restriction, which meant to use
        a different user, but did that with sudo(), obviously defeating
        the fix. sudo is not used to switch user anymore, that `with_user`.
      
      closes odoo/odoo#55274
      
      X-original-commit: 75a166f1d115cc712bb39e7711d0fcb173732650
      Related: odoo/enterprise#12149
      Signed-off-by: default avatarOlivier Dony (odo) <odo@openerp.com>
      e7dcf6ac
  23. Jul 09, 2020
  24. Jun 30, 2020
    • Martin Trigaux's avatar
      [FIX] *: correct all or improve code translation lookup · 400cc4f1
      Martin Trigaux authored
      
      This commit fixes all issues detected by the new pylint
      gettext-variable test.
      It converts some calls to the new syntax
        _("Foo %s", bar)
      
      to progressively migrate the code to the new syntax.
      
      A few calls were not technically incorrect but still detected by the
      linter.
      
        _("Foo" +
          "Bar")
      
      has been converted to
      
        _("Foo"
          "Bar")
      
      as it has the same effect and make sure the argument is of type
      asteroid.Const instead of BinOp).
      
      closes odoo/odoo#53683
      
      Related: odoo/enterprise#11467
      Signed-off-by: default avatarRaphael Collet (rco) <rco@openerp.com>
      400cc4f1
  25. Jun 29, 2020
    • qho's avatar
      [IMP] hr_timesheet: Improve the usability of timesheet portal · 1424a383
      qho authored
      
      1. Generic timesheets improvements
      
          - Portal /my/timesheets
          - Add a group bys task, date, employee
          - Add search in project, name, employee, task
              * The task column should not be visible if none of the timesheets have the Task field set
          - If a group by task, date, employee or project is applied, the corresponding column should not be visible
      
      2. Timesheets from sub-tasks on parent tasks
      
          - Portal /my/tasks
          - Display the 'Total Hours' spent on a task at the end of the list of timesheets
          - Below the list of timesheets for the task, display another table detailing the respective timesheets (and total hours) of each sub-task linked to this task (= 1 table/list per sub-task)
              * Title should be: 'Timesheets for sub-task: xyz'
              * only visible if there are sub-tasks linked to this task
              * only visible if total hours > 0
      
      3. Timesheets on Invoices
      
          - Portal /my/invoices
          - Add Project + task fields
              * Task field only visible if set on one of the timesheet entries
              * Project field only visible if there are at least 2 different projects in these timesheet entries
      
      4. Correct visibility for the portal users
          - Portal users is allowed to see timesheets if the users are added in allowed portal users list in the project
          - When a portal user is added as the message follower of the project, the user is added to allowed portal users as well
          - When a portal user is removed from allowed portal users, the user is also removed from message followers
      
      closes odoo/odoo#47248
      
      Taskid: 2201908
      Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
      1424a383
  26. Jun 23, 2020
  27. Jul 29, 2020
    • Thibault Francois's avatar
      [FIX] hr_timesheet: Timesheet in multi company · fb396a95
      Thibault Francois authored
      
      Allow user that have a employee in a company A
      and that is allowed on company A and B to timesheet
      on company B
      
      Problem:
      A user have access on company A and B but is link to
      an employee that belong to company A. He want to timesheet on a
      project from the company B. He gets an error
      "Incompatible companies on records".
      
      Since most users are linked to only one employee that belongs
      to one company. It's impossible to have consistent companies.
      
      Solution:
      
      The employee shouldn't be checked on the timesheet
      
      closes odoo/odoo#55074
      
      X-original-commit: 7eada96b8fc1c370801ff42231167885cc8e46bc
      Signed-off-by: default avatarOlivier Dony (odo) <odo@openerp.com>
      fb396a95
  28. Jun 23, 2020
    • Rémy Baranx (bar)'s avatar
      [IMP] hr_timesheet: convert onchange to stored-editable computed fields · d924d89a
      Rémy Baranx (bar) authored
      The fields 'project_id' and 'user_id' have been converted to
      stored-editable computed fields.
      
      Convert the 'allow_timesheets' field.
      
      Improvement of the _compute_task_id method to check the task_id field before using it.
      
      Update hr_timesheet tests by removing calls to onchange methods because
      now, compute methods are always called.
      
      Get back the onchange on the 'project_id' to compute the task_id field due to a complex
      bug found in sale_timesheet tests.
      d924d89a
  29. Jun 18, 2020
  30. Jun 15, 2020
  31. Jun 11, 2020
    • Thibault Francois's avatar
      [FIX] timer, hr_timesheet: Fix _compute_display_timer_buttons · ab487982
      Thibault Francois authored
      
      mixin method should not return in the middle of the loop
      Use the value updated on the record instead
      
      super() is called with self at every iteration
      which is not very efficient and can be wrong
      
      Solution call super for each specific record
      and only when needed
      
      write is not a good practice in compute method
      
      closes odoo/odoo#52858
      
      X-original-commit: 7e19ed98d18305370b5c14edd3d310cfea5df714
      Related: odoo/enterprise#11100
      Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
      ab487982
  32. Jun 02, 2020
  33. Apr 29, 2020
    • Nisha patel's avatar
      [FIX] hr_timesheet, timer: Fix traceback in kanban view when using the timer · 6bfc5bd8
      Nisha patel authored
      
      Currently, when the unit amount of line is zero and the timer time
      spent on entry is less than one minutes then entries are unlinked
      once the timer is stopped and due to that the entry disappear from the
      kanban view and traceback is generated.
      
      After this commit, we fix the issue by preventing the deletion of
      entries by setting options 'prevent_deletion' on widget so we should
      no allow to delete the entry if the option is set on widget.
      
      closes odoo/odoo#50395
      
      Taskid: 2230155
      Closes: #49128
      X-original-commit: 64b9a9b4deaee5a8139b0afbe3f222a476a038f9
      Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
      6bfc5bd8
Loading