Commit Graph
44 Commits
Author SHA1 Message Date
Thibault DelavalléeandVictor Feyens d875bcd79d [IMP] gamification, google_drive, project: limit usage of search on ir.model
Purpose of this commit is to globally improve code performance by limiting
search impact by using cache when accessing ir.model.

Note that tests are left untouched as they are generally done using admin
(or at least data preparation is done as admin). Diff is kept small currently.

Task-2638444
PR odoo/odoo#76005

Co-Authored-By: Thibault Delavallée <tde@odoo.com>
Co-Authored-By: Victor Feyens <vfe@odoo.com>
2021-09-08 07:56:03 +00:00
Martin Trigaux 15692f3948 [IMP] *: merge ir.model.data helpers
remove _get_id and _get_object_reference that were one liner to
_xmlid_lookup
2021-08-10 13:49:05 +02:00
Martin Trigaux c7bac3dee0 [IMP] *: make ir.model.data helper private
No reason to interfact with them directly in RPC
2021-08-10 13:49:04 +02:00
Martin Trigaux aa8eba2fb9 [FIX] *: add sudo when accessing models 2021-08-10 13:49:04 +02:00
Yannick Tivisse 60aa239897 Revert "[FIX] google_drive: fix traceback when add filter"
This reverts commit 82f236d98e322efd84c873df54f8e728e1d2a1bf.

The fix is actually not solving all the issues, and also introduce
a behavior change. Actually, the expected result for filters like

<filter string="My Pipeline" name="my" domain="[('user_id', '=', uid)]"/>

will result into a evaluated filters, but invalid as the uid is set to
the person configuring the google configuration, not the user who will
use it.

As it is tricky (or even impossible) to solve the issue properly in all
the cases, we prefer to warn the user that the filter is invalid instead.

closes odoo/odoo#66042

X-original-commit: 5df2c1d10318cc53f1c3e90256cba6a48d246dcb
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-02-12 10:53:20 +00:00
Victor Feyens dce6a8e080 [FIX] google_drive: fix wrong constraint definition
Finetuning of 3174d2f56e

* the constraint method shouldn't return anything, but raise when a record is invalid
* the constraint should work when self contains multiple records
* the message should clearly explain which record is invalid.

Task Id: 2328664
COM PR: https://github.com/odoo/odoo/pull/55525
ENT PR: https://github.com/odoo/enterprise/pull/12250
2020-11-20 10:04:27 +00:00
Kamesh Patel c74517e503 [FIX] google_drive: fix traceback while create templates
Before this commit:

While creating new templates it will give a traceback

After this commit:

While creating new templates it will not give a traceback

LINKS

Task-2334852

closes odoo/odoo#59502

X-original-commit: d04a1b869ef73c302dcd9a1cb04f6d952b0a3db3
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-10-08 11:46:20 +00:00
Martin Trigaux a74a648030 [IMP] *: use ast.literal_eval
When simply need to parse a domain, it is easier

Add .strip() on ir.ui.view as ast.literal_eval produces an syntax
error if the node starts with spaces (as done in the xpath of
hr_attendance.view_employee_form_inherit_hr_attendance)

closes odoo/odoo#43831

Related: odoo/enterprise#7894
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-01-28 13:58:05 +00:00
Adrian Torres 3da477dfc5 [FIX] *: adapt code to comply with new ondelete policy
The ondelete policy must be explicitly set for m2o fields whose inverse
is a reflection model (ir.*)
2019-11-07 08:39:17 +00:00
Christophe Simonis 140ee6b8f0 [MERGE] forward port branch saas-12.4 up to 98a55917a6 2019-08-14 16:48:10 +02:00
Christophe Simonis 0fadd586fa [MERGE] forward port branch 12.0 up to ff9ddfdacc 2019-08-06 15:57:57 +02:00
David Dufresne 921fab992d [FIX] google_drive: do not reset refresh_token
When setting the authorization code, a refresh token is generated in
the background and stored in a system parameter.

However, when saving the general settings (res.config.settings)
without changing the authorization code, the refresh token is deleted.

The refresh token should only be deleted if the authorization was
removed.

This was not the case as the set_param is always called and a value is
only computed when the authorization code has changed. The current
value was never retrieved.

Set a ir.config_parameter only when it a value has changed.

closes odoo/odoo#35028

Signed-off-by: Jérome Maes (jem) <jem@openerp.com>
2019-08-01 14:11:54 +00:00
Adrian Torres 4b38cc6590 [REM] *: calls to @api.multi
Multi is the default api for methods, it is not necessary to explicitly
decorate methods with it, adds clutter and most people use it because
they see that the rest of the code uses it.

Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
2019-07-17 14:13:12 +02:00
Raphael Collet 368e9530f4 [REF] *: record.env.user._is_XXX() -> record.env.is_XXX()
Superuser mode implies `record.env.is_XXX()`.
2019-07-04 11:32:22 +00:00
Priyanka Kakadiya 624fdc77d4 [IMP] google_drive : better google drive configuration
Improve the configuration setting of google drive to make it more userfriendly
Display a message when google drive is enabled but no token have been generated

