Commit Graph
110459 Commits
Author SHA1 Message Date
Yannick Tivisse c8601f4384 [MERGE] base/res_config: Clean model and behavior of configuration forms
Purpose:
========

The res.config.settings are quite a mess. The API is not well know and the general usage in the common modules is bad.

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

Clean use of ir.values in models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- clean use of ir.values -> those should be only real default values for existing fields in other models.
- Use ir.config_parameter or something else if conversion is required

reset values when option is disabled
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

propagate checkboxes in settings. Ex: "use <my feature> opens <feature_value> configuration". Code should handle both <my_feature> and <feature_value>. Unactivating a feature should disable it really.

SALES
default terms & conditions
WEBSITE
Google Analytics
Google Analytics in dashboard
INVENTORY
Security Lead Time for Sales -> reset to 0
Security Lead Time for Purchase -> reset to 0
No Rescheduling Propagation -> reset to 1
MANUFACTURING
Security Lead Time -> reset to 0

clean alias congiguration
~~~~~~~~~~~~~~~~~~~~~~~~~

crm, project: remove unnecessary and unused generate_sales_team/project_alias, conf is done on sales team / project
crm: generate_lead_from_alias cleaned
hr_expense: correctly take into account "Use Mailgateway" settings, reset alias if not set

pos: mutli sales price settings cleaned
sales: multi sales price settings cleaned, default deposit product cleaned
website: has_google_analytics, has_google_analytics_dashboard, has_google_maps settings cleaned
website_sale: multi sales prices settings cleaned
print: default_provider_id

Ease google analytic settings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

it's hard to get all the google analytics working. Setup steps are still confusing. And if you set up analytics API first (before creating an account), you get a traceback in the dashboard...

review google analytics id wizard
    - How to get my Tracking ID
    - How to get my API Client ID
    - open those links in new tabs

make sure any traceback pops up if the user enter a client ID without a Tracking ID. It is the case for now. One way is to block the
user with a warning: Please enter your Tracking ID.

as soon as an ID is set, activate related features and populate fields in website settings + some changes in labels

only display Google Analytics in Dashboard in website settings if Google Analytics is checked
+ blocking warning if the user enters a Client ID without any Tracking ID

Reorganise files according to the guidelines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Declare models in camel case, place python files in models, xml views in views...

Remove some useless/unused code
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Some chunck of code are never called or are useless.

Clean ir.actions.todo models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Remove some useless fields:
- type: Historically we used ir.actions.todo to make complex things. Now we only use them to redirect to a specific action when a module is installed. All our ir.actions.todo type is `automatic`
- Note: Useless
- Group_id: All our ir.actions.todo are launched by the administrator. No need to specify groups on it.

Prevent to be redirected everywhere on update
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Prevent to have more than one open ir.actions.todo. This avoid this use case:
- Install ecommerce, be redirect to the theme selection
- Install note, be redirected to /shop.

We just take the last defined ir.actions.todo into account.

Stay on a config setting form by pressing apply
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If we click on Apply, we want to stay on the config page to see the new fields coming from the module you just installed

Keep the current behavior when installing a module from the App menuitem, which is either jumping to the app switcher or jumping to a specific action if defined on this module

Clean default method to get/set the values on a config form
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Currently there are 4 types on fields on res_config:
- `default_`: These fields should use ir.values and they have been cleaned in a previous section of this commit message
- `group_`: They define security groups
- `module_`: They allow to install/uninstall modules
- Other fields: They are the other fields that are implemented in a quite messy way.

Currently all the methods beginning by `get_default` are used to fetch their default values, usually by looking in the ir.config_parameter table.
Currently all the methods beginning by `set_` are used to set their values, usually in the ir.config_parameter table.

This section purpose is to replace all the occurences of `get_default_foo` and `set_foo`. As these methods won't be called anymore, a warning is logged to notice its deprecation. They are replaced by the generic methods `get_values` and `set_values` that should be overridden to define the behavior of the added fields.

Add a test on res_config on page loading and saving
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Try to create and execute all res_config models. Target settings that can't be loaded or saved and avoid remaining methods get_default_foo` or `set_foo` that won't be executed.
2017-06-19 17:38:19 +02:00
Yannick Tivisse e54f70d3cc [IMP] base: Add a test on res_config on page loading and saving
Try to create and execute all res_config models. Target settings that can't be
loaded or saved and avoid remaining methods `get_default_foo` or `set_foo` that
won't be executed is foo != `fields`
2017-06-19 17:37:38 +02:00
Yannick Tivisse 100f320217 [REF] base/res_config: Deprecate get_default_foo and set_foo
Currently, all the methods that start with `get_default_` and `set_` are called on a res.config.settings loading or saving.

