Commit Graph
6529 Commits
Author SHA1 Message Date
kais-odoo 9b2c19b945 [IMP] project: improve generic UX of project
In this commit made following changes:
- added copy writing content in project form view for
  access_instruction_message field.

task-3067151

Part-of: odoo/odoo#106233
2023-04-11 11:33:29 +02:00
Kartik Chavda a457785920 [IMP] sale_project: improve generic UX
Purpose of this PR to do generic improvement.

So in this PR done following improvements:

- add context in partner fields in various places to display
customer partner first in selection of partner field.
task-3099758

closes odoo/odoo#107913

Related: odoo/enterprise#34950
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-11 09:21:00 +02:00
Pratik Awasthi 28b093e6b6 [IMP] project: test onboarding tour for project
This will improve the testing of the onboarding tour
 - earlier when we change the class and don't update the class in the tour it goes unnoticed
 - to prevent failure of the tour we called onboarding tour from python to test the flow
 - Because it helps users to understand the flow so we can let the tour fail

task-3235684

closes odoo/odoo#115672

Related: odoo/enterprise#38333
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-07 16:40:48 +02:00
Bastien (bvdn) 0c2060eab9 [IMP] project, web: sort burndown chart legend
Before this commit:

- The burndown chart displayed the stage in order of the data fetching which wasn't logical especial for a chart that supposed to represent the evolution of the tasks in the project
- When sorting all/my tasks by stage, It was possible to select any project in any quickcreate of the stages which didn't make much sense

After this commit:

The burndown chart legend is now ordered according to the stage sequence (previously was ordered randomly by comming data)
Modified the burndownChartModel, simply makes a RPC to get the stages and sequences then sort the legend elements (one by stage) with it
Display only the projects which uses the stage in the dropdown menu of the task kanban quickcreate (when grouping by stage)

When sorting by all/my tasks by stage, the quickcreate now only display the projects which contains the stage selected
done by adding a domain in the quickcreate form
(shoutout to LTU and AUON who actually found the fix)

Task-3067445

closes odoo/odoo#105694

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-07 15:31:52 +02:00
Abderraouf Ghrissi (abgh) bd6428515a [IMP] project: Improve UX
Before this commit:
- project tasks view: when we group by company, milestone, customer,
worksheet template or any m2o field, the KanbanColumnQuickCreate is
displayed for that field, we can add a new one or apply examples,
but thoses examples are stages.
That doesn't make any sens to add them in a project or milestone context,
then if you add a new column manually or via the apply examples, it will
disappear once refreshing the page.
To summarize, stage is the only valid group by that can have the
KanbanColumnQuickCreate.

- all tasks view: same problem as the previous point + quick creating
is also not valid for group by stage as we are in all tasks context that
are linked to different project and the examples are mainly applied for a specific
project, if you try to add manually or via the examples and refresh they are going
to disappear as they are not linked to any project.

- my tasks view, same problem for previous point + quick creating when grouping
by personal stage is valid but apply examples  button is displayed to show stages and if
used, it will not add anything, so it should be hidden.

- Project Kanban examples stages are all created as not folded.
Some users don't know that 'folded in kanban' option is available on the stages,
and that tasks in a folded stage are considered as done.

After this commit:
- project tasks: KanbanColumnQuickCreate and applying examples are only available
when grouping by stage.

- all tasks: KanbanColumnQuickCreate is not available.

- my tasks: KanbanColumnQuickCreate is only available when grouping by personal stages.
applying examples is not available.

- some example stages are folded..

task-3092925

closes odoo/odoo#107633

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-07 11:37:03 +02:00
Yashkumar Vaishnav e64a458fcc [FIX] project: fix customer rating issue in project
Before this commit, even if customer rating is disabled from setting user can
get subscription of task rating.

This commit ensures that only when the customer rating field is enabled, the user can
get a subscription to task rating.

task-323170

closes odoo/odoo#117577

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-06 18:17:54 +02:00
Yashkumar Vaishnav 7266a546bb [FIX] project: fix broken layout in activity view
In this commit, we fixed the broken layout of task activity view.

task-3231708

