Commit Graph
45 Commits
Author SHA1 Message Date
Raphael Collet 6cf8db906f [REF] *: adapt code to new flush API
closes odoo/odoo#87527

Related: odoo/upgrade#3497
Related: odoo/enterprise#26939
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-05-25 18:00:47 +02:00
Prakash Prajapati f1e3615eca [IMP] project: check email in stage is sent when project is in that stage
This commit adds a test to check the email is correctly sent when the email
is linked to a project stage and a project arrives in that stage.

task-2723662

Part-of: odoo/odoo#88889
2022-05-20 10:56:46 +02:00
Prakash Prajapati a7cd11612b [IMP] project: improve the my tasks/private flow test
tasks assigned to the current user should be in the 'inbox' stage by default.
tasks with no project set should only be visible to the users assigned to them.

task-2723662

Part-of: odoo/odoo#88889
2022-05-20 10:56:45 +02:00
Xavier BOL (xbo) 790cc8698a [IMP] rating,project: use the average of rating value for satisfaction
Beforer this commit, we display a emoji to show if the customer is
satisfied, okay or not for the task via the last rating value. The
problem is we use only the value for the last rating for each task.

This commit uses all ratings for each by using the average of rating
value for each task to know if all the customers that done a rating are
satisfied or not.
Moreover, we add 4 filters in the project.task model using the average
of rating values.

1. Satisfied => rating_avg >= 3.66
2. Okay => 2.33 >= rating_avg < 3.66
3. Dissatisfied => rating_avg < 2.33
4. No rating => show the tasks without any ratings.

task-2671848

Closes #81027
2022-01-05 13:58:01 +01: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
William Braeckman 7563b448da [IMP] project: add personal task stages and multiple assignments
Adds personal stages to tasks.
Users assigned to tasks will be able to have their own pipeline to
handle their tasks independently of the project's pipeline.

The assignee field on Tasks has also been changed to a Many2many to
support multiple assignees on one task.

The same table is used to store those information, essentially a triplet
(task, user, stage), to ensure that:
1) personal stages only apply to tasks to which you are assigned to.
2) synchronizing to make sure that you don't have a personal stage for a
   task on which you are not assigned anymore.

Alongside those changes, some minor changes have also been made:
- Modified the task's tree view.
- Renamed the Tasks menu to 'My Tasks'.
- The default view is now the kanban view for the 'My Tasks' action.
- project_id is not required anymore, tasks with no project are
  considered 'private', those tasks are only visible to those that are
  assigned to it.
- Added tracking of both user_ids and depend_on_ids in the chatter.

Closes odoo/odoo#74087

Task ID: 2398734
2021-09-01 07:17:40 +00:00
Yannick TivisseandXavier BOL 29bdb04421 [IMP] project: Improve task's partner_id management
Purpose
=======

During the development of the task #2169100, it appeared that the synchronisation
of a task's partner_id according to its project's partner_id and its parent's
partner_id was not very clear.

A first idea was to simplify the partner_id management: as it could be annoying
for the customer to see all the task's partner_id overriden after project's
partner_id modification, the idea was to just use the parent's parnter_id or the
project's partner_id as default value of the task's partner_id. Then, if the
partner_id of the project or of the parent is changed, there is no more impact
on the task partner_id itself.

The main problem of this solution is that the management of the task's partner_id
is also extended in several others modules like sale_project and sale_timesheet.

You can find below what seems to happen with all these task partners.

Start following rules according to which module is installed.
(for the record: sale_timesheet depends on sale_project which depends on project).

Rules are applied in the order they are written.

Rules labelled "O" only apply when changing the project through the task form view.
Rules labelled "C" apply everywhere.

technical: C=compute, O=onchange

project
C.1 If parent's partner changes and the partner is not set, then set the parent's
    partner
C.2 Else if project's partner changes ant the partner is not set, then set the
    project's partner

sale_project [+ project]
C.1 If the project's sale order line's partner changes and the partner is not set,
    then set the project's sale order line's partner
C.2 Else apply (project.C) rules

sale_timesheet + [sale_project + project]
C.1 Apply (sale_project.C) rules
O.1 If the project is billed "At Project rate" or "At Employee Rate" and the
    partner is not set, then set the project's sale order's partner
    the sale order line's partner

Specification
=============