This commit purpose is to replace all the occurences of `get_default_foo` and `set_foo`. As these methods won't be called anymore, a warning is logged to notice its deprecation.

The generic method `get_default_fields` and `set_fields` could be improved too. The method names and API are not so good:

    Why "default" fields? What you ask for is the current value of the stuff, shown as fields in the model. The values are fed as default values in the wizard, but that's an implementation trick.
    Why "fields"? What you ask for are configuration parameters, and such things.
    Why passing a list of fields? Its value is never used.

We should further simplify the API of both methods to something like

def get_values(self):
    return {}

def set_values(self):
    pass
2017-06-19 17:37:38 +02:00
Yannick Tivisse 56feb8dd16 [IMP] base: Load actions todo on button_immediate_install 2017-06-19 17:37:38 +02:00
Yannick Tivisse 1196409a9f [IMP] base: Stay on a config view after save 2017-06-19 17:37:38 +02:00
Yannick Tivisse 75c9248f90 [IMP] base: Remove seemingly unused wizard 2017-06-19 17:37:38 +02:00
Yannick Tivisse d1fc62df0b [IMP] base: Prevent to have more than one open ir.actions.todo 2017-06-19 17:37:38 +02:00
Yannick Tivisse 2132178f1f [REF] base: Remove some fields on ir.actions.todo
All our ir.actions.todo records are automatic.
2017-06-19 17:37:38 +02:00
Yannick Tivisse 057ed8eacf [IMP] base: Remove a seemingly unused method 2017-06-19 17:37:38 +02:00
Yannick Tivisse e1ee9fee8d [IMP] sale,pos: Use a correct class name according to guidelines 2017-06-19 17:37:38 +02:00
Yannick Tivisse 3055b00c44 [IMP] base: Introduce generic methods get_default_field and set_fields
Method `get_default_fields`
===========================

Currently all the methods beginning by `get_default` are used to fetch their default values, usually by looking in the ir.config_parameter table.

As several methods `get_default_fields` have been defined in res_config classes, it better to define it in base and calling to super to avoid side effects like the following example
- 2 classes that override the same class and define the same method. In that case one method will never be called, as it is ovewritten by the other.

Method `set_fields`
===================

Currently all the methods beginning by `set_` are used to set their values, usually in the ir.config_parameter table.

As several methods `set_fields` have been defined in res_config classes, it better to define it in base and calling to super to avoid side effects like the following example
- 2 classes that override the same class and define the same method. In that case one method will never be called, as it is ovewritten by the other.

Methods `get_default_foo` and `set_foo`
=======================================

This commit deprecates the method starting with `get_default_` or `set_` in the res.config models. A warning is raised in that case.
2017-06-19 17:37:38 +02:00
Yannick Tivisse 3eb37589ab [IMP] purchase: Remove useless default value for po_lead 2017-06-19 17:37:38 +02:00
Yannick Tivisse f5df7c6002 [FIX] base: Store correctly ir.values according to the basemodel field type 2017-06-19 17:37:38 +02:00
Yannick Tivisse a38a3e93c2 [MOV] *: Reorganize configuration files according to guidelines 2017-06-19 17:37:38 +02:00
Hiral Bhavsar 100ab909e6 [IMP] website: Restructure the 'Google Analytics' wizard.
* Set the blocking warning if the user enters a 'Client ID' without
   any 'Tracking ID'.
 * 'Google Analytics in Dashboard' field is visible only if
   'Google Analytics' is checked in website settings.
 * Get/Set the value of 'google_analytics_key' and
   'google_management_client_id' from 'website' model instead of
   'ir.config_parameter' on 'Google Analytics' wizard.
 * If ID is set on 'Google Analytics' wizard then activated the related
 features and populate fields in website settings.
2017-06-19 17:37:38 +02:00
Thibault Delavallée e331c0bd19 [IMP] website: improve setting ga_client_id from dashboard
It now update the website settings parameter use_google_analytics_dashboard
so that the settings are correctly updated with the user choice.

Implementation is changed so that the dashboard uses a jsonRpc call instead
of directly calling ir_config_parameter set_param.
2017-06-19 17:37:38 +02:00
Thibault Delavallée ac23ca499e [REF] website: use config parameter instead of ir values in settings
Fields like `default_foo` still used ir.values although those are system-wide
parameters and should therefore be stored in ir.config_parameter
table.

