Commit Graph
135017 Commits
Author SHA1 Message Date
Michael Mattiello (mcm) 4520a09f2c [REF] web: convert FieldBoolean to owl
This commit does 4 things:
- adds a file for deprecated legacy fields.
- moves legacy FieldBoolean into this file.
- converts FieldBoolean to owl component.
- adds a new xml file for component fields' templates.

task id: 2193996
2020-03-31 07:11:01 +00:00
Michael Mattiello (mcm) 9324282b01 [REF] web,*: add new field registry for components
* account

This commit adds a new field registry for component fields.
This field registry is used to only register the new field components
and the other one should register the legacy fields.
Those two registries will be used together while all legacy fields are
not converted to owl component.

As the legacy registry now throws an error when adding a component
field the existing component fields (account.ShowGroupedList and
account.ShowResequenceRenderer) are moved into the new registry.

This commit also refactors some field managers (form renderer, list
editable renderer, calendar popover) to use the new registry and thus
support the component fields.

task id: 2193996
2020-03-31 07:11:01 +00:00
Michael Mattiello (mcm) 91c7e574ed [ADD] web: add CustomCheckbox owl component
This commit adds an owl component for the Odoo custom checkbox.

task id: 2193996
2020-03-31 06:13:11 +00:00
Michael Mattiello (mcm) cde276a1ef [REF] web: add missing features of abstract field
This commit adds missing features of AbstractField written in owl.

task id: 2193996
2020-03-31 06:13:11 +00:00
Romain DerieandJeremy Kersten 30f4f610bf [IMP] website: improvement regarding social image
This commit introduce multiple improvements regarding social image:
  - (perf) Don't read ir.attachment through `social_default_image` when it is
    not needed. Use a stored boolean to know if the field should be accessed.
    This will remove one SQL query in attachment for public user.
  - Show website logo, not the company logo since we now have a different logo
    for website.
  - Don't show images lower than 200 width or 200 height px. Logo will be
    shown regardless of his size.
  - Don't show website logo if there is a website social_default_image.
    Indeed, the spec was to prevent showing logo and social_default_image if
    they are the same image. Technically, this is hard to identify as they
    could be the same image uploaded with different resolutions (media dialog),
    especially if one of those was uploaded through the backend and one from
    the frontend.
    It is most likely we will never correctly identify duplicate as they won't
    be exactly the same.
    For this reason, it makes more sense to hide the website logo if the
    social_default_image is set. It avoids every issues while it makes sense
    since you won't want to use the logo over the social_default_image. If you
    really want to, you could reupload it through the SEO media dialog.

closes odoo/odoo#47848

Related: odoo/upgrade#1012
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Co-authored-by: Romain Derie <rde@odoo.com>
Co-authored-by: Jeremy Kersten <jke@odoo.com>
2020-03-30 16:06:13 +00:00
Christophe Monniez f425aee52b [FIX] website: activate translation before starting tour
During the rte_translator tour, the step that adds and loads the fr_BE
language lasts a very long time.  This time depends of the loading of
`.po` files.