- If the partner changes, we ignore all current tasks and let them be. We set the
  new partner as default value on all new tasks. In detail, we have done
  this:
    - When the user creates a task give the customer of the default project or the
      task parent as default customer for the task.
    - When the user changes the project and no partner in the task, we take the
      partner of the new project (if this project has a customer).
    - When the user changes the customer of the project, the linked tasks are not
      impacted by this changes, even if some tasks have not a customer yet.
    - When the user changes the customerf of the parent task, the child tasks are
      not impacted by this changes, event if these tasks have not a customer yet.
- remove the onchange rule to remain consistent.

TaskID: 2232042

closes #51471

Co-authored-by: Xavier BOL (xbo) <xbo@odoo.com>
2021-05-20 13:32:18 +02:00
Thibault Libioulle bc86a101a8 [IMP] project: add tests for subtasks
This commit adds tests concerning PR #62577.

Tests also address errors in PR #68647 and #69170.

PR #70576

task-2388034
task-2522066

X-original-commit: b76e277f03c881ce6fd4d92fc8c8fb3e0ab704ea
2021-05-19 11:31:17 +00:00
ram c89e6587a9 [IMP] rating: update stored rating keys
Purpose is to lessen used storage space by shortening rating keys. See related
branches for more details.

Task ID-2439720
COM PR odoo/odoo#66992
ENT PR odoo/enterprise#16757
UPG PR odoo/upgrade#2302

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-04-26 14:10:20 +00:00
ram ddf7195ae3 [IMP] rating, project, im_livechat: improve handling of ratings
RATING

Rating texts currently have a negative skewness. Indeed apart top rating
all ratings have a negative feeling. In this commit we update them
to match more closely a 1-5 range from dissatisfied to satisfied, ok being
the middle value.

PROJECT

Filter customer rating were taking in account ratings from first e-mail
instead of current satisfaction.

IM LIVECHAT

Livechat did not catch feedbacks without comment.

Task ID-2439720
COM PR odoo/odoo#66992
ENT PR odoo/enterprise#16757
2021-04-26 14:10:20 +00:00
Thibault Libioulle 8bbf0e9e64 [IMP] project*: improve sub tasks workflow
We want to ease user experience regarding sub task creation and
management. We thus enforce the values of subtask stage, project and
parent task. we want to remove the ability of a user to choose a
third-party subtask project different than the actual one. Also, we want
to remove the ability to make one sub task recurrent. In general, We
want to improve and strengthen the relation parent-childs for Tasks. A
sub task is dependant of its parent all along the workflow.

This commit address those needs and, especially, removes the subtask
project configuration discussed in :
- odoo/odoo@66a0e5a
- odoo/odoo@b709e22

1) With this commit we want to change the way to link a subtask with its
project	for UI reasons, we want to be able to easily distinguish
subtasks that are linked to the project of their parent from subtasks
that are linked to another project. To do so, the idea is to create a
field display_project_id not required. Only relevant tasks are linked
to their project through this display_project_id, the other are linked
to their project only via project_id. As a result, domains in the
application are only based on the fact that tasks have
display_project_id. The other are simply hidden.

2) The number of subtasks is shown on kanban and list views with a
   wigdet to easily render it and extend the UI.

3) The default sub-task assignee is the assignee of the parent task.

4) Task form is modified to integrate those changes.

5) Various searches on project task are restricted with a clause where
display_project_id must be not null. Except in portal, in which context
we always display all tasks and subtasks.

PR community: #62577
PR enterprise: odoo/enterprise#15043
PR upgrade: odoo/upgrade#1984

task-2388034

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-03-26 13:51:39 +00:00
Martin Trigaux c59c10f1bc [FIX] *: correct typos and bad English
Courtesy of translators
Reexport .pot of modified modules

closes odoo/odoo#61010

X-original-commit: 62a18bdb372e234107fd2099a2df5f9e3a442c96
Related: odoo/enterprise#14489
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-10-29 19:23:41 +00:00
Rémy Baranx (bar) 972e097dbe [IMP] project: convert onchange to stored-editable computed fields.
The 'stage_id' field is now a stored-editable computed field.

The 'company_id' has been converted to a stored-editable computed field.

The modification of the 'partner_id' field in the onchange method has been
moved and merged into the _compute_partner_id method.

Remove the empty 'onchange' method from the project.task model and also remove
this method call from the sale_timesheet module, which inherits from the project.task model.

Adapt the _compute_partner_id to retrieve exactly the behaviour before the onchange
method deletion.

Update code and tests of the task/subtask partner_id management after discussion with Alexandra to clarify the behavior.

