Commit Graph
76 Commits
Author SHA1 Message Date
Martin Trigaux d9287caf94 [IMP] *: convert to private methods
render, render_template, load, activity_schedule_with_view,
get_website_pages should all be private:
It should not be possible to render an aribtrary template only with
its name or id

Still need to render some qweb views from js so the method
render_template is kept public.
This explains why the website editor still need read access on
ir.ui.view as we want to allow any snippet to be rendered.
2020-05-14 13:59:10 +02:00
Adrian Torres 02327d8a6b [IMP] base: warn user about the consequences of uninstall
This commit adds a warning banner near the bottom of the uninstall
wizard warning the user of the consequences of module uninstallation and
advising him to try it first on a duplicate database so as to avoid
borking the database.

The Cancel/Confirm buttons were also swapped and the Cancel one was
made primary to avoid mindless "next-clicking"

closes odoo/odoo#33396

Task-id: 1824392
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-23 12:26:56 +00:00
alt-odoo 8f70f203d0 [FIX] base: merge user contacts without company
If some contacts are linked to a user, we keep the company consistent
but we should do it only if a company is set on the destination partner.

opw-2199352

closes odoo/odoo#46000

X-original-commit: 3f9cb47cb6fdc240a58f3daa3bd4cf32f55cb084
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-02-21 21:06:03 +00:00
Adrien Dieudonne 62c9227fda [FIX] web: document layout configuration: style not scoped
Commit 9a482fc introduced change for the document layout preview:
all "td" tag included in clearfix were in display: flex;
Because of this some styles were broken in form views on mobile.

We could have only put this rule in the right scope but
we preferred to fix this correctly.

Steps to reproduce:
- Go to Settings
- General Settings
- Click on Configure Document Layout

Related to task-ID: 2184243

closes odoo/odoo#45830

X-original-commit: 0206ee8f8a3652ae0eeb5aa78a94b92bd6e84921
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2020-02-20 14:47:04 +00:00
Swapnesh Shah f69fa0af63 [FIX] base: paperformat_id is required on settings
Not setting a value for paperformat_id on 'Company Document Layout'
will also make paperformat_id False on the company but it is required
in the settings.

Without this commit, you can get in the weird situation of being able
to set a value on the document layout but having an error in the
general settings as a required field is missing.

Apply the same logic as in the other views

closes odoo/odoo#45527

X-original-commit: e518063e48936a3f8f9f921950cdae209e67ab47
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-17 15:07:15 +00:00
Jason Van Malder 501ae8dad2 [FIX] odoo: fix translation import onconflict
Issue

    - Export all english translation
    - Import the file and override existing terms

Cause

    When importing, we try to insert the translation if
    it doesn't exists. If it exists, we do an update via
    a "onconflict" rule.

    This update can be done only one time but in the values to import
    there are things like:
    ```
    ( 'Account', # translation
      8, # numbers of duplicate
      ['account', 'account', 'account', 'account', # modules
      'account', 'account_ponto', 'account_yodlee', 'payment']
    )
    ```

Solution

    It will not be fixed in stable to avoid performances issues.
    Instead, we will display a clearer error message.

    As it's a `psycopg2.ProgrammingError`, the cursor is aborted
    and we can no longer use it to retrieve translations. This
    is why I use a save point.

OPW-2150610

closes odoo/odoo#41934

X-original-commit: e108770d55b42a1793085a169145492b39d0a15c
Signed-off-by: Jason Van Malder <jvm-odoo@users.noreply.github.com>
2019-12-16 12:26:22 +00:00
Kevin Baptiste 6cbe824871 [REV] web: reverts update to fontawesome 5.11.2
This reverts commit ff1c35513a.

closes odoo/odoo#41480

X-original-commit: 116057b26e71db4692280463669f3e80d813ddcc
Related: odoo/enterprise#7110
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-12-09 10:33:36 +00:00
Kevin Baptiste ff1c35513a [IMP] web: update to fontawesome 4.7.0 to 5.11.2
FontAwesome 5 introduced new names for some icons as described on
https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4#name-changes

