Commit Graph
483 Commits
Author SHA1 Message Date
Gorash 880954ebfc [IMP] *: remove _render from ir.ui.view and simplify report
There were inconsistencies in the calls to `_render`.
* the view context could contain information that misled developers.
Indeed, the context and value of the view are not supposed to be found
in the rendering. Thus by calling `ir.qweb` with the name of the
template, we ensure that there is no unwanted information and in
addition the cache key is that of the name of the template which saves
a query.
* the context used for rendering was modified by a method on
`ir.ui.view`, except this is not information used by this model. There
is now a `_prepare_environment` method residing on `ir.qweb`. This
method allows to modify the value dictionary as well as the context in
which the rendering will be done. This preparation of the data as well
as my security check is done only once per rendering. This also saves
some queries
* Freeze options for rendering were inconsistent. It could be that
options on which rendering depends were not part of the cache key. Thus,
depending on the user who generated the generation of the rendering
function, there was or was not information in the template. For example
for automatic branding. This is no longer possible, because it is the
context that is used. The options serving as a cache key are only
recorded for information (for the profiling system for example). A
simplification of the `ir.qweb.field` models could be made.

The report rendering and call `ir.qweb` instead of `ir.ui.view`.

Part-of: odoo/odoo#85110
2022-03-29 10:56:15 +02:00
Ivan Yelizariev 2f1bd13274 [FIX] project: make custom fields copiable again
Since #73341 copy_data is filtered to avoid leaking information to portal user.
Partically, it makes custom field not copiable.

Fix it by disabling the filter for internal users. This may lead to a problem
with hacky field `personal_stage_type_ids`. To avoid extra complexity in the
code, just mark it as `copy=False`. The latter change is kind of an improvement
from functional point of view, since using default personal stage seems to be a
better idea rather than copying the stage.

---

opw-2746922

closes odoo/odoo#87064

X-original-commit: 9947e82c5c25cde030aca43f7eb6fe1293300329
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-03-23 19:25:12 +01:00
Cedric PrieelsandPriyanka Kakadiya aa24c3a757 [IMP] *: improve report security
* hr_timesheet_{attendance}, project, rating, sale_timesheet

- removed the 'admin' group on the reporting menu items so that 'users' can
  access these menus.
- 'timesheet / attendance' menu should only show if user has access for both
  the attendance and timesheet.
- Project/User should access 'Task Analysis' report And Added rule for user.
- customer ratings: only show ratings which has access of their project/task.
- ratings: user should not able to edit ratings.

task-2467564

closes odoo/odoo#82634

Related: odoo/enterprise#23439
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
Co-authored-by: Priyanka Kakadiya <pka@odoo.com>
2022-03-16 16:07:00 +01:00
Prakash Prajapati 0386f1432a [FIX] project: fix the importing tasks with recurrence
Currently, when making an import on the project. task and trying to enable the
'recurring_task' to True, the field is updated but a recurrence record is not
created.

Steps:
    1. Create an import file of a new task record
    2. Add 'recurring_task' field set to true

Technical Description:
The default value is not set when the file is imported. Such as repeat_interval,
repeat_unit etc. So we have called the default_get method.

task-2733539

closes odoo/odoo#86283

X-original-commit: e24ae464caa068fa0a9b87fd7573528973eb25a4
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-03-11 16:14:47 +00:00
Prakash Prajapati 3cf5044e31 [IMP] project: improve the user/validation errors
The purpose of the PR is, User/validation errors are sometimes not
correct in English and/or quite obscure and don't help the user
understand/solve the issue. so some copywriting should help make
the experience better.

task-2557805

closes odoo/odoo#80107

Related: odoo/enterprise#22402
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-03-09 15:18:50 +00:00
eb1bd132af [IMP] project,hr_timesheet: store is_closed and add an index
Before this commit, when the user searches all the open tasks (the tasks
without a stage set or the tasks are in a stage where `fold` is False),
this search could be slow when a huge number of active tasks is in db
and most of that tasks is in a stage folded.

This commit stores the `is_closed` field to avoid doing a join into the
stage table to know if the stage linked to the stage is folded or not.
Because `is_closed` is a related of `stage_id.fold` and so we will avoid
doing a sql join to know if the task is a open one or not. To further
increase this search, an index is added too.

Closes #85513

closes odoo/odoo#85968

