Commit Graph
103 Commits
Author SHA1 Message Date
Xavier BOL (xbo) b08dea5aad [IMP] rating,project: display rating text based on the average rating
This commit adds a rating text field called `rating_avg_text` to display
a text based on the value of `rating_avg` field in `rating.mixin` model.
Here is the text displayed based on the value of `rating_avg`:

1. 'Satisfied' if the `rating_avg >= 3.66`
2. 'Okay' if the `2.33 <= rating_avg < 3.66`
3. 'Dissatisfied' if the `1 <= rating_avg < 2.33`
4. 'No Rating' if the `rating_avg < 1`
2022-01-05 13:58:01 +01:00
Xavier BOL (xbo) 1ae732c21f [IMP] project: use the rating average instead of customer satisfaction
Before this commit, we use the `rating_percentage_satisfaction` field to display
the customer satisfaction of the project. The problem is this field is
not really a rating average. This field returns the percentage of
satisfied ratings over the total number of ratings.

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

task-2671848

Closes #81027
2022-01-05 13:58:01 +01:00
Xavier BOL (xbo) 89f4370043 [IMP] rating,project: add average ratings field in parent rating mixin
Before this commit, we don't have any filters to the models using the
parent.rating.mixin to know if the customers are globally satisfied or
not to the projects for instance.

This commit adds the `rating_avg` field to compute the average of all
ratings linked to the parent model (in our example, `project.project`
model). This field is also used in the project search view to add 3
filters.

1. satisfied: projects with an average customer satisfaction between 66%
and 100%.
2. okay: projects with an average customer satisfaction between 33% and
65%.
3. dissatisfied: projects with an average customer satisfaction between
0% and 32%.

Another filter is added to find all projects without any ratings linked,
called `No Rating`.

task-2671848

Closes #81027
2022-01-05 13:58:01 +01: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
Nidhi Patel 16f63fa55b [IMP] project, rating: add rating field to task tree and search view
In this commit, we add the 'rating' field to the list view of 'project.task'.
Also, make the field optional and hidden by default.

rating_text field will be used to search tasks and tickets by rating text.

closes #78973
task-2667754

Related: odoo/upgrade#3031
Related: odoo/enterprise#21880
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2021-12-16 08:10:08 +00:00
Vincent Larcin d832a04c68 [FIX] rating: fix chatter rating image alt description
When a rating is posted in the chatter, the alt text for the image is displayed as a score out of 10.
However, the maximum score a rating can have is 5.

This commit changes the alt text to display a score out of 5 instead.

closes odoo/odoo#80753

X-original-commit: 42848c6c3d17de59adb85bf6622f629809cb37c4
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2021-12-02 13:43:14 +00:00
Thibault Delavallée f9dbd38720 [IMP] mail, various: rename custom_layout / notif_layout context usage
RATIONALE

Currently we can specify email used for notification layouting through context
use in mail composer. It is then propagated to message_post, stored on
mail.message and used to encapsulate emails sent based on posted messages.

SPECIFICATIONS

On template model: rename ``notif_layout`` parameter of ``send_mail`` to
``email_layout_xmlid`` to be coherent with naming used in other parts of the
code. Moreover it better indicates we expect an xml id.

On rating model: rename ``notif_layout`` parameter of ``rating_send_request``
to ``email_layout_xmlid``, for the same reasons as above.

In various wizards: support ``email_layout_xmlid`` context key when no field
is available, notably because this is still done manually in some wizards
like survey invite. Keep a fallback on ``notif_layout`` but remove support of
``custom_layout`` deprecated since quite a long time.

Task-2621326 (Mail: add 'view' button in 'light notification template')
Task-2647302 (Mail: add layout field in composer)

Part-of: odoo/odoo#76418
2021-11-10 09:58:09 +00:00
William Braeckman 3d10c7c708 [IMP] project,*: improve project UX
* = hr_timesheet, sale_project, test_main_flows

