Commit Graph
2376 Commits
Author SHA1 Message Date
Louis (wil) 3f6f949fa5 [I18N] export sources
closes odoo/odoo#140002

Related: odoo/enterprise#49687
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-10-27 08:36:16 +00:00
Yannick Tivisse 7ebafb1eb7 [IMP] base: Remove manager rights to user demo
closes odoo/odoo#139731

Related: odoo/enterprise#49562
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-10-25 20:56:11 +00:00
williamandh4818 dc696c8ed4 [IMP] analytic: allow cross analytics
Purpose
=======

Make it possible to compare analytic values between plans by inputting
up to one account per plan on each line.
For instance, if we have 2 plans: "Country" and "Product Type", with the
following accounts

| Country | Product Type |
| ------- | ------------ |
| BE      | Drinks       |
| LU      | Food         |

And the following invoices:
* 1000€ of drinks in Belgium
* 2000€ of food in Belgium
* 3000€ of food in Luxemburg

We want to be able to display the following pivot tables:

|     | Drinks | Food | Total |
| --- | ------ | ---- | ----- |
| BE  |   1000 | 2000 |  3000 |
| LU  |      0 | 3000 |  3000 |
| Tot |   1000 | 5000 |  6000 |

|        | Total |
| ------ | ----- |
| Food   |  5000 |
| * BE   |  2000 |
| * LU   |  3000 |
| Drinks |  1000 |
| * BE   |  1000 |
| Total  |  6000 |

Implementation
==============

* `ir.fields` are added/removed dynamically on `account.analytic.line`
* Each analytic plan corresponds to one field on `account.analytic.line`
* The fields are added dynamically in the views.
* `account.analytic.plan` doesn't have a `company_id` field anymore,
  meaning that all the companies have access to all the plans. This
  means that the applicability fields and lines are now company
  dependent, and those can be used to know which fields/plans to display
  for which company.
* There can no longer be one "Project" plan per company, even if the
  accounts of that project can still be owned by only one company.
* There is now only one method to get the default (or "Project" plan),
  which is `_get_plan_columns`

task-3497653

closes odoo/odoo#139225

Related: odoo/upgrade#5306
Related: odoo/enterprise#49226
Signed-off-by: William André (wan) <wan@odoo.com>
Co-authored-by: william <wan@odoo.com>
Co-authored-by: h4818 <ayh@odoo.com>
2023-10-25 18:10:57 +00:00
Chrysanthe (chgo) df8535fbd4 [REF] portal, *: portal redesign
*: base, account, account_payment, auth_top_portal, hr_timesheet, loyalty,
   mrp_subcontracting, payment, project, purchase, sale, sale_stock,
   sale_timesheet, website_crm_partner_assign, website_sale,
   website_slides

Portal general redesign. Increase visual consistencies with the backend
[1] and adapt to the new default website design [2].

[1] https://github.com/odoo/odoo/pull/116641
[2] https://github.com/odoo/odoo/pull/120302

task-3046004

Part-of: odoo/odoo#138077
2023-10-25 15:50:36 +00:00
Xavier Bol (xbo) 3bb63c8817 [FIX] {hr,sale}_timesheet: use column_invisible instead of invisible
Before this commit, `invisible` attribute is used for the list view
to hide the field inside the list view but that invisible does not
hide the column.

This commit replaces `invisible` attribute by `column_invisible`
to completely hides the fields in the list as it was expected.

task-3542388

closes odoo/odoo#137820

Related: odoo/enterprise#48523
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-10-25 09:56:37 +00:00
Xavier Bol (xbo) 52b0a06851 [IMP] hr_timesheet: unset the task_id when the project changed
Before this commit, when the project of the timesheet changed, the
task_id of the timesheet is not unset and so it could have some
inconsistency.

This commit ensures the task linked to the timesheet has the same
project than the one set on the timesheet, otherwise the task_id is
unset.

part of task-2276015
task-3542388

Part-of: odoo/odoo#137820
2023-10-25 09:56:37 +00:00
Xavier Morel 9ebbfdac73 [FIX] *: incorrect translations markings
Fixes a large number of cases where strings are translated then
formatted, instead of letting `_()` do the formatting internally,
which allows it to recover from incorrect translations (missing,
broken, or extra placeholders).

Also

- removes translation markers entirely when there's nothing to
  translate e.g. `_("%s - %s")` is not useful