closes odoo/odoo#116317

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-06 18:17:51 +02:00
damr 5ad0aa5c2a [IMP] project,web_form_project : add the handling of AAL for
project_profitability + change the name displayed in portal

This commit's purpose is to
- add the computation of the AAL for the project profitabity. If a the
analytic account of a project contains AAL that were manually added (
and thus not linked to any sol/purchase/etc ) those lines are not
computed in the 'other costs/other revenues section.

- to display the title of the ticket/task/project in the name of the page My ticket/My task/My project of the portal

task-2960753

closes odoo/odoo#106438

Related: odoo/enterprise#34344
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-06 17:20:44 +02:00
Pratik Awasthi af44a2bc9a [FIX] project: fix domain for task in portal
Steps:
- Install Project
- portal view > task

Issue:
- the private task was displayed in the portal view

Cause:
- the domain was not set for the private portal project

Fix:
- displayed task whose project_id is not false
- so private project was not displayed in the portal view

task-3147011

closes odoo/odoo#117783

X-orignal-commit: https://github.com/odoo/odoo/pull/111456/commits/2c00c7d37cf66601e7a25e22d6170973ea78b158
X-original-commit: b4ff1f0cd543fec9ca653fad97a96287e50743d7
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-06 13:51:51 +02:00
luvi 0b2b151784 [IMP] web, *: add tests to TagsList component
*: project

This commit adds test to this component and removes unused props. Since commit (1),
it is now considered as a core component. Those props have been removed from the
props declaration, to better match the real usage of the component.

Since the className props was not present:
- The o_kanban_tag class given in theory were not set in practice. The rules
corresponding to that class were already adapted to fix the display of tags in the
kanban view. It was possible to get rid of the references to the o_kanban_tag class.

- The o_field_property_tag_readonly class was also missing, and the logic to prevent
the click on tags was duplicated in the onTagClick function. This makes the class
useless. I removed mentions to this classname. Instead, each tag has the pe-none class
using the same condition, but set in the tag declaration.

(1): 129fa3f150

Part-of: odoo/odoo#117751
2023-04-06 12:48:31 +02:00
Pratik Awasthi 0e2c84592f [FIX] project: fix opening of project from list view
steps:
project > kanban card > task analysis > list view of report

cause:
trying to open a project from the list view

issue:
looking for __count in read_group

fix:
add no_open to project_id in the list view because we can open a project from
kanban card and configuration

task-3111378

closes odoo/odoo#117773

X-original-commit: aa051ccf9566cb0eb74d6357de7f069165349e48
Related: odoo/enterprise#39360
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-06 11:46:57 +02:00
std-odoo df9e9ec261 [IMP] digest, *: compute the KPI in batch
*: account, crm, hr_recruitement, im_livechat, point_of_sale,
   project, sale_management, website_sale

Purpose
=======
Now, the KPI are computed based on their `company_id` and not based
on the current company. If no company is set on the digest, we compute
it based on the current company.

The KPIs are computed based on their company. Most of the time, they
will all belong to the same company so we can improve the performance
by computing them in batch.

Task-2827996
See odoo/enterprise/pull/27658

Part-of: odoo/odoo#91945
2023-04-05 15:11:06 +02:00
Audric Onockx (auon) 00b6a18225 [FIX] project,hr_timesheet: fix performance issue in task kanban
It takes a too long to load project task kanban view.
And ~85% of this time is spent in `ProjectTask._get_all_subtasks`,
which is a recursive method returning the children of the children,
while any, of the task, for each task, just to display their count.

We replaced this recursive method with a SQL request,
which is way faster. Also, it can be called in batch.
It will return a dict {id: subtask_ids}.

task-3246085

closes odoo/odoo#117624

X-original-commit: 3b55936fed9ebdcfb8190437ad66c3e42c26b01c
Related: odoo/enterprise#39295
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-04 18:07:14 +02:00
Michael (mcm) 77e825cab2 [REF] web: replace odoo module by native one
This commit converts almost all odoo module by native module.
The goal is to deprecate odoo.define in favor of native module and then
simplify boot.js by removing the regexp that finds module dependencies.

task id: 3162300

