Commit Graph
123837 Commits
Author SHA1 Message Date
wan 969705fa2a [ADD] account: suspense account management
Task 1930403
Purpose:
A suspense account is an account in the general ledger that temporarily stores any transactions for which there is uncertainty about the account in which they should be recorded. Once the accounting staff investigates and clarifies the purpose of this type of transaction, it shifts the transaction out of the suspense account and into the correct account(s). An entry into a suspense account may be a debit or a credit.

The Chosen Odoo approach (macro) for this case is
1) from bank statement -> reconciliation widget -> reconciliation model
2) create move that have a dedicated checkbox
3) be able to reopen the bank statement line "like if there is no linked account move" and finally reconcile the transaction with the good invoice/bill (we can reprocess account move "to check")
4) when we reprocess, Instead of creating an account move : Check if there is an "to check" existing linked account move and remove all the account move lines then replace  them by the good ones --> we want to keep the sequence

closes odoo/odoo#30486
2019-02-08 10:11:41 +00:00
David Beguin 723789b6b1 [FIX] website_slides: Fix clean ACLs and refactor access options commit
Fixes related to commit 748b9072d6

 * fix template still having an unnecessary t-else whereas the t-if has
   been removed;
 * move order by strategy on right class;
 * fix access rights on intermediate model between channels and partners. It
   should be accessible to website publisher as they will have so manage
   channel members;
 * fix some typos;

closes odoo/odoo#30949
2019-02-08 12:01:12 +00:00
Aurélien Warnon c4c067509e [REM] website_slides: remove the 'state' field of slide.channel.partner
Purpose
=======

The 'state' field for a member of a channel did not imply anything functionally
so we decided to remove it. It allows to remove an unnecessary computed fields.
ACLs are updated accordingly.

If needed, we will soon be able to check partner_ids that have ordered but
not paid a channel / course product by searching the related 'sale.order' model
for such products.
2019-02-08 11:33:09 +00:00
Antoine Guenet eea58a3cf8 [FIX] web_editor: on anchor split, rerange and clean data on getValue
Due to a wrong order of operations, after splitting an anchor (press
ENTER), the range was setting on the first anchor. Now it sets on the
second one (as the code - but not the tests - suggests was supposed to
happen). Tests were adapted to reflect that change.

In tests, after splitting the anchor, `Wysiwyg.getValue` didn't always
properly clean up `data-original-title`. Targetting empty
`data-original-title` attribute instead of `aria-describedby` attribute
should fix that issue.

closes odoo/odoo#30923
2019-02-07 10:20:57 +00:00
William Henrotin b1fadbc6c6 [IMP] mrp: Work Order Form View
Small changes in the form view of WO

TaskID: 1903181

closes odoo/odoo#30654
2019-02-08 08:53:00 +00:00
wan 6dd25994bf [FIX] account: remove useless TOFIX lines
There is nothing preventint to remove this line
The second FIXME is preserved to keep the tests running, as the account functionality of the function may be removed

closes odoo/odoo#30323
2019-02-07 08:50:17 +00:00
Juhil Somaiya 5c13831dc5 [IMP] sale, base: partner form view improvement
Improved partner form consistency and clarity via following changes:
- Renamed string and tooltip from Shipping address to Delivery address
- Changed description of the customer address
- Re-organised contact partner form and added image of partner
- Changed default avatar to a simpler one that is not Stephane Bern
- Test case improvement

Task ID: 192044

closes odoo/odoo#29917
2019-02-08 06:37:35 +00:00
Cedric Snauwaert e67b22946d [FIX] base_vat: belgian vat number correct display
Odoo Accept the following mask for vat encoding :
BE0477472701
BE.0.477.472.701
BE.477.472.701
BE477.472.701
BE477472701

But, in certain cases we have to add the zero to be compliance (i.e. belgian official reports...). -> http://www.tvaintracommunautaire.eu/belgique.html

This commit make use of the compact method defined in stdnum.be.vat (which is used by vatnumber in order to validate the vat). The compact method return a 10 digits vat number starting with a 0 which is compliant with the official reports.