This commit replaces the old names to the new ones.

closes odoo/odoo#35826

Taskid: 2050241
Related: odoo/enterprise#5180
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-28 10:05:12 +00:00
Xavier Morel 6044782aef [IMP] base: logging conf & logging of partner merge wizard
* root the base.partner.merge wizard's logger in odoo.addons so the
  "odoo" logger configuration properly applies to it
* update the default logging configuration to set the root logger
  rather than independently set the odoo and werkzeug loggers

closes odoo/odoo#40872

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-11-26 12:48:05 +00:00
Martin Trigaux ac63556e23 [IMP] base: explicitly pass parameters for translation methods
Instead of relying on the context content, pass explicit values for
overwrite and create_empty_translations
applu this to trans_load and trans_load_data
Adapt the test that was trying to create empty translations.
2019-11-19 10:37:07 +01:00
Martin Trigaux 49fbab5329 [IMP] base: split and deprecate load_lang
load_lang was a kind of hybrid method trying to active or creating a
language if not found. This was error prone.
Instead rely on two methods with clear purpose:
ResLang._create_lang(lang, lang_name=None)
  - create a new res.lang entry using the locale of the server
    return the res.lang record to match the API of _activate_lang

ResLang._active_lang(code)
  - activate the given code lang

Most of the time, _active_lang is what is expected

tools.trans_load_data and IrTranslation._load_module_terms no longer
activate the language if not active.
Loading the translations should be explicit on an activated language,
it is too error prone to silently activate/create a language if not
found.
Remove lang_name from trans_load_data as no longer needed.
2019-11-19 10:37:01 +01:00
jvm-odoo 65edd6c55e [FIX] base: fix merge partner wizard
In the contacts app, you can select 2 partners and merge them.

Before this commit:

    - If a partner was added by a SQL query and not directly on Odoo,
      the create_date will be empty. This causes a crash because the
      merge wizard try to sort the partners by date

After this commit:

    - If a partner do not have a create_date, it will be considered
      as 01/01/1970. The merge wizard will sort the partners by IDs too.

OPW-2091925

closes odoo/odoo#39523

X-original-commit: deeb769c0d579c51ab42b072ccc1c013d79fcea4
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-11-04 12:28:53 +00:00
Sébastien Theys 3c3f0753da [FIX] tools, base: fix orientation of image with EXIF orientation tag
Before this commit, some images would display incorrectly orientated.

This typically happens for images taken from a non-standard orientation
by some phones or other devices that are able to report orientation.

The specified transposition is applied to the image before all other
operations, because all of them expect the image to be in its final
orientation, which is the case only when the first row of pixels is the top
of the image and the first column of pixels is the left of the image.

Moreover the EXIF tags will not be kept when the image is later saved, so
the transposition has to be done to ensure the final image is correctly
orientated.

closes odoo/odoo#38717

X-original-commit: 0f8e132ec0495fcdfa0a47d5b9c98a2f6f10c7d8
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2019-10-14 13:03:03 +00:00
Christophe Simonis d74b451805 [MERGE] forward port branch 13.0 up to f4105eb9c7 2019-10-09 02:08:17 +02:00
Lucas Perais (lpe) 2721dd522c [FIX] base, account, product, hr_holidays: document layout save and print
In an onboarding situation, the company doesn't have a logo
make an invoice, send and print, print

The document layout editor's layout opens, because nothing is set up
on the company

Click Save

Before this commit, it was impossible to make the invoice print
because each time the document layout was displayed

After this commit, the invoice prints when clicking on Save
There is no default external layout for main_company

Also, the heuristic used to evaluate whether a company
has been set up, onboardingly speaking, has changed.
Before we used the existence of the logo, after we check if
a layout has been setup. When saving the document layout
modal, a report layout is written on the company

So, practically, the document layout modal only appears once
when trying to print invoices (or other documents)

