Change the decimal point and thousands separator for es_PE and es_CR
Set the currency symbol and position for Colon CRC
closesodoo/odoo#48535
X-original-commit: 88f420f37c305a7451be31ee36c479c2dffd4db8
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
When routing an HTTP request, the dispatcher uses an environment with a
placeholder for the user (the object `RequestUID`). This environment is
not supposed to be used after routing has been done. However, the
flushing function takes any environment with a given cursor, and it
crashes when this environment is chosen (`psycopg2` cannot adapt the
type `RequestUID` for `write_uid`), and simply does not make sense.
closesodoo/odoo#48495
X-original-commit: da61a64bf6731a08557d23680eabf4d910035ebd
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
When a serialization error occurs in a given code context, the call is
retried. However, currently the environment is flushed outside this
context, which may cause a serialization error that is not handled by a
retry. Move the flush inside the checked call to catch all
serialization errors, and handle them properly.
X-original-commit: 6197bfb3b2d51873416780c96cd4cb538a1f219c
In case of short controller that don't use qweb template, we don't need
anyhting else that this url code that don't change frequently.
It make only sense for model like lang, website, ... that will not change
frequently. And are called on each call by the dispatcher.
In case of a website page, we will btw browse lang later, but in case of
small controller like /favicon.ico, or page without qweb, ... we can just
use the same from last query.
If model is already an ir.attachment we don't need to do a new search_read.
We can use it record directly.
After this commit, we don't do extra request if we already have the info,
else we don't change the behavior.
task-2211013
Most of the time, the record exists, but we still ensure it does, every single
time, making an SQL query.
Doing a try catch will result in the same behavior, but won't make that query
most of the time.
task-2211013
Before this commit, trying to use Odoo as a library without initializing
the logging features would result in a crash because `Logger.runbot()`
is monkey-patched inside the function `init_logger()`, which is de facto
necessary for using Odoo as a lib.
With this commit, we do the monkey-patch at the module-level so whenever
the `netsvc` package is imported the patch is applied, which should be
well before the loading of the registry starts.
closesodoo/odoo#48396
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
When we print a report for multiple records, we call wkhtmltopdf one
time and to save each document separately, we will split the PDF based
on its outline if it is available.
The outline is generated by wkhtmltopdf based on headings
(H1,H2,H3,H4,H5,H6,H7,H8,H9 elements) for example this document:
```
<h1>hello</h1>
<h2>world</h2>
<h1>!</h1>
```
has this abbreviated outline structure:
```
/Outlines: {
'/First': {
'/Title': 'hello'
'/First': {
'/Title': 'world'
},
'/Next': {
'/Title': '!'
}
}
}
```
But the current heuristic did not take into account level of headings,
so if the document had a lower-level headings this could break the
multi-printing of these reports.
So for the example above, the document would be cut in 3 when in reality
we only want to cut it twice over the top level heading (`<h1/>` here).
An existing issue in Odoo is in l10n_in_sale, `<h6/>` element are added
to the report invoice line so instead of only one `<h2/>` heading
containing the invoice name per document, there was an additional
heading per invoice line which broke the heuristic.
note: we also add an assertion to ensure first heading is on first page.
note: allowing several top-level heading on same page has been
implemented so reports that did not work in 11.0 but worked in 12.0 and
over (thanks to 573e57773) still work after this change.
opw-2188767
closes#48099closesodoo/odoo#48374
X-original-commit: 63c2478cc9fb21afb83d31b04ff6c6090ee492ab
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
In 12.0 9de1bc0e aria-label translation was added for python views, but:
- aria-label attribute are not exported
- aria-label are not translated for JS view rendering
So by default, aria-label would only be translated for python views that
had the same aria-label term in a translatable element (eg. "title"
attribute).
opw-2222504
closes#48255closesodoo/odoo#48275
X-original-commit: 6b6b11ea2f8391f1f195bd1650531f77b6bed729
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Purpose of this commit is to let computed stored editable fields being
copied if their field class allows it.
Indeed the value of those fields is computed based on some triggers but
can also be updated manually by users. When copying a record, it makes
sense to consider that this value is what the user expects and allow its
copy, if the original field allows it. Either it was computed, and
copied value will be correct without having to call computation again
(well, provided all dependencies have been copied, too), or it was
updated and the copied value will be the one the user entered.
Without this fix, an edited field is not copied, and will be recomputed,
which may look like an inconsistent value.
Task ID 2209163
closesodoo/odoo#48383
X-original-commit: 4b274d3b4101fbae154a572cdf40d23838899773
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
Purpose
=======
If a user specifies a language on a company (res.partner), chances are children
of said company will speak the same language. It is at least most likely than
having them speak the default DB language.
Specifications
==============
If a language is set on the parent, the child contact created from the o2m
should have by default the same language.
Before this commit, we set lang in the context of the o2m field but it not
taken into account and is overriden by the default DB lang.
After this commit, the default lang value is forced in the default get to
be the same than the parent, if any. Else, we fallback to the default DB lang.
Link
====
Task ID: 2210350
PR #48077
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Context:
Since 7593b887df an entry of ir.model.fields.selection is created
for each entry in a selection field. This allow a more modular
approach of tagging entries with an external id and translating
selections in the module that defined the selection (and not the one
that defined the field)
Problem:
When removing a selection, every record that used this selection is
updated with a 'set null'.
This was also intented on abstract models that do not have a table.
To reproduce:
1. create two models:
class ModelA(models.Abstract):
_name = 'abstract.a'
select = fields.Selection([
('foo', 'Foo'),
('bar', 'Bar'),
])
class ModelB(models.Model):
_name = 'model.b'
_inherit = 'abstract.a'
2. update code and removes the key 'foo'
3. update the module
-> error
psycopg2.errors.UndefinedTable: relation "abstract_a" does not exist
LINE 1: UPDATE "abstract_a" SET "select"=NULL WHERE "re...
When updating the values in db, only update on real models
closesodoo/odoo#48288
X-original-commit: 6b20a8241300ebfc185500eb64e210db755574a8
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
PURPOSE
Move links shortening tools on mail.render.mixin to have rendering and
post procesing tools available on that mixin.
SPECIFICATIONS
Move html and text links shortening methods on mail.render.mixin class.
That way rendering and post processing is done in that mixin instead of
being specific to link.tracker model. Indeed those methods are tools and
not really business related methods.
Future commits will improve the way mail and sms composer use the render
mixin. This commit is therefore both a cleaning and preparing commit.
LINKS
Task ID 1963529
Community PR odoo/odoo#32397
Rewrite code parsing name (_parse_partner_name) to make it easier to
understand. Tweak find_or_create to return directly a recordset with the
found partner / new partner instead of a name_get result.
Also inherit Partner.find_or_create() in mail in order to benefits from
email_normalized field, allowing to improve the search on matching emails
and avoid duplicates.
LINKS
Task ID 1963529
Community PR odoo/odoo#32397
As find_or_create API and code will be slightly improved soon let us add some
tests to ensure behavior and avoid (too much) regressions. Notably about the
fallback on faulty emails support aka "name email@domain)" which in parsing
is considered as valid. This may happen when people copy-paste emails.
LINKS
Task ID 1963529
Community PR odoo/odoo#32397
Commit 60106cf2 (task 2082503) introduced some changes on server
actions and automated actions, some changes were applied on server
actions but via the base_automation inherited view.
This commit move those change so they are directly applied on the server
action form view.
closesodoo/odoo#40964
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
With the introduction of `new`, the use of `resolve_2many_commands` is
redundant, as it accomplishes the same function with the added benefit
of returning a record-like object whose API is more familiar than
`resolve_2many_commands` API.
closesodoo/odoo#37290
Related: odoo/enterprise#9409
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
This code adapts all business code instances of calls to
`resolve_2many_commands` and replaces them by calls to `new` which
returns a record-like object whose api is more familiar than the
`resolve_2many_commands` api.
To avoid having to fixup half a dozen places where we're creating PDF
writers, and possibly ending up with new ill-configured writers in
the future, patch PyPDF2's own writer with a subclass setting /Creator
and /Producer.
Note that this will not affect non-post-processed PDFs generated by
wkhtmltopdf. wkhtmltopdf does not allow setting these properties[0][1], so
to fix this issue we'd have to alter _run_wkhtmltopdf to pass the
result through PyPDF2 in order to alter its metadata.
[0] https://github.com/wkhtmltopdf/wkhtmltopdf/issues/2000
[1] https://bugreports.qt.io/browse/QTBUG-44451closesodoo/odoo#29460
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
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>
before this commit:
actions are not showing as per the sequence, like:
1) Other actions (delete, duplicate)
2) Windows actions
3) Server actions (without sorting by sequence)
After this commit:
Server actions are sorted by the sequence, like:
1) Other actions (delete, duplicate)
2) Windows actions
3) Server actions (with sorting by sequence)
task-2005419
closesodoo/odoo#39872
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Before this change, if an error occurs while trying to match / import
a sub-field e.g. order_line/product_id, only the name of the top-level
field is showing when displaying the error e.g. "Order Line", which
lacks precision and makes understanding and fixing the issue more
complicated.
After this change, the entire field path should be displayed, e.g.
"Order Line / Product" in the example above.
Task-1906700
closesodoo/odoo#33031
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Because CacheMiss calls str() on the record it's given, it's not
possible to override __str__ and get field values: on the first cache
miss (= the first field access) we're going to blow the stack:
* any random field is accessed
* and faults
* which creates a CacheMiss
* which stringifies the record
* which accesses a field
* which faults
* which creates a CacheMiss
* etc...
Fix:
* move the basic Model's stringification to repr(), which is
implicitly called on str() if no __str__ is specified, for historical
reasons we were doing the opposite
* use repr() when initialising CacheMiss
closesodoo/odoo#42966
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
The use case is a cache miss of a stored field with compute on a new
record with origin. The field should be computed only when explicitly
triggered, i.e., when a dependency has been modified. Otherwise it
should be fetched from the origin record.
closesodoo/odoo#47353
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
PURPOSE
Remove dead views to clean dead records
SPECIFICATIONS
Find unused views and remove them, notably specific views that are not used
anymore because generic one is always taken. Notably
* view_partner_short_form: a short form view on partner that is not used
anywhere anymore. Indeed it has a priority of 2 whereas default form view
has a priority of 1 (lower better). It is not referenced in actions
anymore. It is therefore dead.
LINKS
Task ID 2196317 (Social/Marketing specific)
Purpose of this task is to prevent users from setting portal users on
internal documents by mistake, and preventing noise and performance
issues resulting from loading all the portal users in those fields.
This commit fixes internal many2x fields to res.users which are now
restricted to internal users by setting domain (share=false) on form view.
closesodoo/odoo#47553
Taskid: 2172779
Related: https://github.com/odoo/enterprise/pull/9204
Related: odoo/enterprise#9204
Closes: #47553
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
* remove global assignation in xml, it is a computed field anyway, let the orm compute it
* put all `ir_rule` definition as noupdate in the xml
closesodoo/odoo#47688
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
ir.rule are default values but can be customized based on the
company's policy and needs.
This is typically a record that is in noupdate as should be
customization-friendly.
Purpose
=======
The main definition of 'assignation' is the following:
"an appointment to meet someone in secret, typically one made by lovers"
The correct word we should be using is 'assignment':
"the allocation of someone or something as belonging to a particular group or category"
So in this commit change every iteration of the word
'assignation' to 'assignment', across all modules.
closes odoo/odoo#45041
Taskid: 1966215
Closes: #45041
Related: odoo/enterprise#8375
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Importing 100 records and getting 100 errors (often the same every
time because a required field was not mapped) is not super useful and
spams the logs a lot.
Cutting off at one point seems useful.
Note: integrates warnings-related fix from #47972 reported by Grzegorz
Marczyński in #47936.
closesodoo/odoo#48095
X-original-commit: 6b05f1d13c862dd66e89f35607d072315be80995
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Purpose of this commit is to improve english wording in Odoo
regarding res.partner.industry model.
For that purpose we rename "Sectors of activity" with
"Industries" everywhere we use that naming.
Original feedback #2212682
Task ID #2214290Closes#47559
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Before this commit, url_lang (= url_for) will make query to find the lang_code
but we alrady have this info in ormcache with get_available method.
So instead to rebrowse (search query) the lang, we use a new method that will
try to find it in cache if possible before to make the query.
The gain on each page is n-1 (where n is # lang installed)
Because the switcher of languages do an url_for for each lang available.
Related to #47257
task-2211013
X-original-commit: 2cecbe356ce283e15fb0bbd0a6e9aa4735af520e
Before this commit, we compute the hash on each request, to know if we need to
download the file from the frontend or if we can use cache.
Now we store the hash computed in cache. The cache will be invalidated when we
touch one of these translations (openerp-web in the comments) or when you
install a new lang (already the case).
+ avoid to use read on a record, since it will not use the cache from record.
Related to #47257
task-2211013
X-original-commit: d5aaecbc51de19ef1d8d9988b691177fc73a4b86
This warning should only appear when Chrome is used.
closesodoo/odoo#48009
X-original-commit: 013b32f000520217af17b6e1ffe1872ec97afdf0
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
* from collections import <ABC> is deprecated, unclear why the
deprecation warning didn't appear before (possibly only appears in
3.7/3.8?) either way `collections.abc` should be 3.3+ so switch
everything to it.
* add some more ignores on third-party packages deprecation
warnings (meh)
* while at it, mitigate generation of non-breaking space on some
versions of Babel (in the french locale used by our tests anyway)
closesodoo/odoo#47581
Related: odoo/enterprise#9214
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Before this commit, when a user try to import data with a XLSX file, the
file was mistaken by an SVG file. This issue arises because a XLSX file
from import isn't encoded in base64, and for testing if the file is an
SVG file it will be decoded. base64.b64decode by default (when validate
is False), will remove all characters that are in the base-64 alphabet
from the input prior to decode. So in our case, when the non encoded
XSLX file is force decoded the results starts, unluckily, with '<' and
it's mistaken by an XML/SVG file. Note that, the XSLX file is wrongly
tested because a XSLX file is just a ZIP file, and all the ZIP files
start with PK\x03\x04, and P is the first byte of a base64 encoded XML
file.
Now, only files that were previously encoded into base64 are decoded to
be tested. The validate = True parameter in base64.b64decode will raise
a binascii.Error if there are a non-base64-alphabet characters in the
input, this will allow us to know if the input was or wasn't base64
prior encoded. As base64.b64decode with validate = False, removed the
non-base64-alphabet characters this allows to decode input files
compatible with RFC 2045 (MIME). The files compatible with this standard
will have a newline character (b'\n') after every 76 bytes of the
output, and end with a newline. To keep backwards compatibility, we
remove the newlines and the carriage return from the input before the
decoding.
opw-2194468
closes#36081closes#31849closes#33543closesodoo/odoo#47906
X-original-commit: 65d709c9ab386d646f682c494cfb21cb06ec8034
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Co-authored-by: Xavier Morel <xmo@odoo.com>
When passing a view
from `active` `False`
to `active` `True`,
its xml wasn't being checked, and it could be very well be invalid.
e.g.
Create a view inheriting from `base.view_partner_form`
`active` set to `False`
`arch` set to
```
<field name="foo" position="after">
<field name="bar"/>
</field>
```
On creation, the `_check_xml` constraint is valid because the view is disabled.
Now, write `active` to `True`. Notice no constraint error is raised while the view is invalid.
This is particularly critical now that we automatically disable invalid custom views
during upgrades. When the user tries to re-enable the view which has been disabled to see
what was wrong, he doesn't get any error because of this.
closesodoo/odoo#47897
X-original-commit: fb2aeb29cd62e02ca5485e5b60d6b61ae4acc252
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
When uninstalling a module, all related ir.model.data records are
unlinked, if the unlink fails, a dichotomy is performed until all
records are unlinked.
It happens that a record appears in both part of the dichotomy. In that
case, the record is deleted in the first part. When second part records
are unlinked, a crash occurs because the record cannot be found anymore.
With this commit, sets are used instead of lists to store the records
that need to be removed, avoiding duplicates in dichotomy.
closesodoo/odoo#46323
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
With this commit, a new script "tests-uninstalls.py" is added in order to
test module uninstallation.
This script is a kind of standalone tool. It uses odoo as a library but
the odoo server is not started at all.
In its standard invocation, it tries an install/uninstall/reinstall
cycle for each all module found in the specified database.
By specifying '-U', it only tries to uninstall the comma separated list
of modules following the argument.
Be aware that this tool, will alter the database against which it was
invoked.
Co-authored-by: Raphael Collet <rco@odoo.com>
This commit adds the possibility to compare a view arch to another one.
The result will be shown in a diff viewer (github like).
This is following what was done at #32009
task-2190072
closesodoo/odoo#44646
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Before this commit, the query to fetch records with/without relations would be
done in a separate query which results would be then passed to the main query.
This commit adds this query as a subquery of the main query to do it in the
same SQL query instead of separately.
task-2211013
closesodoo/odoo#47729
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
Performances from a general point of view can be difficult to track.
This commit proposes to improve logs in two ways:
The current logs only use the sql_counter, wich will only be updated
when a cursor is closed. In a test-enable install, this counter
is actually the queries of the tests wince the install cursor is
open untill the end. The first fix is to use bot sql_counter and
sql_log_count to have total queries untill now on closed cursor,
but also the current number of queries of the current cursor.
This means that the new log format will be
{nb} modules loaded in {time}, {loading_querie} (+{test_cr_queries}) queries
instead of
{nb} modules loaded in {time}, {tests_cr__queries}queries
Nothe that in the current version, {nb} is actually the total number of
loaded modules until now.
This commit also add an equivalent end log by module and change the
loglevel of module start on install (mainly usefull if an error occurs
before anything else is logged hidding the module causing this error.)
A cleaner runbot logger is also added, in order to be abble to call
_logger.runbot( instead of _logger.log(25. This will clarify the purpose
of such a log level.
closesodoo/odoo#47283
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Combining a state and attrs does not work
Apply all in the same domain
closesodoo/odoo#47676
X-original-commit: 3588487ab4ef867f7fb981a395deaf298eb4a4e4
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
The `__closer` attribute is filled with the origin of a call to
`cr.close()`. That information is reused in the `check` decotator that
ensure the user is not using a closed cursor. In case he is using a
closed cursor, an error is raised with that optional origin in case of
`--log-sql`.
The attribute is a dundler so it is only accessible within its class, as
the decorator has been moved outside of the class by 058cf208a8 it is
not directly accessible thus `__getattr__` is called as a fallback. The
`__getattr__` itself is protected by the `check` decorator thus they
call each other in a infinite recursion.
As the related dundler is no more used internally, it has been decided
to remove it entirely.
closesodoo/odoo#47616
Task: 2199895
X-original-commit: 3ebf7cb9cca37b05f44aaffc0b1f289cc65f300f
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
Use of the new control panel helpers to increase consistency and change the assertions
according to the new DOM/behaviour (e.g. components removed instead of turning invisible).
Part of task 2196029
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>