Avoid extra call to session_store.save if we don't touch to the session
Use an explicit name to storage post_viewed in the session
task-2211013
Co-authored-by: Romain Derie <rde@odoo.com>
Co-authored-by: Jeremy Kersten <jke@odoo.com>
Http routing and websits module will already do it later and handle the case.
The only ModelConverter used that will be impacted is:
/web_editor/attachment/<model("ir.attachment"):attachment>
that is a json controller called with eisting data
task-2211013
Co-authored-by: Romain Derie <rde@odoo.com>
Co-authored-by: Jeremy Kersten <jke@odoo.com>
We use `author_id` (res.partner record) to instanciate our frontend widget
address so it can be changed through left panel in a searchable list.
This require a read on res.partner to get his name, even for visitors.
Using a related will have the same result for visitors while it won't need to
query res.partner table.
task-2211013
Co-authored-by: Romain Derie <rde@odoo.com>
Co-authored-by: Jeremy Kersten <jke@odoo.com>
Without this commit, if `lang_code` or `env.context.get('lang')` was set, we
would still access `env.user.company_id.partner_id.lang` to fill the loop array
even if we break and don't need that value.
Switching from loop to if conditions prevents that.
task-2211013
Co-authored-by: Romain Derie <rde@odoo.com>
Co-authored-by: Jeremy Kersten <jke@odoo.com>
Without this commit, a simple search like:
`env['blog.tag'].search([('website_id', 'in', (1, False))])`
would generate 4 SQL queries instead of 1.
3 requests would be done on `blog.blog`, see `right_ids` at ORM level.
task-2211013
Co-authored-by: Romain Derie <rde@odoo.com>
Co-authored-by: Jeremy Kersten <jke@odoo.com>
`tags_list()` is called in loops to get nicely formatted URL in blog tag button
but doing an exists here will do everytime an SQL query regardless of the
cache.
We can safely remove the call to `exists()` as the `tag_ids` parameter is
coming from the controller `active_tag_ids` key which is already ensuring the
exists condition.
It make also the number of requests determinists for test with a random number
of tags. From between 200 ~ 300 queries (depending number of tags)-> 116
task-2211013
Co-authored-by: Romain Derie <rde@odoo.com>
Co-authored-by: Jeremy Kersten <jke@odoo.com>
Most of the website rendering process depends of customize_show views which are
part of a configuration setup.
Once it has been setup, it will most likely never change afterward.
It makes sense to orm cache those infos to avoid having to query ir.ui.view
table everytime we render something.
Note that just store basic and small infos used for customize_show case.
task-2211013
Co-authored-by: Romain Derie <rde@odoo.com>
Co-authored-by: Jeremy Kersten <jke@odoo.com>
Followup of 73dc42d6d5: catchall or bounce alias reset to the same value
should not raise an UserError. This happens for example when reinitializing
mail module.
Also enable batch write again.
closesodoo/odoo#50248
X-original-commit: 00709025a9436b35744908481c5e5faa1e3ef655
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Avoid messing up with style by translating it
closesodoo/odoo#50251
X-original-commit: 6151757a8357693e189ff1ab31ece5efdbac65d6
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
The name was autogenerated to "XMas Promo 2020-04-27 09:15:11" (which
is rather technical)
Make a static one to avoid changing it everytime the translations are rexeported
X-original-commit: 52a630eb28ead7b21f39dccbbff628ea594c7099
Followup fix of #48912
The multi-company group should be given to users if they have access to
multiple companies and do not already have this group.
closesodoo/odoo#50233
X-original-commit: 0c721d90c5cd428ef8d51f195da8e02ee91d4364
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
- In a res.partner;
- Schedule activity;
- Choose 'meeting' as activity;
- Set a summary : 'test summary';
- Open Calendar;
- Chose a date and an hour;
- Edit the meeting;
- Add a description with a line break;
- Save the meeting;
- open the res.partner view;
Before this commit, the note on the planned activity lack the line
break.
Now, the note in the planned activity has the same output as the
description of the calendar meeting.
opw-2236838
closesodoo/odoo#50226
X-original-commit: 2e9cc92fb45f9328c45520275ab11c7a486a2590
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
The (private) Rule.build method takes a values *dict* parameter. From
the start it was called with an invalid argument, but before 0.15
`append_unknown` would lead to just not using the argument at all
unless the rule is dynamic (aka has converters)[0].
In 0.15 the code was refactored and the `values` mapping is now used
in every case[1], leading to a pretty systematic error when calling
`search_pages`, which occurs any time an auto-completed URL field gets
used on the website e.g. when converting text to a link using the page
editor or when trying to update menu items.
Fixing this in 13.0 because while the current debian stable ("buster")
still bundles 0.14, the soon-to-be-released Ubuntu LTS (20.04) updates
werkzeug to 0.16. Debian Testing (bullseye) also bundles 0.16 but
isn't expected to get released for another year so it's less of a
concern.
Fixes#47356
Relates to odoo/docker#299
[0]
https://github.com/pallets/werkzeug/blob/c769200d1dcf1e21daaa2781f0c5109586daad42/werkzeug/routing.py#L797-L828
[1] https://github.com/pallets/werkzeug/blob/048cdfd9b969c0c3a133d7ff43b8ad1ad6a673ec/src/werkzeug/routing.py#L1020-L1032closesodoo/odoo#50194
X-original-commit: 4f1589075d2aae65c67a01c5c0f75c19c50a61d6
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
8b921471e4c11575b64d6e5e84508fc625dd2b07 has introduced wrong context key which replaces `res_partner_search_mode` with the depricated `search_default_customer` which was breaking search functality added by 8766f388da
In this commit we correct context's key.
closesodoo/odoo#50222
X-original-commit: 2e309d41cd7e7f22343379bd8a6b397b7d8684fd
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Prevent unexpected country creation when creating a state. Indeed,
there is usually no reason to create a new country.
opw-2239697
closesodoo/odoo#50210
X-original-commit: a502a404b18a0946d9ff64de9e05c28737e82c57
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Users (res.users) and Partners (res.partner) are two main models of Odoo.
This PR aims at improving the performance of their creation:
* Records creation in batch
* Code optimizations to reduce number of queries when possible
Task Id - 2229358
closesodoo/odoo#50209
Forward-port-of: odoo/odoo#48912
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Instead of triggering one has_group by user (one sql query/user if not already ormcached),
and potentially filling the `has_group` cache with new users data (we don't know if and when this data
will be used anyway), compute this field from the groups information already in cache.
X-original-commit: d771d7e9c8503543d29fdbf2ab961c2a32cc3bac
Improve the performance of the default method for user groups by avoiding a `ref` call,
using the group in cache instead.
Calls to ref always trigger one SQL query to verify record still exists
This means that creating 10k user would trigger 10k queries only for the default.
X-original-commit: e67efb88338ef669059591728e7722fe1dff4bf0
The main classes of partners and users support batch creation, but
the majority of their overrides doesn't support creation in batch.
Adapting those overrides to support records creation in batch shows
great performance gains:
* On `res_partner` : 2 to 3 times faster
* On `res_users`, with the inherited `res_partner` created in batch:
up to 10 times faster.
Tests done with 500 to 4k records:
* `res_partner` with only a name provided
* `res_users` with a name and login
X-original-commit: 9c3c5f161580039c1fe50f68acac808c18817997
State field is present twice and statusbar widget is not usable.
Let us fix it by ensuring field is present once and widget is
clickable.
closesodoo/odoo#50207
X-original-commit: 5644eb335e82c7184c27b540fc89ae6e77460992
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
The cash rounding profit_account_id directly impact the account on the
rounding invoice line. If this is configured with a 'payable' or
'receivable' account such line will be read as term and condition line
in '_recompute_payment_terms_lines', messing up the line amounts
Adding a domain to avoid the wrong choice
opw-2214059
closesodoo/odoo#50205
X-original-commit: 303afca8e86a36ff748050cf60ef779663ac1868
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Clearly display to the user which newsletter is currently being used by the
Newsletter Block. Currently when editing the block it displays the first
available newsletter by default. This is confusing for the user that may
think its block was badly configured.
It now clearly display the current chosen newsletter.
Task ID #2192807Closes#47959
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
With a second company generate the report under
Accounting>Reporting>Journals Audit
The name on the report and the currency are the one of the first
company.
This occur because the information on the template is gathered using a
parameter named 'res_company' which is set to the first company and not
the actual one (stored in company_id). Changing the parameter on the
template fix the issue.
opw-2242431
closesodoo/odoo#50173
X-original-commit: 229025e915c6a1a42bb7462486bfa2e6882abad5
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
account.fr.fec model needs to have write access as it
explicitely calls write() on its records.
closesodoo/odoo#50149
X-original-commit: ffef4a4361c6e817872defae504f002629a1a0e4
Related: odoo/enterprise#10196
Signed-off-by: Josse Colpaert <jco@openerp.com>
This commit will put more emphasis on both the revenue and the contact
attached to the opportunity.
Task ID 2240258
closesodoo/odoo#49773
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit adds 2 improvements to help clarify kanban view:
1. In kanban view on Mobile, add some space between the two clickable links
(expevted & confirmed)
2. The "Confirmed" button land on kanban view instead of pivot view
Task ID 2228562
closesodoo/odoo#49595
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
- Create a product P with 10 units on hand
- Create a SO with 5 units, validate
- Create another SO with 5 units, validate
- Update the quantity on hand to 8
The picking linked to the first SO as 2 units unreserved, while one
would expect the unreservation on the second picking.
When unreserving, sort the move lines according to the picking scheduled
date. The latest schedule date comes first.
opw-2233331
closesodoo/odoo#49830
X-original-commit: 41c05cbfb015407dbbf7100233999ecd154267dc
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit ease the creation of campaigns as
they only require a name and a responsible.
When the user clicks on create, it will display the
"Quick Create" card instead of redirecting him to a
full form view.
Task ID 2237999
closesodoo/odoo#49774
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Purpose of this commit is to avoid de-synchronization where content could
be unpublished whereas slide was published.
Task ID 2239840
closesodoo/odoo#49908
X-original-commit: d0f4a3e85eab63e335766a823185fd6ada6e07b4
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Issue
- Install eCommerce, Delivery Costs
- Create 2 delivery methods:
- Country: US States: Empty
- Country: US States: Oklahoma
- Publish both
- In private browser, go to "Shop"
- Order anything, select US as country
The states list only contains Oklahoma.
Cause
When selecting a country, `get_website_sale_states`
is triggered. (website_sale_delivery's one)
It will loop on deliveries methods and add the
delivery method states to an empty list.
But when the delivery method conditions are
country US & States empty. States = no states
So only the states of the delivery method
country US, states: Oklahoma are taken
in account
Solution
Make all states availables when one of the
delivery methods doesn't have states
OPW-2222282
closesodoo/odoo#50167
X-original-commit: 4ef8186307c92637ea16f15c99fd538599acd575
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
Added country states for 6 EU countries: Estonia, Latvia, Lithuania,
Finland, Sweden, Norway. used ISO 3166-2:EE, ISO 3166-2:LV, ISO
3166-2:LT, ISO 3166-2:FI, ISO 3166-2:SE, ISO 3166-2:NO
The county structure in Norway changed on 1 January 2020, but not yet
published in ISO 3166-2
NB! Import for field country_id:id with value "no" for Norway do not
work, must be "base.no", otherwise considered as False
closesodoo/odoo#50168
X-original-commit: 882fa61fd3c3e0e332fb62ecb92a6c4416864321
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
PURPOSE
To align on the v13.0 enable the 'Allow Download' option by default.
SPECIFICATION
Change the default value of slide_resource_downloadable from False
to True.
LINKS
Task ID : 2225802
PR : #49951closesodoo/odoo#50164
X-original-commit: 44bfb8c73f9abc563ce764411610f45e5bdf18b1
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
URPOSE
Prepare code cleaning and optimization in mail, mass_mailing and SMS by
cleaning models for readability and code complexity and footprint reduction.
SPECIFICATIONS
Add tool methods and asserts for link tracker tests.
Add tool methods and assets for mass mailing tests, notably about mailing
traces and their link with emails.
Merge existing and duplicated tests and rewrite them a bit.
Rename and improve test_mass_mailing models.
LINKS
Prepares task ID 2238597 (notification and trace models cleaning)
Task ID 1906925 (mass mailing tests cleaning)
PR #50169
Related: odoo/enterprise#10180
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
State field on trace model is computed based on other (datetime) fields.
It seems therefore unnecessary to force its value.
LINKS
Prepares task ID 2238597 (notification and trace models cleaning)
Task ID 1906925 (mass mailing tests cleaning)
PR #50169
PURPOSE
Prepare code cleaning and optimization in mail, mass_mailing and SMS by
cleaning models for readability and code complexity and footprint reduction.
LINKS
Prepares task ID 2238597 (notification and trace models cleaning)
Task ID 1906925 (mass mailing tests cleaning)
PR #50169
Method _get_exception_code_values can return None value for code. We should avoid
getting a KeyError in HTTP_STATUS_CODES in this case.
closesodoo/odoo#50160
X-original-commit: ea138667d55b535d8ec51f86fd649e28d704ac76
Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
When creating new translations, do not prepopulate the translation
with src.
Take the following scenario:
- set a value in a translatable field in English
- open the translation popup -> creates all ir.translation
- notice an error in English, close the popup
- correct the error in English
- reopen the popup -> existing translations not modified
Add test about reseting
closesodoo/odoo#50147
X-original-commit: 619eccc7a533eedfb3aec0c3740ead1006e0f2f7
Related: odoo/enterprise#10194
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
- A user using ldap to sign in can now changes his password,
providing hid old password.
- When the ldap password is changed, empty the possible
value for the password set in database so
it can no longer be used.
- Usually, in all res.users methods auth_ldap replaces,
we first try to call `super` before fallbacking to
ldap if the call to super fails.
e.g. when authenticating,
we first check the regular (super) credentials,
before fallbacking to ldap if it fails.
In this case, we do the opposite on purpose,
to give the priority to ldap in case a user changes of password.
e.g. a user has the same password in ldap and in database,
when he changes, we rather like changing the ldap password
and then empty the internal password.
closesodoo/odoo#50144
X-original-commit: 8bff93feee0c40dd9ee73ed8217cfdd6abb7de3b
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
When we change the version of branch we keep drivers.
But drivers are not compatible with all branch and Odoo
on the IoT Box can't start.
So we remove all drivers before checkout on another branch
closesodoo/odoo#50140
X-original-commit: 4e97aec6717697c742e5e0b09f00ab7dec09712f
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
PURPOSE
Be able to customize notification email values in a given model by overriding
a simple method instead of having to hijack the email creation process.
SPECIFICATIONS
Add a hook in mail.thread that can be overridden in specific addons, either
by model or globally by inheriting mail.thread.
Include _notify_email_headers in it so that it is correctly embedded in
model-specific values computation.
This removes the need to replace _notify_record_by_email long method in a
custom module.
Closesodoo/odoo#48213Closesodoo/odoo#50097closesodoo/odoo#50129
X-original-commit: 1ba8712d7a797cf2e821ae881cb1f1c4ea2fc11d
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Before this commit, when a list contained owl field components,
the mounted hook was called twice on those components. This may
cause tricky issues like handlers being bound twice, and memory
leaks.
closesodoo/odoo#50127
X-original-commit: 206dd91e78f7896fc6b01020507657e61771787f
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
- Create a product P with a subcontracted BOM
- Create a PO for P, 10 units
- Receive 10 units
- Return 3 units and specify 'To Refund'
13 units are considered received.
The reason is that we don't return to a vendor location, but an internal
location.
We subtract the quantity when the following conditions are met:
- we ask for a refund
- we return to an internal location
- the return location is not in the warehouse of the move
The solution is similar to odoo/enterprise#9647
opw-2235157
closesodoo/odoo#50119
X-original-commit: 5fd6c5b65e00dcac77b232b9f47b2292d86c6b0f
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
A plaintext email is displayed in a `<pre/>` tag to conserve spacing.
But since there is no escaping, if in this text there was XML tags or
HTML entities, they would appear as HTML in browser which is not wanted.
Do note that this was not a security issue since the content will still
be subjected to the checks and foundling of HTML emails.
Without the change, the added test would fail because character &,<,>
were not escaped.
opw-2242323
closes#50003closesodoo/odoo#50123
X-original-commit: 932532b5b59e0b71c8e16dadfb2ff36c38764208
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>