closes odoo/odoo#37137

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-10-01 14:32:43 +00:00
Julien Mougenot 43d91c289a [FIX] base: document layout reset colors button
Fixed the button allowing to reset to the logo colors in the
document layout configurator.

Before this commit, the custom_colors boolean asserting that
the colors used by the layout are different than the ones computed
from the logo and used to revert to those colors was in readonly
and couldn't be toggled.

Now, the boolean is editable and allows to revert the colors properly.

Task 2072557

closes odoo/odoo#36968

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-09-16 14:30:07 +00:00
Xavier-Do fc5934dc45 [FIX] base: fix rte translator timeout
In some cases, after installing a new language in rte_translator tour,
some query using ir_translation table will become very slow.

Identified query:
SELECT res_groups_users_rel.uid, res_groups_users_rel.gid
FROM res_groups_users_rel, "res_groups" LEFT JOIN "ir_translation" as "res_groups__name"
ON ("res_groups"."id" = "res_groups__name"."res_id"
AND "res_groups__name"."type" = 'model'
AND "res_groups__name"."name" = 'res.groups,name'
AND "res_groups__name"."lang" = 'en_US'
AND "res_groups__name"."value" ! '')
WHERE 1=1 AND res_groups_users_rel.uid IN (2) AND res_groups_users_rel.gid = res_groups.id
ORDER BY COALESE("res_groups__name"."value", "res_groups"."name")    OFFSET 0´

During post_install this query will become slower (between 0.7 and 2 seconds) ~50%
of the time, when this usually take less than 0.1 second.

For some tour step, this query is executed several times, making a simple
/web loading going from less than one second to more than 10 second, breaking the tour.

The main intuition behind that would be that the query plan completely fails,
mainly because postgress is to busy and doesn't have time to launch an analyse
when runbot load is high.

This commit proposes to execute a manual ANALYZE on ir_translation table
after a new language is installed. Tested with 40 builds, rte_translator never failed
with this fix.

closes odoo/odoo#36954

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2019-09-16 13:33:04 +00:00
Christophe Simonis 64e43808b7 [MERGE] forward port branch saas-12.5 up to 58a83d1222 2019-09-20 17:34:45 +02:00
Julien Castiaux 4f03a5f136 [FIX] *: remove old deprecated modules/functions
PEP-594 is deprecating a bunch of modules. As part of the cleanup, we
are also dealing with long deprecated modules, functions and aliases.

* `assert_` -> `assertTrue`
* `assertEquals` -> `assertEqual`
* `assertNotEquals` -> `assertNotEqual`
* `assertAlmostEquals` -> `assertAlmostEqual`
* `assertRaisesRegexp` -> `assertRaisesRegex`
* `assertRegexpMatches` -> `assertRegex`
* `base64.encodestring` -> `base64.encodebytes`
* `base64.decodestring` -> `base64.decodebytes`
* `inspect.getargspec` -> `inspect.signature`
* `inspect.formatargspec` -> `inspect.signature`
* `logging.warn` -> `logging.warning`

closes odoo/odoo#36863

Task: 2003936
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-17 11:36:42 +00:00
Raphael Collet d2409ecb5e [FIX] base: ill-defined model 'base.document.layout' 2019-09-03 12:02:45 +00:00
Romain Derie 269aa59411 [IMP] http_routing, website: allow to customize the lang in URL
With this commit it is now possible to change the lang displayed in the URL.
Eg, you could use `/fr` instead of `/fr_BE`, or even a fancier `/french`.

Task-32838

Courtesy of pla@odoo.com

closes odoo/odoo#35135

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2019-08-26 16:35:19 +00:00
Raphael Collet 9920f20e4c [IMP] models: ORM speedup
This branch is the combination of several optimizations in the ORM:

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

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

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

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

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

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

* computed fields are computed in superuser mode by default.

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

closes odoo/odoo#35659

Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-08-20 12:43:59 +00:00
Martin Trigaux 30ab0d3a89 [IMP] base: better default for translation overwrite
Following 43d355c208, same logic
Hide it but make it checked by default