Related: odoo/enterprise#24828
Related: odoo/enterprise#25055
X-original-commit: cf8bb93
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
Co-authored-by: Yannick Tivisse <yti@odoo.com>
Co-authored-by: Laurent Stukkens (LTU) <ltu@odoo.com>
2022-03-07 20:23:15 +00:00
41bcee0cda [FIX] *: use lazy translation for _get_stat_buttons in project update
Before this commit, the translation is not done in lazy, so for each
stat button shown in the right side panel of the project update, a query
is done to find the correct translation based on the language of the
user. It means, the translation is costly and need to be done in lazy to
reduce the time for the translation of those stat buttons.

This commit uses the `_lt` to translate in lazy mode those stat
buttons. By doing that, the execution time is reduced from 750 ms to 250 ms.

X-original-commit: 95fe018
Part-of: odoo/odoo#85660
Co-authored-by: Yannick Tivisse <yti@odoo.com>
Co-authored-by: Laurent Stukkens (LTU) <ltu@odoo.com>
2022-03-03 03:07:57 +00:00
Vincent Schippefilt 05fc9a6733 [IMP] *: use _read_group instead of read_group
This commit modifies most of the usages of read_group and uses
_read_group instead. _read_group doesn't join automatically on the
many2one fields when no order_by is specified, making it more performant
when the "name" of the many2one is not relevant, which is the case for
most back-end cases

closes odoo/odoo#84908

Task-id: 2479334
Related: odoo/enterprise#24877
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-03-02 17:10:48 +00:00
Laurent Stukkens (LTU) b42359bd5f [IMP] project: improve cyclic dependencies validation error message
task-2710808

closes odoo/odoo#85395

Related: odoo/enterprise#23370
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-03-01 17:25:22 +00:00
Audric Onockx (auon) 43196c9ec0 [FIX] project : keep one task as model for recurrence
Steps :
Create a recurrent task.
Delete it.
Run the cron "Create Recurring Tasks".

Issue :
IndexError: tuple index out of range.

Cause :
The cron calls a method which takes the last task of the recurrence
as a model. As there is no such task, an python error is thrown.

Fix :
Do not display the "Continue Recurrence" button when deleting the last
task of it.

opw-2743788

closes odoo/odoo#85176

X-original-commit: 4f143131a1722e87b7dbb6b54a76b81ce2ba40cd
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-03-01 08:06:44 +00:00
abderraouf f87d0d5226 [IMP] project : Add project Tree view, improve some wordings and hide uom conversion when default and selected are the same
Before this commit, In the product form, when the selected uom is Hours and as Hours is the default uom, we display this conversion (1.0 Hours = 1.0 Hours) which is useless
Before this commit, Kanban is the only view available for projects. With this view, we can't select a batch of projects and display optional fields
Before this commit, Some wordings didn't have a significant meaning.

This commit hides uom conversion when selected and default uom are the same.
This commit adds the projects tree view.
This commit improves some wordings according to what was mentionned in the task.

task-2724965

closes odoo/odoo#82135

Related: odoo/enterprise#23206
Related: odoo/upgrade#3207
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-02-28 20:23:53 +00:00
Vincent Larcin d161d28782 [IMP] sale_timesheet: link milestones to SOLs
Currently, a service can be configured to be invoiced on milestones.
This means that the user has to manually update the delivered quantity on the SO in order to invoice it.

We now also have the notion of milestones in the project module.
It would be nice to have a link in between the milestone and the corresponding SOL, so that the delivered quantity is automatically updated when the milestone is reached.
This would help the users save time, limit the risk of error and reduce the confusion of having unrelated milestones at two different places.

To this end, this commit adds a new "milestones" invoice policy that computes the delivered quantity of a SOL based on the milestones that have been reached, and renames the previous "milestones" policy into "manual".

Task-2558889

Closes https://github.com/odoo/odoo/pull/81684

closes odoo/odoo#81684

Related: odoo/upgrade#3265
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-02-28 13:52:41 +00:00
Kartik Chavda 229046e830 [FIX] project: display rating average percentage
This commit display rating average percentage in project update right
side panel view's rating stat button instead of just displaying
rating_avg_percentange field's value.

task-2732325

closes odoo/odoo#82859

Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-02-25 19:21:42 +00:00
Christophe Simonis c4158bec64 [IMP] project: accelerate the computation of the doc_count field
The query added by 6c207ed1027d9b39eecd19886932b17f1a79dccd is not
optimal. Avoid using `LEFT JOIN` and `OR` by doing 2 queries and adding
their results.