Smaller changes:
 - Projects created on the fly (through `name_create`) will now come with a
   default `new` stage in order for them to not be empty.
 - Removed task auto assign upon creation besides in FSM's 'My tasks' menu.
 - Allow the reordering of projects without needing to group by
   anything.
 - Make `project.task`.`description` and `project.tags`.`name`
   translatable.
 - Disable the creation of records in the view when clicking on `Tasks
   in recurrence` stat button.
 - Track the planned date of the task in the chatter
 - Disable the creation of records in the view when clicking on
   'invoices' stat button and add the kanban view to that action.
 - Make milestones completely available to regular project users.
 - Remove the 'Documents' button in the project's kanban settings menu.
 - Add kanban, pivot and graph views to the 'Hours Recorded' stat button
   on projects
 - Add the calendar view on the 'Hours Forecast' stat button on projects
 - The 'Sales Orders' stat button on the `project.project`'s form view
   will now display the amount of sales order linked to the whole
   project. So the one linked to the project itself if it exists + all
   the tasks. It will also open them, form view if 1 else list view.
 - Fix a typo in the settings 'projets' => 'projects'
 - The analytic account  of the project will now be assigned to the
   sales order when a task is created through the 'Create a task in an
   existing project' option.

Changed the portal task view to include a sidebar similar to sales
orders, with a simple menu leading to different parts of the screen.

Changed the `project.task` 'rating' stat button:
 - The icon will now represent the latest review.
 - The action will directly lead to the record's form view if there is
   only 1 rating.
 - Make some fields readonly in the form view.
 - Display the % of satisfaction instead of the number of ratings.

Reorder all stat buttons on the `project.task` form view in this order:
 - Products, Worksheet, Sales Order(s), Invoices, Ratings, Hours
   Forecast, Parent Task, Tasks in recurrence, Tickets, Quotations and
   lastly Customer Preview

Make the status of the project editable directly through the kanban
view. A new widget has been added to handle that properly. When editing
the status through that means, a `project.update` will be created with
the current date and the appropriate status. In addition to that a new
status has been added (only on `project.task`, not `project.status`)
namely `to_define` in order to differentiate new and running projects.
Projects now start with the `to_define` status.

The `project.project`'s  rating stat button has been changed in the
following ways:
 - The icon will now change in function of the satisfaction percentage,
   smile above 66%, meh between 33% and 66% and frown below 33%.
 - The color will also change depending on the rate, smile is green, meh
   is orange and frown is red.
 - The ratings will now be in function of the last 30 days instead of
   all time and the action will also filter on those 30 days.
 - Change the action name from 'Rating' to 'Ratings'.

`project.project` ticket stat button:
 - Will now open the form view when there is only one record.
 - Added the activity view.
 - Disable the creation of new records.
 - Rename the action to 'Tickets'.

Closes: odoo/odoo#75269

See: odoo/enterprise#20334

Task ID: 2611006

Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2021-10-28 15:27:36 +00:00
William Braeckman 32ba417549 [IMP] rating: add satisfaction percentage to rating.mixin
Adds the satisfaction percentage as an optional compute to
`rating.mixin`.

Closes: odoo/odoo#75269

See: odoo/enterprise#20334

Task ID: 2611006
2021-10-28 15:27:36 +00:00
Thomas Josse ef4ad5a9d4 [IMP] rating: changes the conversion of the ratings
Purpose
=======

This commit changes a conversion variable
`RATING_LIMIT_SATISFIED` in order to follow a new conversion:
> 5/4 := Satisfied
> 3 := Okay
> 2/1 := Dissatisfied

Specifications
==============

This commit only changes the variable in order to limit the
modifications made to the `rating` module/models.

This is done in order to change the faces displayed for each review/rating
without impacting the statistics. The ratings/reviews will have the same values
as before but will only get a different conversion if higher than 4.

task-2597345

See odoo/enterprise#20480
See odoo/upgrade#2784

Part-of: odoo/odoo#75646
2021-10-22 11:09:17 +00:00
Victor FeyensandThibault Delavallée f85387ef33 [IMP] mail(_*): limit usage of search
Purpose of this commit is to globally improve code performance by limiting
search impact by

  * adding limits when only first found record id used;
  * avoid unnecessary searches when record set can be filtered instead;
  * using cache when accessing ir.model;