Add the 'multi_edit' attribute to tree views.
2020-06-23 08:57:08 +00:00
Benjamin Frantzen (bfr) e4a4ffb974 [IMP] customer ratings flow improvements
- Rename the 'Use Rating on Project' feature into 'Customer Ratings'
- Rename the 'Set Email Template to Stages' link to 'Set a Rating Email Template on Stages'
- Add an optional list view for the Stages menu
- display warning if the rating_template_id field is set and if one of the selected project_ids doesn't have the rating_status field set to true
- Project form view revamp
- rename the '% on tasks' stat button into 'Customer Satisfaction'
- Remove the 'no option' for the rating frequency field because it is required
- project form : Add a 'Go to Website' stat button
- Project dashboard: remove the 'Customer Ratings' menu item in more
- Ratings page: the 'Last 30 days' filter include ratings from today
- remove the Appointment / Helpdesk Customer Satisfaction / Live Support menu items

TASK ID : 1251
2020-05-08 12:17:20 +00:00
ryv-odoo c7a1a2d964 [REF] rating, various: improve rating.rating ACLs
PURPOSE

Rating model should be available only for internal users. External users
access them only through dedicated routes or controllers using sudo and/or
granting access through tokens. Therefore simplifying ACLs should be feasible.

SPECIFICATIONS

Remove access to rating.rating for public and portal users. Only employees
can access it, with full access given to system admins.

Update various functional flows to use sudo() and check that access is
verified before using sudo.

Impacted modules

  * rating / mail: add groups on some rating related fields as only
    internal users should access them now;
  * rating / mail: set some statistics fields using compute_sudo as their
    value should be accessible for external people even without access to
    the underlying rating.rating records;
  * project: makes some use of rating and has to be updated, notably for
    the public rating page;
  * website_{livechat, rating, slides}: add sudo in public routes as access
    is already granted;
  * website_slides: set statistics field using compute_sudo as their
    value should be accessible for external people;

TASK ID 2053096
PR #36592

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-11-19 15:46:51 +00:00
Yannick Tivisse bae2d9f717 [IMP] crm, product, ...: Clean some common test classes 2019-11-12 11:34:36 +00:00
Raphael Collet b7fd679a6c [FIX] *: sudo() -> with_user() 2019-07-04 11:32:22 +00:00
XavierDo 92e9e84b63 [IMP] mail, *: don't track fields at create
*: project, crm, maintenance, helpdesk,

It is useless to track fields during create since they
have no initial value and future tracking message will
show changes on tracked field.

We can log a default creation message instead
(as it is now if there is no mail_create_nolog context key)

This change will implies
- less queries when creating record
- cleaner creation messages
- less occurence of mail_create_nolog ctx key

Removing tracking at create could break the creation subtypes
mechanism (example: following task creation subtype on project)
Instead of using _track_subtype to give a subtype at create,
a new _creation_subtype method can be override. If a creation
subtype is set on a specific modlel, creation messages will be
create by message_post instead of _message_log.

We also need to adapt the message_track_post_template in order to
keep this feature whithout tracking.

Task: #1916916

closes odoo/odoo#31945

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-03-29 15:28:43 +00:00
jem-odoo 52e2ec2ef9 [IMP] project: make project use rating parent mixin
No functionnal changes are done in this commit. Everything
stays the same, but use the parent mixin mecanism.

Task-1903565
2018-12-04 12:48:19 +00:00
jem-odoo 47479401cb [IMP] rating: introduce the parent mixin
When creating a task, the satisfaction of the project is recomputed even
if the task has not rating. This can lead to performance issue:
concurrency error in Postgresql can happen if a task is created when
somebody else tries to update the project.
The satisfaction recomputation will give and concurrency error whereas
it will return the same satisfaction percentage, since the task has no
rating.  The same problem will happens in every modules implementing
the rating feature: project, helpdesk and livechat.

This problem leads us to create the rating.parent.mixin in order to
retrigger the computation only when a new rating appears on the
parent object. We also unstore the field to make its computation lazy.
Maybe in a near future, this field will be computed in SQL directly.
The parent mixin allow us to standardize the behavior to all parent
rating models.
These optimizations should reduce the number of computation and speed
up the task creation.

opw-1902502
Task-1903565
2018-12-04 12:48:13 +00:00
Thibault Delavallée b227f6e759 [REM] project: remove assigned subtype and keep only classic tracking
Since e9734f4975 assignation is now a notification sent in the
inbox or by email to the newly-assigned responsible. It is therefore
considered as not necessary to link a subtype to the assignation itself.
Indeed having it logged in the discussion history as a classic tracking
in addition to the notification is considered as sufficient.