From local tests, a `search_read` on `project.project` is about 4x faster:
2400ms -> 600ms.

closes odoo/odoo#85365

X-original-commit: 0235f2ded8ef6478ed36e2d8ba1c46acef5f1dab
Signed-off-by: Christophe Simonis <chs@odoo.com>
2022-02-25 08:26:10 +00:00
Vincent LarcinandPriyanka Kakadiya 41116c81cd [IMP] project, sale_{project, timesheet}: improve user experience
This commit introduces some user experience improvements:

    - Always display sale_line_id field whether partner_id is set or not.
    - Don't restrict sale orders to the partner_id's one
    - Set partner_id to the one of the SOL if partner_id is False
    - Remove create option for fields 'user_ids'
    - Display the kanban state in the kanban view even in fsm

Task 2585357

closes odoo/odoo#73531

Related: odoo/upgrade#3211
Related: odoo/enterprise#19812
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
Co-authored-by: Priyanka Kakadiya <pka@odoo.com>
2022-02-17 10:08:43 +00:00
Xavier BOL (xbo) 97d477b0a0 [IMP] project: add subtasks stat button in project sharing form view
Before this commit, the "Sub-tasks" has been added in the basic form
view of project.task in backend.

This commit adds this stat button in the project sharing form view to
have the same button than the one in backend.

task-2648955

Closes #82379
2022-02-14 13:23:12 +01:00
Xavier BOL (xbo) b517fdc19d [IMP] project: rename the portal form view route of project and task
Before this commit, when the current user is in the '/my/projects'
route and selects a project the route becomes '/my/project/<id of
project>'. There is no reason to change the route and then adding the id
of the project. In sales order route, we keep the route and we add the
id of the SO to see the portal form view of the SO selected.

This commit renames the route of project and task form view to keep the
same route and the same logic of SO and quotations routes for instance.

task-2648955

Closes #82379
2022-02-14 13:22:42 +01:00
Xavier BOL (xbo) 70e5f6ccbb [IMP] project: get parent task of another project in project sharing
Before this commit, the portal user can see the parent stat button in
project sharing form view of task if the parent is in the same project.
This button can be clicked and it redirects the user to the parent task
form view in the project sharing.

This commit improves this button and its visibility in project sharing
feature. The button is visible only if the current user has access to
the project of the parent task. That is the privacy visibility of the
project should be set to 'portal'. If the portal user has access to the
project of the parent task and he is not a collaborator of this project,
then the current user will be redirected to the classic portal view of
the parent task. If it is a collaborator then we display the parent task
in the project sharing feature.

task-2648955

Closes #82379
2022-02-14 13:22:36 +01:00
Cedric Prieels 7e35518129 [IMP] project: improve tags management
In big databases, the number of tags becomes rapidly huge. This makes
it very hard to find revelant tags. In practice, the same few tags are
usually used in a given project.

This commit:
- Limits the search of tags to the project's tags of the task as well
  as to the tasks' tags of the task's project.
- Prevents creating case sensitive variants of existing tags.
- Reuse existing tags from other projects and other projects' tasks
  when the user `creates` (or at least thinks creating as the
  _name_search would not return the searched tag) a new tag in his project.

task-2735833

closes odoo/odoo#82925

Related: odoo/enterprise#23814
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-02-12 19:26:16 +00:00
Xavier BOL (xbo) 68a3c80d30 [FW][FIX] project: create subtask in project sharing
Before this commit, when the current user is in project sharing and see
the form view of a task with at least a subtask. He cannot create
another one because of an error in the `_compute_portal_user_names`
method. Indeed, it is because we want to update the cache to get the
user_ids of the task related since the portal user cannot see the
users assigned to the task since he cannot access an internal user. This
update cache is made by calling the `_read` method but this method
checks after having fetching the data if the self is equal to the
recordset fetched. If the `self` contained newIds, then the method will
raise an error because a Task with newId != Task with id in db.

This commit fixes the compute method to call the _read method only on a
self with no NewIds to avoid this issue and correctly updates the cache
to get the name of the users assigned to a task in project sharing for
the portal user.

Fix found by Florian Damhaut <flda@odoo.com>

Co-authored-by Florian Damhaut <flda@odoo.com>

opw-2745857

closes odoo/odoo#84298