For un unknown reason the temporary postgresql table created in
ir_translation.py may takes more times than usual. This, repeated for
each `.po' files, in enterprise, leads to a timeout of this step (more
than 60 sec).

As this seems linked to postgresql (or another external factor) and as
the purpose of this test is not to test the translation loading, the
present fix is to simply activate `fr_BE` translation for the website on
the server side before starting the tour.

The loading of translation is tested in test_translation_import module.

closes odoo/odoo#48621

X-original-commit: a15c7099a36a3a5b4dca9375b233cbe3fe2a280f
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-03-30 14:33:28 +00:00
Christophe Monniez 748cc7e501 [IMP] base, lunch: populate res.users and lunch models
closes odoo/odoo#48636

X-original-commit: f3f2a1e4723240b6396cea943fc86291c16f4c9d
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2020-03-30 21:30:15 +00:00
Xavier-Do 9d1a92548e [IMP] base: populate res.partner and res.company
X-original-commit: f360cc8d80bacf66923e45a98669959133806ff8
2020-03-30 21:30:15 +00:00
Xavier-Do f545fd274d [IMP] core, base: add tooling to populate database
Some use case like testing performance or upgrade scripts required a database
with prefilled data, covering basic corner cases. A solution can be to
create data a procedural way.

This commit proposes an API to easily populate a model, usually by giving a
list of possible values for each field or by giving a compute method that will
be based on raw values of other fields.

The basic way to define how to populate a new field is to override `_populate_factories`,
a method that returns a sequence of pairs `(field_name, factory)`.

The definition of a field is a "factory", a function that returns a neverending iterator
combining its value(s) with the values of the iterator given in parameter.
Some factory helpers are given in `tools.populate.py`:
- `iterate(vals, weighs)` ensures that one record is created for each value
by iterating on them, then resumes as `random.choice` on those vals following weights
once the first iteration is finished.
- `cartesian(vals, weights)` makes a cartesian product of its own values with the values
of its input iterator, then resumes as a randomized generator.
- `compute(function)` calls the given function with the current values dict and a random object,
and assigns the current field to the returned value.
- ...

Each iterator yields dictionaries of field values, and the factory should add a
value for the current field(s).  The yielded dictionaries also contain a pseudo_field
`"__complete"`, that indicates whether this step is some randomized data
to reach the expected count of records.  A falsy value indicates that the iterator
is still covering mandatory cases.  This indicates whether a cartesian product is
finished, or an `iterate` has consumed all its values.

The order of the factories is quite important, since some computed fields may need
other fields to be defined, and `cartesian` factories should always be at the beginning
to avoid having too many combination.  That is why the factories are given as a list of
pairs instead of a dictionary; this makes it easier to insert elements at any place.

Example:
field A: cartesian([T, F])
field B: cartesian([0, 1])
field C: iterate([a, b, c, d, e])
field D: compute(1-B)

_c is shortcut for __complete
_ is a random value, or result of a random value

```
iter | root  | field A  | field B | field C     | field D   | result
0     {_c:F}  {... A:T}  {... B:0} {...C:a}      {...D:1}    T,0,a,1 complete:False
                         {... B:1} {...C:b}      {...D:0}    T,1,b,0 complete:False
              {... A:F}  {... B:0} {...C:c}      {...D:1}    F,0,c,1 complete:False
                         {... B:1} {...C:d}      {...D:0}    F,1,d,0 complete:False
1     {_c:T}  {... A:_}  {... B:_} {...C:e,_c:F} {...D:_}    _,_,e,_ complete:False
2     {_c:T}  {... A:_}  {... B:_} {...C:_}      {...D:_}    _,_,_,_ complete:True
```

X-original-commit: 4c0182dafa584853ed83a166096f45c33c06a245
2020-03-30 21:30:13 +00:00
Nicolas Martinelli 2dc4ef69c1 [FIX] account, pos_cash_rounding: company_id on cash rounding
- Create 2 companies C1 and C2
- Create a cash rounding method for C2, i.e. use an account of C2
- In the POS configuration of C1, choose the created cash rounding
  method

When closing the POS, entries will be booked in C1 and C2 => error.

We define a `company_id` field which is a related to the `account`
company.

opw-2223150
opw-2217718

closes odoo/odoo#48632

X-original-commit: a1feee5db2d6509c0af8f59812a8e8ce5b23c662
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2020-03-30 20:39:16 +00:00
oco-odoo 0eef278268 [IMP] base, account, l10n_ch, website_sale, payment, web: make payment QR-code generation more generic
This new modelling makes it easier to add new QR-code formats, and allows using all of them in website_sale and account.payment's form view as well (so, Swiss QR codes are now available there, while they were restricted to only invoices in the past). All barcodes are now generated as reports, from a dedicated route. This was only partly the case before : Swiss QR added a cross on top of the QR-code directly in the template, it wasn't part of the image returned by the route; now it is.

[ADD] base_qr_code_sepa: new module decoupling SEPA QR-codes generation from the base module

Each new QR-code generation option should thus be done in a dedicated module (or added to a localization) in the future.

[IMP] base_qr_code_sepa: update the generated QR codes to version 2 of the specification

Version 1 is still supported, so no need to backport this.

[IMP] l10n_ch: make Swiss QR-codes compatible with the new version of the specification (the old one is deprecated)

This will be backported to 11.0 and 12.0, as these QR-codes will soon replace ISR.

[IMP] account: make it possible to mark manual payments as sent with a button on the form view

This way, when making them directly with a QR-code (or doing a more classical wire transfer), people can keep track of what they already have asked the bank to do, and what they still have to treat.

closes odoo/odoo#44839

Related: odoo/enterprise#8262
Related: odoo/upgrade#992
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-03-30 11:28:41 +00:00
svs-odoo c1f3596bd3 [FIX] mrp: create mrp.document through mrp.eco
How to reproduce:
  - Open PLM app, open an Engineering Change Order;
  - Click on "Update Documents";
  - Try to upload a document -> Traceback.

As we did not cast res_id as integer, the check method of ir.attachment
crashes when accessing company_id on a malformed recordset of ECO
because the domain generated by _filter_access_rules_python is:

  `['|', ('company_id', '=', False), ('company_id', 'in', [2, 1])]`

This route is also used when adding attachment to a `product.product`.
In this case the check didn't work either but somehow passed because no
domain is generated by `_filter_access_rules_python`.
The following snippet shows that if there was one, it would also crash:

```
In [16]: records
Out[16]: product.product('25',)