closes odoo/odoo#28523
2019-02-07 15:11:51 +00:00
Thibault Delavallée 29219b9c93 [IMP] website_slides: remove duplicated code
Code probably coming form a rebase conflict. Duplicated and therefore removed.

closes odoo/odoo#30921
2019-02-07 13:58:57 +00:00
Raphael Collet 4bc02d104e [FIX] stock: missing dependency of move_ids_without_package
closes odoo/odoo#30910
2019-02-07 13:13:15 +00:00
Raphael Collet d27e689056 [IMP] fields: dummy updates of one2many fields should not trigger recomputations 2019-02-07 13:13:15 +00:00
Robot Odoo 71bf0c1207 [MERGE][REF] website_slides: clean access and add membership on channels
Purpose of this merge is to clean access rights on slide models and give
less access to public / portal / internal users. Website publishers and
editors have rights to edit slides content and manage channels.

Another purpose is to clean and refactor access options on channels and slides.
Access to a given slide depends on the current user being a member of the
slide channel. A channel can be either public (joined easily) or on invitation
only (manual addition of members).

Slide can be flagged as preview, meaning they are accessible without any
concern about channel membership. It is used as teasing or free promotion
of a channel.

Publish flag is orthogonal. Non published slides are not visible to everyone
except website content editor. It allows to work and improve slides without
displaying them to members or public people.

Slide upload access is a bit cleaned. A can_publish field is added controlling
who can publish slides. Currently website publishers are allowed to publish
content. Not publishers people allowed to upload cannot publish their own
content. It stays in a submitted non published state.

Base for tests are also added. More of them will be added in future commits.

This merge is related to task ID 1937411 and closes PR #30847. More
generally this merge is linked to ongoing tasks

* task ID 1902304 (main eLearning task) PR #29876;
* task ID 1922159 (new user profile and gamification) PR #30514;
* task ID 1936153 (new homepage for slides) PR #30770;
* task ID 1937160 (payment flow and integration with ecommerce) PR #30914;

This merge is therefore not functionally complete itself and serves as a
preparation for other incoming commits. See sub commits for more details
on what has been done here.
2019-02-07 17:03:40 +01:00
Thibault Delavallée 797daba163 [IMP] website_slides: add widget to join a channel
Purpose is to add a new widget and its route allowing to join a channel.
As visibility is now mainly based on membership a widget to join channels
is required.

This commit is linked to task ID 1937411 and PR #30847.
2019-02-07 13:44:39 +00:00
Thibault Delavallée ddccd33bae [IMP] website_slides: improve upload slide screen
Slide upload access is a bit cleaned. A can_publish field is added controlling
who can publish slides. Currently website publishers are allowed to publish
content. Not publishers people allowed to upload cannot publish their own
content. It stays in a submitted non published state.

This commit is linked to task ID 1937411 and PR #30847.
2019-02-07 13:44:39 +00:00
Thibault Delavallée b91add891c [IMP] website_slides: add tests
Currently website_slides module lacks tests. This commit adds base for tests
and add some tests related to recently cleaned access rules and rights.

Future commits will gradually add more tests to the module as it evolves
towards a more broad and up-to-date application.

This commit is linked to task ID 1937411 and PR #30847.
2019-02-07 13:45:57 +00:00
Thibault Delavallée 748b9072d6 [IMP] website_slides: clean ACLs and refactor access options
Purpose of this commit is to clean access rights on slide models and give
less access to public / portal / internal users. Website publishers and
editors have rights to edit slides content and manage channels.

Another purpose is to clean and refactor access options on channels and slides.
Access to a given slide depends on the current user being a member of the
slide channel. A channel can be either public (joined easily) or on invitation
only (manual addition of members).

Slide can be flagged as preview, meaning they are accessible without any
concern about channel membership. It is used as teasing or free promotion
of a channel.

Publish flag is orthogonal. Non published slides are not visible to everyone
except website content editor. It allows to work and improve slides without
displaying them to members or public people.