In project module the task opened subtype was linked to task creation and
task assignation. This subtype is now used only for task creation. It also
fixes a strange behavior. Changing assigned user in an ongoing task was
trigerring the task opened subtype which was strange. This is not the case
anymore.

This commit is related to task ID 60790. Closes #23244 .
2018-03-20 13:55:52 +01:00
RomainLibert 12b580c953 [IMP] rating: Parent document name update
For objects inherting from rating.mixin, when their parent model change
(e.i.: task from a project to another), the "Parent document name" does
not change. The rating is still considered belonging to the old parent
object (rating stat of project is not correct).

Change the rating API. In rating mixin, instead of having 2 methods
returning parent id and parent model (rating_get_parent_id and
rating_get_parent_model_name), we should have one method returning the
'parent relation field' (inevitably m2o field). Then we can deduce its
parent_res_id/parent_res_model, and check this parent field is in values
of write to trigger the recompute of parent_res_name.

Also, add "ondelete=cascade" on parent_res_model_id

Impacted modules: project, rating, helpdesk, livechat
2018-02-23 16:13:03 +01:00
Akash Bhavsar 66a0e5a541 [IMP] project: drop project substask constraint
This commit improves subtask mecanism, on several points:
1) Drop the project constraint: before this commit, creating
subtask in non parent project was not possible. Now you can move
subtask to any project.
The default project of a subtask is the one from the parent.
2) When setting a parent task, we want to force some field to have
the same value as its parent, like `partner_id` or the `sale_line_id`.
The idea is here, we work for the same client; a subtask count for the
same goal (SO line or customer). Those fields should be readonly on the
view.
3) Refactor some methods

Task: 38498
2018-01-17 09:34:11 +01:00
Yannick Tivisse 642e6a5314 [IMP] project: Remove default author when going through the mail gateway 2017-08-07 12:15:38 +02:00
Raphael Collet 0783318f97 [FIX] adapt logger names 2016-09-02 17:28:13 +02:00
Ravi Gohil f077a6c7bd [IMP] project: replaced except_orm by AccessError in tests
Comments were referring to Warning rather than AccessError but:
- Warning is deprecated
- The functions that are tested actually raise AccessError
2016-06-30 14:41:22 +02:00
Adrien Dieudonne 9b69184ffa [REM] project: remove state field on project.project
Also remove unused method _generate_task()
2016-06-16 14:59:40 +02:00
Yannick Tivisse e87144b255 [IMP] project: improve tests to consider a task created in a project with and without stages 2015-09-03 13:11:19 +02:00
Raphael Collet ec181361f0 [IMP] project, project_issue: discard project templates 2015-09-02 14:29:42 +02:00
Thibault Delavallée e6f038a821 [REF] mail: mail_thread: followers update
Followers can now be partners or channels. Partners following a document
will receive needaction, as previously. However people can follow documents
through channels. Members of a channel are able to listen to a stream
of messages using the channel. Those messages do not create needaction
messages. It is therefore possible to follow documents without receiving
too much notifications. For interesting documents subscribing with its
partner will create notification.

message_follower_ids fields is udpated. It is now a many2many to
mail.followers, not to res.partner anymore. A subscription can be either
a partner (partner_id) or a channel (channel_id).

Some access rules have been updated accordingly.
2015-08-21 12:11:56 +02:00
Thibault Delavallée f1099a6598 [REM] resource, project: removed faces library and its related
code in resource and project.

This library was once used to perfom resource allocation: scheduling
tasks and things like that. However this feature cannot be accessed
through the interface since a long time.

The feature is now removed from the project code. The library has been
removed. Some code in resource used only in the project code
has also been removed, as well as a test linked to this code.
2015-07-28 12:36:00 +02:00
Yannick Tivisse e485b6c5ee [IMP] Project : remove task delegation
Conflicts:
	addons/project/wizard/project_task_delegate.py
2015-07-08 15:39:02 +02:00
Christophe Simonis a304194936 [MERGE] forward port of branch saas-6 up to 81b5c60 2015-06-25 00:26:31 +02:00
Christophe Simonis 704a11ddee [MERGE] forward port of branch 8.0 up to b8bf1e0 2015-06-24 12:45:14 +02:00
Xavier Morel 11ba4689b1 [IMP] running speed of some tests & new testcase type
Some tests (e.g. mail) have expensive and significant DB setup for a
number of small and cheap tests. Using a TransactionCase, the DB setup
far dominates the tests themselves, by up to 10x (mail unit tests take
~130s on my machine, the tests themselves take ~15s).