closes odoo/odoo#117456

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-04 16:01:57 +02:00
Abderraouf Ghrissi (abgh) a75cf43c9f [FIX] project: display project in read-only when portal user is not a collaborator
Before this commit:
- A portal user cannot access the project if he's not a
follower but a public user can do that and it doesn't
make sense for portal users to have less access than public users.

- Technically the problem was that we call _check_project_sharing_access
with the portal user instead of sudo, so when trying to access
self.collaborator_ids, an exception is raised saying that
the portal user cannot access to project fields.

After this commit:
- Portal users can access the project in read-only when they are not
followers.
- Technically, we preferred searching over just adding self.sudo()
to get the result directly in one query for a better performance.

task-3205644

closes odoo/odoo#117549

X-original-commit: f51685213c2c10a54e4d31f42d20a4bc7f4b17cc
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-04 13:35:42 +02:00
Vincent Larcin a116225e18 [IMP] hr_timesheet,project: take away Marc Demo's admin rights
Since 16.0, the demo user Marc Demo has gained admin access to all the apps.
To facilitate testing access rights, this commit restores his access rights
as they were before for the Services apps.

Enterprise: https://github.com/odoo/enterprise/pull/38055

Task-3229247

closes odoo/odoo#115026

Related: odoo/enterprise#38055
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-04 13:34:54 +02:00
Adesh JolheandManisha Tulsiyani 23cf931808 [IMP] hr_,sale_(timesheet, project),purchase: generic improvements for the project
Purpose of the commit is to do the generic improvements for project.

So in this commit did the following changes:
 - adding a label 'last update' to the stat button in project form view.
 - indicate 'my project' in the tab instead of 'project sharing view in portal' in project sharing.
 - set the first non-folded stage of the project as default on newly created tasks.
 - remove user confirming the SO as the default project manager.
 - hide fields service_tracking, service_upsell_threshold if sale_ok is false.
 - set purchase_method to purchase by default if product is of service type.
 - remove the : next to the totals labels and decrease the font-size for values of 'total hours'
   and 'remaining hours' in timesheets notebook in project task form view.

task-2897867

closes odoo/odoo#96548

Related: odoo/enterprise#29774
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Co-authored-by: Manisha Tulsiyani <matu@odoo.com>
2023-04-04 11:01:59 +02:00
Michael (mcm) ff0d6dd580 [REF] *: replace odoo module by native one
This commit converts almost all odoo module by native module.
The goal is to deprecate odoo.define in favor of native module and then
simplify boot.js by removing the regexp that finds module dependencies.

task id: 3162300

closes odoo/odoo#117305

Related: odoo/enterprise#39118
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-03 17:07:24 +02:00
c5dd03ffee [FIX] project: review UX and UI in Project app
This commit reviews the UX and UI in Project app and improves the usability of the
new features recently added (subtasks list in kanban card, state field replacing
kanban_state field, etc).

The following changes are made in this commit:

- swap of user_id icon in the kanban box and the removal of the allow_unassign field and setting
- change the ordering of the fields in the subtask list
- make small layout changes in the project.task and project.project kanban cards
- remove the "lock-icon private" sub-title of private tasks, replace it with a
  little lock icon on the bottom right icons of the kanban card.
- remove the break tag in the project.task kanban card that was unecessary
  given the new display and margin style settings
- lock icon is bigger
- kanban icons are better aligned
- state is as big as avatar
- remove the 'remaining hours on SO' field
- deadline field will be optional and hidden by default in project.task list view
- remove the rating field
- add stage field as optional in project.task list views
- priority and state fields will no longer be optional
- stage_id will be copied when duplicating a task, except when the task is
  generated through the recurrence
- remove the tooltip of the tag_ids field
- When duplicating a task having sub-tasks, '(copy)' is no longer
  added to the name of the sub-tasks of this task.
