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.
closesodoo/odoo#81721
X-original-commit: 376ccf0944dae1bc53ae9c5385977c4e6b23e083
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
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.
closesodoo/odoo#80119
X-original-commit: 1815b108004b407714705b6f62b65f4cfc38a395
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
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>
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().
closesodoo/odoo#75598
Related: odoo/enterprise#20451
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: Xavier Dollé <xdo@odoo.com>
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
closesodoo/odoo#73275
Taskid: 2588233
Related: odoo/enterprise#19464
Signed-off-by: Kevin Baptiste <kba@odoo.com>
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
closesodoo/odoo#68801
X-original-commit: 240de08ac8f5dbd2e263a48fea859605770f82a3
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
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
closesodoo/odoo#66026
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
The .po format is wildly used in Odoo and is the format used for storage and
interaction with Transifex
closesodoo/odoo#65039
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
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.
closesodoo/odoo#56421
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
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
closesodoo/odoo#56995
X-original-commit: c121a246f16899735306266a3a12b526e08e7620
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
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.
closesodoo/odoo#55970
Task: 2320982
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
/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
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>
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.
closesodoo/odoo#54564
Related: odoo/enterprise#11887
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
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,
...)
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
closesodoo/odoo#53756
X-original-commit: 41209dababfaebca7bfd3be6ee5a2f41e9bb4ff5
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
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.
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
closesodoo/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>
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)
Fixesodoo/odoo#50975closesodoo/odoo#51468
X-original-commit: 3cedadb5ba606e156f52e70ed08b25ac2df8d58b
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
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.
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"
closesodoo/odoo#33396
Task-id: 1824392
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
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
closesodoo/odoo#46000
X-original-commit: 3f9cb47cb6fdc240a58f3daa3bd4cf32f55cb084
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
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
closesodoo/odoo#45830
X-original-commit: 0206ee8f8a3652ae0eeb5aa78a94b92bd6e84921
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
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
closesodoo/odoo#45527
X-original-commit: e518063e48936a3f8f9f921950cdae209e67ab47
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
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
closesodoo/odoo#41934
X-original-commit: e108770d55b42a1793085a169145492b39d0a15c
Signed-off-by: Jason Van Malder <jvm-odoo@users.noreply.github.com>
* 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
closesodoo/odoo#40872
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
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.
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.
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
closesodoo/odoo#39523
X-original-commit: deeb769c0d579c51ab42b072ccc1c013d79fcea4
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
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.
closesodoo/odoo#38717
X-original-commit: 0f8e132ec0495fcdfa0a47d5b9c98a2f6f10c7d8
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
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)
closesodoo/odoo#37137
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
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
closesodoo/odoo#36968
Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
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.
closesodoo/odoo#36954
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
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.comclosesodoo/odoo#35135
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
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.
closesodoo/odoo#35659
Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
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)
closesodoo/odoo#35679
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
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
closesodoo/odoo#35504
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
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>
closesodoo/odoo#33863
Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>