closes odoo/odoo#35819

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-08-19 14:55:57 +00:00
Martin Trigaux 43d355c208 [IMP] base: better default for translation overwrite
FP request: hide the field from the view as too technical
MAT analysis: it should be true by default as most expected behaviour
(it was the reason why it was displayed in the first place)

closes odoo/odoo#35679

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-08-13 14:21:00 +00:00
Martin Trigaux 85ee046b37 [IMP] *: use res.lang methods
get_installed and _lang_get_id are both ormcached and correctly check
the context

Retrieving a res.lang from a code is a frequent action that can be
achieved with _lang_get (cf previous commit).
Using _lang_get ensure the active_test in the context is correct and
is not poluted with another context propagation issue.
odoo/odoo#35490 discussion is an example of bad context propagation

closes odoo/odoo#35504

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-08-07 13:06:17 +00:00
mreficent 355a5dfc36 [IMP] *: fix typos in comments
closes odoo/odoo#35404

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-08-07 10:28:33 +00:00
Julien MougenotandLucas Perais ed18095127 [IMP] base: Configure document layout
The onboarding modal for setting up the few base fields of a company
has now been moved to a wizard
It is accessible from the general settings, but also in the onboarding
section of sale and account modules.

The following company settings are editable with that wizard:

- Set report **layout**:
The user can chose the overall look of the report. The current choices
are : *Standard* (default), *Background*, *Boxed* and *Clean*.

- Set company **logo**:
Changes the company logo.

- Set report **colors**:
The user can set the primary and secondary colors of the report through
a newly added widget allowing to pick a custom color.
When changing the **logo**, colors are automatically set to its most dominant
colors.
> A "Reset colors" button also triggers the color calculation.

- Set report **font**:
Changes the overall font of the report. Only Google Fonts are used
for enhanced compatibility.

- Company **tagline**, also called "header"
- **Footer**
- **Paper format**
- Report **preview**:
A mockup of a final report
Automatically updates when changing **layout**, **logo**, **colors** or **font**

Co-authored by: Julien Mougenot <jum@odoo.com>

closes odoo/odoo#33863

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>


Co-authored-by: Lucas Perais <lpe@odoo.com>
2019-07-29 08:29:26 +00:00
jbm-odoo 2c558eb652 [IMP] base: Remove translatable field of res.lang
The technical field `translatable` of a res.lang has become useless

closes odoo/odoo#34895

Signed-off-by: Romain Libert (rli) <rli@odoo.com>
2019-07-22 13:46:30 +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
Lucas Lefèvre 4f47b729b1 [IMP] base: Remove Load a Translation menu
Activating a language automatically load the translation,
hence the menu is no longer necessary.
2019-07-16 17:28:52 +02:00
Hiral Bhavsar 6f30fcec14 [IMP] base: rename action menu 'Merge Contacts' by 'Merge'
Rename the action menu 'Merge Contacts' by 'Merge' for the 'res.partner'
model.

Linked to task 1984526
Related to PR #33720
2019-07-10 15:07:56 +00: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
Hiral Bhavsar 3cd7ed07a2 [IMP] *: remove 'view_type' on window actions.
The old tree views don't really exist anymore, this odd pseudo-flag to
dispatch between "list" and "tree" tree views has no reason to remain.

Task 1937686

closes odoo/odoo#31243

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-06-17 11:34:17 +00:00
Xavier Morel 10f1a1a0c4 [REM] multi from ir.actions.act_window
Task 1843603

* src_model is redundant with binding_model_id
* multi -> binding_view_types (if empty => all views) (maybe should be
empty by default yo?)
* in convert, type => rec.get(type) but no @type possible on <act_window>...
* removed deprecated auto_refresh & auto_search (not used anywhere (?))

closes odoo/odoo#24738

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-05-27 12:00:39 +00:00
Raphael Collet f44571f550 [IMP] base: remove mapped() where not necessary 2019-04-30 07:54:49 +00:00
Christophe Simonis 44515bc7be [MERGE] forward port branch saas-12.2 up to c9f832d9f0
closes odoo/odoo#31790

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-13 14:24:51 +00:00
Yenthe666 fd24c240fb [IMP] base: improve source term
Use the "There are" form when followed by plural

