Commit Graph
229 Commits
Author SHA1 Message Date
Christophe Simonis d45c32baac [MERGE] forward port branch saas-15 up to bdd051bf78 2018-06-13 18:13:48 +02:00
Christophe Simonis bdd051bf78 [MERGE] forward port branch saas-14 up to c43c540172 2018-06-13 14:12:12 +02:00
Christophe Simonis 3d7b238b8e [FIX] core: correctly decode 8bit mail headers
When an header contains surrogates, an Header object is returned when
read headers from Message objects.

Also, correctly join header parts in python3.
2018-05-22 16:45:59 +02:00
Christophe Simonis bd2de7ae78 [MERGE] forward port branch saas-15 up to d818b516c1 2018-05-14 14:37:08 +02:00
Christophe Simonis d818b516c1 [MERGE] forward port branch saas-14 up to 5274a62037 2018-05-14 12:28:37 +02:00
Christophe Simonis 5274a62037 [MERGE] forward port branch 10.0 up to 7b1362ac55 2018-05-14 11:51:18 +02:00
xmo-odoo 020906659e [FIX] orm: "relate" binding type on actions
When ir.values was removed and the "action" ir.values were merged
directly into the actions themselves, "client_action_relate" was
discarded as unused (and possibly too similar to
client_action_multi?). *However*:

* it was actually used implicitly as "relate" was the default key2 of
  the <act_window> XML tag
* and it had a crucial difference from client_action_multi:
  client_action_multi is shown on both form and list views by default
  and only on list if multi=True, whereas relate is shown on *either*
  the form or list view (tree if multi else form)

This means without relate the actions which should be only visible on
the form view are now on both list and tree, which leads to
overpopulated `Action` menus and odd behaviours (e.g. actions relying
active_id on lists, which id do they get and why?)

=> reintroduce relate as "action_form_only" for the specific case of
multi=False and either no key2 or a key2 of client_action_relate. If
multi=True then binding_type=action.

Fixes #20124

Followup: Task 1843603 to remove #multi and redundancy
2018-05-09 09:45:29 +02:00
Christophe Simonis f2e105eeca [MERGE] forward port branch saas-15 up to d3a040cebe 2018-05-08 18:12:03 +02:00
Christophe Simonis d3a040cebe [MERGE] forward port branch saas-14 up to 1813f42dbc 2018-05-08 17:18:48 +02:00
Nicolas Lempereur d595e3a258 [FIX] tools: mail transcoding css space consistent
The transcoding of a mail (transforming CSS into inline styles on the
element nodes of the mail) used the form:

 property:value;

So when a mail is saved, it would be eg. with `style="property:value;"`
and when it is being edited "property:value" is removed if available via
CSS stylesheet given the structure.

But the sanitize_style (introduced in bfe7aafa7) adds an espace before
the value (which is more pretty but was probably not choosen in
transcoding to decrease size of mail):

 property: value;

so the inline style would not be removed when editing possibly causing
conflict with the editor.

With this commit, the sanitize_style doesn't add a space. It could have
been changed in transcoding but the code is already rather slow and we
don't want to use a regex replace or two string replace instead of the
current one string replace.

opw-1841107
2018-05-08 16:46:23 +02:00
Christophe Simonis 1813f42dbc [MERGE] forward port branch 10.0 up to 14f59f4b78 2018-05-08 16:23:54 +02:00
Christophe Matthieu b8006bfb1c [FIX] mail tools: html_sanitize must keep useful styles from mass mailing
Issue: The clean removes too many tags so emails sent do not resemble the
preview.

opw-1841138
opw-1841105
2018-05-07 15:34:40 +02:00
Christophe Simonis ad825b673b [MERGE] forward port branch saas-15 up to bfa5af45df 2018-04-16 17:10:23 +02:00
Christophe Simonis bfa5af45df [MERGE] forward port branch saas-14 up to aab0908818 2018-04-16 14:21:00 +02:00
Christophe Simonis aab0908818 [MERGE] forward port branch 10.0 up to c92d43c04b 2018-04-16 12:33:49 +02:00
Christophe Simonis c92d43c04b [MERGE] forward port branch 9.0 up to 752dcc761c 2018-04-16 12:05:35 +02:00
Christophe Simonis c921d94236 [MERGE] forward port branch saas-15 up to 3730a0d2df 2018-03-13 12:05:36 +01:00
Christophe Simonis 3730a0d2df [MERGE] forward port branch saas-14 up to 0e898eae35 2018-03-12 18:48:15 +01:00
Christophe Simonis 0e898eae35 [MERGE] forward port branch 10.0 up to 0440e25380 2018-03-12 18:16:02 +01:00
Martin Trigaux 4fc0947850 [FIX] tools: do not escape \t
msgid ""
"You cannot set a negative product quantity in an inventory line:\n"
"\t%s - qty: %s"