Task: 1894961

closes odoo/odoo#29562
2019-02-14 11:40:57 +00:00
Adrian Torres ee6dc40a60 [IMP] fields: forbid required m2o ondelete set null
A many2one field that is required means that its column cannot contain
null values, however the default ondelete policy for all m2o fields is
`set null`, which contradicts `required=True`.

This patch will, by default, apply the `restrict` policy to required m2o
fields unless the ondelete attribute is explicitly specified. However,
if the policy specified is `set null`, a ValueError will be raised
whenever the registry registers the field as this makes no sense.

The default ondelete policy remains unchanged for non-required m2o
fields (set null)

closes odoo/odoo#30122
2019-01-29 16:17:03 +00:00
Adrian Torres 52f5528cfb [REF] *: replace deprecated pycompat helpers for builtins
This commit replaces calls to pycompat helpers that were intended for
python 2 <-> python 3 interoperability for python 3 builtins, as python
2 is no longer officially supported by Odoo.

This includes:
    * calls to imap/izip/ifilter replaced by map/zip/filter
    * uses of text_type replaced by str
    * uses of unichr replaced by chr
    * calls to implements_to_string, implements_iterator removed
    * string_types and integer_types replaced by str, int respectively
    * calls to to_native replaced by calls to to_text

This is done in preparation to the removal of these deprecated helpers
in the following commit.
2018-11-29 09:28:17 +00:00
Christophe Simonis a1b384d66b [MERGE] forward port branch saas-11.3 up to 2de573440e 2018-09-17 19:40:47 +02:00
Nicolas Martinelli a8950a9e8f [FIX] google_drive: google_drive_refresh_token
When saving the settings, the `google_drive_refresh_token` is never set.

This is due to the `ir.config_parameter` which was retrieved after being
saved.

opw-1882068
2018-09-17 08:28:38 +02:00
Benjamin Stiens 6383120f3b [IMP] all: Improve error messages
Many error messages are misleading or too "vague"
This task aims to improve all error message.

Task #47042
PR #23321
2018-05-28 16:45:48 +02:00
Christophe Simonis a98b46b8f5 [MERGE] forward port branch saas-11.1 up to fa1f2132e7 2018-01-22 18:44:05 +01:00
Christophe Simonis bd3869bd3a [FIX] core,google_drive: python3 compatibility 2018-01-19 13:42:26 +01:00
Christophe Simonis 2f95cfb8ed [MERGE] forward port branch saas-16 up to f99c4f2b48 2018-01-19 12:43:58 +01:00
Lucas Perais (lpe) 5140d3d10f [FIX] google_drive: adpating to new framework JS
The google_drive module has not been converted to the new Odoo Javascript framework, and hence was not even started.
This commit corrects that.

The logic is essentially the same as in previous versions

The test implemented contains an inevitable hack that makes sure no other test is affected,
in particular by the new route that the module calls (and that any Sidebar will call)

OPW 801145

closes #21993
2018-01-17 09:35:32 +01:00
Richard Mathot a18bd499ac [REF] various: convert res.config.settings to use ir.config_parameter integration
This commit updates the various res config of Odoo addons to use the
newly-introduced config_parameter field attribute.
2018-01-16 13:34:29 +01:00
Vandan Shah 76fc68a9fc [FIX] google_drive: Use 'get' instead of 'post' in 'copy_doc'
Purpose
=======

This chunk of code was badly converted in P3 on https://github.com/odoo/odoo/commit/01e35141479b8dfc4a390518f89fc52e7cec5396#diff-6ad3d62d2147f2fef519473f2576b459R94
2017-11-30 13:01:33 +01:00
Yannick Tivisse 781a03b2bc [IMP] res_config: Update file names, xmlids, class names according to guidelines
Now that we only have one model (res.config.settings). Uniformize everything according to the guidelines.
2017-09-01 13:03:18 +02:00
Deep Patel 898224f110 [IMP] web,account,...: Regroup settings, add a nav and search bar
Purpose
=======

Settings are often way too long and hard to scan and sometimes you don't know where to find the settings you're looking for.
By adding a left navigation, you can already have an overview of the settings, and switch easily between them.

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

- Add a search bar on all the apps that have settings which can search results from all the installed apps.
  (If i'm on sales settings,and I search anything then it shows results from sales settings and also shows
  all the other matching results from all the other apps such as, Inventory...etc) with app name.