closes odoo/odoo#30731

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-03-12 16:06:08 +00:00
Christophe Simonis 71faa19af0 [MERGE] forward port branch saas-12.1 up to 2b3296bbf8 2019-03-11 14:42:34 +01:00
Pratima Gupta ba5a2b47ac [IMP] base: Allow to sum fields on partner merge wizard
When merging 2 partners, we could want to sum fields instead of
keeping one of the values. Example: Loyalty Points

This commit adds the necessary support to achieve this.

This commit is related to task #1869488.

closes odoo/odoo#30141
2019-02-13 10:35:42 +00:00
Xavier Morel a0e05e2ab9 [IMP] fields: selection fields only use strings
closes odoo/odoo#29039
2019-01-26 14:25:44 +00:00
Christophe Simonis cf52a04979 [MERGE] forward port branch saas-12.1 up to d3b8422c9c
closes odoo/odoo#30614
2019-01-28 13:58:11 +00:00
Lucas Perais (lpe) 15cd94b746 [FIX] base: merge contacts linked to by an o2m field with caps
Define a field on a model as:
- o2m to res.partner
- the field's column, hence its name, has capital letters in it
(studio does that)

create two objects of that class, each one linked to a different partner with the new o2m

merge the partners

Before this commit, the object linked to the second partner, was deleted
This was because merge partner sql requests did not quote the column name

After this commit, the second object still exists

OPW 1925060

closes odoo/odoo#30300
2019-01-17 12:30:20 +00:00
Nicolas Lempereur ed99544dfa [FIX] translate.py: really generate missing terms
With 12.0's (#28297) empty translations were no longer added by default
with the idea that if needed the "Generate Missing Terms" wizard should
be used.

But that wizard itself used what was modified so also did not added
empty translation.

With this changeset, empty translations are added when using the
"Generate Missing Terms" wizard.

fixes #29184
closes #30037
2019-01-09 15:00:43 +00:00
Xavier Morel 66f0e26f6f [CHG] *: make binary fields default to attachment=True
Check that it makes custom binary fields into attachment as that's the
main reason for the change: when users create binary fields via Studio,
they're necessarily db-stored (as the interface doesn't allow altering
the attachment attribute and it's unclear how we'd handle users
switching it on/off every time), which significantly bloats their
database (and burns storage & backup space), especially as the primary
use case for binary fields is adding images and documents to records.

* check that binary fields are properly created as attachment=True
* add attachment=False on fields where that seems relevant (most but not
  all of the fields previously using the default)
* remove occurrences of attachment=True

closes odoo/odoo#29308
2018-12-07 13:37:34 +00:00
Christophe Simonis 3e4b9d4d66 [MERGE] forward port branch saas-11.4 up to 639bd89635 2018-11-09 14:51:55 +01:00
Christophe Simonis 639bd89635 [MERGE] forward port branch saas-11.3 up to 94a9fc9902 2018-11-08 17:08:03 +01:00
Christophe Simonis 94a9fc9902 [MERGE] forward port branch 11.0 up to e5c8071484 2018-11-08 14:13:52 +01:00
Martin Trigaux 339bf145ce [FIX] base: allow languages with iso code of size 6
Some languages like kabyle ou filipino have the iso code kab_DZ and fil_PH
It was not possible to import it.

closes odoo/odoo#31332
2019-02-21 15:51:03 +00:00
Lucas Perais (lpe) 6389b358c8 [FIX] base: partner_merge: adapt to new administrator ID
closes odoo/odoo#28146
2018-10-25 10:05:13 +00:00
Nimesh Jethva 7eea263f36 [IMP]base_*: Improvement in model description
Purpose of this commit is to give description more "business oriented"
because those descriptions appears in Odoo Studio which is supposed to be used by end users, not only by developers.

Related Task ID : 37311
2018-09-21 11:45:15 +02:00