When no default_model is set on a field, don't prefix it by `default_`.
2017-06-19 17:37:38 +02:00
Thibault Delavallée a3301757f0 [FIX] website: dashboard should correctly check user groups
Probably to backport.
2017-06-19 17:37:38 +02:00
Thibault Delavallée 2bbfce88d0 [REF] stock: use config parameter instead of ir values in settings
Fields like `default_foo` still used ir.values although those are system-wide
parameters and should therefore be stored in ir.config_parameter
table.

When no default_model is set on a field, don't prefix it by `default_`.
2017-06-19 17:37:38 +02:00
Thibault Delavallée 7efa2b63a6 [REF] sale_stock: use config parameter instead of ir values in settings
Fields like `default_foo` still used ir.values although those are system-wide
parameters and should therefore be stored in ir.config_parameter
table.

When no default_model is set on a field, don't prefix it by `default_`.

Also, reset security_lead when use_security_lead is unchecked to avoid it to be used in further computations
2017-06-19 17:37:38 +02:00
Thibault Delavallée 71e5c8b0b5 [REF] (website_)sale: use config parameter instead of ir values in settings
Fields like `default_foo` still used ir.values although those are system-wide
parameters and should therefore be stored in ir.config_parameter
table.

When no default_model is set on a field, don't prefix it by `default_`.
2017-06-19 17:37:38 +02:00
Thibault Delavallée fdace36840 [REF] sale: fix use of default terms and conditions
Various code using the sale_note field (default terms and conditions)
is updated to check the use_sale_note field that is the setting
enabling it.

This is a preferred solution compared to resetting sale_note each time
use_sale_note is set to False in order to avoid loosing the data
users may have entered in sale_note field.
2017-06-19 17:37:38 +02:00
Thibault Delavallée 682a648be0 [REF] purchase: use config parameter instead of ir values in settings
Fields like `default_foo` still used ir.values although those are system-wide
parameters and should therefore be stored in ir.config_parameter
table.

When no default_model is set on a field, don't prefix it by `default_`.

Also, reset po_lead when use_po_lead is unchecked to avoid it to be used it further computations.
2017-06-19 17:37:38 +02:00
Thibault Delavallée b9c45fbabc [REM] project: remove deprecated generation of alias on sales team
According to usability experts configuring a sales team alias should
be done directly on the sales team view and not through an hidden
and strangely configured settings.
2017-06-19 17:37:38 +02:00
Thibault Delavallée b55a5aa605 [REF] point_of_sale: use config parameter instead of ir values in settings
Fields like `default_foo` still used ir.values although those are system-wide
parameters and should therefore be stored in ir.config_parameter
table.

When no default_model is set on a field, don't prefix it by `default_`.
2017-06-19 17:37:38 +02:00
Thibault Delavallée 8572ac79e7 [REF] mrp: use config parameter instead of ir values in settings
Also, correctly reset manufacturing lead time

Settings now correctly use an ir.config_parameter telling whether to
use or not manufacturing lead time. An onchange is added in order to
ensure that lead time is not still used by code although the settings
is unchecked.
2017-06-19 17:37:38 +02:00
Thibault Delavallée 76bf5dc83d [REF] hr_expense: fix settings using volatile checkboxes
This commit fixes

 * `default_alias_email` is now called use_mailgateway to better reflect its use. When
   unchecked the alias_prefix value is set to False in order to
   reset the alias.
 * empty list message displays receipts alias only if the mailgateway
   option is activated
 * some code cleaning so that get_default_ and set_ methods are put
   into a sole method in order to lessen code size
2017-06-19 17:37:38 +02:00
Thibault Delavallée 4b5513cfd4 [REF] crm: use config parameter instead of ir values in settings
Fields like `default_foo` still used ir.values although those are system-wide
parameters and should therefore be stored in ir.config_parameter
table.

When no default_model is set on a field, don't prefix it by `default_`.

Also, remove deprecated generation of alias on sales team.

According to usability experts configuring a sales team alias should
be done directly on the sales team view and not through an hidden
and strangely configured settings.
2017-06-19 17:37:38 +02:00
qsm-odoo 0bd189d280 [FIX] website(_*): properly style primary buttons
* portal, sale