Technically a new model is added to model membership on channels. It is
a decorated m2m between channels and partners; on this m2m the state of
membership is added. In a near future additional information will be stored
on this model, like completion of channel or certification information.

Other technical changes implied by this commit
 * visibility is simplified to either public or invite;
 * can_see and can_see_full are removed, as well as concept of 'partial'
   display of slides;
 * group_ids related to private access is removed;
 * a computed / searchable field is added to be able to efficiently find
   and search active members of a channel;

This commit is linked to task ID 1937411 and PR #30847.
2019-02-07 13:44:39 +00:00
Nimesh Jethva e9ac626c65 [IMP] account: Add chatter on bnk statements form view
This commit is related to task ID : 1871356

odoo/closes #26127
2019-02-07 13:27:04 +00:00
Robot Odoo 91ee6ba5a7 [MERGE] gamification: prepare use of gamification in slides and user profile
Purpose of this merge is to prepare addition of gamification in slides /
eLearning platform. In order to be able to use karma and the badges in other
modules we move those models in gamification.

A website_profile module is added to hold code, data and all necessary stuff
to display a user profile, including its gamification-related details. It
is a bridge between gamification and website. It will soon hold a revamped
user profile, used in both forum and slides.

More generally this merge is linked to ongoing tasks
 * task ID 1902304 (main eLearning task) PR #29876;
 * task ID 1922159 (new user profile and gamification) PR #30514;
 * task ID 1936153 (new homepage for slides) PR #30770;
 * task ID 1937160 (payment flow and integration with ecommerce) PR #30914;

This merge is therefore not functionally complete itself and serves as a
preparation for other incoming commits. See sub commits for more details
on what has been done here.

closes odoo/odoo#30908
2019-02-07 15:38:27 +01:00
mgh-odoo ca25a692bd [IMP] account, sale: Move terms and conditions to account
Purpose
=======

Be able to define terms and conditions if sales is not installed.

If sales is not installed, the user cannot define default terms and conditions
for his customer invoices since the setting in the sales section.

If sales is installed and default terms & conditions are defined, a customer
invoice created from scratch (not from an SO) will have them.

This is not consistent.

Task: 1917663

closes odoo/odoo#30140
2019-02-07 13:11:19 +00:00
Hetal Dhanak f711e6d6a2 [IMP] calendar: Improve calendar alarm computed name
Improve usability of fields 'reminder_ids' (calendar.appointment.type)
and 'alarm_ids' (calendar.event)

If the user does not set a meaningful 'name' on a newly created calendar.alarm,
it is a pain to select the desired record from those fields.

(Also, user should be able to edit existing calendar.alarm)

Related Task ID: 1923205

closes odoo/odoo#30129
2019-02-07 12:48:12 +00:00
Thibault DelavalléeandDavid Beguin 43740f94ea [IMP] website_slides: add dependency on website profile
Purpose is to prepare the use of gamification tools in slides. In this commit
we add the dependency on website_profile (gamification front-end) in slides
and add the slides category on challenges.

