Commit Graph
99 Commits
Author SHA1 Message Date
Xavier Morel 74241b3766 [FIX] test_lint: support fstrings in sql injection checker
Those were not accounted for, leading to fstrings passing through
unflagged.

Also update the SQL checker to be stricter but smarter:

The previous version would "fail open", unknown nodes would be allowed
through hence f-strings not being flagged when they started appearing
in arg0 position, should now fail-closed, anything that's not allowed
is forbidden.

This flags a few more cases, all of which seem acceptable upon review.

However the previous version would also only resolve arg0 (in case it
had a `NAME`, to see if that resolved to an acceptable form of
query-building). The new version performs resolution during
`_check_concatenation` and should thus allow e.g. format strings to be
separate variables (though not e.g. module-level constants, yet
anyway).

In resolution, replace the ad-hoc process by astroid's built-in
`lookup` which seems to provide the same information. Slightly more in
fact, as it yields every assignment in case of e.g. conditionals, but
making use of that would require a lot more changes in the checker so
leaving the behaviour as-is for now.

It's important to *not* use `ilookup` here, because ilookup is not
"iterable" but "inferring", and we don't want values, we want
expression ASTs for analysis.

NOTE: previous improvements as well as fixes to existing code were
only implemented in 14.0, hence this being merged in 14.0 not 13.0
despite 13.0 still being supported.

closes odoo/odoo#81721

X-original-commit: 376ccf0944dae1bc53ae9c5385977c4e6b23e083
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-12-27 09:36:42 +00:00
Jeremy Kersten 7f3a2b700f [FIX] base: fix acl error on wizard merge contact
Since 5dc4cff60a, we removed the access read on ir.model.*

Before this commit, an employee without admin rights cannot merge partners
because he doesn't have the right to read the model ir.model.fields.

Now with use a sudo to find the reference field and avoid the traceback.

closes odoo/odoo#80119

X-original-commit: 1815b108004b407714705b6f62b65f4cfc38a395
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-11-19 16:33:16 +00:00
Raf VenandThibault Delavallee be8aa967f0 [IMP] base: merge activities of merged partners
When merging partners through the ``base.partner.merge.automatic.wizard``
wizard, messages and followers are merged. However activities are not
probably because its underlying model is "newer" then messages and followers.

This commits fixes that behavior.

Task-2641572
PR odoo#76159
Closes #71654

X-original-commit: 7e17678ec6ebbbe37b807a5d264cc5afd46bae1a
Part-of: odoo/odoo#77005
Co-authored-by: Thibault Delavallee <tde@odoo.com>
2021-09-22 19:25:56 +00:00
Raphael ColletandXavier Dollé 1595c0ee27 [REF] core: replace thread-local "envs" by cursor-bound "transaction"
Refactor the Environments object into a Transaction object, which is
bound to one cursor, and is no longer shared among several cursors.

The following methods/properties have been changed:
 - Environment.envs no longer works (because of the design change);
 - Environment.manage() is deprecated (no longer useful);
 - Environment.reset() is now an instance method;
 - env.clear_upon_failure() is deprecated in favor of cr.savepoint().

closes odoo/odoo#75598

Related: odoo/enterprise#20451
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: Xavier Dollé <xdo@odoo.com>
2021-09-03 15:45:46 +00:00
Kevin Baptiste 86aa7b78aa [IMP] *: introduce data-hotkey on form and modal views
Define `data-hotkey` on most used action buttons.

For the modals, the following keys are dedicated for "special"
actions:
 - Alt+G: add
 - Alt+V: save
 - Alt+Z: cancel

closes odoo/odoo#73275

Taskid: 2588233
Related: odoo/enterprise#19464
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-07-15 08:39:49 +00:00
Nicolas Lempereur 3f0fb5e09c [FIX] base: generate missing terms ok src dupes
When using "Generate Missing Terms" we export all translations and
reimport them with `create_empty_translation` so they empty translation
are made available.

But since we export all modules in the same PO file, the same terms that
might have different translation in different modules would get the same
translation value after using "Generate missing terms" which is
unexpected => usually we import/export PO file by module and so a term
translation is unique for one module only.

With this changeset, we import translation module by module.

When testing speed of Generate Missing Terms with 90 modules and 37000
translations, the timing taken change like this:

- original code: 21 seconds
- exporting/importing 1 PO file per module: 45 seconds
- exporting 1 TGZ file total/importing 1 PO file per module: 23 seconds