Task-2638444
PR odoo/odoo#76005

Co-Authored-By: Thibault Delavallée <tde@odoo.com>
Co-Authored-By: Victor Feyens <vfe@odoo.com>
2021-09-08 07:56:04 +00:00
Krina Oza cfd5837a24 [IMP] rating: improvement for the ratings view
The purpose of this commit is to make improvements in ratings
views.

so in this commit did the following changes:
Graph View
  - rename 'Rating Value' to 'Rating Value (/5) in measures
  - remove 'document' and 'parent document' measures
Kanban view
  - only display the name of the rated operator, not his company
list view:
  - resequence the fields and change attrs
search view:
  - added various filter

Related Enterprise PR: https://github.com/odoo/enterprise/pull/19415

closes odoo/odoo#72965

Taskid: 2531491
Related: odoo/enterprise#19415
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-08-19 04:32:46 +00:00
Martin Trigaux c7bac3dee0 [IMP] *: make ir.model.data helper private
No reason to interfact with them directly in RPC
2021-08-10 13:49:04 +02:00
Martin Trigaux 03ff8d4d58 [FIX] *: retrieve model with sudo in selection fields 2021-08-10 13:49:04 +02:00
Ipsita Borisagar 18cd50d572 [IMP] im_livechat, rating: few improvements regarding ratings
PURPOSE

In livechat, rating emojis(happy, neutral and sad) display with percentage of
how happy visitors are with the particular channel, click on that will show all
ratings of livechat channels and stat button is visible while creation, if it
has no rating.

SPECIFICATION

Add one computed field "rating_count" for the model 'rating.parent.mixin' which
shows the total rating amount of a particular channel and based on that field
invisible the stat button when the count is 0.
Also, display only happy face emoji with the percentage of happiness on
the kanban view of livechat channel, click on that will only display ratings of
the particular channel.

Task- 2471714

closes odoo/odoo#67336

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-06-30 07:34:50 +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
David Beguin a7b3003f9f [FIX] im_livechat, website_livechat: fix rating values
Rating values have been reviewed to be between 1 and 5 but not in livechat apps.
This commit align rating values.

Task ID-2301261
PR odoo/odoo#60549

X-original-commit: ed408d45e8d35eff94a73e37183cbf2e91833f15
2021-03-29 11:17:48 +00:00
David Beguin 14316fbc31 [FIX] im_livechat: fix livechat usability
Fix issues in livechat display

  * rename Rated user filter into Rated Operator
  * add padding to improve readability of the feedback screen in the livechat
window.
  * fixed URL in placeholders to match existing "contactus" page URL

Task ID-2301261
PR odoo/odoo#60549

X-original-commit: 60e27876bb7ccdd6a6f871db82d44ac194b6f739
2021-03-29 11:17:47 +00:00
Victor Feyens c1ac7b89f9 [IMP] rating: support batch creation
See merge commit for more details.

Task ID-2330149
COM PR odoo/odoo#61246
ENT PR odoo/enterprise#14561
2020-12-03 10:19:09 +00:00
Martin Trigaux 1658473bf2 [FIX] *: rephrase, correct typos
Courtesy of Transifex's translators for reporting bad/unclear sentences.

closes odoo/odoo#62564

X-original-commit: 9b3b2e8d711e3be75b1faffaf6f4f8f4ec90186e
Related: odoo/enterprise#15038
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-11-30 07:07:58 +00:00
Kevin Baptiste 49dfed790f [FIX] rating: return correct last rating value
Before this commit, the last rating value returned was not the last
consumed one.

closes odoo/odoo#61868

Taskid: 2260685
X-original-commit: 5fd11c46a4a12ffb977b15511e6eaf744cd8e0b6
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2020-11-17 14:43:48 +00:00
Nasreddin (bon) b85680a348 [FIX] portal_rating, rating: Wrong star rating number
Issue

	- Install 'eLearning' module
	- Go to 'Course' page on website
	- Open any course and click on 'Review' tab

	Rating star numbers are 2,4,6,8 & 10.

Cause

	Since this commit https://github.com/odoo/odoo/commit/e4a4ffb974ccde1842e1b2389450718f8576ad5b,
	odoo use a system of 5 stars instead of 10.

opw-2373115

closes odoo/odoo#61158

X-original-commit: e2e1ecd0de467cb97748092554c5abc3b0c9f993
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2020-11-02 13:12:52 +00:00
Thibault Delavallée 073278642d [FIX] rating: improve parent container satisfaction computation
Currently rating globally allows 3 values for customers through email
requests: 5, 3 and 1. Through other means (frontend use of rating widget)
values from 5 to 1 are possible.

Only 5 is considered as a valid value for parent container satisfaction.
This leads to strange situation where a document with 4, 4, 4 and 5 has
only 25% of satisfaction.

This is considered as a bit harsh. In this commit we move the "satisfied"
limit of parent container as being above the "ok" value (aka, 4 and 5).

X-original-commit: c884a29b6b0f2cbc8b0aebbaed93d6f211621d1d
2020-09-28 10:12:22 +00:00
Victor Feyens 594ccdcbf4 [FIX] *: typos and english incoherences
Mainly transifex issues but also some errors found through 'grep' checks.

Fix typos and obscure english strings in xml contents, fields strings/helps, some docstrings, ...
ensuring correct translations base (and fallback when translations isn't available).

closes odoo/odoo#57276

X-original-commit: 4214f05d454bca2b60fda3a288d529c098e84f77
Related: odoo/enterprise#13053
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-09-08 18:12:26 +00:00
Xavier-Do a5b5b88255 [FIX] rating: fix main flow tour mobile
Main flow tour mobile was still deactivated when #55995 was merged.
For a strange reason, a compute is called with a newId in mobile and not in the base
version of the main flow tour. This commit fixes the compute to handle such a case.

closes odoo/odoo#56281

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2020-08-21 10:43:54 +00:00
Nicolas Martinelli ca3b3d894b [FIX] rating: count and average
In an app using rating (e.g. eLearning), get 3 ratings:
- A 5-star review
- A 3-star review
- A 0-star review

The average is 2.5 stars, while it should be 4 stars.

This happens because the 0-star review is taken into account in the
average computation, while it shouldn't. Indeed, zero star means no
review.

We apply the same login than:
https://github.com/odoo/odoo/blob/0028a602bea6a48aaa2747127ec075394732b324/addons/rating/models/rating_mixin.py#L205

opw-2290617

closes odoo/odoo#54279

X-original-commit: 4f7981f80fb55ab4bf8b30d137e45b4fda4013cd
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-07-09 13:51:28 +00:00
Yannick Tivisse (yti)anddmonzonis dadcec593d [IMP] project: Improve global UX (back2basics)
Improve the onboarding of new users and clean a few screens.

Task ID: 2237996

closes odoo/odoo#50284

Related: odoo/enterprise#10536
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Co-authored-by: dmonzonis <mod@odoo.com>
2020-06-02 12:11:57 +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
Jason Van Malder 34b091fc93 [FIX] rating: delete rating & message when deleting rating
Issue

    - Install eLearning
    - Delete a rating
    - Go to the course page, review tab

    Only the stars disappeared.

Cause

    Review = rating + message, the rating is the stars and
             publisher_comment

    So this is normal if the review is not completely deleted

Solution

    Seen with SBU and he said that the message should be deleted
    too.

OPW-2181568

closes odoo/odoo#44529

X-original-commit: 1f41c7ae9de061ec861a3a3db9c403510861cc76
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-02-05 07:00:53 +00:00
Patrick Hoste d9247094c2 [FIX] rating: fix search on rating
Fix the access error you could get when filtering on ratings when not logged
in or when the user has no rights to access ratings.

How to reproduce: filter on channel review ratings in eLearning frontend
when being anonymous le portal.

As rating is a technical model, we have to first retrieve messages linked
to that rating value and afterwards return a new domain used to build
the final search.

Task ID : 2167776
PR : #42847

closes odoo/odoo#44380

X-original-commit: 7a241e9c21046dababc2744dd94b0c47e2d8a931
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-01-31 12:38:33 +00:00
Thibault Delavallée 5649fc88e8 [REF] {website_}mail: move and replace published field of mail.message to is_internal
PURPOSE

Clean posting process and improve mail.message definition and comprehension.

SPECIFICATIONS

Website mail defines a website_published field allowing to publish / unpublish
comments on the frontend of some modules. This field has several drawbacks :

  * it is used only for front-end people (portal, public) and has no real
    effect in chatter / classic discussions;
  * it is used only in some advanced front-end module and is not available
    in portal by default;
  * its naming is not really correct as it is not linked to fields coming
    from the website_published mixin and its behavior is not really
    the same;
  * its use is a bit duplicated with internal flag coming from subtype
    allowing to hide messages related to an internal subtype;
  * there are overrides of standard mail.message methods just to handle
    this flag;

In this commit we change that field by an is_internal flag directly on
mail.message model itself. It tells if share people (customers, share users)
are allowed to read the message. This field can be given through posting
API or set manually using widgets. It is also used in access rights custom
methods and managed like the internal flag of subtypes.

Mailgateway was already using an internal flag for internal note replies. It
is renamed to is_internal and propagated as it is now a standard field. It
also eases code understanding.

Portal is updated to allow managing the flag directly. It means customer portal
now natively allows to moderate customer comments without any need of website
modules.

Rating is updated accordingly. An is_internal field is added, replacing the
related on website published.

LINKS

Task ID 2071556
PR #38692
2019-12-02 15:18:44 +00:00
Thibault Delavallée e2b33f460d [REF] mail, various: rename subtype parameter of message_post to subtype_xmlid
PURPOSE

Clean posting process and improve mail.message definition and comprehension.

SPECIFICATIONS

In order to be more explicit subtype parameter is renamed to subtype_xmlid.
It therefore clearly indicates it should be a valid subtype Xml ID. Support
of ill formatted Xml IDs is removed because there is no reason to try to
add some random prefix. Give something that exists or go to hell, punk !

LINKS

Task ID 2071556
PR #38692
2019-12-02 15:18:44 +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
David Beguin c7d6fc84a8 [FIX] rating : set rating_last_image/feedback to readonly
It's a non sense to be able to write on rating_last_image/feedback field as it is a related
to a computed field based on the last rating, given by someone.
We should not even try to corrupt data !

Task ID: 2076656
PR #37511
2019-09-30 15:54:51 +00:00
Debauche Stéphane 2dc1f2ea73 [FIX] rating, typo error in `_compute_rating_image`
closes odoo/odoo#37583

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-09-30 11:08:34 +00:00
Debauche Stéphane f518a7dc63 [FIX] rating: fix image computation and display
Currently if we try to display image of a rating having a different value of
0/1/5/10 there is an infinite loading. Indeed images for rating are limited
to those values.

In this commit we fix that by computing a rounded value to find the closest
image.

Text display in form view is also centered for better wow onboarding back 2
basics demo usability fiximp effect.
2019-09-27 15:11:27 +00:00
Thibault Delavallée 10804f1e4b [FIX] (website_)rating: synchronize rating feedback with message body
Purpose is to set review message on both message and rating so that reviews
are correctly displayed in eLearning backend as well as correctly displayed
in chatter frontend.

Task ID 2058595
PR #36281
2019-08-30 15:06:00 +00:00
Thibault Delavallée a6a6795305 [FIX] rating: allow rating deletion
Purpose of this commit is to

  * delete rating when deleting message. Otherwise rating coming from
    frontend portal review chatter are lost in the void;
  * allow system users to delete ratings;

Task ID 2058595
PR #36281
2019-08-30 15:06:00 +00:00
Raphael Collet 9920f20e4c [IMP] models: ORM speedup
This branch is the combination of several optimizations in the ORM:

* store field values once in the cache: the cache reflects more
faithfully the database, only fields that explicitly depend on the
context have an extra indirection in the cache;

* delay recomputations by default: use method `recompute` to explicitly
flush out pending recomputations;

* delay updates in method `write`: updates are stored in a data
structure that can be flushed efficiently to the database with method
`flush` (which also flush out recomputations);

* make method `modified` take advantage of inverse fields to inverse
dependencies;

* filter records by evaluating a domain on records in Python;

* a computed field with `readonly=False` behaves like a normal field
with an onchange method;

* computed fields are computed in superuser mode by default.

Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien
Pinckaers.

closes odoo/odoo#35659

Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-08-20 12:43:59 +00:00
Adrian Torres 4b38cc6590 [REM] *: calls to @api.multi
Multi is the default api for methods, it is not necessary to explicitly
decorate methods with it, adds clutter and most people use it because
they see that the rest of the code uses it.

Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
2019-07-17 14:13:12 +02:00
Adrian Torres 9e71d57d11 [REM] *: remove calls to api.one and adapt code
Adapt all code that was using `api.one` to recordset-style method and
remove any and all calls to `api.one` in preparation for its removal.
2019-07-05 09:04:45 +00:00
Xavier-Do 2fcb3c658d [REF] mail: rename notif_layout to email_layout_xmlid on message model
Purpose is to make field use more obvious by correctly stating in the
name it should contain an xml id to a qweb layout used for email
notifications. This renaming is propagated through various calls and
addons.

Related to task 1943901
Linked to PR #32404
2019-05-29 13:34:32 +00:00
Xavier-Do 581a74143e [REF] mail: simplify notification code
Purpose of this commit is to clean notification process: calls, methods
API, method name, variable propagation.

Contains notably

  * simplify API of methods used to group recipients when sending notification
    emails;
  * improve and rename methods used in email notification process;
  * move some methods on model itself as non mail thread records could be
    mass-mailed and _notify_email_headers could be called on other records;

Related to task 1943901
Linked to PR #32404
2019-05-29 13:34:32 +00:00
Christophe Simonis 8c29df10e0 [MERGE] forward port branch saas-12.1 up to 93d736e905 2019-02-11 17:00:35 +01:00
Christophe Simonis 87924cb5ad [MERGE] forward port branch 12.0 up to a46138cb01 2019-02-07 13:14:02 +01:00
Nans Lefebvre 9d1b07f97b [FIX] project, rating: use rating last update to compute satisfaction percentage
The function _compute_parent_rating_percentage_satisfaction used the creation
date of the rating to compute the percentage.
However when a client give a new rating, it updates the old one.
As a result it doesn't give the recent satisfaction percentage,
but the satisfaction percentage of recently created tickets.
In other words recently angry clients from old projects would not appear.

Similarly this method is somewhat reimplemented directly in SQL in the rating
route, which happens to be in the project controller.

opw 1921486

closes odoo/odoo#30752
2019-02-01 09:01:27 +00:00
Christophe Simonis f927c68ddb [MERGE] forward port branch 12.0 up to cb8fefa899 2019-01-31 16:59:58 +01:00
jem-odoo 8c840f7539 [IMP] rating: add rating average on mixin
This commit provides 1 more field on the rating mixin: the average of
the ratings of the document. Before that, the only way to get the
average was to call `rating_get_stats` record per record.
As we are on a mixin, this new field is not stored to avoid recomputation
each time a rating is added. To improve performance, we decided to
compute `rating_count` and `rating_avg` in one `read_group`.

This commit also set an extendable method to get the domain of the
rating to include in those statistics computation, called `_rating_domain`.
This way, each model inheriting the rating.mixin can define the subset of
pertinent ratings.

As consequence, this commit uniformized the way average is displayed:
instead of taking the closer value to the 0.5 value, it only round it
at 2 digits.

Task-1902304
2019-02-06 09:55:13 +00:00
Christophe Simonis c8ace043e5 [MERGE] forward port branch saas-11.3 up to 387d5cff90
closes odoo/odoo#30566
2019-01-25 17:29:34 +00:00