X-original-commit: f61c4f43365d38a955c497e022f0e8f18f50a6b2
Forward-port-of: #84189
Related: odoo/enterprise#24207
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-02-09 20:41:50 +00:00
Xavier BOL (xbo) 5ad8369bdb [FW][FIX] project: disallow the portal user to assign to a task
Before this commit, the portal user is assigned to the subtask if he
creates a subtask via the project sharing feature. We recently hides the
`Assign to me` button to those users.

This commit removes the `default_user_ids` in the context used when we
create a subtask in the project sharing feature to not assign the user
to that new subtask.

Related PR: #84006

X-original-commit: f3a241e97f80007f6d7ce2567dd22784cb35de26
Forward-port-of: #84189
Part-of: odoo/odoo#84298
2022-02-09 20:41:50 +00:00
Yannick Tivisse f448b3314e [IMP] all: Improve res.config perf on method execute
Purpose
=======

Several actions are done even if nothing has changed on the configuration.

Example:
Writing on a cron the same value makes a dummy write-lock on the table
...

Part-of: odoo/odoo#82999
2022-02-08 14:53:36 +00:00
alt-odoo 6e7d7f780d [FIX] project: allow regular user to share project in edit mode
If a user without Administration/Settings rights tries to share a
project in edit mode with a collaborator, an access rights error is
currently raised when creating the portal user. We should not create
any user instead, as there is a signup link sent to the partner anyway.
He can then set up his password without having to click on Reset
password, which was not user-friendly anyway.

closes odoo/odoo#84001

X-original-commit: 8de8c196a137f4ebbf67d7c7c83fee36f873f5c8
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-02-04 17:56:39 +00:00
Alvaro Fuentes 45631cfcea [FIX] project: MemoryError on _compute_attached_docs_count
When there are multiple projects and many tasks the compute of
project.project.doc_count may raise a `MemoryError` on access to the
projects kanban view.

This issue may appear since the addition on 642fb2e6 of docs_count field
to the kanban view `view_project_kanban`.
https://github.com/odoo/odoo/blob/136808203545eb5d7056d941f3fc250f2871f95b/addons/project/views/project_views.xml#L613
This provokes too much information to be prefetched by the ORM, in
particular the `description` fields of the tasks which may be big (e.g.
contain embedded images).

This issue was observed during upg-101057

closes odoo/odoo#83997

X-original-commit: 6c207ed1027d9b39eecd19886932b17f1a79dccd
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-02-04 16:54:04 +00:00
Kartik Chavda c9e10cb888 [IMP] project, **: improve generic ux for project
** = hr_timesheet,rating,sale_timesheet,sale_project

Purpose of this commit to improve generic UX of project app.

So, In this commit done the following  point:
- change the label for 'planned_hours' field in project task form view.
- change demo user access right to project user instead project admin.
- display the rating_status and rating_status_period fields under the 'customer
  ratings' feature in the settings.
- add 'project_id', 'mail_template_id', 'rating_template_id' fields in project
  task search view.
- add open and closed filter in project search view.
- display 'assign to me' button secondary when user set on task.
- add tooltip for 'date_deadline' field in  project form view.
- replace create_date field by write_date in rating views.
- change context of billable time stat button action.
- improve search view of project task.
- hide rating stat btn when satisfaction is 0%.
- change name of task create when SO confirmation.
- change name of project create when SO confirmed when there is only one SO
  line contain service_tracking is 'only_project'.
- add id field in tree view of project task as option hide

task-2710539
closes: #81630
2022-01-31 19:25:47 +00:00
Thibault Delavallée 1f7c83cc3e [REF] mail, various: clean thread _notify API
PURPOSE

Global purpose is to rename some methods and add some docstrings to clean
API of notification methods used in mail thread. Notably use _notify_thread
prefix for main methods, and _notify_by_'mean' for tool sub-methods.

SPECIFICATIONS

Remove unused arguments coming from old implementation and usage. They were
introduced notably for performance reason when cache was more often invalidated
which is not the case anymore. Anyway when parameters are unused it is always
better to remove them.

Remove ``notify_by_email`` parameter in ``_notify_thread``. It is only used
in channels to avoid notifying people of some automated notifications. The
same behavior has been cleanly implemented at odoo/odoo@018820d .

Rename methods, starting with ``_notify(_records)`` to ease their grouping
and understanding. Add some additional prefixes like ``_notify_by_'mean'``
and ``_notify_get_recipients`` for recipients related computation. Add some
docstrings, notably when parameters usage is not clear.