- project.task kanban view:
  * (+ x tasks) mention next to the name is removed
  * The caret is replaced with 'fa-check-square-o x/y'
    which will represent the number of sub-tasks closed
    compared to the total number of sub-tasks
  * Only open subtasks are displayed
  * When changing the state of a sub-task to a closing one,
    the sub-task is muted and removed from the list on the view reload
  * The name of the parent task on the kanban card of sub-tasks is
    displayed except when viewing the sub-tasks of a particular task
    through the sub-tasks stat button
  * project.project kanban view: the fa-check-square-o icon of
    milestones is replaced with fa-flag-o
  * project.task kanban card: the fa-play and fa-pause icons
    are moved on the right of the remaining hours widge.
  * Allow users to edit the stage_id in batch from the list view of tasks
    if all of the selected tasks are part of the same project.
  * the state will have the same size as the avatar
  * change the opacity of the tasks that are closed
  * state is at the right of subtask list
  * the striked should be replaced by the opacity on the kanban card

Enterprise PR: odoo/enterprise#38132

Task-3229873

closes odoo/odoo#116628

X-original-commit: 09b5d5843096d27b5a4ab0f603ad44bdb2e74723
Related: odoo/upgrade#4478
Related: odoo/enterprise#38771
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Co-authored-by: Panagiotis Kyriakou <paky@odoo.com>
Co-authored-by: Bastien (bvdn) <bvdn@odoo.com>
2023-04-03 17:07:21 +02:00
Kartik Chavda f7ed7052fb [IMP] {sale_,}project: hide customer for non-billble project/task
Before this commit user able to see and add customers on non fsm and
non billable tasks/projects which is not provide any significance as
user don't need customer for normal tasks/projects.

So, in this commit hide customer field and also move partner phone
and city to field service app as it was only usefull for FSM project
and task.

task-3141350

closes odoo/odoo#111335

Related: odoo/upgrade#4274
Related: odoo/enterprise#36459
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-31 19:10:48 +02:00
Kartik Chavda 421537e67e [IMP] project: hide project related filter
Before this commit project field was hidden from views
open for specific project but search view still display
project related filter/groupBy and there is not point
displaying that if all tasks has same project set on
then.

This commit hide project related fielter/groupBy from
views open from specific project.

task-3141350

Part-of: odoo/odoo#111335
2023-03-31 19:10:47 +02:00
Kartik Chavda 96ca3680d9 [IMP] hr_timesheet: change allocated hours field label
Before this commit allocated hours field label on task has
to change allocated days when user change encoding unit.

This commit change label to allocated time that work for
both encodinging unit and we don't have to change label
depending upon encoding unit.

task-3141350

Part-of: odoo/odoo#111335
2023-03-31 19:10:47 +02:00
Vincent Larcin 317cf3b85e [FIX] project: fix task search views priority
Steps to reproduce
------------------
1. Install and open the Timesheets app.
2. Click on the "Start" button on the top left.
3. Click on "Select a Task" and then on "Search More..." to open the list view.
4. The associated search view is not the same as in the Project app.

Explanation
-----------
This occurs because the selected search view will be the one related to the model
with the lowest priority. Since we didn't define a priority for any of the views,
the view `view_task_search_form_base` is the one with the lowest default priority.
However, this is a base view created for inheritance purposes and not intended
to actually be used anywhere.

To solve this issue, this commit adds a very high priority to the base views,
and a low priority to the concrete views we want to be used in such cases.

Note that this unintended behavior is also present in versions below 16.1,
but in a non problematic way (only the project related filters are missing).

---

Enterprise: https://github.com/odoo/enterprise/pull/37812

Task-3217905

closes odoo/odoo#117354

X-original-commit: e68bd3490ee609a82c2a0fb0d76c1e2502a2ffc0
Related: odoo/enterprise#39128
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-31 17:02:55 +02:00
hiroh-odoo 0e9498a345 [IMP] project,sale_timesheet: improve generic ux
Purpose of this commit is to improve the generic usage of the project app.

So in this commit done the following changes:
- add done task count field in milestone and display it in milestone form view
  stat button all tasks under this milestone and the done tasks of the milestone.
- rename 'project.project' form view field lable from 'Name of the tasks' to
  'Name of the Tasks'.
- add 'invoiced' column in the project update description under the sales section.
- remove helper for 'project.project' name field in form view.
- add a placeholder in the 'project.task' form view.

task-3073860

closes odoo/odoo#107076