In [17]: records.stock_move_ids
Out[17]: stock.move()

In [18]: self.env['product.product'].browse(25)
Out[18]: product.product(25,)

In [19]: self.env['product.product'].browse(25).stock_move_ids
Out[19]: stock.move(41, 13)
```

task-2223153

closes odoo/odoo#48515

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-03-30 14:42:12 +00:00
Odoo's Mergebot e3ae7c6492 [MERGE] web,*: selection in list views
*account

This commit allows the user to apply actions to all records
matching the current domain in list views. It also ensures that
the user is aware of the set of records actually selected.

The number of selected records is now displayed in the control
panel, and the user can, with an additional click, select all
records matching the current domain instead of the ones of the
current page.

Task 2185145

closes odoo/odoo#48305

Related: odoo/enterprise#9537
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2020-03-30 20:44:04 +02:00
Nicolas Lempereur b53cf339e4 [FIX] web,*: phone number ltr even in rtl language
Currently there is two ways in view to have a phone number displayed in
LTR in a RTL language:

- have `widget="phone"` on a field
- have a class o_force_ltr on the field

But this is currently done very rarely and fail in list view because the
direction of data cells is used, eg.:

```
<div style="direction:rtl">
  <table><tr><td style="direction:ltr">
      <span>+1 2 3</span>
  </td></tr><tr><td>
      <span style="direction:ltr">+4 5 6</span>
  </td>/tr></table>