Some linting is also performed in updated actions, just to lessen styling
issues notably on runbot.

This commit should not change anything functionally as it contains only
some renaming and docstrings updates as well as some outdated parameters
removal.

Task-2710804 (Mail: Clean Mail.Thread API)

Part-of: odoo/odoo#82167
2022-01-31 17:47:30 +00:00
Raphael Collet a1904aa6f6 [IMP] core: field index names
The possible index names have been renamed "btree", "btree_not_null"
(instead of "not null") and "trigram" (instead of "gin").

Task 2742526

Part-of: odoo/odoo#83274
2022-01-28 14:10:01 +00:00
Fabien Pinckaers eedf37d6e2 [IMP] Better handling of indexes
Three supported types:
- btree (default for index=True)
- btree not null (when >90% of the data are null)
- gin trigram search (for char fields)

Review of indexes on all objects.

closes odoo/odoo#83015

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-01-19 16:52:23 +00:00
Thibault Delavallée 6aa3a88190 [FIX] portal, various: give access to portal in customer emails by default
Records inheriting from portal mixin implement their own access to portal
using tokens. Activating the access button by default seems the right thing
to do instead of having to do it manually in each addon. Access is granted
at record level using tokens and access URLs anyway.

This eases future improvements of "Pay Now" notification template as it
will use the ``has_access_button`` instead of doing custom computation
directly in the template itself.

Task-2712450 (Mail/Sale: Improve 'Pay Now' notification template)

Part-of: odoo/odoo#82627
2022-01-14 16:37:45 +00:00
Kartik Chavda a942000c2a [FIX] project: fix 'Blocking' stat button for project update
The purpose of this commit is to:

    - Open the form view if there is only 1 blocking task.
    - Prevent the project update button to show in the view opened
      through the action_dependent_tasks action.

task-2722863

Closes: https://github.com/odoo/odoo/pull/82065
X-original-commit: 22078a6a0ee0f059db8aef3a283485bc192ce0a1
Part-of: odoo/odoo#82649
2022-01-12 15:49:31 +00:00
Kartik Chavda 960e79f843 [FIX] project: display Gross Margin button if analytic_account_id is set
The purpose of this commit is to only show 'Gross Margin' stat button
in right side panel of project update when analytic account is set
on that project.

So, in this commit we add a condition in order to only show that stat button
if an analytic account is set on that project.

task-2722863

Closes: https://github.com/odoo/odoo/pull/82065
X-original-commit: 95c1deb34330db98e24f70fceae85038d47217e7
Part-of: odoo/odoo#82649
2022-01-12 15:49:30 +00:00
Cedric Prieels e2a134b398 [FIX] project,sale_timesheet: fix project update right columns values
Prior to this commit:
- Some of the project update right panel values were wrong (the number of sold and
effective hours were wrong if the service is in units, and eventual down payments are
now removed from the list of SOLs)

task-2703516

closes odoo/odoo#82607

X-original-commit: d1a06012c629f075b6faeaad2b17670e6c0e2aa5
Related: odoo/enterprise#23429
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-01-12 13:11:00 +00:00
Kartik Chavda f65b971a51 [FIX] project: remove the translate attribute from task name
Purpose of this commit is to make the name field of task
non translateble.

So, in this commit remove 'translate=true' attribute from
name field's defination.

task-2722863

Closes: #82068
X-original-commit: d344e502ad61cb9a7b2a174590ce7ae7af0c1e1a
Part-of: odoo/odoo#82551
2022-01-11 12:14:52 +00:00
Florian Damhaut 43e7c32d38 [FIX] project: set sub_sub_tasks parent correctly
Step to reproduce:
- Create a Project with task A
- Create a Sub_Task to task A named sub_task B
- Create a Sub_Task to sub_task b name sub_sub_task C
- Duplicate Project

Current Behaviour:
- sub_sub_task C (copy) has no parent_id

Behaviour after PR:
- sub_sub_task C parent_id is sub_task b (copy)

opw-2727220

closes odoo/odoo#82417