- Able to activate feature from the current page results (no matter if the searched result is from another apps).
- Highlight searched word in results
- Delete the sheet, have a full white background
- Add left navigation bar on setting
- Left navigation bar fixed
- List displayed based on installed apps
- On right panel, by default display current app setting and change accordingly
- [Mobile] Left navigation bar displayed on top
- Add Breadcrumb on top of the page: have the name "Settings" + Save / discard CTA + Search
- Add General Settings on the nav bar
- remove "save this page..." notif in all settings
- Delete all recommanded apps section + all checkbox that install app should disappear:
	payroll: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrrSkMzWVpuZ0ZoaFE/view?usp=drivesdk
	Events: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrrYXlHMHd2NTM2blE/view?usp=drivesdk
	Manufacturing: Delete Repair - Quality Control - Maintenance - Product Lifecycle Management [LAP][ok]
	Timesheets: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrrdFg5XzNydkd2TlU/view?usp=drivesdk
	project: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrraWo3NE04TktwcTQ/view?usp=drivesdk
	inventory: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrrQkRaVUR5ekFQYTQ/view?usp=drivesdk
	recruitment: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrrbDdqLWQweF80UkE/view?usp=drivesdk
	purchase: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrrRlAyUDBnb0trQWs/view?usp=drivesdk
	email marketing: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrrOUZONjhvX2k3Y2s/view?usp=drivesdk
	expenses: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrrR0JpN1ZpQmtxU3M/view?usp=drivesdk
	attendances: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrralpjZ1VJclNpMWs/view?usp=drivesdk
- About duplicate settings:
	Docsaway: Delete from Sales + delete Default Print Provider
	Attributs & Variants: Delete from Purchases - Manufacturing
	Multi-currencies: delete from Sales
	Unit Of Measures: Delete from Purchase & Expenses
- Add a scroll bar on the left bar when there's too many apps
- Keep the navbar visible even when you search
- Move General Settings to the bottom of the list
- Update on Settings:
    - Accounting:
        - rename automatic rates
        - Anglo Saxon Account: Should be in technical feature
        - Place Accounting Reports section before Taxes section
    - CRM:
        - Phone Validation: Enforce international format becomes
        - Local Numbers: (2 radio buttons proposals) Add international prefix / No prefix
    - Fleet: typo " ... a new car if ..." + text is too long <br>
    - project: fix tooltip for colab pads
2017-09-01 13:02:54 +02:00
Christophe Simonis bf51fe55a1 [MERGE] forward port branch saas-16 up to 0f2b2c4e2b 2017-07-07 14:30:30 +02:00
Christophe Simonis 7dc731db83 [MERGE] forward port branch saas-15 up to 1f16d34aaa 2017-07-06 13:54:22 +02:00
Christophe Simonis 5009752dcf [MERGE] forward port branch 10.0 up to 1206cc3f7d 2017-07-06 13:05:24 +02:00
Christophe Simonis 1206cc3f7d [MERGE] forward port branch saas-11 up to 5f7f3209e0 2017-07-06 12:30:51 +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 a38a3e93c2 [MOV] *: Reorganize configuration files according to guidelines 2017-06-19 17:37:38 +02:00
Xavier Morel 01e3514147 [FIX] P3: urllib, urllib2 and urlparse
In Python 3, all of these were "consolidated" under urllib(.request,
.parse, .errors) which is inconvenient.

Since we already have hard dependencies on requests and
werkzeug(.urls, which is a backport of Python 3's unicode-aware
urllib.parse) migrate *everything* to that.

A sticking point is urllib2.URLError, those were (mostly) replaced by
the slightly more general IOError which URLError extends.
2017-05-15 12:26:30 +02:00
xmo-odoo b4429c2a91 [FIX] Various P3-related import changes
* LDAP import: python-ldap is not python3-compatible, pyldap is

  Warning: only supported from debian Stretch (current testing)?
  https://packages.debian.org/search?searchon=names&keywords=pyldap

* implicitly relative imports
* imports of moved or removed stdlib modules

issue #8530
2017-04-28 09:06:53 +02:00
Raphael Collet d0ca2d115e [REF] ir_config_parameter: remove group_ids and simplify
Add `sudo()` to call `get_param` where necessary, and make the web client use a
controller instead of directly accessing parameters.
2017-01-03 16:52:49 +01:00
Raphael Collet bf668b64c1 [IMP] all: clean usage of safe_eval
Specifically: do not import `safe_eval` as `eval`, keep it explicit instead.
2016-08-11 15:36:56 +02:00
rap-odoo a5e7a4c8ae [IMP] Account,...: Change 'string' attribute on some fields to avoid repeated names
In odoo at many places the filter items are having repeated strings eventhough the
fiter works differently , so find all the places where this happens and give
proper string to each filter..
2016-06-08 14:02:23 +02:00
Jérome Maes 36fa95df0b [IMP] google_drive : make it use the constant defined in google_account 2016-05-31 09:09:23 +02:00
Jérome Maes 1d67e4982d [IMP] google_drive : allow to remove drive access token
Before, we submitting empty token field on General Settings, it did not remove the token from database.
2016-05-31 09:09:22 +02:00
vbh-odoo 3174d2f56e [MIG] google_drive : migrate to new api 2016-05-31 09:09:22 +02:00
Jérome Maes b581e2004f [MOV] google_drive : move code to split file per model 2016-05-31 09:09:22 +02:00
vbh-odoo 009578d5ee [MOV] google_drive : reoganise module directory 2016-05-31 09:09:21 +02:00