</div>
```

will be displayed as:

+1 2 3
6 5 4+

In this commit, we use unicode-bidi* to optionally add an additional
level of embedding so direction is taken into account by the
bidirectional algorithm.

This commit also adds o_force_ltr class or phone widget on phone fields
where it is not already defined.

*: https://drafts.csswg.org/css-writing-modes-3/#propdef-unicode-bidi

opw-2224828
closes #48425

closes odoo/odoo#48588

X-original-commit: ab067218e069f0a92610c3f0d4137e563e47755c
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-03-30 13:50:04 +00:00
Luis González 8ccdbea9a7 [FIX] web: Make company switcher widget usable with the keyboard
Background
==========

After the refactor on the multi-company behavior performed for v13, now
there are two possible actions per company, depending on where they're
clicked: switch to the company or toggle it. Such actions were handled
by `<div>` elements, which aren't keyboard-reachable by default.

The Issue
=========

Because of the above, the company switcher was neither reachable nor
usable when using the keyboard.

Solution
========

To solve this, the following is performed:
- Add HTML attributes required to make elements reachable, along with
  their corresponding aria attributes
- Actions that are currently triggered when clicking on an element, now
  are also triggered when the keyboard focus is on the element and `ENTER`
  or `SPACE` are hit

Closes #47650

closes odoo/odoo#48627

X-original-commit: 33a7238d0b03ccb89e4c4d2f0d7380b5649dc4d4
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Luis González [Vauxoo] <luisg123v@users.noreply.github.com>
2020-03-30 16:31:37 +00:00
Goffin Simon e4be7ad7a6 [FIX] website_event: Ordering more tickets than available seats
Steps to reproduce the bug:

- Let's consider an event E with Maximum Attendees = 2 and Autoconfirm
- Create two kind of tickets Premium with Maximum available seats = 2 and Normal with Maximum available seats = 2
- Go to the website and register for E
- Take two tickets Premium and two tickets Normal

Bug:

Odoo gave the possibility to buy for tickets for E even if the Maximum Attendees was 2
and Odoo never autoconfirm these tickets.

opw:2214576

closes odoo/odoo#48567

X-original-commit: ff49afc6c71285cf90f720f2e97f8adedee7204b
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2020-03-30 14:34:55 +00:00
Adrian Torres 1daf8eb127 [FIX] *: set ondelete policy of required Selection fields
With this commit, Selection fields with `required=True` which are
extended via `selection_add` are given proper ondelete policies to
ensure the cleanup of records containing these extended options during
uninstall of the extending module.

This commit also cleans up leftover uninstall hooks that were being used
to handle the same set of problems prior to the ondelete mechanism being
implemented for Selection fields.

closes odoo/odoo#46325

Related: odoo/enterprise#9117
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-30 13:42:04 +00:00
Adrian Torres f0481392c6 [IMP] core: introduce mechanism for selection_add cleanup
- Let A and B be two different modules.
- A defines a required Selection field F of model M and B extends
  it through the `selection_add` argument.
- Create records of model M and have some of them have any of the
  options introduced by module B selected for field F.
- Uninstall module B.

The result will be records of Model M with an option for field F that no
longer exists, this makes the registry inconsistent and prone to
crashing (it is sufficient to access the form view of such a record to
trigger a crash).

This commit introduces a mechanism similar to the `ondelete` argument
found in Many2one fields, the argument name is the same but it's
different both in behaviour and in implementation.

The `ondelete` mechanism for Selection fields is enforced for **any**
Selection field with required set to `True`, this means that the
developer is required to set a cleanup behaviour for when their module
is uninstalled. For possible cleanup options, see fields.Selection's
docstring.

As far as implementation goes, everything is implemented in Python
unlike with Many2one fields where the behaviour is delegated to
PostgreSQL.

The `ondelete` setting will be processed during
`ir.model.fields.selection.unlink()` to ensure that the registry is left
in an appropriate state after module uninstall.
2020-03-30 13:42:04 +00:00
Adrian Torres 96223568c4 [FIX] core: invalidate registry at the start of setup_models
This is necessary in order to create models on-the-fly within tests and
to test improper Model / Field creation: registry.reset_changes will
only perform the reset of the registry if it is invalidated, however if
the setup of models crashes before it is invalidated (as is the case of
a test), the reset_changes will not be triggered and thus the registry
will be left dirty for subsequent tests.
2020-03-30 13:42:04 +00:00
Odoo's Mergebot 73dc42d6d5 [MERGE] mail, maintenance: prevent re-using alias
PURPOSE

Make aliases usage more unique, prevent re-using bounce or catchall aliases
and remove auto-uniqueness of aliases.

SPECIFICATIONS

Before this commit, user could create an email alias having same name as
catchall/bounce email alias, which should not happen. Also, while creating
or duplicating alias, if the same name was already available, a new unique
name was generated by adding a sequence number to existing name.

This behavior is not considered as a good one as it magically creates aliases
different from what user expects. User could even not own the newly-created
alias, leading to a broken mail gateway.

In this merge we improve that behavior by ensuring that no duplicate alias
name should be entered while creation / update for both catcall/bounce and
mail alias. Also, while duplicating an alias, name will now be blank by default
to force user to enter the name. Finally when creating an alias an error is
raised if the name is already taken.

TaskID 2160070

closes odoo/odoo#47567

Related: odoo/enterprise#9211
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-03-30 15:36:00 +02:00
Aaron Bohy 7c740639fd [REF] account: remove select_all
Following the new selection feature in list view, we can remove
the custom handling in the resequence action, aiming to perform
the action on the active_domain when all records of the page were
selected.

Part of task 2185145
2020-03-30 13:33:40 +00:00
Aaron Bohy 009fe3e81b [FIX] web: list: keep header checkbox selected
... when toggling an optional field.

This bug wasn't really important until now, but with the new
selection mechanism, it could lead to weird situations (e.g. the
selection box says that all records are selected, but the thead
checkbox isn't checked).

Part of task 2185145
2020-03-30 13:33:40 +00:00
Aaron Bohy 4fd30ecbc1 [IMP] web: adapt multi edit feature to list selection changes
We don't change the multi edit mechanism for now: it still only
applies to the selected records, limited to the current page.
However, we add the information in the confirm dialog to make it
clear for the user.

Part of task 2185145
2020-03-30 13:33:40 +00:00
Thibault Delavallée 0abe4437dc [MOV] mail: split alias model from its mixin
Purpose is to ease module understanding.

Task ID 2160070
2020-03-30 12:50:26 +00:00
Siddarth Gajjar a1b01751b5 [IMP] mail: prevent from re-using aliases
PURPOSE

Make aliases usage more unique, prevent re-using bounce or catchall aliases
and remove auto-uniqueness of aliases.

SPECIFICATIONS

Before this commit, user could create an email alias having same name as
catchall/bounce email alias, which should not happen. Also, while creating
or duplicating alias, if the same name was already available, a new unique
name was generated by adding a sequence number to existing name.

This behavior is not considered as a good one as it magically creates aliases
different from what user expects. User could even not own the newly-created
alias, leading to a broken mail gateway.

In this commit we improve that behavior by ensuring that no duplicate alias
name should be entered while creation / updation for both catcall/bounce and
mail alias. Also, while duplicating an alias, name will now be blank by default
to force user to enter the name. Finally when creating an alias an error is
raised if the name is already taken.

Task ID 2160070
2020-03-30 12:50:26 +00:00
Thibault Delavallée 92b176e89c [FIX] maintenance: do not create random aliases
PURPOSE

Make aliases usage more unique, prevent re-using bounce or catchall aliases
and remove auto-uniqueness of aliases.

SPECIFICATION

Remove automatic aliases creation. Aliases should be created on demand with
real emails owned by users, not hidden in creation.

Task ID 2160070
2020-03-30 12:05:47 +00:00
Aaron Bohy 94583df492 [IMP] web: adapt delete feature to list selection changes
Following the new selection feature in list views, this commit
adapts the delete action.

Part of task 2185145
2020-03-30 09:55:08 +00:00
Aaron Bohy 8608a5ed8d [IMP] web: adapt (un)archive feature to list selection changes
Following the new selection feature in list views, this commit
adapts the archive and unarchive actions.

Part of task 2185145
2020-03-30 09:55:08 +00:00
Aaron Bohy 9755e8875b [IMP] web: adapt export feature to list selection changes
The export feature already exported the whole domain when the
thead selector checkbox was checked (unlike all other actions
which were executed on the current page only).

Following the new selection feature, this commit uniformizes the
behavior of the export with other actions: if the page is selected,
only the records on that page are exported. To export all records
matching the current domain, the user has to click on the 'Select
all' link in the control panel.

Part of task 2185145
2020-03-30 09:55:08 +00:00
Aaron Bohy 7af5fb31ec [IMP] web: selection in list views
This commit allows the user to apply actions to all records
matching the current domain in list views. It also ensures that
the user is aware of the set of records actually selected.

The number of selected records is now displayed in the control
panel, and the user can, with an additional click, select all
records matching the current domain instead of the ones of the
current page.

Task 2185145
2020-03-30 09:55:08 +00:00
Aaron Bohy 9be9a75e67 [REF] web: move _archive function to BasicController 2020-03-30 09:06:17 +00:00
Aaron Bohy 63047c1c33 [REF] web: DataExport tests: lint file and factorize mockRPC 2020-03-30 09:06:17 +00:00
Robin Heinz fba2f5d331 [FIX] point_of_sale: barcode from pos to base.
Switch the declaration of the field barcode to the base module instead of the point_of_sale module.

closes odoo/odoo#41658

Task-id: 2069831
Related: odoo/enterprise#6736
Related: odoo/upgrade#984
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2020-03-30 08:42:26 +00:00
Jorge Pinna Puissant 1c3d1eed01 [FIX] account: avoid convert amount in currency into debit/credit in a reverse entry
- Create an account in foreign currency;
- Create different currency rates for the foreign currency at different
    dates;
- Create a journal entry at past date X with 2 lines, and use the
    "foreign currency account" for one of the lines, but a domestic
    currency account for the other;
- Now try to reverse the entry at a later date with a different exchange
    rate (select an appropriate date in the wizard).

Before this commit, an error was raise because the move is not balanced.
This issue occurs because the 'amount_currency' value is used to
recompute the debit/credit value based on original currency rate. But
the _onchange_currency function is also called, and it recomputes the
credit/debit for the foreign currency line with the  exchange rate of
the date of the reverse entry.

This commit is a fine-tuning of ae3d7aeb706dc1bc3216fd63c6a943e5d9cb56e7
to avoid recomputing credit/debit in a reverse entry.

opw-2227098

closes odoo/odoo#48609

X-original-commit: 748b2bcb3950840d815040684f72802c968240f2
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2020-03-30 12:33:13 +00:00
jerome hanke (jhk) 91d341adce [FIX] product: barcodes can be url encoded
Steps to reproduce:
- install sales and barcodes
- go to sales > catalog > products > create
- give the product a random name and the following barcode: #1N4005-T+A
- save > print > product labels

Current behavior:
the barcode is not generated properly because it is not url encoded
everything after the # charachter is ignored

Current behavior:
barcodes are url encoded and generated properly

opw-2203716

closes odoo/odoo#48607

X-original-commit: 5aaacb825d0c408bc11c4fbb386e1d365a68594b
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-03-30 12:19:21 +00:00
Damien Bouvy 1e5ab1b533 [FIX] payment_sips: datetime parsing
SIPS date format can be somewhat variable, some sanitation is required
before using the data raw for the ORM.

opw-2224926

closes odoo/odoo#48604

X-original-commit: db998d39d7d692779a64522e168bba29b82f1d03
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-03-30 12:00:25 +00:00
Samuel Degueldre 807ac81144 [IMP] web_editor, *: set image alt automatically, remove useless alts
*: website, web_unplash

The html alt attribute is supposed to contain a description of an
image's content (an alternative to the visual representation), a lot of
snippets contained alt attributes that were not descriptive of their
content, and would as such be counter-productive in terms of
accessibility. This commit removes those.

Previously, the alt attribute on img tags had to be set manually by the
user through the editor. This commit makes use of the description field
on ir.attachment to store image description, and sets the alt attribute
on images to that description when choosing an image from the media
dialog.

task-2091417
closes odoo/odoo#45174

Related: odoo/enterprise#9520
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-30 11:07:10 +00:00
Samuel Degueldre 02e71a1a3c [IMP] web_editor: add unique to image URLs to leverage browser caching
Previously, image urls did not contain the unique parameter, this
resulted in all browser caching for images being dependent on etag
headers. This commit changes the url format used by images in the
web_editor to use the /id-checksum/ format instead of only the id, this
in turn makes it so that the 'Max-age' header is set to 1 year. This
also solves some browser caching issues when changing the optimization
level of an image in place in the media-dialog.

For binary attachments with an url (eg, unsplash images) the unique is
added as a search parameter (?unique=checksum) as a cachebuster
mechanism, but currently doesn't set the max-age header, which may or
may not be done at a later date.

task-2091417
2020-03-30 11:06:48 +00:00
Samuel Degueldre 49ea7b2b41 [IMP] web_editor: improve image optimization workflow in media dialog
Previously, when selecting an image, the user could optimize their
images by clicking a little cog icon in the media dialog. They would
also be prompted to optimize their images when uploading them. In most
cases, it makes a lot more sense to always save the original in the
database, and optimize the original whenever it's dropped in the page
automatically.

A second problem is that when using the optimization feature, optimized
images would be displayed along the originals by default, resulting in a
lot of duplicates while browsing the media dialog.

This commit changes both of these things:

- By default, when uploading an image, the original uploaded image is
  used. The user can still optimize their image manually through the
  media-dialog by using the cog icon. When choosing an image in the
  media-dialog, if it's not already an optimized image, an optimized copy
  is automatically created and used instead.

- Optimized images are now hidden by default, in the media dialog, and
  can be shown by clicking a checkbox at the top of the modal when in
  debug mode

task-2091417
closes odoo/odoo#45174
2020-03-30 11:06:48 +00:00
Samuel Degueldre 25630e4421 [IMP] web_editor: remove summernoteManager from rte
The wysiwyg which is the parent of the EditorMenuBar already has an
instance that can be used instead.
2020-03-30 11:06:48 +00:00
Samuel Degueldre 5576a5f84d [IMP] web_editor, web_unsplash: improve media-dialog UX
Previously, searching for images in the database and on unsplash was
mutually exclusive, and controlled by a dropdown menu next to the search
bar. Additionally, the display of db images and unsplash images was very
different, making using the search function inconsistent and awkward.

This commit merges the unsplash search into the db search. When
searching, the first few matches from the database are displayed, then
results from unsplash.

Additionally, the layout of images has been greatly improved,
eliminating almost all padding, using some flex-box magic to allow the
images to take up all the available space without being cropped or
deformed.

The input to add an attachment by URL is now collapsed by
default, and clicking on it will expand it to reduce visual clutter.

Finally, when not in multi-images mode, the clicked image is immediately
used, rather than the user having to click it and then click the add
button, or having to double click, which was not obvious.

task-2091417
closes odoo/odoo#45174
2020-03-30 11:06:45 +00:00
Julien Mougenot 634c00a32f [FIX] web_tour: load xml at test start
Before this commit, the template of the "Tip" widget was loaded on test runtime
and caused a concurrency issue.

Now, the template is loaded before the test suite is launched and is ready when
the test is executed.

closes odoo/odoo#48589

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-30 10:20:12 +00:00
Joseph Caburnay 0de552c7c5 [FIX] point_of_sale: closing session with zero-valued invoice
The problem is described in https://github.com/odoo/odoo/issues/48550.
This is caused by reconciled receivable line in the invoice being
reconciled with another reconciled receivable line in pos_session's
move_id. The lines are already reconciled because their balance is zero.
So to avoid trying to reconcile those reconciled lines, we do not
include them in the list of lines to be reconciled.

closes odoo/odoo#48587

X-original-commit: f24677098bec9b96108a901dde08bf75dc7d4c5f
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2020-03-30 10:03:31 +00:00
Patrick Hoste e711dc08d4 [FIX] website_profile: fix edit profile issue
PURPOSE

Before this commit when an administrator edit another user's profile it
was his own data that displayed for the changes.
This commit fixes this issue.

SPECIFICATION

Add a test in both controller route when displaying the edit view and
when submitting the changes that check if the edited user is the same
as the actual user.

LINKS

Task ID : 2222043
PR : #48262

closes odoo/odoo#48575

X-original-commit: 4ab4de5b57a17002d8b14584c7d39a29e8bca357
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-03-30 09:24:14 +00:00
Pierre Masereel a8b803c26b [FIX] point_of_sale, pos_discount: install discount when session open
Whe a pos session is opened, it is impossible to install discount
anymore, because the module tries to set a default value for the product
discount.

To fi this error, we are setting the default value, only on config that
are closed.

closes odoo/odoo#48576

X-original-commit: 4c4adf472453de65e45e71f0cbd22a36ef2ed0db
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2020-03-30 09:24:35 +00:00
yhu-odoo d0455ae64b [IMP] purchase: make billing consitent with sale invoicing
========
Purpose
========

Currently, purchase missing some billing functions that we have in sale
invoicing:
 - Create credit note when necessary
 - Create vendor bill in batch in list view

========
Spec
========

 - In case of retures, when create a bill for a purchase order, we check
the total amount we want to bill to decide whether it's a vendor bill or
a credit note.
 - In the list view, add a new action to create vendor bill/credit note
for all selected order.

========
Links
========

Task 2170715
PR #44210

Related: odoo/upgrade#919
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-03-27 09:33:21 +00:00
Arnold Moyaux 3c08091940 [FIX] mrp: stock.move with reference new
Usecase to reproduce:
- Create a MO as draft
- The stock move inside don't have a reference despite the MO name is
already set.

It happens because the reference and the group are set during the
action_confirm. However it's not great if the user takes time before
confirmation or if he cancels the MO. In those case the reference
on the moves remains 'new'.

opw-2201986

closes odoo/odoo#48568

X-original-commit: 1b7e304a907d8a43d5f561226028a4b353902fab
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-03-30 08:59:24 +00:00
Swapnesh Shah 688992cb75 [IMP] base: privatize method and fixed typos
Before this commit, method `postprocess_pdf_report` was public and can
be called over RPC while there is no usecase to allow it to be called
over RPC.
Clarify helper of field attachment_use
Remove helper of report_name as QWeb is the only supported type
Log wkhtmlerror

closes odoo/odoo#33770

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-03-30 08:33:58 +00:00
Moisés López a13bfacb0b [FIX] base: correct es_PE and es_CR locales
Change the decimal point and thousands separator for es_PE and es_CR
Set the currency symbol and position for Colon CRC

closes odoo/odoo#48535

X-original-commit: 88f420f37c305a7451be31ee36c479c2dffd4db8
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-03-27 16:31:36 +00:00
Laurent Smet 40bc3b89f2 [FIX] account: Fix broken attrs in account.move form view
closes odoo/odoo#48530

X-original-commit: 61c549a84db2b6a066548c94a498c4cd9564fd23
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-03-30 08:06:39 +00:00