The SavepointCase introduced here is an hybrid of SingleTransactionCase
and TransactionCase: it uses a single transaction for all tests in a
class, but each test case is isolated by a rollbacked savepoint. This
allows a common DB setup (via setUpClass) while keeping independent
tests.

TransactionCase should remain the primary test case superclass, but
SavepointCase can be a fair optimisation when setup costs far dominate.
2015-06-23 16:38:14 +02:00
Olivier Dony 0bd4545348 [LEGAL] Use global LICENSE/COPYRIGHT files, remove boilerplate text
- Preserved explicit 3rd-party copyright notices
- Explicit boilerplate should not be necessary - copyright law applies
  automatically in all countries thanks to Berne Convention + WTO rules,
  and a reference to the applicable license is clear enough.
2015-06-02 03:16:04 +02:00
Pariket Trivedi 2b61f6f6b3 [IMP] project,project_issue,portal_project: code cleaning
- remove unnecessary copy() method from project/res_partner.py
- remove old methods on project.project
- progress is not used anymore on project.project
- use clickable statusbar for project states
- remove _resolve_project_id_from_context
- rename project.category becomes project.tag to be more explicit
- remove old methods on tasks
- issues: remove option fetchmail_issue
2015-05-12 16:31:43 +02:00
Jignesh Rathod b55969a577 [REF] mail: migrated tests to the new API and refactored them.
Tests have been migrated to the new api to prepare the migration of the
mail module itself. Moreover tests have been cleaned: redundant tests
and unnecessary tests have been removed.

As the base test class in mail is used in other addons, other addons
have been updated :
- portal
- project
- portal_project
- website_project_issue
- sale
- purchase

Future commits will come with somes fixes for issues detected when cleaning
the tests.
2015-03-24 10:18:16 +01:00
Thibault Delavallée d4e9640e34 [REF] mail: _track update.
_track is now a method that returns the subtype to trigger in a given
tracking context. A tracking will now lead to only one subtype
being trigerred, instead of having multiple possible subtypes.

Now, one tracking leads to one message with one subtype, or without subtype
if there is none matching. This simplifies the model for future evolution of
chatter and mail.

[IMP] project, project_issue: cleaned task and issue subtypes, now having
opened for created / assigned.
2015-02-24 16:28:51 +01:00
Dikshit Prajapati 2aed2108fa [IMP] project : mailgateway: add to and cc as followers of the newly created task 2014-08-04 14:44:42 +02:00
Raphael Collet cbe2dbb672 [MERGE] new v8 api by rco
A squashed merge is required as the conversion of the apiculture branch from
bzr to git was not correctly done. The git history contains irrelevant blobs
and commits. This branch brings a lot of changes and fixes, too many to list
exhaustively.

- New orm api, objects are now used instead of ids
- Environements to encapsulates cr uid context while maintaining backward compatibility
- Field compute attribute is a new object oriented way to define function fields
- Shared browse record cache
- New onchange protocol
- Optional copy flag on fields
- Documentation update
- Dead code cleanup
- Lots of fixes
2014-07-06 17:05:41 +02:00
Thibault Delavallée ef8322273e [FIX] [TESTS] project, hr_holidays and portal-related modules: fixed tests, because the raised errors have been updated
bzr revid: tde@openerp.com-20131206125751-lx5ki1nz10pdo63r
2013-12-06 13:57:51 +01:00
Thibault Delavallée 98ec74dd62 [IMP] project_issue: added date_last_stage_update in reports; removed month_last_stgae_update in project_task, only date is sufficient because reports already handle this correctly. Updated coding style of tests.
bzr revid: tde@openerp.com-20130710132954-tnr75cf33nti8r1u
2013-07-10 15:29:54 +02:00
Thibault Delavallée 4b0baa3615 [CLEAN] project, project_issue, project_mrp: misc cleaning of code + fixed bug in project_mrp + re-added commentred tests in project_mrp
bzr revid: tde@openerp.com-20130710122526-tf87avul7huqgigg
2013-07-10 14:25:26 +02:00
Thibault Delavallée 9b41f8fadc [TESTS] project: refactored tests. Moved surviving yml tests into unittest; added mailgateway test.
bzr revid: tde@openerp.com-20130710101508-62eh89gzq22qvpq5
2013-07-10 12:15:08 +02:00