Skip to content

[13.0][HACK] website_slides: remove pt_BR#3

Open
kaynnan wants to merge 15 commits into13.0from
13.0-hack-website_slides
Open

[13.0][HACK] website_slides: remove pt_BR#3
kaynnan wants to merge 15 commits into13.0from
13.0-hack-website_slides

Conversation

@kaynnan
Copy link

@kaynnan kaynnan commented Feb 27, 2024

Hack para ignorar erros relacionados a tradução durante o script de migração OpenUpgrade

cc @marcelsavegnago

xmo-odoo and others added 15 commits August 31, 2023 08:52
Apparently `lxml.html.document_fromstring` (and possibly other
`lxml.html` loaders) parses byte-strings as latin1 regardless of their
actual encoding, maybe because python2, maybe because there's a super
legacy html4 parser underlying it.

Either way that means ever since loading
`static/description/index.html` files was added 10 years
ago (4bf6a7e) `_get_desc` has been
loading these files in latin1 rather than the utf8 most people would
expect.

Add an explicit decoding phase to try and load html description files
in UTF8. Fall back to latin1 in case there are description files which
are genuinely in latin1, or even just some random-ass broken stuff
which very much isn't utf8 (the extended-ascii encodings -- of which
latin1 is one -- will happily accept and mangle any input as every
byte value is valid, utf8 is a lot more structured).

Closes odoo#127846

closes odoo#133708

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
I missed a critical issue in odoo#133708: various users had discovered
they could already fix description issues by adding an XML declaration
to their document which is very cool (though technically not really
valid).

What is a lot less cool is that lxml gets *extremely* unhappy when
asked to parse *strings* with an encoding declaration, raising a
ValueError, so the purported fix breaks on any module which does that,
which seems to include a lot of OCA modules.

Gate the encoding guessing by bailing if the document has an XML
declaration, in which case we just assume the author knows what
they're doing and we leave them alone. For extra safety, check the
encoding declaration in ascii and utf16. Could also have checked for
BOMs, but lxml seems to not care about them overly much (in fact it
seems to prefer them decoded which is odd).

closes odoo#133900

Reported-by: @rezak400
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Upgrade (aka migration) scripts are a core part of Odoo, allowing
database manipulations for modules during version changes.

Any module, including custom ones can run upgrade scripts, even if the
`--upgrade-path` flag (and with it, the `odoo.upgrade` sub-module) is
not present. Currently only the "standard" modules benefit of easy
upgrade script testing. Any custom modules that want to run tests of
their upgrades have to import the tests in the usual `tests` folder,
which is not ideal.

Therefore, to allow TDD and programmatic testing of upgrade scripts in
custom modules, the test discovery is here modified to also parse the
module's `migrations` and `upgrades` sub-modules for tests.

closes odoo#122569

Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
Since odoo#122569, we now try to import the `migrations`
sub-package of each module to find upgrade tests.
However, this badly written regex match the OCA module `base_maintenance`,
which generate a RecursionError.

closes odoo#136282

Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
This uses the hook method introduced in ce1f1b6 for consistency when used on modules
that modify this behavior.
…ok_method-ocb

[13.0][FIX] purchase_stock: Use hook method
When making backports we could need to address double compatibility. We
can ease it setting a handy flag we can use in our code

TT45385
When Odoo is installed with the latest version of the PostgreSQL client (postgres-client or postgres-client-16) and running in Docker (possibly other environments as well but not reproduced so far), executing `pg_dump` via `exec_pg_command` fails with

    Database backup error: Postgres subprocess ('/usr/bin/pg_dump', '--no-owner', '--file=/tmp/tmpmnqiktog/dump.sql', '15TEST') error 1

This seems to be because `os.devnull` is being opened in *read* mode which is incorrect (as it's written to). It's not entirely clear if older `pg_dump` simply ignored the non-writable stdout or if docker adds some restrictions which cause the failure.

Either way this can be solved by either opening `os.devnull` in write mode or switching to the `DEVNULL` constant. While the function is deprecated in 16.0 (7f14631) and removed in master (ae3056f) the latter is not a huge change and it a touch cleaner.

fixes odoo#139687

closes odoo#143198

Forward-port-of: odoo#142987
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
[13.0][FIX] base: postgres subprocess error when dumping database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants