Commit Graph
132425 Commits
Author SHA1 Message Date
Debauche Stéphane 42d3a82a80 [IMP] stock_account: remove the wizard which change the `standard_price`
Overwrite the method ``write`` of the model ``product.product``.

When we write on ``standard_price``, if
- the context key ``disable_auto_svl`` is not set
- the ``cost_method`` is not "fifo"
We automatically compute ``stock.valuation.layer``

(before we needed to manually call ``_change_standard_price``)

Task #2031422

closes odoo/odoo#41265

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-06 10:58:03 +00:00
Aurélien WarnonandThibault Delavallée d6458e68df [IMP] survey: allow to link a user answer to its user input email field
PURPOSE

Allow some questions to be linked to customer data. We would like to have an
email field filled with user info / updating user info automatically in the survey.

SPECIFICATION

For now, we only want to be able to collect the user email address for a specific
question of the survey. For that purpose, add a ``save_as_email`` field on the
question model.

If this option is checked, the answer to that specific question will override the
"email" stored on the survey.user_input allowing live udpate of user input
based on given information. If multiple questions are marked as such, the
last (not empty) answer will prevail.

If user input already has an email (invitation-based surveys for example)
prefill the answer with the email so that people don't have to retype it.

GOING FURTHER (aka, incoming)

With live mode: maybe some additional fields will need to be saved
nickname
avatar

LINKS

Task 1919290
PR #41429

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Aurélien Warnon <awa@odoo.com>
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2019-12-06 09:54:07 +00:00
Thibault Delavallée 4b95e7e5ef [FIX] survey: correctly compute filters based on finished
Oversight of 374b57a153 .
2019-12-06 09:53:32 +00:00
Aurélien WarnonandThibault Delavallée a5f115d1fc [FIX] survey: fix typo in survey templates and lint some code
From
"Their was an error during the validation of the survey."
To
"There was an error during the validation of the survey."

Some side code linting is also performed because my linter is screaming on
me.

Task ID 1919290
PR #41429

Co-Authored-By: Aurélien Warnon <awa@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
2019-12-06 09:53:20 +00:00
qsm-odoo 864cb9132d [REF] web_editor: do not select left panel input content automatically
Part of https://github.com/odoo/odoo/pull/41402

closes odoo/odoo#41402

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-12-06 10:05:55 +00:00
qsm-odoo 83fae16bb9 [REF] web_editor: review user value widgets scss
Part of https://github.com/odoo/odoo/pull/41402
2019-12-06 10:05:55 +00:00
qsm-odoo a41717bebf [IMP] web_editor: add left panel input on a new line by default
Before this commit, inputs were always a title followed by the <input/>
on the same line.

Now it follows the same logic as we-row elements: title on a line,
<input/> on a new line, except if the 'o_we_inline' class is used.

Part of https://github.com/odoo/odoo/pull/41402
2019-12-06 09:45:30 +00:00
qsm-odoo e4d4aab042 [IMP] web_editor: validate input entry with ENTER in editor left panel
Especially useful with a no-preview input.

Part of https://github.com/odoo/odoo/pull/41402
2019-12-06 09:45:30 +00:00
Samuel Degueldre 65262c5e3e [IMP] web_editor: allow options to target subelements of a snippet
Add the ability for a snippet option's method to target multiple
subelements of the option's $target using the data-apply-to attribute
with a jQuery selector. This is achieved by calling the method on a
proxy of the object where accesses to the $target are redirected to a
different object.

While it may seem preferable to just set the $target before calling the
method and restoring it after the call, as this would be much simpler
code, it is not possible as this breaks down under asynchronous
conditions, hence the need to operate on a proxy such that all
concurrent asynchronous operations have their own independent $target
available for their entire time of execution.

Part of https://github.com/odoo/odoo/pull/41402
2019-12-06 09:45:30 +00:00
Andrea Grazioso (agr-odoo) ae9c2487c8 [FIX] base: force compute active_lang_count
Create a new contact (just open the create form)

The "Language" field is missing, because active_lang_count is not
computed before the record is saved, but it is necessary to display the
language field

opw-2149324

closes odoo/odoo#41172

X-original-commit: 4c90fde44e463979de9c6c1f5acb5c5e0c469c21
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-12-02 09:08:49 +00:00
Xavier Morel d3798b4058 [FIX] hr_maintenance: remove dynamic domain
* converts dynamic domain from onchange_department_or_employee_id to a
  static domain on the field
* remove the department_id field (and all uses of it), it looks to
  never be set and not really be settable: the field is hidden in the
  form, doesn't have a default value, does not have anything to
  compute it, ...
* remove the onchange itself as it has very little value: it
  auto-selects an equipment if there exists a single equipment
  assigned to the selected employee or to no employee

  Even if we removed the "equipment not assigned to any user"
  bit (under the assumption that people would mostly request
  maintenance for their own equipment, and that this would usefully
  trigger more often) it's unlikely for dedicated users of
  hr_maintenance to assign only one equipment per employee. So the
  onchange would rarely do any useful work, and what work it saves is
  trivial: if there's only one equipment the employee could ask about
  for maintenance it's really trivial to do that.

Task 2115472

closes odoo/odoo#40963

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-12-06 07:27:20 +00:00
Odoo's Mergebot 374b57a153 [MERGE] survey: clean and rename models, refactor survey results page code
PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS

[REF] survey: remove unused or unnecessary fields to clean models. Some fields
are also renamed to better indicate their use.

  * On survey.survey, remove question field, unnecessary related on title.
  * On survey.survey, remove unused category field.
  * On survey.user_input, remove input_type and its garbage collect.
  * On survey.{survey, user_input}, remove url fields replaced by methods

  * On survey.survey, rename thanks_you_message to description_done
  * On survey.survey, rename certificate field to certification
  * On survey.survey, rename passing_score field to scoring_success_min
  * On survey.user_input, rename quiz_score field to scoring_percentage
  * On survey.user_input, rename quizz_passed field to scoring_success
  * On survey.user_input, rename token field to access_token
  * On survey.user_input, rename question_ids field to predefined_question_ids

[REF] survey: rename some models to ease understanding

In this merge we rename the long standing ``survey.label`` model. Indeed
a label is something before a question, like an input label. Labels in survey
are used for suggested answers and sometimes as rows for matrix answers.

After much thoughts we rename ``survey.label`` to ``survey.question.answer``.
It indicates this model holds answers. Moreover it is namespaced within the
``survey.question`` model name to avoid conflict with user input / user answer
model.

As model naming changes, some fields also evolve. In survey.question model

  * ``labels_id`` is renamed to ``suggested_answer_ids`` to indicate it is
    used to display suggested values to the user;
  * ``labels_id_2`` is renamed to ``matrix_row_ids`` to indicate it is used
    to generate the rows of the matrix-type question. A matrix is therefore
    done using ``matrix_row_ids`` for rows and ``suggested_answer_ids`` for
    columns which seems easier to understand;

In survey.question.answer (old survey.label) model

  * ``question_id_2`` is renamed to ``matrix_question_id`` to ease its
    understanding, notably that it is used for matrix questions;

Main user answer model is ``survey.user_input``. It holds lines related to
answers given to specific questions. In this commit we rename this model from
``survey.user_input_line`` to ``survey.user_input.line`` to be coherent with
general odoo naming guidelines.

[REF] survey: on survey.user_input.line, rename value_suggested{_row}

A new naming recently introduced for ``survey.question.answer`` has been
recently introduced: ``suggested_answer_ids`` and ``matrix_row_ids``. In
this commit we propagate that naming to survey.user_input.line model. New
naming is

  * ``suggested_answer_id``: one chosen value for single / multiple choice.
    It is also used for matrix columns as those indicates the value to give
    on a given row;
  * ``matrix_row_id``: the related row of the suggested answer for matrix
    questions;

It adds two benefits

  * it finishes by _id which is always a good idea for m2o fields;
  * it better indicate the use;

 [REF] survey: on survey.{question,user_input.line}, make type and field names match

To better understand question type and their input type, we update some of
``survey.question`` ``question_type`` keys :

  Type----Old type-----New type

  text----free_text----text_box
  char----textbox------char_box

Untouched question types: ``numerical_box``, ``date``, ``datetime``,
``simple_choice``, ``multiple_choice``, ``matrix``. Those are already
understandable.

Then ``survey.user_input.line`` ``answer_type`` keys are also updated to
match their question type counterparts

  QuestType--------Old type-----New type

  text_box---------free_text----text_box
  char_box---------text---------char_box
  numerical_box----number-------numerical_box

Then ``survey.user_input.line`` fields used to store the value are updated to
propagate the new naming

  AnswerLineType----Old field----------New field

  text_box----------value_free_text----value_text_box
  char_box----------value_text---------value_char_box
  numerical_box-----value_number-------value_numerical_box

Untouched answer types and field storing value: ``date``, ``datetime`` still
refer to same question type and use value_date / value_datetime fields.
``simple_choice``, ``multiple_choice`` and ``matrix`` still use ``suggestion``
answer type and ``suggested_answer_id`` (+ ``matrix_row_id``) to store link
to ``survey.question.answer`` records.

[REF] survey: refactor results page

Purpose of this merge is to globally rewrite the way statistics are
pre computed and used in results page of surveys. Indeed current code is
very complex, having a lot of calls to the same methods while taking only
part of its results. It also have a mix of model and controller methods,
data is computed several times a bit differently, ...

In this commit we rewrite that part. Including

  * a simpler code flow;
  * a simpler data structure;
  * use a better naming for methods instead of "prepare_results" called
    randomly within the code and re-using part of its returned content;
  * use record sets / records instead of giving sub-elements of a record
    like question.title, label.value, ...

Data structure

  * simply give a question_and_page_ids to the template that will iterate
    on pages / questions;
  * have a graph_data, table_data dictionaries available for graph and
    table display with simple entries;
  * graph_data: holding all necessary but minimalist data for graph display
    if question allows it;
  * table_data: holding all necessary but minimalist data for table / summary
    display;
  * hold record sets of done / failed answers and answer lines;

In this commit we also simplify and clean pagination in survey graph results

  * remove page_range helper tool that can be inlined in the templates
    directly, doing a simple range;
  * fix and improve pagination code;

[IMP] survey: improve demo data

Add a new demo survey about a quiz: a survey with scoring but no certificate.
Have almost all possible combinations of questions and options (notably choices
to have a scoring) and answer lines in order to be able to, notably, debug
the statistics / result page.

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765

closes odoo/odoo#41198

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-12-05 18:06:56 +01:00
Thibault Delavallée f7fb9b96f4 [IMP] survey: improve demo data
PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS

Add a new demo survey about a quiz: a survey with scoring but no certificate.
Have almost all possible combinations of questions and options (notably choices
to have a scoring) and answer lines in order to be able to, notably, debug
the statistics / result page.

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765
2019-12-05 15:21:28 +00:00
Thibault Delavallée 351a4439b3 [REF] survey: clean results page and its code generating statistics
PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS

Purpose of this commit is to globally rewrite the way statistics are
pre computed and used in results page of surveys. Indeed current code is
very complex, having a lot of calls to the same methods while taking only
part of its results. It also have a mix of model and controller methods,
data is computed several times a bit differently, ...

In this commit we rewrite that part. Including

  * a simpler code flow;
  * a simpler data structure;
  * use a better naming for methods instead of "prepare_results" called
    randomly within the code and re-using part of its returned content;
  * use record sets / records instead of giving sub-elements of a record
    like question.title, label.value, ...

Data structure

  * simply give a question_and_page_ids to the template that will iterate
    on pages / questions;
  * have a graph_data, table_data dictionaries available for graph and
    table display with simple entries;
  * graph_data: holding all necessary but minimalist data for graph display
    if question allows it;
  * table_data: holding all necessary but minimalist data for table / summary
    display;
  * hold record sets of done / failed answers and answer lines;

In this commit we also simplify and clean pagination in survey graph results

  * remove page_range helper tool that can be inlined in the templates
    directly, doing a simple range;
  * fix and improve pagination code;

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765
2019-12-05 15:21:28 +00:00
Thibault Delavallée bb3d4634df [FIX] survey: lint JS files and reorganize route code
PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS

This commit lints JS files located in survey as some typos and mistakes
were recently introduced. Code related to routes is also slightly reorganized
to better understand file main sections.

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765
2019-12-05 15:21:28 +00:00
Thibault Delavallée a6e9ee91d1 [REF] survey: on survey.user_input{.line}, reorganize and clean model code
PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS

In survey.user_input.line, clean code about constraints. Purpose is to make
it easier to read and understand.

Code creating user input lines is moved from survey.user_input.line model to
survey.user_input. Indeed it is now based on a user_input record, and create
answer line related to a question, based on values coming from controllers
(and therefore frontend). It makes more sense to delegate that code to the
user_input model itself that creates its lines. Code is also rewritten to
be cleaner and easier to read.

Code computing statistics on user input records is moved from survey model
to user_input model, where it belongs. Missing translation marks are added
because translations matter.

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765
2019-12-05 15:21:28 +00:00
Thibault Delavallée 0406b7049e [REF] survey: on survey.{question,user_input.line}, make type and field names match
PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS

To better understand question type and their input type, we update some of
``survey.question`` ``question_type`` keys :

  Type----Old type-----New type

  text----free_text----text_box
  char----textbox------char_box

Untouched question types: ``numerical_box``, ``date``, ``datetime``,
``simple_choice``, ``multiple_choice``, ``matrix``. Those are already
understandable.

Then ``survey.user_input.line`` ``answer_type`` keys are also updated to
match their question type counterparts

  QuestType--------Old type-----New type

  text_box---------free_text----text_box
  char_box---------text---------char_box
  numerical_box----number-------numerical_box

Then ``survey.user_input.line`` fields used to store the value are updated to
propagate the new naming

  AnswerLineType----Old field----------New field

  text_box----------value_free_text----value_text_box
  char_box----------value_text---------value_char_box
  numerical_box-----value_number-------value_numerical_box

Untouched answer types and field storing value: ``date``, ``datetime`` still
refer to same question type and use value_date / value_datetime fields.
``simple_choice``, ``multiple_choice`` and ``matrix`` still use ``suggestion``
answer type and ``suggested_answer_id`` (+ ``matrix_row_id``) to store link
to ``survey.question.answer`` records.

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765
2019-12-05 15:21:28 +00:00
Thibault Delavallée 2a35d92b6c [REF] survey: on survey.user_input, rename question_ids field to predefined_question_ids
PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS

``question_ids`` field name is quite difficult to understand as we wonder why
there is such a field on user input model. As its purpose is to store questions
user has to answer (randomly chosen or all chosen) let us rename it to
``predefined_question_ids``.

Moreover starting from now on if it is now given at create it is automatically
computed. Classic flows go through ``survey._create_answer()`` method that
prepares them accordingly. However tests or demo data do not necessarily go
through that method and it makes scoring fail (notably) if people forget
to define them.

Let us automatically generate them at user input create if not given.

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765
2019-12-05 15:21:28 +00:00
Thibault Delavallée 3a094f2294 [REF] survey: on survey.user_input.line, rename value_suggested{_row} fields
PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS

A new naming for ``survey.question.answer`` has been recently introduced:
``suggested_answer_ids`` and ``matrix_row_ids``. In this commit we propagate
that naming to survey.user_input.line model. New naming is

  * ``suggested_answer_id``: one chosen value for single / multiple choice.
    It is also used for matrix columns as those indicates the value to give
    on a given row;
  * ``matrix_row_id``: the related row of the suggested answer for matrix
    questions;

It adds two benefits

  * it finishes by _id which is always a good idea for m2o fields;
  * it better indicates the use;

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765
2019-12-05 15:21:28 +00:00
Thibault Delavallée 755ac5f313 [REF] survey: on survey.user_input, rename some fields to ease understanding
PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS: RENAME QUIZ_SCORE ON SURVEY.USER_INPUT

On survey.user_input, quiz_score field to scoring_percentage

``quiz_score`` field name is related to the old "quiz" behavior of surveys
that is replaced by certifications and scoring mechanisms. Let us propagate
the renaming, beginning with a ``scoring_`` prefix.

SPECIFICATIONS: RENAME QUIZZ_PASSED ON SURVEY.USER_INPUT

on survey.user_input, rename quizz_passed field to scoring_success

``quizz_passed`` field name is related to the old "quiz" behavior of surveys
that is replaced by certifications and scoring mechanisms. Let us propagate
the renaming, beginning with a ``scoring_`` prefix.

SPECIFICATIONS: RENAME TOKEN ON SURVEY.USER_INPUT

on survey.user_input, rename token field to access_token

Survey user input model holds two token field. One is used to distinguish
a pool of attempts linked to a given invite: ``invite_token``. The other
one is used to control access to a specific user input. It means that
``invite_token`` indicates a set of user inputs and each of them is accessed
through its own ``token``. To be coherent with other naming in odoo this
latter field is renamed to ``access_token``.

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765
2019-12-05 15:21:28 +00:00
Thibault Delavallée 1e66894042 [REF] survey: on survey.survey, rename some fields to ease understanding
PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS: RENAME THANKS_YOU_MESSAGE ON SURVEY.SURVEY

On survey.survey, rename thanks_you_message to description_done

In this commit we rename thanks_you_message field. Indeed for certifications
or recruitment form, "thank you" is not really the unique content you
would get in a post-survey message. We therefore rename it to description_done
to better indicate its use.

SPECIFICATIONS: RENAME CERTIFICATE ON SURVEY.SURVEY

On survey.survey, rename certificate field to certification

All certification related fields on survey model begin with certification_ .
Only the boolean one telling if a survey is a certification or not is called
certificate. In order to ease grep and ordering it is renamed to certification.

SPECIFICATIONS: RENAME PASSING_SCORE ON SURVEY.SURVEY

on survey.survey, rename passing_score field to scoring_success_min

``passing_score`` field name is not really the best name we could find.
Renaming the field using a ``scoring_`` prefix allow to know this field
is linked to the scoring mechanism.

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765
2019-12-05 15:21:28 +00:00
Thibault Delavallée 7edeb24de9 [REF] survey: globally rename survey.user_input_line model to survey.user_input.line
PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS

Main user answer model is ``survey.user_input``. It holds lines related to
answers given to specific questions. In this commit we rename this model from
``survey.user_input_line`` to ``survey.user_input.line`` to be coherent with
general odoo naming guidelines.

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765
2019-12-05 15:21:28 +00:00
Thibault Delavallée 2592e72f2c [REF] survey: globally rename survey.label model to survey.question.answer
PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS

In this commit we rename the long standing ``survey.label`` model. Indeed
a label is something before a question, like an input label. Labels in survey
are used for suggested answers and sometimes as rows for matrix answers.

After much thoughts we rename ``survey.label`` to ``survey.question.answer``.
It indicates this model holds answers. Moreover it is namespaced within the
``survey.question`` model name to avoid conflict with user input / user answer
model.

As model naming changes, some fields also evolve. In survey.question model

  * ``labels_id`` is renamed to ``suggested_answer_ids`` to indicate it is
    used to display suggested values to the user;
  * ``labels_id_2`` is renamed to ``matrix_row_ids`` to indicate it is used
    to generate the rows of the matrix-type question. A matrix is therefore
    done using ``matrix_row_ids`` for rows and ``suggested_answer_ids`` for
    columns which seems easier to understand;

In survey.question.answer (old survey.label) model

  * ``question_id_2`` is renamed to ``matrix_question_id`` to ease its
    understanding, notably that it is used for matrix questions;

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765
2019-12-05 15:21:28 +00:00
Thibault Delavallée 84bb9c748d [REF] survey: remove unused or unnecessary fields to clean models
PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS: QUESTION FIELD ON SURVEY.SURVEY

On survey.survey, remove question field, unnecessary related on title.

Question model holds two fields for its title: ``title`` and ``question``.
Question is simply a related on title, making the two fields completely
redundant. It is mainly due to historical reasons, when updating models for
certifications and eLearning. In this commit we keep only title field and
remove the question related field as it adds unnecessary complexity to the
model.

SPECIFICATIONS: INPUT_TYPE FIELD ON SURVEY.USER_INPUT

On survey.user_input, remove input_type and its garbage collect.

``input_type`` field exists on user input model to tell whether answer has
been created through invite or through manual click on a survey page. It
has been added a long time ago when surveys were either open to everyone,
either closed and on invite only.

Since eLearning and certification surveys access mode on surveys has evolved.
Notably being able to distinguish invite from manual survey user input is not
necessary anymore. Indeed what is important is the way people can reach the
survey, not how they created their user input.

Invitation creates token and this can be used if people effectively want to
find invitation-related user inputs.

Since 09ea5c7d49 manual entries still in draft are garbage collected.
Reason is still unclear as it is not obvious that tons of unnecessary entries
will be created. As this seems like unnecessary optimization this commit
removes that feature along with the input_type field.

SPECIFICATIONS: REPLACE URLS FIELDS BY METHODS ON SURVEY.{SURVEY, USER_INPUT}

On survey.{survey, user_input}, remove url fields replaced by methods

In this commit we remove some remaining of URL fields that are better found
using methods. Both survey and user input holds a "start" url field that is
replaced by a method call ``get_start_url`` on both survey (generic) and
user input (token specific) models. We also introduced a ``get_print_url``
method doing the same for the printable version of survey / user input.

SPECIFICATIONS: REMOVE CATEGORY FIELD ON SURVEY.SURVEY

On survey.survey, remove unused category field.

Survey model holds a ``category`` field whose purpose is to be able to somehow
categorize surveys according to their use. However using this field is not
easy as it is hidden and is a simple selection field. Module should add their
own key. Its sole use is in ``hr_recruitment_survey`` which is a niche module.
Let us clean models and lessen model complexity.

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765
2019-12-05 15:21:28 +00:00
Thibault Delavallée ca52dbaede [IMP] base: add math floor and ceil to qweb rendering context
PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS

Add math floor and ceil functions in qweb rendering context. It allows to use
some math methods directly in templates to avoid unnecessary data preparation
in controllers that lead to a lot of hard to read code mixed with important
code. Notably in survey we will use them for some pagination within statistics
rendering.

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765
2019-12-05 15:21:27 +00:00
Andrea Grazioso (agr-odoo) 8c6976a634 [FIX] account: correctly get "Search More" output
Open Bank reconciliation, deactivate some record (-), go to "Manual
Operations" tab, add Analytic Tags using the "Search More" functionality.
Resulting tag will be blank and impossible to delete.

This is because:
1) The field shown is the display name, which is missing.
2) When selecting analytic tag(s) this way an array of
results is returned but it is not handled correclty by the view.
When selecting the analytic tag from the drop down menu a single value
'{id: , display_name: }' is returned.

opw-2146833

closes odoo/odoo#41419

X-original-commit: 42ae9ce544605314d969ae1210245f5b5bbf2628
Related: odoo/enterprise#7073
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-12-04 14:11:32 +00:00
remi-filament a04502c97e [FIX] account: Add widget date for payments
closes odoo/odoo#41142

X-original-commit: fdbabfdc59d2d8deb62d08c7bd132a93a5f2f738
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2019-11-19 08:26:17 +00:00
Thanh Dodeur 68ecfe1357 [ADD] web: adds file upload mixin
This commit adds mixin to manage file uploads in view controllers and to
display progress bars.

The first motivation and use case is to allow MRP to manage and display
uploads like in Documents.

closes odoo/odoo#38397

Task: #2074822
Related: odoo/enterprise#5887
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-12-05 14:38:26 +00:00
lejeune quentin aa6474801c [FIX] point_of_sale: Fix access point for IoT Box
When the box is in "access point" it calls the function 'get_wifi_essid'
at every ping => ~ 3 seconds.
So after a few moments the network card blocks and turns off.
Now we redirect the user to the '/steps' route that only executes the function once.

closes odoo/odoo#41415

X-original-commit: b5020a4471666cb53398077db4e856d1c60245a9
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2019-12-05 11:16:20 +00:00
Nicolas Lempereur 9edb13c6fd [FIX] pad: no deadlock on pad readonly modification
When the adapation without jQuery promise was done for 12.3 (in
bfed574255) the hack for always saving a pad URL was added in
the deferrence of the start method.

This caused that in the following conditions:

- pad URL is set
- form is in edit mode
- a change in the form change the readonly status of the pad

=> we would have a mutex lock (of the form change) waiting for the pad
that is being rerendered to finish its start but that can only be done
once the mutex is unlocked (because setValue of the pad is protected by
the same mutex) => so we have deadlock and interface does not allow to
save or do any other change.

This happened for example if we had a project.project A without
collaborative pad, project.project B with collaborative pad, and if we
moved a task from project B to project A then back to project B.

With this change, we get back to the behavior before bfed57425 of not
waiting for the fake "setValue" in `start` of Pad.

Without the change, added test fails with:
    Expected 1 assertions, but 0 were run

because interface is deadlocked so write does not happen.

opw-2150827
closes #41346

closes odoo/odoo#41406

X-original-commit: cc73abb218e17756b21824a192f4461eb8537c0e
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-12-04 14:59:30 +00:00
qsm-odoo d7f4289166 [FIX] web_editor: prevent setting values of non-activable methods
closes odoo/odoo#41404

X-original-commit: 6af602fa676db19260a828a3cfd0befe3ba1ef4e
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-12-05 10:59:48 +00:00
qsm-odoo b62b686066 [FIX] web_editor: fix some design issues with editor left panel
- Some layout broken when a scrollbar appeared
- The edit icon of background disappeared when the filename was too long

X-original-commit: d3419fed27147c92e673fb367657db8865a0d538
2019-12-05 10:59:47 +00:00
wan 24db4805c6 [REV] web: unwanted logs and debugger
Some debugging lines were introduced in https://github.com/odoo/odoo/commit/30cf7bc798ddede8e610001146f4a76352aa582f
Those should be removed

closes odoo/odoo#41400

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2019-12-05 11:48:47 +00:00
lejeune quentin f0b445d24c [FIX] point_of_sale: Cleanup computer after build of IoT Box
We must delete the folder "MOUNT_POINT" before the "zerofree"

closes odoo/odoo#41399

X-original-commit: 4dffb76fab1a44eb79b2770100eef000ef23a9e5
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2019-12-04 14:20:02 +00:00
Nicolas Martinelli c593c468b1 [FIX] account: sequence of AML
When printing an invoice, the order of the lines not always match the
order in the interface.

It occurs because `account.move.line` contains a `sequence` field which
is taken into account in the UI but not used in the report. Note that
commit 0a5955bff6 explicitly removed from the `_order`.

opw-2145878
opw-2147922

closes odoo/odoo#41396

X-original-commit: f4571e2fe0f30d753172ce1fa1dc40d93b87e00a
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-12-05 08:43:06 +00:00
Victor FeyensandIgor Ishchenko 1bff1987bb [FIX] sale: fix field to check if invoice is paid
The state field does not contain any information whether an invoice was
paid or not. This info is stored in the invoice_payment_state field.
This change fixes the field used in the customer-facing template to
display the payment status of the invoice.

closes odoo/odoo#41394

X-original-commit: d1d83ee53c8274c1cb44f1cd7440e73a9eba9bef
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Co-authored-by: Igor Ishchenko <igor@cruxlab.com>
2019-12-05 09:27:02 +00:00
qsm-odoo 8180b46563 [FIX] web, web_editor: improve browser support for JS lazy loading
opw-2125858

closes odoo/odoo#41371

X-original-commit: d19982b7a22b04ab76c787b9adfffd24552eb5c0
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-12-04 16:40:03 +00:00
Alexandre Kühn 6245ed2bce [FIX] bus, mail: navigate from tests with mocked bus services
Before this commit, when navigating from test environment (e.g.
page reload), it crashed with following error:

`TypeError: Cannot convert undefined or null to object`

This error comes from mocked bus services in tests: even when they
have been destroyed, they handle the window event 'unload'. They
no longer have a parented parent, so `this.call()` returns
`undefined`, hence the crash.

This commit prevents mocked bus services to listen on window 'unload'
event. Tests must always simulate this window event by explicitly
calling the handler.

closes odoo/odoo#41378

X-original-commit: fd08d04f0a24fea52e7b668b90aec48b33d349a3
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-12-04 14:46:28 +00:00
Daniel Blanco 46b1218094 [FIX] l10n_cl: taxpayer type and sequences of document type
Description:
- Add readonly attribute to partner view for l10n_cl_sii_taxpayer_type field for children res.partner records.
- Fix the tax payer type label to prevent usage of "label for.."
- Optimize document type order to put most used on top of file and in selection of document types during invoicing process

closes odoo/odoo#41372

X-original-commit: 4162b9b618ffe62548e9a1d5ae3c0fdd604a1395
Signed-off-by: Josse Colpaert <jco@openerp.com>
2019-12-04 17:21:15 +00:00
Nans Lefebvre 09908b736f [FIX] base: when saving settings, only reset environment if modules were installed/uninstalled
Execute the tests from ea574fe9ff644 and 9e9ac5ced80b30,
which are in a SavepointCase.
The second test fails on a cache_miss.
Whats happens is the following:
 - the second test starts with the environment from the beginning of the
   first test. However its envs has a reference to environments that
   were created during the first test.
 - when computing the field, the ORM finds the value in a zombie
   environment, so does not recompute it
 - when trying to get the value, the value is not in cache

The issue is that going through res.config.settings's execute resets the
envs.

One solution is to put:
    self.addCleanup(lambda: setattr(self.env.envs, 'envs', envs))
in SavepointCase's setup.

However in that case the reset is not needed at all:
it's necessary only if there were some modules to install.
Unfortunately to_install and to_uninstall are not symmetric:
to_uninstall contains only modules that should be uninstalled, whereas
to_install contains everything, and only filters later what actions
really need to be performed.

In this case, we can rely on the result of the installation process.

closes odoo/odoo#41126

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-12-04 14:09:56 +00:00
Nans Lefebvre ba5b77427d [TEST] account: remove group from all users when removing settings
Initial issue solved by 3eb06a27da
We keep the test since it ensures that settings can be saved properly.