X-original-commit: dbf27b60041e53b12fc79ac2f67197d1a77a1d8c
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Damhaut Florian (flda) <flda@odoo.com>
2022-01-10 08:46:23 +00:00
Xavier BOL (xbo) 1ae732c21f [IMP] project: use the rating average instead of customer satisfaction
Before this commit, we use the `rating_percentage_satisfaction` field to display
the customer satisfaction of the project. The problem is this field is
not really a rating average. This field returns the percentage of
satisfied ratings over the total number of ratings.

This commit changes the using of `rating_percentage_satisfaction` field
by the `rating_avg` to only use the rating average to really know if
globally the customers are happy of a project or not.

task-2671848

Closes #81027
2022-01-05 13:58:01 +01:00
William Braeckman a3a32c66fd [IMP] project: improve on x2many tracking
While investigating an issue with the x2many tracking, we found a
better way that to track those field while also fixing the issue.

Fixes an issue with `default_*` context keys that are used in the
project app upon writing on tasks.

TaskId-2725014

closes odoo/odoo#82189

X-original-commit: a281a18fc84a09177f7b5e8aab98b8dc34dcc3b8
Signed-off-by: Xavier <xbo@odoo.com>
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-01-04 08:47:07 +00:00
Kamlesh Pathekar 271c6223cb [IMP] project: add analytic tags on project
-if an analytic tags are inserted on the project, it will be added to the timesheet /invoice
 analytic tag.
-In this commit, analytic tags field is added on project in order to gain in
 granularity.Those tags are passed to the invoice lines generated from the
 project's SO lines.
-set the analytic account and analytic tag of the project by default on its tasks.
-added string 'Analytic Tags' analytic_tag_ids field on task.

closes #78973
task-2667754
2021-12-16 08:10:08 +00:00
Yannick TivisseandVictor Feyens 18952cdc76 [IMP] *: Convert single create method into multi
Taskid: 2703085
Part-of: odoo/odoo#80824
Co-authored-by: Victor Feyens <vfe@odoo.com>
2021-12-14 19:13:18 +00:00
Kartik Chavda 7ca2c8e6e7 [FIX] project: fix default assigned to for rating in task
Before this commit, the default assignee set to a rating in a task is
always empty because we check if the `project.task` has a `user_id`
field to give the partner of this user.
Since it is no longer the case because we can recently assign many users
to a task. That is, it is `user_ids` field and no longer `user_id`
field.

This commit overwrites `rating_get_rated_partner_id` method to set by
default the partner of the user contained in `user_ids` field if this
field contains at most one user. Otherwise, we set no partner. We choose
to not select the first user in the user_ids field because we cannot
consider it is the responsible of the task and not another one.
We cannot create a rating per user because the rating average will no
longer right because at the beginning of the task we could have 5 users
and after we could have more users or less users and so the number of
ratings for this task could be different each time we send a rating
review to the customer.

Part of task-2696911

closes odoo/odoo#81009

X-original-commit: 88e7d270bee962d6e4d40f6b62d25a9519abfcf2
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
Signed-off-by: Xavier <xbo@odoo.com>
2021-12-07 18:40:46 +00:00
Laurent Stukkens (LTU) e89eff40bb [FIX] project: prevent archived assignees from not being visible
Prior to this fix:

    - Archived users are no more shown in the assignees

After this commit:

    - All users, including archived ones will be shown in the assignees.

task-2703358

closes odoo/odoo#80783

X-original-commit: d6092e318e04619313851276865b333afd264aad
Related: odoo/enterprise#22689
Signed-off-by: Xavier <xbo@odoo.com>
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2021-12-02 16:49:51 +00:00
Victor Feyens 31c3894b80 [REV] sale: do not precompute fields depending on x2m
and do not force precomputation on side models, it would reduce their performance.
2021-12-02 12:12:04 +01:00
Yannick Tivisse 232d66069a [IMP] sale: Make some field precomputed 2021-12-02 12:12:03 +01:00
Anjali 86f5ca73d9 [IMP] sale_(project): generic UX improvement for project
Purpose of the commit is to improve the generic UX of task
and project views.

task-2590412

closes odoo/odoo#75509

Related: odoo/enterprise#20423
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2021-11-30 14:30:43 +00:00
Kartik Chavda 17e58758de [IMP] sale,sale_(project,timesheet): improve the UI
Purpose of the commit is to do the generic improvement for the
project:

So in this commit, done the following changes:
- duplicating a project, copy all milestone of project and
set is_reached and deadline field as 'False'.
- chanage the order of the state button in sale order form view.
- pass mail body as default description value in message_new
method of project task.

task-2652943