Was creating a ir.translation record with a src as

You cannot set a negative product quantity in an inventory line:
t%s - qty: %s

('t' instead of \t)

Closes #23541
Fixes #23521
2018-03-08 13:47:12 +01:00
Christophe Simonis 5ad55264e4 [MERGE] forward port branch saas-15 up to b04c8eae6b 2018-03-01 18:02:30 +01:00
Christophe Simonis b04c8eae6b [MERGE] forward port branch saas-14 up to 153ae5e8b8 2018-03-01 17:26:43 +01:00
Christophe Simonis 153ae5e8b8 [MERGE] forward port branch 10.0 up to a6855b31c9 2018-03-01 16:51:37 +01:00
Christophe Simonis a6855b31c9 [MERGE] forward port branch 9.0 up to d4ec6b75ac 2018-03-01 13:25:10 +01:00
xmo-odoo 43617bbcb6 [FIX] type error when exporting to tarfiles
When exporting to a tarfile, we first export each module's translations
to a file on the FS, then create a tarball from all of them.

With the P3 bytes/string split, translation export was defined to export
to a bytes IO object in order to work correctly with CSV (which work on
bytes IO for better cross-version compatibility). However the tgz file
export was left opening module's files in `w` mode, which in P3 means
text, which blows up as POFile expects to ultimately write to a bytes IO
object: it uses text, and a StreamReaderWriter is used to translate that
into an underlying bytes IO.

Fix by explicitly opening the files in binary mode.

Fixes #22700
2018-02-02 19:39:51 +01:00
Nicolas Martinelli 8ed7570b1c [FIX] tools: float_round DOWN
The result of the following:
```
float_round(2.5, precision_rounding=0.05, rounding_method='DOWN')
```
is 2.45. Instead, 2.5 is expected.

In case of the `DOWN` method, epsilon should be added, not subtracted.
In the meantime, we introduce a slight reorganization of the method to
make it clearer.

opw-805008
2018-01-29 11:06:33 +01:00
Christophe Simonis bd3869bd3a [FIX] core,google_drive: python3 compatibility 2018-01-19 13:42:26 +01:00
Martin Trigaux cab7e0d204 [FIX] *: add missing space in multilines messages
Courtesy of @Yenthe666
2018-01-03 11:09:09 +01:00
Christophe Simonis 970be94f37 [MERGE] forward port branch saas-14 up to e9c2dcd28d 2017-12-05 14:52:16 +01:00
Lucas Perais (lpe) 2a86e9245c [FIX][BACKPORT] Always round monetary values in database
backport of afef71d6b9

Original commit message:

Let `create` and `write` round monetary field values before sending them to the
database. Pass the values to be written to `field.convert_to_column`, so that
the currency can be retrieved from the values, and the value be rounded.
2017-12-05 13:46:06 +01:00
Xavier Morel 150fc064fd [FIX] product: image changes not sticking everywhere
Fixes #20046

Simply reverting e5ef1c5917 looks to
work *but* since I didn't note the repro case for the issue and don't
remember what it was it may re-introduce previous breakage. Instead,
ensure all "sizes" for the image are reset if any of the sizes is
present *and* Falsy by adding a final case to the conditional.