opw-2439029

closes odoo/odoo#68801

X-original-commit: 240de08ac8f5dbd2e263a48fea859605770f82a3
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-04-06 08:20:19 +00:00
ijas ahammed eca92a97be [IMP] base: display db ID along with name in partner merge wizard
Before this commit:
When merging the contacts, chances are there that the name of records being
merged are exactly same, and so we might not be able to distinguish them
and so can not tell for sure that which records are being merged to which
destination record.

After this commit:
In the 'Destination Contact' field, now we also show ID of the partner
along with the name, so that end user can easily distinguish between
them. For this, we pass 'partner_show_db_id' on the context for that field from
view, allowing us to get expected result from the name_get by using this
context key.

Task ID-2323060

closes odoo/odoo#66026

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-02 14:12:50 +00:00
Ivan Yelizariev 4da2b5d3a8 [IMP] base: export translation terms in po/pot format by default
The .po format is wildly used in Odoo and is the format used for storage and
interaction with Transifex

closes odoo/odoo#65039

Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
2021-01-26 08:53:33 +00:00
wan 864f962145 [IMP] base: do not resize module icons
Most of the modules have a square icon but some don't. For instance, the
flags of l10n modules, or other third party modules.
Flags have very specific proportions, and we don't want them to be
resized when rendered.
While we could hardcode a square icon for each problematic icon, it
would be more manipulations, and the flags are already in the repo
without the right proportions; we don't want to duplicate binaries.

The many2many `module_ids` kanban field of the uninstall wizard has also
been updated to look more like the generic kanban view for the modules.

The classes in the kanban view of `fleet_vehicle_model_view_form` seem
to have been copy-pasted and are useless. It has been removed to reduce
future possible side effects of changing css.

closes odoo/odoo#56421

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2021-01-15 15:56:47 +00:00
Julien Castiaux 90b52d144a [REF] base: Use Command helper for x2many
Task: 2366606
2020-11-30 10:16:09 +00:00
Simon Genin (ges) 618067aa3f [IMP] base: Document layout preview improvements
The document layout preview is a complete defferent simplified template
with its own css that replicates at best the different styles.
It does not have the external layout features and lack of fidelity.

The new preview actually use the real documents templates and put the
result in an iframe. It now has a high fidelity, though not perfect.

The goal is for a better onboarding, where clients see easely how
documents will look if they had an app to generate them. Of course, the
data on the document is a false invoice.

Refactor all this from base to web.

Task ID 2304177

closes odoo/odoo#56995

X-original-commit: c121a246f16899735306266a3a12b526e08e7620
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-09-03 08:44:35 +00:00
Julien Mougenot 47a80f8825 [FIX] base: Render "custom colors" widget
Since commit 11857adec0 the invisible form
widgets are not rendered at all. This caused an issue in the document
layout designer where the "custom_colors" field was invisible but still
referenced by a label with a "for" attribute.

Now, said field is not completely invisible anymore; it is set with
"display:none" instead to be rendered invisible and interactive as
before.

closes odoo/odoo#55970

Task: 2320982
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-08-19 12:38:22 +00:00
Martin Trigaux d5c1649239 [IMP] base,web: _for_xml_id as a safe access point
/web/action/load is the public controller that Should be used by the
webclient to fetch actions
_for_xml_id is the default access method on actions that implements
fields filtering to avoid leaking server action code or other
information not needed by the webclient

Implementing whitelist of fields that can be access per model
2020-08-17 09:08:23 +00:00
704bcc5527 [IMP] portal, *: move language switcher to portal
*: base, http_routing, website

Make the language switcher available on portal without website
installed.

Part of https://github.com/odoo/odoo/pull/55300
task-2203383

Co-authored-by: Jeremy Kersten <jke@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2020-08-14 17:40:58 +00:00
shs-odooandNisha Patel d35adaa030 [IMP] base,base_setup: Improve general languages settings
Purpose of the task is, We saw that users encounter difficulties
while installing languages so improve the user onboarding experience
when user wants to install a new language.

So in this commit,
 - Change the load langauge wizard title as 'Add Language' and rename
the button as 'Add'
 - Removed documentation link as it is not up to date
 - Added the 'Add language' button to general settings and it will open
the wizard to load the languages. and move the 'manage language' button
to the debug mode.
 - After install added button 'switch to (lang)	& close' to switch to
newly added language.

closes odoo/odoo#53581