closes odoo/odoo#77065

Related: odoo/enterprise#21199
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2021-11-26 13:37:58 +00:00
Bonis ModiandKartik Chavda f4c054e473 [IMP] project, hr_timesheet, *: improve generic ux
Purpose of this commit to improve generic UX for the project app.

So, In this commit done following changes:

- add 'subtask_effective_hours' and 'total_hours_spent' fields in the page of
subtask in task form view.
- change invisible attrs to column_invisible attrs for block_by page in task
form view.
- add 'task in progress' subtype for project.task and move 'stage changed'
subtype above 'task blocked'.
- remove the 'is_close' field and all its references from project.task.type.
- unarchive all of its tasks when the user unarchives the task stage.
- sort projects on 'is_favorite'.
- internal users following the project automatically follow its updates and
their notification preferences propagated accordingly.
- duplicating a task will duplicate all of its subtasks.
- move parent task field in extra info page of task form view.
- change the label of 'edit' to 'view' in the burger menu of project kanban view.
- user can delete task without sale_order validation error.
- add constraints for 'seller_ids' field.
- add remaining_hours_so field in task tree view.
- add unusual_days in task calendar view.
- add 'no content helper' in action of burndown chart.

task-2536044

closes odoo/odoo#74018

Related: odoo/enterprise#19880
Related: odoo/upgrade#2801
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
Co-authored-by: Kartik Chavda <kcv@odoo.com>
2021-11-23 12:04:00 +00:00
Cedric Prieels (cpr) ea038c6b19 [IMP] project: follow up the project overview removal
The project overview is a significant technical debt
as it is a custom qweb view. It is quite limited:

It is not possible to group the data, to filter on dates,
SOs or Field Service projects.
Improving this is very difficult and would require weeks
of development that are not worth it.
In any case, all the information provided by the project overview
can be found elsewhere. The stat buttons of the report are basically
duplicates of the ones from the project form view.
Therefore, we are removing this report and its twin,
the Project Costs and Revenues.
In addition, analytic items lack context for the user to understand
what generated a certain cost or revenue:

there is no link to the source document;
the entries are not categorized (e.g. it is not easy to understand
if a cost comes from a timesheet cost, a purchase order or an expense);
the billable type group by works fine for timesheets but then all
the other entries are flagged as Undefined, which is not very helpful;
there is no option to easily isolate costs from revenues.

task-2646234
See odoo/enterprise#20936

closes odoo/odoo#76553

Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2021-11-23 11:12:14 +00:00
Thibault Delavallée 869ada08a0 [IMP] mail: rename tracking methods and clean dead code
Purpose is to have tracking methods beginning with ``_track``, indicating
those are tool methods used for tracking. It helps organizing the mail thread
file and having short but precise method names.

We also remove the usage of ``mail_track_log_only`` context key that is not
used anymore in the code. It allows to shorten a bit the code and make it
easier to read.

Task-2671709

Part-of: odoo/odoo#78648
2021-11-23 09:39:52 +00:00
Jeremy Kersten b8a2565444 [FIX] project: don't check access if in sudo
Before this commit, since the code make a sudo -> unsudo to check the rights,
whatever the previous env, it is no more possible to create a task from an
alias.

This commit check that we are not already in sudo before, or in this case it
doesn't check the access right with an unsudo.

closes odoo/odoo#80131

X-original-commit: 56c625079ac5e4da9c7d9994b4459aa06cbfe727
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2021-11-19 17:18:53 +00:00
Thibault Libioulle e458ab7a06 [REM] project: remove unused data
Prior to this commit, the tasks_analysis information was added to the
panel data dict but never used clientside.

This commit removes this useless call to avoid a Traceback on large
projects, with lots of tasks (MemoryError).

task-2694765

closes odoo/odoo#80030

X-original-commit: 33446939e0cc625832de3b22661709508a01044a
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2021-11-18 18:45:15 +00:00
William BraeckmanandThibault Libioulle a2036c5dd7 [FIX] project: make better use of cache in dependency tracking
Minor changes to allow a better usage of the cache in dependency
tracking in order to reduce the query count.

See odoo/odoo#79931

TaskId-2693899

closes odoo/odoo#79956

X-original-commit: 52123efd0cbc77564d6dfc12856996b39666ad64
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
Co-authored-by: Thibault Libioulle <tle@odoo.com>
2021-11-17 16:36:50 +00:00