If any of the image fields is present and non-falsy one of the
previous branches will be taken, so we can just check that any of the
image fields is present at all (this implies it's falsy).
2017-12-05 13:35:51 +01:00
Olivier Laurent 046e4ee29e [FIX] anonymization: P3 encoding issues 2017-11-29 16:19:11 +01:00
Christophe Simonis a094f6318b [MERGE] forward port branch saas-16 up to 745d00362a 2017-11-16 12:40:36 +01:00
Christophe Simonis 5877b7b38c [MERGE] forward port branch saas-15 up to 73e4dacf78 2017-11-15 15:50:36 +01:00
Christophe Simonis 73e4dacf78 [MERGE] forward port branch saas-14 up to 0bf7ab4511 2017-11-15 15:20:52 +01:00
Christophe Simonis 0bf7ab4511 [MERGE] forward port branch 10.0 up to 0fe7989e24 2017-11-15 14:50:46 +01:00
Nicolas Martinelli a9beee42d6 [FIX] tools: lang in formatLang
- Install French language
- Set language of Customer A to French
- Create an invoice due in the past
- Open the Customer Statements

The customer statement of A is translated in French, but the amounts are
formatted in the company's user language (English by default).

We add the possiblity to take into account the lang in the context when
calling `formatLang`.
2017-11-15 12:57:19 +01:00
Adrian Torres 2f0435f081 [FIX] tools: bad regex in mail.py
Before this commit, if comments were found inside the body of a mail
template sent through mass_mailing, the regex in append_content_to_html
that converts possible uppercase tags to lowercase tags would replace
comments by broken html elements, this would break the in-browser parser
and thus would show partial content or no content at all, depending on
the positioning of the comments.

i.e. from <!-- This is a comment --> to <this -->

The regex in question is r'(</?)\W*(\w+)([ >])' which basically matches
opening and closing tags (this was a bad idea from the beginning btw),
the \W* will match any non-alphanumeric chars (so !-- in the
case of comments) and this would be completely discarded since it's not
a match group and when replacing we only use match groups.

This is fixed by simply stripping the \W* since it's discarded anyway,
an alternative fix would be to put it in a match group and add it when
replacing as well, but I don't know if we purposefully discard it or
not.

Neither fix is the good one, the good fix is to replace all the re.subs
by lxml which is much easier and more concise.
2017-10-27 13:32:15 +02:00
Christophe Simonis 10128fa7e8 [MERGE] forward port branch saas-16 up to dc2a6c6cd2 2017-10-20 19:27:04 +02:00
jaredkipe d7cfa8c502 [FIX]: safe_eval’ing some large scripts yield illegal opcodes
Following the 3.6 wordcode change, EXTENDED_ARGS gets used for jumps
offset by more than 256 bytes (128 opcodes), most commonly
absolute (so many script of more than 128 opcodes with conditionals
arer going to trigger the issue).

In bytecoded Python versions, EXTENDED_ARGS was only necessary above
65k opcodes: the opcode would get a separate 16-bits argument, while
wordcode opcodes get 8-bit intrinsic.
2017-10-17 16:16:42 +02:00
Christophe Simonis 868e718e09 [MERGE] forward port branch saas-15 up to 8d0942380b 2017-10-17 15:14:47 +02:00
Christophe Simonis 8d0942380b [MERGE] forward port branch saas-14 up to fbdda5437a 2017-10-17 13:22:25 +02:00
Christophe Simonis fbdda5437a [MERGE] forward port branch 10.0 up to cbca27d005 2017-10-17 12:09:58 +02:00
Christophe Simonis cbca27d005 [MERGE] forward port branch 9.0 up to d5c0cae60b 2017-10-17 11:42:05 +02:00
alexkuhn 44b3491450 [FIX][P3] base, tools: prevent crash when importing translation .po file (#20191)
With Odoo v11 running on Python3:

1. Go to Settings -> Translation -> Import Translation
2. Choose a valid .po file (e.g. generated with the menu Export Translation)
3. Click Import
There is a server error.

There are two bugs behind this error:
1. we open a temporary file that cannot insert bytes ('w+')
2. the name of the temporary file is an integer (its file descriptor)

Python2 processed some implicit conversion between str and bytes, so that the 1st error doesn't occur. The name of a temporary file in Python2 is '<fopen>'.

We made the following corrections to the code:
1. open the temporary file with w+b access (write bytes)
2. enhanced a conditional statement so that we skip instructions in case where the field name of the tempfile is a string

Related Ticket:
opw-775445
2017-10-16 16:30:54 +02:00
Xavier Morel 4c3846e7e0 [FIX] tools: use codecs for csv reader/writer
The class PoFile was already using it.
TextIOWrapper closes its underlying buffer causing the "Synchronize Terms" action
to fail (trying to read on a closed buffer).

Fixes #19911
2017-10-11 11:42:31 +02:00
Sylvain Garancher 823a1aa22d [FIX] P3: graph: correct P3 migration errors
- leftover real division errors
- typos in migration of values() calls in
  fffaf735f5
2017-10-04 15:06:28 +02:00
Olivier Dony b02dea7688 [IMP] config: allow blocking access to db manager
- The `--no-database-list` option will now also block access to database
  management functions and screens.
  Presumably this flag should only be used in production when all
  databases have been provisioned, so the admin should like to block
  access to the db manager at the same time.

- If no `--database` or `-d` parameter is provided, the system will be
  unable to fetch a list of databases at all, so users will be blocked
  with an error message.

- Hide the link on the login screen to the DB manager when it is
  disabled, to prevent sending users to an error page.

- Weak attempt at updating the documentation

Note: the security check for RPC methods could have been done in the RPC
dispatcher, however that would not have protected service methods when
called directly, e.g. by a controller (e.g. the dump method).
2017-10-03 12:46:03 +02:00
Olivier Dony 7d16769263 [IMP] config: support hashed master passwords
- Add support for hashed master passwords (super-admin password) using a
  strong scheme (PBKDF2_SHA512).

- Replace the password with a hash in memory (tools.config map), after
  verifying it

- Automatically replace the plaintext master password with a hash when
  saving it after a password change

- Preserve support for setting/using plaintext passwords when necessary
  (e.g. as a temporary deployment thing)
2017-10-03 12:45:22 +02:00
Christophe Monniez 77df0e5b27 [FIX] misc: Force utf-8 decoding when opening a file 2017-10-03 12:01:52 +02:00