- fixes a few messes which lead to only partial translatability
  (DRY is generally a bad idea when translations are involved, even
  more so when you don't make the variable part translatable)
- fixes a few nearby issues noticed at the same time
- replaces a few `"%s"` by `%r`, which should automatically quote
  strings relatively appropriately
- fixes translated strings which use `\` to escape a newline (in order
  to fill-paragraph): `\` escapes only the newline, if the
  continuation string is indented this results in a bunch of spaces
  ending in the string to translate, which is pretty garbage for the
  translator, using implicit concatenation works much better

Note: some of the updates revert f-string parameters to %, because
babel (2.9) apparently has trouble with f-strings and blows up trying
to extract them.

Not in scope:

Helping translators fix translatable strings e.g. any translation
string with more than one placeholder probably should use keyword
placeholders

- Provides more context / data to the translator to make sense of the
  sentence.
- Allows reordering the translated terms, which can be necessary
  depending on the sentence and language.

closes odoo/odoo#139314

Related: odoo/enterprise#49311
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-10-23 16:45:09 +00:00
John Laterre (jol) 76c0b8ef06 [IMP] account,analytic,hr_timesheet: harmonize analytic search view
The aim is to harmonize the analytic search view between `hr_timesheet` and `account` by creating an inheritance from `analytic`.
This allows the accountant to have access to all the fields and filters defined in other modules.

task-3463639

closes odoo/odoo#138542

Related: odoo/enterprise#48870
Related: odoo/upgrade#5271
Signed-off-by: William André (wan) <wan@odoo.com>
2023-10-20 14:59:16 +00:00
John Laterre (jol) f5b2dea457 [REV] hr_timesheet: refactor search view of timesheet
This reverts commit 4dcf11a71d.

The reason is that it broke the inheritance with `analytic`, and thus with `account`.
This in turn made it impossible to harmonize the search view between modules.

Part-of: odoo/odoo#138542
2023-10-20 14:59:16 +00:00
Adrien Dieudonné 1158c45e4a [REF] *: remove .oe_left and .oe_right
The first intention of this commit was to remove ´@extend´ but
it actually makes sense to remove ´.oe_left´ and ´.oe_right´ classes.

Since grid we can avoid "float" elements (see .oe_subtotal_footer)
and we only have to remove this class.
For the other case, we have to use ´.float-start' and ´float-end´
to replace ´oe_left´ and ´oe_right´.

closes odoo/odoo#139199

Related: odoo/enterprise#49211
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-10-19 18:02:21 +00:00
ravb-odoo c2fdf83e0b [IMP] sale_timesheet,_*: improve mail template and portal view
_*= account, hr_timesheet
This commit improves the Portal functionality and add email template:

- improve email template for invoice includes timesheet (add link in mail which
  redirect to timesheets linked with invoice).
- improve timesheets template by renaming labels and internal header/footer.

task-3251680

closes odoo/odoo#127224

Related: odoo/enterprise#43593
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-10-19 14:47:11 +00:00
ravb-odoo c44d8d7deb [IMP] sale_timesheet,_*: add dynamic label for timesheet record
_*= account, hr_timesheet
This commit improves the Portal functionality and add email template:

- improve email template for invoice includes timesheet (add link in mail which
  redirect to timesheets linked with invoice).
- improve timesheets template by renaming labels and internal header/footer.

task-3251680

Part-of: odoo/odoo#127224
2023-10-19 14:47:10 +00:00
Hugo Carlier (Huca) 561775fda9 [FIX] hr_timesheet: avoid access error in project sharing
Steps
=====
- Install hr_timesheet
- Create a project shared (in edition) with a portal user
- Creata a task with a subtask and log timesheets for the subtask
- As a portal user open the parent task form
- Go in the timesheet tab
- Click on the button "Sub-tasks Hours/Days Spent" at the bottom of the
  page

Issue
=====
An access error appears for an uom.uom record.

Cause
=====
Portal users have no access to uom.uom records. The method
_apply_timesheet_label uses this model to determine if the time spent
needs to be displayed with an 'hours' or a 'days' label. This raises a
traceback when it is called by a portal user.

Fix
===
The method _apply_timesheet_label is called as sudo, following the fix
that was already done in project sharing (see odoo/odoo#73341).

task-3527521

closes odoo/odoo#139125

X-original-commit: 01b1cf07bc1fb618d34065271cdc07fce561337f
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-10-19 10:45:52 +00:00
dhrs-odoo 6df6108221 [FIX] hr_timesheet: manage missing space issue
In this commit we have manage sufficient space between allocated
hour and the percentage.

task-3248965

closes odoo/odoo#139113

X-original-commit: 1722359f1bedd238b162dd8f4c07d648d6d2d114
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-10-19 10:45:50 +00:00
Abderraouf Ghrissi (abgh) b9532e7549 [IMP] project: Improve ux
Before this commit:
- project.task > list view: Currently, the progress is displayed
in purple if less than 100% and in red if above. The two colors
don't contrast a lot, making it hard to read. In addition, it
is not coherent with the color we usually apply for the remaining
hours in the rest of the app.
- onbording tour: the manual saving step is no longer necessary
as records are now automatically saved. In addition, showing it
doesn't provide a wow effect and is an extra opportunity to lose
people in the process

After this commit:
- the following color code was applied for the progress bar:
*if progress < 80 -> green
*if progress is between 80 and 100 included -> orange
*if progress > 100 -> red

- step removed.

task-3475170

closes odoo/odoo#132854

Related: odoo/enterprise#46162
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-10-18 18:27:25 +00:00
Demesmaeker 211a5bb13b [IMP] sale(_management,_pdf_quote_builder),*: improve pdf quote builder
Following 116879e17e81657f48a7d11780d8d30715ecc68f a few improvements were needed to make it more
complete.

task-3484125

closes odoo/odoo#137522

Related: odoo/enterprise#48563
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-10-17 08:53:06 +00:00
Brieuc-brd 538fdab99b [IMP] *: fine-tune app icons
The aim of this commit is to improve the impact and rendering of app
icons in bright and dark mode. It also reduces the size of svg files.

To achieve that, this commit updates the colors to flat colors. This
change will make the icons stand out and improve their readability.

task-3072562

X-original-commit: 667a19162b74fb6554a2389ba9c6e69de4ff5113
Part-of: odoo/odoo#138279
2023-10-16 09:21:17 +00:00
padh-odoo f610fb1d31 [IMP] hr_timesheet: improve add pivot and graph view for my timesheet
Improve added pivot and graph view for my timesheet in the timesheet app.
- Before this commit there was no pivot and graph view for my timseet in
  timesheet app.
- In this commit pivot and graph view is added or my timseet in
  timesheet app.

Task-3479322

closes odoo/odoo#134495

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-10-13 21:11:50 +00:00
Leonardo Pavan Rocha 43122b3efc [IMP] hr*: change employee field widgets to show private/public employee
In HR modules we have both hr.employee and hr.employee.public models and the
issue is that if a certain user doesn't have access to read the hr.employee
record, it will throw errors/avatar pictures won't appear. For this reason,
https://github.com/odoo/odoo/pull/116828 introduced a change in many2many
employee fields so that they always show hr.employee.public records. However,
we can improve this behavior by checking if the user has access to the record.
If they have access, the private record is shown (making it easier to navigate,
edit employee information) and if they don't have access, we show the public
record. In order to allow forcing a relation, it was decided to convert all
employee fields to accept a relation parameter in the options. If this option
is set, we use that as the relation.

This commit also changes the HR views using these widgets, removing the
relation option from fields that would benefit from this dynamic check for the
most suitable relation.

task-3524305

closes odoo/odoo#136786

Related: odoo/enterprise#48008
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-10-12 16:11:59 +00:00
Aaron Bohy daf05d48ac [IMP] *: views: deprecate active_* keys from evalContext
This commit aims to simplify the evaluation context used to
evaluate expressions used in views (invisible, required, readonly,
domain and context attributes). For now, the evaluation context is
typically the current record (there's a key for each field in the
view). In addition to that, there're static keys (that may conflict
with field names): uid, allowed_company_ids, current_company_id,
active_id, active_ids and active_model.

The motivation of this commit is at some point to get rid of the
3 active_* keys, because they are misleading and basically useless.

The notion of active_* exists, but it is something else: when you
are in a form view (let's say the form of a partner) and you open
its opportunities (by clicking on the stat button), the list view
of opportunies shows up and in the context, there're 3 keys
active_*, referring to the record from which we came. One can
easily access those information with context.get("active_*"), in
python or in view archs.

However, almost all `active_id` found in archs were actually used
to refer to the id of the current record. Indeed, for now, in the
evaluation context of a record, the value of the `active_id` key is
always the id of the record. So this commit adapts them to
directly use `id` instead. There was no use of active_ids, and
a single use of active_model which was removed (active_model is
the res_model of the view, so it isn't really necessary).

This commit doesn't drop the support of those keys, it deprecates
them. They will be removed for v18. A warning will be displayed if
they are used.

closes odoo/odoo#136665

Related: odoo/enterprise#47917
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-10-10 00:54:04 +00:00
Abderraouf Ghrissi (abgh) 56073896a6 [IMP] project: merge date_deadline and planned_date_end
Before this commit:
- The existing of two dates behaving as and end date for project_task
(date_deadline and planned_date_end) is confusing.

In this commit:
- The main goal is to simplify the interface by having one field/widget
that acts as both the deadline and the end date, instead of having two separate fields.
So we removed planned_date_end (changes can be seen in the enterprise related pr (link at
the end) and changed the date_deadline type from date to datetime in project_task and
report_project_task_user

Related PRs:
Enterprise: odoo/enterprise#40866

task-3084978

closes odoo/odoo#120953

Related: odoo/upgrade#4654
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-10-06 08:25:14 +00:00
rupa-odoo 206cf98a8a [FIX] hr_timesheet: fix access rights of planned_hours
Before this commit, Even if the user doesn't have access to the timesheet still
user was able to see the "Allocated Hours" in Project tasks. which is part of
the timesheet.

After this commit, if the user doesn't have access to the timesheet then
the user won't be able to see the "Allocated Hours" in Project tasks.

task:3472646

closes odoo/odoo#137135

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-10-03 07:18:57 +00:00
rajh-odoo 9b2ca51df7 [FIX] hr_timesheet: fix project kanban remaining hour field visibility
Description of the issue:
remaining hour field was visible to all users

Desired behavior after PR is merged:
remaining hour will only visible to that user who have timesheet access this
field will invisible if user doesn't have timesheet access

task-3484290

closes odoo/odoo#137082

X-original-commit: e737f0934f8a83cd02a4a79fbf174b95b524a4e7
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-09-29 14:48:17 +00:00
Julien Carion (juca) fadb88b651 [IMP] web, *: display none instead of undefined
This commit changes the default label of the graph view's axis to None
instead of undefined.

task-3519566

closes odoo/odoo#136822

Signed-off-by: Florent Dardenne (dafl) <dafl@odoo.com>
2023-09-28 13:21:01 +00:00
Audric Onockx (auon) 0baaa4b654 [IMP] project,hr_timesheet: improve project update
Add a new column, after tasks that shows the following information :

Tasks: Total done tasks /  Total tasks (ratio in percentage)
Timesheet: Hours spent/ allocated hours (ratio in percentage) 
\> visibility: only show if the timesheet setting is activated.

Right side panel  :

Add the Done icon before Tasks 
Add hours spent/allocated hours information under the Timesheet
Extra time: Add a new stat button that shows
the overall extra time used for the project. 
visible if hours spent > allocated hours.
By clicking on this it will redirect to the same view
as we have for the timesheet stat button.

task-3432102

closes odoo/odoo#129177

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-09-28 07:50:02 +00:00
Thibault Delavallée 8409ebe5fb [FIX] various: update query counters to runbot state
Update (some) query counters according to runbot state.

Also make some tests deterministic when involving company name.

Task-36879 (Mail: Support MultiCompany Aliases)

closes odoo/odoo#135288

Related: odoo/enterprise#47345
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-09-19 16:37:13 +00:00
Valentin Chevalier 054ca0a19a [IMP] web, *: Add more formatters in assets_frontend
Before this commit, formatters like `formatMonetary` and `formatFloat`
weren't loaded in the assets front-end.

This commit introduces `formatAmount` ( `formatMonetary` calls
`formatAmount` but makes some prior processing to deduce the currency
from the field) and makes `formatAmount` and `formatFloat` accessible
from any front-end application.

Note: The currencies were added in the front-end session info because
they are needed in `formatAmount`.

closes odoo/odoo#133824

Related: odoo/enterprise#46658
Signed-off-by: Valentin Chevalier <vcr@odoo.com>
2023-09-06 19:43:39 +00:00
ravb-odoo 0d996dc2c0 [IMP] hr_ timesheet, sale_timesheet: hide 'To invoiced' field and rename some fields
before this commit, when time and material section is visible then 'To invoiced'
field is also visible in portal.

This commit hide the 'To invoiced' field in portal when time and material
section is visible and rename some fields.

closes odoo/odoo#126053

Task: 3251754
Related: odoo/enterprise#42995
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-08-28 16:41:59 +00:00
Gurupreet Singh 60009bccc9 [FIX] hr_timesheet: fix the border color in kanban view remaining hour field
In the Kanban view of the project module, the remaining hour's widget should
have the frame colored orange, while the rest of the widget should have no color

task-

closes odoo/odoo#125526

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-08-24 18:36:44 +02:00
Kartik Chavda a844f37aac [IMP] hr_timesheet,project: refactor 'planned_hours' field
Before this commit 'project.task' model 'planned_hours' field
is inconsistent to the 'allocated_hours' field.

After this commit rename the 'planned_hours' to 'allocated_hours'
and related string change to 'Allocated Time'.

task-3231680

closes odoo/odoo#120405

Related: odoo/upgrade#4617
Related: odoo/enterprise#40643
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-08-24 18:36:33 +02:00
Gorash 774a3fad0e [REF] base,all: Update modifier syntax: view migration
Apply of the migration script to update all view modifiers.

Part-of: odoo/odoo#104741
2023-08-18 09:49:13 +02:00
Pratik Awasthi 496c0a275a [IMP] project: improve the list view by adding personal stage
This will improve the following generic UX

-  rename 'personal user stage' into 'personal stage' for private task
- added the 'personal stage' field to the right of the stage optional=hide
- earlier gantt view open with the user now it will open with groupby  project
- removed groupby stage in pivot view
- rename 'undefined' into 'private' for graph view of private task

task-3251648

closes odoo/odoo#120094

Related: odoo/upgrade#4607
Related: odoo/enterprise#40515
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-08-17 19:50:59 +02:00
adjo-odoo 1ebc6c0044 [IMP] project(_sms),rating,hr_timesheet: improve the UI for project
The purpose of this PR is to improve the generic usage of the project app.

So in this PR done following changes:
 - In reporting > tasks analysis measures:
   - removed the # of tasks and average rating measures
   - Changed rating value (/5) to rating (/5)
 - In task analysis reporting formatted overtime as hh: mm
 - In the project  burndown chart added tip to action helper
 - In project.task search view > quick searches:
   - changed sale order to sales order
   - under the SO one, a 'sales order item' has been added to the quick search
 - Added many2one_avatar_employee widget in project sharing-> timesheets notebook
 - In project.project form view > share editable added text in muted
 - Added tip in the project.project form view > invoicing notebook under
   employee/SOL o2m
 - A placeholder has been added to the rating email template field in the project
   task stages: 'Task: Rating Request'
 - now rating submission page is editable
 - In task stages list view :
   - moved the project field on the right of the name
    - switched the 'SMS template' and 'email template' fields from the place
 - In project.task > recurrence notebook:
   - moved the 'next tasks' list to the right of the recurrence
      configuration fields
 - In project.task > sub-tasks notebook > optional fields >
   renamed 'initially planned hours' into 'allocated hours'
 - In project.task portal form view: renamed
   'history' into 'Message and communication history'
 - Added 'open' filter in my tasks menu search view
 - Added 'schedule an activity' status in the kanban activity widget

task-2903637

closes odoo/odoo#95971

Related: odoo/enterprise#29467
Related: odoo/upgrade#4095
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-08-16 16:04:09 +02:00
Jorge Pinna Puissant e338487028 [REF] *: remove owl="1" from the templates
As all the templates are now imported in the owl app, there is not need
anymore to specify the owl="1" attribute in the templates.

Part of task~3443861

Part-of: odoo/odoo#130467
2023-08-11 14:32:30 +02:00
Yash Vaishnav 86b43bcfa6 [FIX] hr_timesheet: fix task_id field records when creating a timesheet
To reproduce the issue, follow these steps:

1. Install the Timesheet and Project.
2. From the settings menu, create a new company.
3. Create a project using the newly created company(e.g. New Company) and add
   a task to it.
4. Open the Timesheet application and create a new timesheet.
5. In the timesheet, select the project created in step 3, and observe that the
dropdown for tasks does not display any task.

Cause for this issue:
-The timesheet application has a domain set for the task field where the company
associated with the task_id should be the same as the company selected in the
current environment.
-However, when a new project is created with a 'New Company', the tasks
associated with it also have the  'New Company' assigned to them. On the other
hand, the current environment has a default company called 'Your Company'
associated with it.
-Therefore, due to this domain setting, the task field does
not display any tasks since there are no tasks associated with the
'Your Company' in the current environment.

Fix:
Since the cause of the issue is related to the company domain set in the task
field, we can solve it by removing it from the domain.

task-3323027

closes odoo/odoo#131197

X-original-commit: 7b9f9a1323ecaeab2b248784e1493b39fe07b8f1
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-08-09 03:08:14 +02:00
pash-odoo 0a4e2fbcd2 [REM] hr_timesheet: remove access rule for group_hr_timesheet_user
Before this commit, access rule for group_hr_timesheet_user is define for
read and write permission for task which allow internal user to edit task if
link is provided even if user have no access.

In this commit, we have remove access rule for group_hr_timesheet_user because
it is not required anymore since read access is already given to internal user
which does not allow user to edit task if user have no access.

task-3354831

closes odoo/odoo#130807

Related: odoo/upgrade#5020
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-08-07 19:57:47 +02:00
hiroh-odoo a8bfdf8df2 [IMP] hr_timesheet,project,*: improve task analysis and list view
*=sale_timesheet.

In this commit improve following UI in task analysis and list view,

- aggregate the sum of following fields in project.task list view, hours spent
  on sub-tasks, total hours, progress.
- in project.task list view move 'id' after the 'state'.
- from task analysis remove the measure 'remaining hours percentage'
  from graph and pivot view.

task-3330295

closes odoo/odoo#124396

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-08-02 17:29:00 +02:00
Damien Bouvy 4e08fe09c8 [FIX] *_timesheet: adapt timesheet report
X-original-commit: ce7df0df6dd41174623fc15552d1faa07b4f9159
Part-of: odoo/odoo#129492
2023-07-25 00:54:54 +02:00
Damien Bouvy f7cf89d914 [IMP] hr_timesheet: adapt reports to studio report editor
Includes several modifications to better work with the new editor:
- add placeholders on t-field/t-out nodes
- add several div.oe_structure containers in key places for easier user
  edition
- add branching options for several t-if directives without a t-else to
  display for users (e.g. displaying the payment QR code if the value is
  set vs. when the value is not set). These branching options are set to a
  default value (the t-if node) which is what users see by default in the
  report editor; the t-else node is a version they can manually toggle if
  they wish)
- avoiding 'naked' t nodes as child of table/thead/tbody/tr elements, as
  these break the table layout in chomium-based engines (that we know of);
  instead, try to have foreach loops on tr or td nodes directly, or hoist
  t-set directives above the table node
- replace several div or p (block) nodes by span or other inline nodes
  to make it easier for users to insert content in their vicinity

X-original-commit: eabdfe294d38df463828f87970b25d52ceae4a6a
Part-of: odoo/odoo#129492
2023-07-25 00:54:53 +02:00
Audric Onockx (auon) fb88a7448c [IMP] project,_*: allow all project features on tasks w/o project
_*: hr_timesheet,sale_project,sale_timesheet
Generally, you don't want subtasks to be displayed at the same level
as their parent tasks. You want to consider the subtasks as part of
their parent's project, but don't want to see them directly in this
project. Rather, you want them to be accessible only via their parent.
(There are exceptions to that and we want to stay flexible.)

First solution that comes to mind is to have `project_id` set to False
for the latter tasks, but then how to get the value of the fields that
are related to the project?

So, second solution would be to have a field `project_root_id`,
which would be the project of the parent, or the grand-parent, etc.
The issue now is that we have to fields "project", and it isn't obvious
when to use one or the other.

The most simple way to answer this need is to keep one field "project",
that will always be set for (non-private) tasks,
and create a boolean field : `display_in_project`.
But we want it to be technical (no checkbox in the view).
So, when the user unsets the project on a subtask, the view will act
as if the project was unset, but in the back-end,
we'll set `display_in_project` to False and set `project_id` back.

The fact that all tasks have a project allows us to know if action x
can be perform on this task t, dependind on t.project_id.allow_x.

task-3367246

closes odoo/odoo#128281

Related: odoo/enterprise#43996
Related: odoo/upgrade#4930
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-07-20 13:06:46 +02:00
damr 16a07ed1bf [IMP] project: make the field company_id of projects non required
This commit's purpose is to allow the user to set the company_id of a project to False, meaning the project is no longer restricted for the user who does not have access to the company of the project. This change induces a lot of other small behavior changes/approximation. Since some fields (currency_id, resource_calendar_id, etc) were company dependent, we had to updates some use cases.

task-3084819

closes odoo/odoo#122144

Related: odoo/enterprise#41363
Related: odoo/upgrade#4947
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-07-19 23:17:53 +02:00
Julien Carion (juca) 6c412be2ea [IMP] *: coherent hotkey uses
This commit makes hotkey uses more coherent throughout the entire
codebase by setting alt+q as main shortcurt for confirm and default
actions and alt+x for cancel actions.

task-3370463

closes odoo/odoo#127469

Related: odoo/enterprise#43694
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-07-19 18:24:15 +02:00
Xavier-Do 595aa24843 [IMP] registry: multiple ormcache
One of the main issue with ormcache is that the invalidation clears
everything, meaning that some value, slow to compute but with a long
lifetime, can be removed from the cache because an easy to invalidate
value is cleared, like after writting or creating a product has an
example.

Most example in the code will try to invalidate the cache of the models
doing something like `env['ir.qweb'].clear_caches()` but it is
finally equivalent to `env.registry.clear_cache()`, and cross worker.

The idea is to have multiple cache, maybe with specific sizes for a
specific purpose.

Having one per model is maybe a bad idea because it will be difficult
to size the LRU correcly, and it is too dynamic. Checking invalidation
may be expensive.

The proposed solution is closed allow a limited number of named caches,
using onse sequence per cache. This is actually close to the
cache_longterm.

We want to discourage using a specific cache for one use case in
the buisness code. Adding a cache shouldn't be something easy, doable
in stable.

Note that we could also change the invalisation mecanism using an
insert only table. We an check the sequence of this table, but also
fetch all invalidation messages.
Another possible improvement, especially if we have more than x cache is
to have a global sequence, checking signaling would mean to check the
main sequence, and only the other ones if the main one changed.

Note that this poc is inspired from the long term cache but not all
use case where applie yet.

Part-of: odoo/odoo#119813
2023-07-18 11:42:26 +02:00
Audric Onockx (auon) 69d6715491 [REF] project,hr_timesheet: reorganize project/src/js files
task-3300649

closes odoo/odoo#120668

Related: odoo/enterprise#40774
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-07-14 15:34:35 +02:00
FrancoisGe 42e5e247bf [FIX] web: m2o must only use the context of the field
From commit 2ecfed335d, clicking on the arrow of a m2o opens the
record in form view and passes it the context of the current view.
After this commit, only the context defined on the <field> is passed.

Problem:
An example of a problem, is the use of an incorrect active_id in the
second view that is passed through the first form view to the second.
Previously, the active_id of a form view was always the id of the record
and not that of the previous view. This behaviour is debatable, but it
leads to major changes. We therefore prefer to revert to the old behaviour
and no longer pass the entire context in order to avoid this problem.

How to reproduce:
- Go to a form view with a m2o
- Click on the arrow of the m2o

Before this commit:
    The view context contains all the context from the first form
    view and the second.

After this commit:
    The view context contains the context of the m2o field and the second view.

closes odoo/odoo#127538

Taskid: 3394945
X-original-commit: a9bec1fec3ff08461732ef2717457524339eb716
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-07-12 16:52:54 +02:00
Xavier ALT 4978894a1b [FIX] hr_timesheet: fix access error on 'all timesheets' list view
After odoo/odoo@ad40298a9, when a user having access to timesheet app
but not to accounting app tries to see his timesheet in list view, and
some lines have been invoiced manually, an access error is raised.

This commit ensure that user can compute `readonly_timesheet` even when
user has no accounting access.

opw-3415661

closes odoo/odoo#127996

X-original-commit: 8f224acaac2d3c67d06284726a75194c9dc20a28
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-07-10 23:43:41 +02:00
prye-odoo 7694f012cd [FIX] *: handle unlink/create access for reporting views
*: account,event_sale,fleet,hr_attendance,hr_contract,hr_timesheet,
im_livechat,point_of_sale,project

When the user tries to delete a record(s) from the reporting views,  this
traceback will be generated.

Steps to produce (Example only):

- Settings > Technical > Actions > Window Actions
- Search for the Work Entries Analysis. Open it and add a 'tree' as view_mode
in that action.
- Payroll > Reporting > Work Entries Analysis menu and select the tree view.
- Select one or more records and try to delete these records.

Error: A traceback appears: "cannot delete from view "hr_work_entry_report"

Handled the unlink access by using their model access of the reporting models.
similarly, this issue resolves in other reporting models.

Sentry-3975590063

closes odoo/odoo#125697

X-original-commit: 209d8c76ce9bb1d6cc7084d55b5623e939af8fbc
Related: odoo/enterprise#42825
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2023-07-03 21:55:48 +02:00
Rémy Voet (ryv) c5cb357d90 [IMP] *: add dependencies to display_name field
The previous commit introduced an optimization to reduce the number of
queries and fields fetched when we call `name_search`. But it works much
better when the dependencies of `display_name` contain field names used
in the calculation (on the same record/model).

Then, to improve the performance and the cache coherency, add `depends`
and `depends_context` depending on the custom `_compute_display_name`.
Add only the first level of dependencies (never traverse relational
field) because only these have a positive impact on the previous
optimization and the cost is very low (see `modified`).
About `depends_context`, we don't include `lang` because (when `_` is
used by example) it is unlikely to get the same display_name in the same
request with two different lang.

closes odoo/odoo#122085

Related: odoo/documentation#4639
Related: odoo/enterprise#42599
Related: odoo/upgrade#4780
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-06-28 17:41:19 +02:00
Rémy Voet (ryv) 3c62ca1eb9 [REM] core: remove name_get API
Rationale
=========

Since v8, the `display_name` field is present on all models. By default,
`display_name` uses `name_get` which has pretty much the same purpose
(return record name used by the web client). Gradually, many (backend)
developers (and the ORM: https://github.com/odoo/odoo/commit/6da1c3ac4c036eac289597602976538e243cb939)
started using `display_name` (more convenient than
`record.name_get()[0][1]`) but it still had the `name_get` override.
It becomes more complex than necessary and poeple start to misunderstand
the two (and sometimes override both, leading to inconstiencies between
`display_name`/`name_get`).

To simplify the ORM and the API, we decided to keep only one of them,
the `display_name` field:
- It is much more convenient from a backend point of view
(`record.name_get()[0][1]` vs `record.display_name`)
- It is cached during the same transaction (and invalidated if
its dependencies change)
- It can be overridden like any other compute field (override
`_compute_display_name` with any extra dependencies)
- `name_get` is replaced by `read(['display_name'])`
(API perceptive), which can actually be more efficient
(if `display_name`'s depends are correct, the ORM will only fetch the
fields it needs instead of every prefetchable field)

Changes
=======

- Deprecates `name_get` for the v17 and based the method on
`display_name` (the opposite of before)
- Converts all usage of `name_get`
- Overrides of `name_get` are now overrides of `_compute_display_name`
- For `res.partner`, rename the field store `display_name` into
`complete_name` because `display_name` context-dependent and it makes
no sense to have a compute store that is context-dependent.
- Previously, it was possible to return multiple names for the same
record with `name_get`, but it was tricky and most of the usage of
this `name_get` didn't take this into account. The only example of
this is the `name_get` of `product.product`
(now use `", ".join(<names>)`).

Part-of: odoo/odoo#122085
2023-06-28 17:41:19 +02:00
Yashkumar Vaishnav 9b26dc6018 [FIX] project,hr_timesheet: fix kanban view structure issue in project task
before this commit, The Kanban view for project tasks includes a subtask button,
a remaining hour timer, an activity button, and assignees in its lower section.
However, when the task has subtasks and timesheet entries, these buttons appear
in the Kanban view, causing the view to lose its structure somewhat.

This commit includes reducing the right margin of the activity button and
remaining hours to provide enough space for other elements in the kanban view.
Additionally, the Lock Icon for private tasks has been given a left margin to
separate it from the activity button

task-3289941

closes odoo/odoo#126446

X-original-commit: eff472e39642bb29e5d4615fcfe1255c00ffc5ef
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-06-26 22:15:51 +02:00