X-original-commit: 2c1b92f626edaf89c93c3bd96d656aa77c580c69
2019-12-04 14:09:40 +00:00
Florian Gilbert ed26e9eafa [IMP] account: Various usability improvements
List of improvements:

Invoice/Bill
- Hide "untaxed amount" section when there is no tax.
- Remove tooltips for tax groups field.
- Remove invoice_partner_icon and set this icon in "Vendor" (in a list view)

Chart of Accounts
- Same views for config bar and regulare one
- By default don't show deprecated accounts and add filter to display them.
- Add some optional fields in list view (taxes, tags, ...)

Dashboard opening balance wizard
- The opening move entry date equals to the opening date - 1 day.

Bank Statements
- Set default order for the list view (by date desc and name desc)

Tax report configuration:
Add 3 new columns for the list view (country_id, code, tag_name)
Add 4 new searchs (name, tag_name, code, country_id)

Task ID: 2048225

closes odoo/odoo#38694

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2019-12-04 13:47:28 +00:00
Raphael Collet 51d020e5fa [FIX] models: query blowup when unlinking many records
The method `unlink` checks whether any of the records to delete is used
as the default value of a company-dependent field.  The query simply
blows up when deleting several millions of records.  The fix consists in
performing the check in batches.

closes odoo/odoo#41331

X-original-commit: 30e8b8f2554e5d16b19f16ea90e3503098dc98a0
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-12-04 08:46:08 +00:00
Patrick Tombez bf250a33f0 [FIX] payment: Keep session serializable
Fix error like "TypeError: {4} is not JSON serializable" when
serializing the session object (e.g. for external storage)

closes odoo/odoo#41360

X-original-commit: e91e38fa4bd12ba9d2027e7778a10252e08b9a86
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-12-04 09:04:29 +00:00
Nicolas Seinlet 7fc372a048 [FIX] stock: always prefix fields of sql views
If a module add a state field on another table used by this report,
PostgreSQL will report a:

```psycopg2.ProgrammingError: column reference "state" is ambiguous```

closes odoo/odoo#41350

X-original-commit: 16ae8aed10c72586a3a3e8b7484099263b0d7804
Signed-off-by: Nicolas Seinlet (nse) <nse@odoo.com>
2019-12-04 12:35:47 +00:00
Simon Lejeune 0e4e21a1e7 [REF] stock: remove quantity_available_locations_domain context key
- we would have to set this domain on every actions directing to
products
-we can't set a proper depends_context since the new orm doesn't support
it

closes odoo/odoo#41322

Related: odoo/enterprise#7033
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-04 12:49:25 +00:00
Simon Lejeune 447cc7b88c [REF] stock: remove company_owned context key
This context key was used to get the valued quantities. We now have a
`quantity_svl` computed field that does this job. The test is removed,
it was showing that intercompany quants are visible thanks to a context
key but with the introduction of the on_hand filter, it is now useless
(just remove the filter)
2019-12-04 12:34:40 +00:00
Jigar Vaghela 616864e968 [FIX] l10n_in: Fix tax grouping key
tax grouping key from base and tax line that will be used as a key to group taxes together
so both functions must have the same dictionary key. (you can check comment here https://github.com/odoo/odoo/blob/13.0/addons/account/models/account_move.py#L412)

here we have three key (product_id,product_uom_id,quantity) in _get_tax_grouping_key_from_base_line
and only one key (product_id) in _get_tax_grouping_key_from_tax_line

so we get wrong tax calculation

now we remove that extra key(product_uom_id, quantity) because we don't need group by these key values.

closes odoo/odoo#41340

X-original-commit: a758e5eace55bad0c11f8a27ba83e8367d293487
Signed-off-by: Josse Colpaert <jco@openerp.com>
2019-12-04 10:41:06 +00:00
nje-odoo 087131fe54 [FIX] sale_timesheet, website_sale: fix UI and tooltip typos
task-2121584

closes odoo/odoo#41339

X-original-commit: 565f42cb0ac32185cfaed1454a0fda2a54b3bec2
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2019-12-04 10:36:19 +00:00
Sébastien Theys 61e66efbbe [FIX] utm: correctly set scss url as absolute
closes odoo/odoo#41320

X-original-commit: b25922f77279eaf09800486954fe79b246ea105b
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-12-03 17:38:26 +00:00