Partial commit linked to eLearning project. Main specifications related
to gamification and user profile can be found on task 1922159 (PR #30514).
Main specifications related to eLearning can be found on task 1902304
(PR #29876).

Co-Authored-By: David Beguin <dbe@odoo.com>
Co-Authored-By: Thibault Delavallee <tde@odoo.com>
2019-02-07 12:13:28 +00:00
Thibault DelavalléeandDavid Beguin b98564479b [ADD] website_profile: new module holding website-related code for gamification
Purpose is to be able to re-use frontend-related model, data and tools
for gamification. Currently only forum uses gamification. Soon slides module
will use them and user profile / biography will be expanded. This commit
prepares those features by already preparing the bridge module and adding
a publish option on badges.

Partial commit linked to eLearning project. Main specifications related
to gamification and user profile can be found on task 1922159 (PR #30514).
Main specifications related to eLearning can be found on task 1902304
(PR #29876).

Co-Authored-By: David Beguin <dbe@odoo.com>
Co-Authored-By: Thibault Delavallee <tde@odoo.com>
2019-02-07 12:13:28 +00:00
David Beguin 9e082662af [IMP] gamification : add ranks based on karma
To encourage forum and slides users to be more active ranks are now added.
They are directly linked to karma. The more the user has karma the more his
rank will be high.

The default rank is Newbie, with 1 point of karma. Users with 0 karma are
considered as inactive on forum or slides. When a user reach a new rank
a mail is sent to him to congratulate him with his new rank.

To add a button in the mail template to allow users to go directly on
a website section (like forum or slides) simply override
get_gamification_redirection_data to add the target url.

Partial commit linked to eLearning project. Main specifications related
to gamification and user profile can be found on task 1922159 (PR #30514).
Main specifications related to eLearning can be found on task 1902304
(PR #29876).
2019-02-07 12:13:28 +00:00
David Beguin 3b9dcb6d8d [REF] gamification, website_forum: move karma, badge and badge level to gamification
Purpose of this commit is to prepare addition of gamification in slides /
eLearning platform. In order to be able to use karma and the badges in other
modules we move those models in gamification.

Partial commit linked to eLearning project. Main specifications related
to gamification and user profile can be found on task 1922159 (PR #30514).
Main specifications related to eLearning can be found on task 1902304
(PR #29876).
2019-02-07 12:11:44 +00:00
XavierDo b8f2edd94c [FIX] core: remove email escape logic from html_sanitize.
Related to #30326

Before #30326, when calling html_sanitize, some content may be escaped
when it shouldn't. A simple example was images with cid links containing @.
(a first fix for another use case was made in 8aff53733b)

We suspect that this escaping (added in 71a92f46e4)
was made to avoid loosing email with format '<email@domaine>' in html_sanitize
to escape them if html_sanitize is called on plain text.

Anyway, only html should be passed to html_sanitize, and therefore email of format
<email@domain> should already be escaped.

PR #30326 fixes the unwanted behaviour in 12.0 and this commit removes
this logic in master.

closes odoo/odoo#30815
2019-02-07 08:53:45 +00:00
shreya thakrar c875d02572 [IMP] base: avoid empty language confusion
In User preferences, the empty language was confusing, rename it to 'System
(English)' instead of blank.
Rename English language as English (US).

Task ID : 1921583

closes odoo/odoo#30096
2019-02-07 10:08:59 +00:00
jem-odoo 794ebb0aaf [FIX] portal: cast type to consteq signed token
To post a comment with a signed token, we compare tokens with the pid.
The token is signed with the pid, which is an integer. When checking
access, we compare the token with a pid as char. Obviously, the comparison
failed, and posting the message is refused, as the 2 'pid' does not
share the same type.
This commit cast the recieved 'pid' into an integer before checking
special access.

closes odoo/odoo#30906
2019-02-07 08:49:53 +00:00
Hardik Prajapati 2a63c2efee [ADD] l10n_be: Add Brussels as a province in Belgium
Even if Brussels is not a province in Belgium, poeple are confused to not see it in the states of Belgium

TaskID: 1909249

closes odoo/odoo#30888
2019-02-07 07:33:44 +00:00
Parth Choksi aa07f73d6d [IMP] sale, pos_sale: Add industry in sales reporting
New reading level in the sales reporting : Customer Industry

Task ID: 1922025

closes odoo/odoo#30495
2019-02-07 04:36:18 +00:00
Martin Trigaux 2bba2e1a20 [IMP] point_of_sale: map accounts based on fiscal position
If a fiscal position is set on an order had uses account mapping, the account
for the generated accounting entries must be adapted
Changed in master for stability reason

opw-1910475

closes odoo/odoo#30883
2019-02-06 13:03:03 +00:00
Sébastien Theys f78b7a76d6 [FIX] web: fix kanban_image for binary data
`.value` is always bin size. By using `.raw_value` we allow the condition to be
true when actually using binary data.

This solves an issue when trying to display the image for a model being created
since at that time the URL does not work yet since the model does not exist.
Eg. website_sale extra images on product.

This also prevents (potentially a lot of) unnecessary GET to fetch images for
which we already have the binary data downloaded.

Part of task 34045

PR: #30881
2019-02-06 13:20:39 +00:00
Aaron Bohy 724504ec1b [FIX] web: pass x2many context to subrecords
Before this rev., the context specified on an x2many fields (in the
arch) wasn't fully propagated to the subrecords. This means that it
couldn't be used, e.g., in the template of the sub kanban view (see
parent commit).

PR: #30881
2019-02-06 13:20:28 +00:00
Aaron Bohy c9eb44d729 [IMP] web: expose context in kanban templates
This rev. allows to use variable 'context' in kanban view
templates.

Part of task 34045

PR: #30881
2019-02-06 13:20:19 +00:00
Fabrice Henrion ae7f82f621 [IMP] mail: change string label
closes odoo/odoo#30858
2019-02-06 13:55:51 +00:00
Aaron Bohy 791b1bd839 [IMP] web: Set a timeout on rainbow man destruction
Avoid traceback when the click that triggered the rainbow man
is the click that closes it.

Example: The last step of a tour.

closes odoo/odoo#29969
2019-02-06 12:58:58 +00:00
Priyanka Kakadiya 152af348f3 [IMP] sale: Improve tour + Move icon to sale_management
- Move application icon to sale_management
- Improve tour

Task: 1920454
2019-02-06 12:58:58 +00:00
Robot Odoo b6839a969d [IMP] survey: scoring & certification
Task #1902306

Purpose
=======

Preliminary cleanup
---------------------------

survey.question is now also the model used for the survey's pages (with the "is_page" field set to True).
This allows to put all the pages and questions together in a o2m field on the view side and
easily reorganize your survey by dragging the items around.

It also removes one level of encoding by directly having 'Add a page' and 'Add a question'
links on the tree view of questions, enabling a faster encoding.

However, this has the downside of making the code reading a little bit more complicated.
Efforts were made at the model level to create computed fields so that the use of these models
still seems somewhat logical. That means:
- A survey still has "page_ids" (question_and_page_ids filtered on is_page = True)
- These "page_ids" still have question_ids (questions located between this page and the next)
- These "question_ids" still have a "page_id"

That makes the use and display of these information at view and controller levels easier to understand.

Certification
----------------

This commit adds certification capabilities to the survey module.

A certification is a survey with the "certification" flag set to true than can be linked
to a certification email template that contains a certification document (PDF).
This template can be edited by the user in the technical settings to customize the certification email/document.

To be able to implement this certification concept, we also have to add scoring mechanisms to surveys.
survey.questions of type 'simple_choice' and 'multiple_choice' now have scores for the suggested answers.
These question scores allow to compute a global score that is used to determine whether the user has successfully
passed the certification or not.

As additional features, we also have:
- A time limit with an interface timer that limits the test to X minutes
  When reached, the survey is automatically submitted and unregistered (= unsubmitted) answers are not taken into account.
- A limited number of attempts for the survey/certification
  If reached, the user can't take the survey/certification anymore

The 'survey result' layout was adapted accordingly to show the success rate of participants and the correct answers
to the survey questions.

Randomization and survey layout selection
---------------------------------------------------------

The "page" concept is now only present in the user interface.
Surveys are split in "sections" that have two purposes:
- Organizing a (long) survey/certification
- Allow to pick a random questions count for that section (more information here after)

On the user interface, based on the questions_layout field, surveys are displayed:
- On a single page, where sections still appear but are only used as visual separations
- On multiple pages, having one page per section (this matches the previous behavior)
- On multiple pages, having one page per *question*

On top of that page concept, this commit added randomization for the survey questions.
The randomization mechanism will take X questions per section of the survey.
The survey.user_input is initialized with the selected questions to be sure to keep that
set of questions and avoid showing a new set of questions every time the user refreshes the page.
This also allows to easilly go back and know which question we have to show.

Specs
=======
- Create a new survey :
  - Add a description field for the survey

- Options on a survey :
  - Passing score : (sum of all good answers) in %
  - If No scoring => No passing score, no certificate
  - If Scoring with answers => Passing score and can see the answers (can create certificate)
  - If Scoring without answers => Passing score but can't review the answers at the end (can create certificate)
  - for the questions, if "no scoring" selected, can 't see the option "good answer" and "score" on the questions
  - If the 2 others options, can see the options "good answer" and "score" on the questions
  - all the types of questions are available for each option.

- Questions
  - Add the option correct answer on the multiples questions (one or more good answers)

- Certifications
  - If scoring, force "mandatory" for "mutliple choices (1or multiple answers)"
  - On the dashboard => visual information that this specific survey is a certification
  - Time Limit : The student is informed on the home screen of the survey of the time limit.
    The clock start when he clicks on "start survey"
  - Template of the certificate : send email with attachment PDF

- Front-end :
  - Add some margin
  - Replace "Back to survey" with the blue-bar from the portal
  - Add a timer (start when the survey starts)
  - Add a progress bar (number of section and number of question inside the section)

- Analyse of the results :
  - First a global graph with the number of people who''ve participated and passed the test

- Stages of a survey :
  - Remove the stage "Permanent"
  - 3 stages :
    - draft : not on-line but can be tested (with phantom token)
    - In progress : on-line
    - closed : not on-line
  - Who can test a survey : the manager and the user. Add this condition to the phantom token.

closes odoo/odoo#29577
2019-02-06 18:44:00 +01:00
Aurélien Warnon 120ff4a1db [FIX] survey: make survey access_token copy=False for duplicate
Task #1902306

Purpose
=======

The "access_token" needs to be unique so it should not be copied when
duplicating the survey.
2019-02-06 13:20:52 +00:00
Aurélien Warnon 77654855a8 [FIX] survey: make "matrix_type" required for matrix questions
Task #1902306

Purpose
=======

When creating a question of type "matrix", the "matrix_type" field needs to be "required".
(survey UI is broken if left empty).
2019-02-06 13:20:52 +00:00
Aurélien Warnon 99bb017f68 [IMP] survey: add invite_token to user_input to reset the attempts count
Task #1902306

Purpose
=======

When you invite people to take a certification multiple times, the user will have his "attempts" count reset
with every invitation.
This is important when there is a limited number of attempts available.
ex: A user invited twice will have 2 x allowed_attempts_count to succeed the survey.

Attempts are now separated in different pools using a "invite_token" field on the survey.user_input.
2019-02-06 13:20:52 +00:00
qsm-odoo eacaf02544 [FIX] website: restore some edit.js features
Following the new editor's merge at https://github.com/odoo/odoo/pull/29775,
the website 'edit.js' file received mistakes / useless code.

https://github.com/odoo/odoo/pull/30839 fixes one of them. Hopefully
this commit will solve the remaining ones.

- https://github.com/odoo/odoo/blob/12.0/addons/website/static/src/js/menu/edit.js#L43
  was moved for no reason at all at the bottom of the method alongside
  its comment which broke the feature and made the comment wrong.

- Changed a '.a' selector into a '.a:not(.b), .a.b' selector...
  https://github.com/odoo/odoo/blob/b6db6b878c5d329c19262d829e13726c3a3a1d25/addons/website/static/src/js/menu/edit.js#L136

- For the same selector, a 'FIXME' comment was removed while it was not
  fixed (this restores it as a 'TODO' instead of a 'FIXME' though).

- On edition stop, removed all the data-editor-message, even the
  specific ones that were not added by the editor (note that it was not
  a problem for the current ones in Odoo as they were by chance on the
  main editable elements which made them not saved in the database):
  https://github.com/odoo/odoo/blob/b6db6b878c5d329c19262d829e13726c3a3a1d25/addons/website/static/src/js/menu/edit.js#L177

closes odoo/odoo#30870
2019-02-06 12:48:01 +00:00
Jaykishan SolankiandRavi Gohil 7c6b8baf03 [IMP] account, point_of_sale,...: Improve usability
- Improve warning message when user tries to create credit note
- Hide 'Active' column in Taxes/Currencies and added default 'Active' filter in Taxes
- Removed 'save this page...' under 'Account Follow-up Levels','Budget Management',
  'Asset Management','Deferred Revenues Management' section in Accounting Settings
- Fixed margin between Cash Rounding checkbox and it's link in Accounting Settings
- Renamed action menu 'Confirm Payments' to 'Post Payments' for payments to make it
  consistent with it's form view
- Hide payment acquirers config for non-adviser users and also restric editing access
  rights for non advisior and employee user (only data read access rights on payment acquirers)
- Renamed Journal type from 'Sale' to 'Sales' and journals 'POS Sale Journal, Stock Journal,
  Cash Basis Tax Journal to Point of Sale Journal, Inventory Valuation Journal and Cash Basis
  Taxes Journal respectively
- Renamed the stat button 'Entries' to 'Items' for account assets form view
- Improved description and name of account_voucher module
- Improved Menu typo, Purchase Receipts to Purchases Receipts
- account_check_printing, hr_expense_check: made field storing check numbers character
  instead of integer, integer field for check numbers shows check numbers as amount
  (i.e., with thousand separator) on UI, which is wrong, hence replaced it with character
  type field and a constraint to allow only numbers to be stored in it.

TaskID: 40157

Co-authored-by: Ravi Gohil <rgo@odoo.com>

closes odoo/odoo#21982
2019-02-06 11:57:29 +00:00
Aurélien Warnon 445541989f [IMP] survey: add randomization and survey layout selection
Task #1902306

Purpose
=======

The "page" concept is now only present in the user interface.
Surveys are split in "sections" that have two purposes:
- Organizing a (long) survey/certification
- Allow to pick a random questions count for that section (more information here after)

On the user interface, based on the questions_layout field, surveys are displayed:
- On a single page, where sections still appear but are only used as visual separations
- On multiple pages, having one page per section (this matches the previous behavior)
- On multiple pages, having one page per *question*

On top of that page concept, this commit added randomization for the survey questions.
The randomization mechanism will take X questions per section of the survey.
The survey.user_input is initialized with the selected questions to be sure to keep that
set of questions and avoid showing a new set of questions every time the user refreshes the page.
This also allows to easilly go back and know which question we have to show.
2019-02-06 10:34:43 +00:00
Aurélien Warnon afb1abbb60 [IMP] survey: scoring & certification
Task #1902306

Purpose
=======

This commit adds certification capabilities to the survey module.

A certification is a survey with the "certification" flag set to true than can be linked
to a certification email template that contains a certification document (PDF).
This template can be edited by the user in the technical settings to customize the certification email/document.

To be able to implement this certification concept, we also have to add scoring mechanisms to surveys.
survey.questions of type 'simple_choice' and 'multiple_choice' now have scores for the suggested answers.
These question scores allow to compute a global score that is used to determine whether the user has successfully
passed the certification or not.

As additional features, we also have:
- A time limit with an interface timer that limits the test to X minutes
  When reached, the survey is automatically submitted and unregistered (= unsubmitted) answers are not taken into account.
- A limited number of attempts for the survey/certification
  If reached, the user can't take the survey/certification anymore

The 'survey result' layout was adapted accordingly to show the success rate of participants and the correct answers
to the survey questions.

Specs
=======
- Create a new survey :
  - Add a description field for the survey

- Options on a survey :
  - Passing score : (sum of all good answers) in %
  - If No scoring => No passing score, no certificate
  - If Scoring with answers => Passing score and can see the answers (can create certificate)
  - If Scoring without answers => Passing score but can't review the answers at the end (can create certificate)
  - for the questions, if "no scoring" selected, can 't see the option "good answer" and "score" on the questions
  - If the 2 others options, can see the options "good answer" and "score" on the questions
  - all the types of questions are available for each option.

- Questions
  - Add the option correct answer on the multiples questions (one or more good answers)

- Certifications
  - If scoring, force "mandatory" for "mutliple choices (1or multiple answers)"
  - On the dashboard => visual information that this specific survey is a certification
  - Time Limit : The student is informed on the home screen of the survey of the time limit.
    The clock start when he clicks on "start survey"
  - Template of the certificate : send email with attachment PDF

- Front-end :
  - Add some margin
  - Replace "Back to survey" with the blue-bar from the portal
  - Add a timer (start when the survey starts)
  - Add a progress bar (number of section and number of question inside the section)

- Analyse of the results :
  - First a global graph with the number of people who''ve participated and passed the test

- Stages of a survey :
  - Remove the stage "Permanent"
  - 3 stages :
    - draft : not on-line but can be tested (with phantom token)
    - In progress : on-line
    - closed : not on-line
  - Who can test a survey : the manager and the user. Add this condition to the phantom token.
2019-02-06 10:34:40 +00:00
Aurélien Warnon dba4783326 [REF] survey: convert survey.page to survey.question -> is_page=True
Task #1902306

Purpose
=======

survey.question is now also the model used for the survey's pages (with the "is_page" field set to True).
This allows to put all the pages and questions together in a o2m field on the view side and
easily reorganize your survey by dragging the items around.

It also removes one level of encoding by directly having 'Add a page' and 'Add a question'
links on the tree view of questions, enabling a faster encoding.

However, this has the downside of making the code reading a little bit more complicated.
Efforts were made at the model level to create computed fields so that the use of these models
still seems somewhat logical. That means:
- A survey still has "page_ids" (question_and_page_ids filtered on is_page = True)
- These "page_ids" still have question_ids (questions located between this page and the next)
- These "question_ids" still have a "page_id"

That makes the use and display of these information at view and controller levels easier to understand.
2019-02-06 09:37:59 +00:00
wan b18ebde9c2 [FIX] account: Clean receivable/payable bank reconciliation
Task 1933763
Be able to reconcile this scenario :

- You invoiced 00 to a contact—> receivable 00
- You received a 0 bill from the same contact—> payable 0
- Contact pay you 0 (bank statement)
- You want to reconcile all the things easily from bank reconciliation

the story looks like (bank move is the one to be managed) :
```
journ    n° compte              contact        DEBIT    CREDIT    Mach
sales    12 400000 Clients      Azure Interior 100.00€    0.00 €  A1
sales    12 701000 Ventes       Azure Interior   0.00 € 100.00 €
purchase 11 440000 Fournisseurs Azure Interior   0.00 €  50.00 €  A2
purchase 11 600000 Achats       Azure Interior  50.00 €   0.00 €
bank      3 550001 Bank         Azure Interior  50.00 €   0.00 €
bank      3 400000 Clients      Azure Interior   0.00 € 100.00 €  A1
bank      3 440000 Fournisseurs Azure Interior  50.00 €   0.00 €  A2
```

closes odoo/odoo#30664
2019-01-30 08:16:00 +00:00
Romain Estievenart 3956afb8e4 [IMP] web: expose FieldX2Many relational fields
Expose to public the variable FieldX2Many.

Task ID: 1910385

closes odoo/odoo#30512
2019-02-06 10:05:11 +00:00
Robot Odoo 6001fb227f [IMP] core: more details in debug mode access error messages
Access rights issues are currently hard to diagnose (especially from
ir.rule) due to how little details they provide.

This makes a pass over various sources of access errors and:
* improve/clarify the base message
* provide an alternative message with more details in debug mode

- [x] ir.model.access
- [x] ir.rule
- [x] related fields
- [x] fields with groups
- [x] close #28451 (provide both _name and _description in access error messages)

Task [1886746](https://www.odoo.com/web?debug#id=1886746&model=project.task&view_type=form&menu_id=4720)

closes odoo/odoo#30144
2019-02-06 13:40:29 +01:00
Xavier Morel 51819dcf17 [IMP] access errors through related fields
When an access error bubbles through a related field (aka the user
doesn't have access to the delegate or the delegate's field), append
the "intermediate step" so that it's easier to understand e.g. that
the access error to a partner really comes from accessing a user or
somesuch.
2019-02-06 11:29:29 +00:00
Xavier Morel 0f167634be [IMP] access error messages on fields with groups 2019-02-06 11:29:29 +00:00