Taskid: 2281393
Closes: #53581
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Co-authored-by: Nisha Patel <nit@odoo.com>
2020-07-17 12:47:34 +00:00
Xavier Morel c8063af7a0 [IMP] core, account, lunch: make <menuitem> recursive
For clarity, some data files are formatted as pseudo-tree
structure. This is somewhat confusing and dangerous when the structure
has no meaning... so add meaning:

* allow nesting menuitems, nested items are set as children to the
  parent they're nested in
* update schema to allow an icon *or* a parent on regular menu items,
  and neither on nested (they have an implicit parent meaning can't
  have an icon)
* remove attributes which don't actually exist from the menuitem
  schema
* also type sequence as an integer while at it

Convert two large-ish menuitem data files to recursive form.

closes odoo/odoo#54564

Related: odoo/enterprise#11887
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-07-28 13:03:13 +00:00
Xavier Morel 6835aeb0de [REM] core, *: deprecate <act_window> and <report>
Convert deprecated tags through the codebase.
2020-07-28 13:03:13 +00:00
Victor Feyens 71ab12840b [IMP] *: do not specify unwanted defaults in default_get
When default_get is called, the wanted fields are specified through the
fields_list arg.  It is useless to fill the values for unwanted fields.

As default_get is called for nearly all records creation, simplifying
the default_get overrides:
* remove potential wrong side-effects of the values
* remove some useless or wrong  defaults computations (searches, refs,
...)
2020-07-23 16:38:17 +00:00
Xavier Morel 6c6c3d7090 [FIX] base: reintroduce log method in merge partner wizard
Well odoo/odoo#40872 is definitely the gift that keeps on giving,
after causing grief with the logging configuration change turns out
inlining the method was *also* a terrible idea because it's overridden
in `mail` in order to note merges on the destination partner, which I
apparently completely missed back then.

Task 2285876

closes odoo/odoo#53756

X-original-commit: 41209dababfaebca7bfd3be6ee5a2f41e9bb4ff5
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-06-26 15:08:29 +00:00
Martin Trigaux ba244cef01 [IMP] *: replace to new _() syntax
Using a few regex like
\((_\(.*%s.*)(\) % )([\w\[\]][\w .\[\]\(\)'"]*)\)
($1, $3))

Old syntax is still compatible but starts the migration to the new
syntax that catches error.
2020-06-18 13:03:34 +02:00
Florian Gilbert 7db53df9cb [IMP] account & account_edi: Some visual improvements.
Hide invoice_origin field.
Hide partner_bank_id for customer invoice.
Remove margin-bottom for report layout in "base" module.
Hide electronic invoicing message for "Send & Print" action.

Task ID: #2277282

closes odoo/odoo#52953

Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-06-15 08:54:12 +00:00
Nasreddin (bon) c503faab53 [FIX] base: User loses company access when merging the related contact
Issue

	- Create a second company
	- Create user with access to main and second company
	- Go to "Contacts" app
	- Edit contact of the new user, and under the "Sales & Purchases" tab,
	  ensure that the company field is set
	- Create a new contact with same email of the new user
	- In list view, select both contact related to new user
	- Click on Action->Merge Selected Contacts, then merge contacts

	User has no more access to both companies, only company related to
	merged destination Contact/Partner.

Cause

	All related companies are unliked from user, and instead overwrited
	with one company related of the merged destination Contact/Partner.

Solution

	Instead of unlink all companies, we will only add the contact company
	to the allowed companies of the user.

opw-2269397

closes odoo/odoo#52620

X-original-commit: e00b23b73f00fb24b2771ea8894031b35204e65e
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2020-06-08 15:04:06 +00:00
Martin Trigaux c142f1628d [FIX] tools: reimport translations in csv
Before this commit trying to reimport csv of a translation failed.
The reason was that before 632fa044c3 the parsing was common
between po and csv while now it's split in two different parsers.
The res_id column of the CSV is the external id of the record and is
handled by IrTranslationImport.

Use DictReader instead of csv_reader to easily add new keys and still
be flexible on the given csv files.

Match the POReader format with a imd_model and imd_name column.

As for the PoFileReader, the code translations are unique and must be
discarded in case of duplicate.

Correct the error message if the imported file is not correct (was
missing an argument)

Fixes odoo/odoo#50975

closes odoo/odoo#51468

X-original-commit: 3cedadb5ba606e156f52e70ed08b25ac2df8d58b
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-05-19 08:01:17 +00:00
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