Related: odoo/enterprise#34593
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-31 17:02:24 +02:00
Audric Onockx (auon) 5f8c5deeb5 [IMP] project: restrict sending rating mails when changing stage
The rating email template should not be sent if:
there is no partner set on the task
or if the current user is set as the partner of the task

task-2924559

closes odoo/odoo#96452

Related: odoo/enterprise#29728
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-31 17:02:14 +02:00
Kartik Chavda 6e03d2bd26 [IMP] {sale_}project{_mrp}: improve some generic UX of project app.
Purpose:
 - Improve some generic UX of project app.

Specification:
 - make milestone field option hide in task tree view.
 - set default 'Tasks' to label_tasks field on creation when
   label_tasks field is empty.
 - order stat buttons of project update right side panel
   according to user usage.
 - hide project field for list, calendar, graph and activity
   view of act_project_project_2_project_task_all action.
 - archive task ratings template when ratings is disabled and
   unarchive that template when its not.

task-3083855

closes odoo/odoo#107467

Related: odoo/enterprise#34778
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-31 15:52:14 +02:00
hiroh-odoo 647cf8fe63 [IMP] project: prevent opening form/list view from reporting
Before this commit open the form/list view from reporting views when clicking
on the graph and pivot.

This commit prevents the opening of the form/list view from reporting.

task-3166747

closes odoo/odoo#113362

Related: odoo/enterprise#37402
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-30 18:58:51 +02:00
Vincent Larcin 20f938bd10 [IMP] project: add fields to burndown chart search view
This commit removes some field from the burndown chart search view that
were previously removed from the task search views.
It also adds a few fields present in the task search views but missing
from the burndown chart.

Enterprise: https://github.com/odoo/enterprise/pull/36804

Task-3142077

closes odoo/odoo#112194

Related: odoo/enterprise#36804
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-30 18:58:43 +02:00
Vincent Larcin 641766bd20 [IMP] project: add sudo in project.task write dict comprehension
All write operations on the `project.task` model are slowed down significantly
by a dict comprehension mapping tasks to their user_ids because of the access
rules checks. By adding a sudo to that dict comprehension, this commit makes it
bypass those checks and speeds it up.

Task-3164004

closes odoo/odoo#115037

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-30 15:09:17 +02:00
Pratik Awasthi 87941198a5 [IMP] project: improve menu for my tasks and all tasks
Purpose:
- In the project, My Tasks and All Tasks menu are related to the task model so
 having two main menus for the same model which display almost the same
 thing would not be great for UI and it'll not look good if we add another menu
 in the future or via customer customization.

So in this Commit:
- We have added a menu named Tasks which has 2 sub-menus My Tasks and All Tasks
 which would be great to display tasks

task-3180910

closes odoo/odoo#113335

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-30 15:09:05 +02:00
Rohitkumar (roku) 21f9219dff [IMP] sale_(project),hr_timesheet: generic UX improvement for project
Purpose of this commit to improve generic usage of project app.

So in this commit done the following changes:
  - the sequence field should not be optional for project.task.type list view
  - move the fa-play icon next to the remaining hours widget in kanban view
  - add filter and separator for burndown chart search view
  - transform the 'milestones' stat button into 'x Milestones /n y Reached
  - change the recurrence banner
  - add the placeholder for the label_tasks field 'e.g. Tasks'

task-2947481

closes odoo/odoo#99528

Related: odoo/upgrade#3872
Related: odoo/enterprise#31047
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-30 15:08:56 +02:00
Prakash PrajapatiandAudric Onockx 484d7ec78a [IMP] project: add some extra fields in project populate data
In this commit, we added extra fields: company, partner, users

Task-3082060

closes odoo/odoo#109844

Related: odoo/enterprise#34515
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Co-authored-by: Audric Onockx (auon) <auon@odoo.com>
2023-03-30 12:54:25 +02:00
Rohitkumar (roku) 587f250858 [IMP] project,(hr,sale)_timesheet: generic improvements for project app
Purpose of the commit is to do the generic improvements for project.

So in this commit did the following changes:
- add a space between 'access to:' and the name of the course in SOL nameget.
- hide the 'remaining hours' value if the nb of 'initially planned hours' is
  equal to 0 in task list view.