Some primary buttons had both the 'btn-primary' and 'btn-default'
classes, which is wrong. In standard bootstrap, the 'btn-default'
class seems to be masked by the use of 'btn-primary' but it is not
the case in some of our themes.
2017-06-19 16:10:30 +02:00
Jerther 3553c555e0 [IMP] tools: add filename in error message of bad schema
To easily identify the file responsible for the error

Closes #17622
Fixes #15869
2017-06-19 15:20:24 +02:00
Florent de Labarre 004412749b [IMP] purchase: clarify code
The sum of list is confusing
Work with recordsets directly

Closes #17673
2017-06-19 14:06:32 +02:00
Richard Mathot 9bcd928bca [FIX] hr_recruitment: fix d83e8e4eb5
People want to be able to edit their email templates without having them
overwritten at upgrade.
2017-06-19 08:38:54 +02:00
Fabien Pinckaers dfe6769f47 [IMP] hr_recruitment: mails CSS fix 2017-06-16 15:34:51 -07:00
Fabien Pinckaers d83e8e4eb5 [IMP] hr_recruitment: Improved email templates & website thank you page 2017-06-16 11:59:54 -07:00
Richard Mathot 2dcf233a28 [IMP] tests: better reporting of PhantomJS crashes
When PhantomJS crashes due to a memory leak/segmentation fault, it will
now be logged, allowing to distinguishes timeouts from crashes more
easily.
2017-06-16 14:21:12 +02:00
Benjamin Willig ff8c2d66a1 [IMP] point_of_sale: add extendable method
To build the key when grouping data for account move line creation

Closes #17596
2017-06-16 10:45:56 +02:00
Joren Van Onder b31435ab5d [FIX] http: replace forward-ported urlparse with werkzeug.urls
Introduced by forward-port of eaa3682bb6
at ed2ddeccdf. At
01e3514147 urlparse was replaced with
werkzeug.urls.
2017-06-15 14:19:30 -07:00
Richard Mathot 41e2a7de77 [FIX] base: forbidden Py2 builtin reintroduced by forward-port ed2ddeccdf 2017-06-15 22:31:20 +02:00
Christophe Simonis fd78b89a02 [MERGE] forward port branch saas-16 up to acfebff880 2017-06-15 21:50:35 +02:00
Christophe Simonis acfebff880 [FIX] *: correct PY3 compatibility introduced by previous forward-ports 2017-06-15 19:24:03 +02:00
Christophe Simonis 2a008d5168 [MERGE] forward port branch saas-15 up to 2f6edfef49 2017-06-15 19:04:51 +02:00
Christophe Simonis 2f6edfef49 [FIX] resource: remove bad test introduced by previous forward-port 2017-06-15 19:00:54 +02:00
Christophe Simonis ed2ddeccdf [MERGE] forward port branch saas-16 up to 1b50c829ef 2017-06-15 18:46:47 +02:00
Christophe Simonis 1b50c829ef [MERGE] forward port branch saas-15 up to 9713dc2e1f 2017-06-15 18:44:16 +02:00
Christophe Simonis 9713dc2e1f [MERGE] forward port branch saas-14 up to 96595772e0 2017-06-15 18:39:59 +02:00
Christophe Simonis 96595772e0 [MERGE] forward port branch 10.0 up to dc8b473a03 2017-06-15 18:35:46 +02:00
Christophe Simonis dc8b473a03 [MERGE] forward port branch saas-11 up to dd7b2556c6 2017-06-15 17:52:49 +02:00
Christophe Simonis dd7b2556c6 [MERGE] forward port branch 9.0 up to 9e324c061c 2017-06-15 17:48:26 +02:00
Simon Lejeune cb73aaf71b [FIX] stock: inventory adjustment and negative quants
It is still possible to have negative and positive quants in the same
location because of returns: if you send something to the customer that
is not there and you return it, you will still be able to reserve the
returned goods to send to another client.

Before, if you would do an inventory adjustment, it would not take into
account these returned quants and their negative counterpart, which made
them difficult to get out of the system.

This fix takes them into account by creating two movements for one
inventory line: move the positive counterpart to the inventory location
before getting back from this location the same quantity.

This way, even if you have 0 as quantity on hand but you have those 2
quants, it will eliminate them. (if you are increasing the stock, part
of the process might have done it automatically already).

Test cases contributed by @jir-odoo

Cherry-pick of be9dce625c
2017-06-15 17:42:10 +02:00
Christophe Simonis 9e324c061c [MERGE] forward port branch saas-6 up to 88802b066c 2017-06-15 17:29:17 +02:00