- hide the 'initially planned hours' and 'hours spent' values if they are equal
  to 0 in task list view.
- hide the 'milestone' and 'assignees' fields if they are false task calendar
  popover
- hide the 'remaining hours on SO' value if there is no SOL set on the task
  list view
- use the progressbar widget for the progress field update list view

task-2949984

closes odoo/odoo#112265

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-29 23:36:44 +02:00
Bruno Boi d2575b50eb [FIX] web,*: restrict kanban examples availability
*: project,utm

**Before this commit**
With the following steps, it is possible to use kanban column quick
creation with unexpected fields, i.e. creating projects instead of
stages inside a project:
- Project > New > Groupby 'Project'
- Click on the "see examples" link in the column in creation
- Apply any column examples
- Instead of stages inside the project, new projects are created

**After this commit**
The kanban_examples registry elements should now clearly
state which are the allowed groupby fields.
The 'See examples' link will not be displayed if the groupby field
is not allowed.

**Usage**
See the modified files in project and utm modules in this commit.

Taskid: 3246042
Part-of: odoo/odoo#115909
2023-03-29 09:33:35 +02:00
Yannick Tivisse 663d708c3b [IMP] project: Remove personal stage garbage collector
Will be reintroduced properly afterward. Currently, even if the
field is defined using ondelete='set null', the M2M relation
doesn't handle the fact that the target table is a real model
and not a simple relational table.

closes odoo/odoo#116880

X-original-commit: f58d2ad669710a353263e418bbf69f5f49145cac
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-03-28 18:46:14 +02:00
Géry Debongnie 3db0ad01a1 [REF] web, *: rework webclient cache invalidation system
The web client has a mechanism to invalidate the action and the view
cache: in the basic model (and the relationalmodel), some code is
looking for updates to some specific models (such as ir.actions) and
trigger a `CLEAR-CACHE` event. This event is then listened by the action
and view services to properly clear the caches.  This mechanism was also
used to reload the page after editing a company, or reloading the
currencies after editing some currency.

With this commit, we modify the orm service to trigger an event after
each rpc. This event can then be used by the action/view service, and
also by the currency/company services to perform their specific cleanup.
This work is one step in the future refactoring of the relational model.

closes odoo/odoo#115655

Related: odoo/enterprise#38814
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-27 16:04:58 +02:00
FrancoisGe 0c9c20d747 [REF] *: fieldsToFetch to relatedFields
Since commit c1cbfb07516d2d06c3311d66e220b1de87c1b681, fieldsToFetch
has been renamed to relatedFields.

Apparently, some commits were merged after this one without using the
new name.

closes odoo/odoo#116623

X-original-commit: dea116bf4c65295e93cc7894132d9f48f98e4189
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-27 08:44:13 +02:00
Victor Piryns (pivi) c0ae3e70e1 [FIX] project: search view for activities on tasks should be correct
Current behaviour:
When checking on the activities that are "Late/Today/Future", the
resulting search view doesn't apply any filter.

Expected behaviour:
If you click on "Late" activities for Tasks, then you should see
only the "Late" activities, not all of them.

Steps to reproduce:
- Install Project
- Create a project and 3 tasks for that project
- On each task, put an activity that is "Late"/"Today"/"Future"
  respectively (1 activity per task)
- Click on the activity widget (top-right in the header) > Tasks > Today
- All tasks are shown, not only those for "Today"

Reason for the problem:
Since the view refactoring from
b77f60b , search filters follow an
hierarchy of inheritance to reduce code duplication. The issue is
that it's "delegation" inheritance (so the childs have a mode of
type "primary") but all their priorities are the sames, so the
algorithm for view matching (refer to documentation) matches the
parent view, that doesn't contains the necessary filters for the
activities, which are defined a few level lower in the inheritance.

Fix:
Add descending priority in the inheritance chain so we match the
lowest child when web-client requests the search view.

Affected versions:
- saas-16.1
- saas-16.2
- master

opw-3234525

closes odoo/odoo#116337

X-original-commit: 609f484
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-24 07:45:04 +01:00
Xavier Bol (xbo) 3081278abc [IMP] project: toggle state if task is subtask without project set
Before this commit, the state mode for subtask without any project set
is not the toggle one as it is the case for the private task.

This commit changes the state mode to have the toggle mode when the
task has no project set, that is, the subtask without any project set
or the private task since a subtask without a project set could be see
as a todo task and not a task in a real process as it is the case for a
task linked to a specific project.

task-3230063

closes odoo/odoo#115781

X-original-commit: e2d7ee73222ab3330da9c45570a4a6330d87c016
Related: odoo/enterprise#38378
Related: odoo/upgrade#4448
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-24 02:23:37 +01:00
Xavier Bol (xbo) 58183d47e7 [IMP] project: do not display private on project if task is subtask
Before this commit, since the display_project_id field has been removed and
the project_id field could be unset on subtasks (default value as the
`display_project_id` field), the widget `project_private_task` consider
a task as private if the task has no project_id set.

This commit changes the widget to check if `is_private` field is true
to display the `Private` on `project_id` field value.

task-3230063

X-original-commit: b0a8a9aedb3b5cfb2acb6ff3b10a77c279bda8fd
Part-of: odoo/odoo#115781
2023-03-24 02:23:37 +01:00
Xavier Bol (xbo) de7d0b17c5 [IMP] {sale_}project,{hr_,sale_}timesheet: remove display_project_id field
Before this commit, the `display_project_id` field was a bit confusing
for the user to know what is the goal of this field. Also this field is
available when the user wants to import his data into Odoo, if he does not
know the goal of this field then he could be lost to know which field he
should for his data to import (or even export).

This commit removes the display_project_id field and so a task will be
private one if the project and the parent fields are not set. The
project to set to the timesheet will be the one set on the task or the
one set on one of its parent tasks.

task-3230063

X-original-commit: 22eda5a5ddcfcda9fa6597d6fe21eb20f525799f
Part-of: odoo/odoo#115781
2023-03-24 02:23:37 +01:00
FrancoisGe 2ecfed335d [REF] *: extractProps receive dynamicInfo
Before this commit, the use of multiple <field> with the same name in a
view was not well supported.

Why was this?
Some Field components need to know information related to the <field>
such as context, domain, required and readonly. The solution used before
this commit to access this information is to use the getFieldContext,
getFieldDomain, isReadonly, isRequired functions of the model.
Unfortunately, these only take into account the last occurrence of the
<field> because the model is not aware that the same field is present
several times on the view. The information must therefore not come from
the model. For example, it was not possible to have the same field
twice with 2 different domains. It will use the domain of the last
field for both.

Solution:
We will add the object "dynamicInfo" to the fieldInfo passed to the Fields
extractProps function. This object will contain a getter to get the value
of required, readonly, domain and context for the current <field>.
If a Field needs one of its information, it will just have to get it
from extractProps.

Part of Task: 3179751

closes odoo/odoo#115197

Related: odoo/enterprise#38151
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-24 01:24:48 +01:00
Audric Onockx (auon) 859156905c [MOV] project: create a separate file per model (views and models)
In this commit, delete the part of each file
that is not related to its model.

task-3234479

closes odoo/odoo#115694

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-22 14:52:10 +01:00
Audric Onockx (auon) 335579325f [MOV] project: create a separate file per model (views and models)
In this commit, we just copy/move the files.

task-3234479

Part-of: odoo/odoo#115694
2023-03-22 14:52:09 +01:00
Thibault Libioulle ecc58cb482 [FIX] project: fix tag name search with none project in context
This commit fixes the name_search traceback on project tags when the
`project_id` in context is set to `False`.

Prior to commit odoo/odoo@05855b6b this check was still relevant since
the implementation used the ORM search method. Since this commit,
project_id must be an integer to be used in the SQL query.

Steps to reproduce:
- Open Project menu;
- Go to My Tasks menu;
- Create a new task;
- Open task;
- Click on Tags field.

Current Behavior:
```
  File "/home/src/odoo/odoo/models.py", line 1605, in name_search
    ids = self._name_search(name, args, operator, limit=limit)
  File "/home/src/odoo/addons/project/models/project.py", line 2756, in
  _name_search
    self.env.cr.execute(query, params)
  File "/home/src/odoo/odoo/sql_db.py", line 313, in execute
    res = self._obj.execute(query, params)
psycopg2.errors.UndefinedFunction: operator does not exist: integer =
boolean
LINE 9:                             ON task.project_id = false
                                                       ^
HINT:  No operator matches the given name and argument types. You might
       need to add explicit type casts.
```

Expected Behavior:
- No traceback and standard name_search behavior.

closes odoo/odoo#116006

X-original-commit: f21bd6f47a75f5d6cbd442f30ef7df221e6fec7d
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-21 19:54:20 +01:00
Thomas Lefebvre (thle) 86ffeb2e5d [FIX] project: update token even if False
Steps to reproduce:
- take a project;
- change the visibility to allow sharing;
- click on "SHARE EDITABLE";
- share the project with a portal user;
- login as portal;
- try to open a project task.
Remark: the problem does not occur for all tasks.

Issue:
A traceback appears.

Cause:
Error occurs because: `return (token and record and consteq(record[token_field], token))`
compare two values with different type.
- `token` is equal to `'null'`
- `record[token_field]` is equal to `False`

In the code: `consteq = hmac_lib.compare_digest`

> `hmac.compare_digest(a, b)`
Return `a == b`.
This function uses an approach designed to prevent timing analysis
by avoiding content-based short circuiting behaviour, making it appropriate for cryptography.
a and b must both be of the same type:
either str (ASCII only, as e.g. returned by HMAC.hexdigest()), or a bytes-like object.
[source](https://docs.python.org/3/library/hmac.html#hmac.compare_digest)

The source of the problem is upstream to this comparison.
Indeed, we first test if we have a token.
As the value of the token is `'null'`, we pass the condition.

Solution:
It is necessary to have a token equal to `False` if the task has not token.
Therefore, whatever the value of the token (token value or `False`), we have to update the token.

opw-3217490

closes odoo/odoo#115947

X-original-commit: dd3a59fa28c5644be93cc2778e0c6854a4481d51
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-20 23:49:09 +01:00
Victor Piryns (pivi) 1e737debbe [FIX] project: speed up name_search of tags on a task
Description:
The pop-up that shows suggestions when adding a tag on a task is
really slow (300~500ms per request on prod).

Cause:
`project.tag` has an override of `_name_search()`, which adds a
domain of the form
```python
['|', ('task_ids.project_id', '=', project_id),
 ('project_ids', 'in', project_id)]
```
which is expensive to compute.

Functional requirements:
- Suggest tags of the "project" first (those that are on tasks in the
  same project), then all the rest.
- Tag's name should be sorted alphabetically per result set (tags on tasks of
project first, sorted alphabetically, then all other tags, sorted
alphabetically)

Solution:
Construct a custom query that makes use of CTE and `UNION ALL` to sort
only on a subsets of the tags to speed up. Also `UNION ALL` with a
`LIMIT` is lazy evaluated, so we gain on speed of all tags are comming
from tags on tasks in the current project.

Affected version:
- 16.0
- saas-16.1
- master

perf-3209468

closes odoo/odoo#115867

X-original-commit: 9e4ed8942800a7fc6e980e79b3e744fc35bd2a0d
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Signed-off-by: Olivier Dony (odo) <odo@odoo.com>
Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>
2023-03-20 18:13:09 +01:00
Martin Trigaux 1be5eae8ef [I18N] *: remove nl_BE files
They dates from < 2027 and are quite outdated. Favour the nl
translation instead.
n_BE is not on Transifex so it was not possible to correct bad
translations.

closes odoo/odoo#115845

X-original-commit: d04c8b7e484db8306d858c891a7a2b11885fdcd9
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-03-20 16:51:30 +01:00
Yannick Tivisse dcbdb6e690 [IMP] project: Remove commercial_partner_id from task/project model
closes odoo/odoo#115155

Taskid: 3231143
Related: odoo/enterprise#38142
Related: odoo/upgrade#4432
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-03-17 13:43:14 +01:00
Yannick Tivisse c002e4176a [IMP] project: Remove project_color field
Taskid: 3231143
Part-of: odoo/odoo#115155
2023-03-17 13:43:14 +01:00