Commit Graph
147686 Commits
Author SHA1 Message Date
Xavier Morel e89b626f54 [IMP] web: make formatMonetary return a Markup object for markup output
Only seems used by some obscure accounting widget, so even if it
breaks fast, we should be able to move things.
2021-07-20 05:40:55 +00:00
Xavier Morel 9d91d78f88 [FIX] web: remove t-raw in substates dropdown
it's just not useful
2021-07-20 05:40:54 +00:00
Xavier Morel 3151f42725 [FIX] web: remove t-raw from FieldMany2ManyTag template
`_badge_text` is just a dedup'd t-set body content, so should work
fine out of the box.
2021-07-20 05:40:54 +00:00
Xavier Morel 7689bf27c7 [IMP] web: remote t-raw from HiddenInputFile
t-call bodies (`0`) should always be markup-safe.
2021-07-20 05:37:42 +00:00
Xavier Morel 7e1827a011 [IMP] web: prepare for de-traw-ification
A note concerning the attributes which I will probably need to take a
look at in the vdom version: the Python version has to process attf in
order to stringify individual elements, and separately stringify the
attribute value so it gets forcefully escaped even if it's
markup-safe (because markup-safety and attributes-safety are
different).

The first should not need to be performed on the JS side, because
Markup can not overload addition, therefore in JS String + Markup is
String whereas in Python it's Markup (and the String gets forcefully
escaped). In general, js!markup is currently much simpler than
py!markup, both by necessity (can't overload operators) and
simplicity (we might want to overload some of the operations
e.g. String#replace, but that's complicated and it's not been strictly
necessary for now).

Also wrt Markup / _Markup: `class` ctors can only be invoked with
`new` meaning they can't be used as template strings or regular
functions. Here `class` is useful to avoid the mess of calling the
super's constructor explicitly (which may not even be possible for
`String`), however it means we need a facade function to support our
use-cases.

Also update `utils.sprintf` to be Markup-aware: if the format string
is a Markup object, interpolated values get automatically escaped (if
necessary) and the result remains a Markup object.

If we need to perform explicit instance check we can always set
`Markup.prototype = _Markup.prototype` (I think), however in theory
that's not necessary: there are protocols in place for the relevant
pseudo-escaping operations and they ought suffice.

qweb/js divergence from qweb/py
===============================

Unlike qweb/py, qweb/js will *not* return a Markup object. That is
because in js a primitive `string` and a boxed `String` object don't
match when typechecking, and while `markup instanceof String` passes,
`typeof markup === 'string'` does not.

The overwhelming majority of string typechecks are the latter: there
are all of 6 `instanceof String` in the entire codebase, all in
dependencies, while there are hundreds of `typeof $X === 'string'`,
several of which get fed the output of template rendering
e.g. `jQuery.parseXML` or `AbstractView#init` (some widgets will
render a template then use it as the `arch` of a subview, so
`viewInfo.arch` can be the output of a qweb template rendering). This
makes for very annoying and somewhat gnarly debugging.

Plus jQuery in particular really doesn't like being fed a boxed
String, as it will interpret said boxed string as an array, and assume
it's an array of DOM elements to wrap, leading to a rather strange
jQuery object as output. Since feeding the result of a template
rendering to jQuery is a major use-case in non-vdom widgets... that's
a bit of an issue.

For the same reason while `_.escape` is `Markup`-aware, unlike
`markupsafe-escape` it does not *produce*, though it is
`Markup`-transparent.
2021-07-20 05:37:42 +00:00
Xavier Morel 7a8c4068de [FIX] website_crm_partner_assign: de-traw-ify
Inserted content comes from markup so it's safe by
definition. Apparently missed it when cleaning up the server-side
templates.

Also remove the useless `ref_content` local, that's what `0` is for.
2021-07-20 05:37:41 +00:00
Xavier Morel ce50728aa0 [REM] lunch: outdated / unused file
lunch.xml apparently stoped being used in
855c6dac25, but was never deleted.

Finally drop it, and its t-raw.
2021-07-20 05:37:41 +00:00
Xavier Morel d60f73985b [FIX] payment_ogone: markupsafe HTML_ANSWER 2021-07-20 05:37:41 +00:00
svs-odoo 16be2b0705 [FIX] mrp_subcontracting: record components
Before this commit, for a subcontracted product with reserved available
tracked components, if at least one component is recorded but not all,
the "Record components" button isn't available anymore.

How to reproduce:
  - Create a product and create a subcontracting BOM for this product;
  - Add a tracked component for this product;
  - Add some qty. for the tracked component in the subcontracting loc.;
  - Create a receipt for the subcontracted product (for demand qty. more
    than 1) with the subcontractor as partner and confirm it:
    => The "Record components" button should be visible.
  - Record a part of the demand qty. then click on "Continue", then on
    "Discard":
    => The "Record components" button is now hidden.

It's because the button is hidden if all the MO are done or to close
(they are) and if all the tracked move lines have a SN/LN (they have as
they are reserved).

task-2604728

closes odoo/odoo#73991

X-original-commit: 392bc27c0ef0bc238a7eac98497b293622f0fe1d
Related: odoo/enterprise#19756
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-07-19 16:55:55 +00:00
Nicolas Bayet ac4ded1639 [FIX] web_editor: delete a contenteditable='false' node
Deleting a node with attribute contenteditable="false" did not work.

closes odoo/odoo#73987

Related: odoo/odoo#73588
X-original-commit: 1e15a85575d867f85c056c564dda94c900da1ea7
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
2021-07-19 15:50:41 +00:00
Thierry Ducrest 569bd99781 [13.0][FIX] stock_account: average unit cost price
When the cost of a product is set to a value below the currency rounding
the average purchase cost price will be wrongly set to zero.

It can happen for product sold in large quantity, that the cost of one product
must be smaller than the smallest unit of currency.

Instead of doing the zero check with currency precision using the
product price precision, which is the one used for the `standard_price`
fields, makes more sense and fixes the problem.

opw-2601121

closes odoo/odoo#73985

X-original-commit: 251be6b943ea8c3f274bb0863d0af3f7c6b8d10d
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-07-19 15:23:02 +00:00
Nicolas (vin) eada83dc83 [FIX] account: fix payment method lines order
Currently, the payment method lines are only ordered
base on their sequences. This could lead an issue if
the sequences are all the same, where they would be
returned in a random order.

Add a second ordering on the id to avoid such random
issues.

closes odoo/odoo#73984

X-original-commit: ac700908a80f67e5fd15fa242cc111d57abd4aa9
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Nicolas Viseur <vin-odoo@users.noreply.github.com>
2021-07-19 15:17:33 +00:00
Nicolas (vin) 9e432ed243 [FIX] account, payment: Various fixes for account payments/method lines
There is an issue when computing the suitable payment token ids making it impossible to
open a payment for a user without access to payment acquirers.

Also, the default computation of payment token was wrong and would never set it
correctly.

The compute for the method lines in payment would not filter unavailable acquirers
line and thus select them by default if they were first in line.

Also fix an issue with the ordering of payment method lines

X-original-commit: 73410a0fd76a70e1730883d35b79fc603741b59c
2021-07-19 15:17:32 +00:00
Nicolas Bayet bc25b371ef [FIX] web_editor: properly capture any form of url on paste
The regex that automatically detect link when pasting text or
when pressing space when editing was not good enough and
for instance did not capture fully an url like:
https://1234-abc.runbot007.odoo.com/web#id=3&menu_id=221

Task ID: 2602725

closes odoo/odoo#73972

X-original-commit: ebe74cb8017ebadbdb6b651e43c59a1d506ba8de
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
2021-07-19 14:15:19 +00:00
Laurent Smet 9581b97c18 [FIX] account: Fix 'amount_by_group' field of invoices
When dealing with multiple taxes per line being on the same tax group, the base wasn't well computed.

closes odoo/odoo#73970

X-original-commit: b04a336c7516486e598bc69b4fee156d17f1b349
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-07-19 13:32:40 +00:00
Raphael Collet 76da18225a [FIX] core: searching parent_of on forbidden records
Before this commit, the implementation crashes when the ancestors of a
record contain non-accessible records.  This fixes the code to avoid it
to crash.

We also make the semantics of hierarchical searches more consistent in
this case: searching with operators 'child_of' and 'parent_of' returns
the subset of accessible records that satisfy the hierarchy operator.
We actually make it coincide with the results of the search when using
the "_parent_store" optimization.

closes odoo/odoo#73962

X-original-commit: 3e1b960acf3f6a726338476ba9e62e5ef5c84ef9
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-07-19 12:21:40 +00:00
Sébastien Geelen (sge) fbca03ead5 [FIX] web_editor: fix traceback in applyColor
When the selectedChildren array was empty it generated an error and a traceback appeared in Odoo.

Task-2580158

closes odoo/odoo#73846

X-original-commit: 65b8ffb56485895cc08be024b18928d1e51949b7
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
2021-07-16 10:59:42 +00:00
Florent de Labarre 6cf1d464e2 [FIX] point_of_sale : translate error messages
closes odoo/odoo#73955

X-original-commit: 871d80c7631b3a47d2d3770cbe374b94731d25d0
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-07-19 11:00:08 +00:00
Achraf (abz) 71a7f5be71 [FIX] web_editor: Allow internal users to copy/paste
On windows when you copy paste text in and into Odoo (for example in the description when creating a ticket) a traceback occurs.
There is an isWhitelist function which verifies that a node is indeed in the authorized items via the following instruction

`item.matches (CLIPBOARD_WHITELISTS.nodes.join (','))`

But on windows there is a comment node containing `<--StartFragment-->`

Here is the clipboard data on linux and on windows for the same copied text (Hello):

- Linux

  <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
  <span style=\"color: rgb(102, 102, 102); font-family: &quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;\">Hello</span>

- Windows

	<html>
		<body>
			<!--StartFragment--><span style="color: rgb(102, 102, 102); font-family: &quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">Hello</span><!--EndFragment-->
		</body>
	</html>

Except for this additional comment on Windows, the `.matches()` method does not exist.

This PR uses the `Array.includes` function on the item's `nodeName`, which should work in all cases while keeping the same behavior.

opw-2591597

closes odoo/odoo#73952

X-original-commit: 9478cfa0942ad2aee69de197024660cdd6f6c739
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2021-07-19 10:36:20 +00:00
william-andre 62273a3b26 [FIX] l10n_nl_edi: annual sequence in test
After https://github.com/odoo/odoo/commit/10db78c7a5143eff20963cc399e49f5dbee800b2

closes odoo/odoo#73445

Related: odoo/enterprise#19547
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-07-19 10:14:25 +00:00
wan 0df91f7ca7 [FIX] l10n_latam_invoice_document: adapt compute method to constraint
The compute method `_compute_l10n_latam_document_type` could give
results that were not satisfied by the constraint
`_check_invoice_type_document_type`.
2021-07-19 10:14:25 +00:00
wan 9f1a08d1b6 [FIX] l10n_it_stock_ddt: manage l10n_it_edi_sdiscoop installed
These modules will need to be merged, but in the meantime the tests need
to be green for the CI.
A constraint is raised in `account_edi_proxy_client` is we do not call
that method.
2021-07-19 10:14:25 +00:00
wan 1b4a4523de [FIX] l10n_it_edi: check empty vat in codice
Introduced in
https://github.com/odoo/odoo/commit/6e0405740199b643e3ff0657a8e0b0e19908b855
2021-07-19 10:14:25 +00:00
wan 35e12d6efd [FIX] l10n_in_pos: make compatible with pos_l10n_se 2021-07-19 10:14:25 +00:00
wan 514f640cd1 [FIX] l10n_in: missing .id on uom.uom
Introduced in
https://github.com/odoo/odoo/commit/18a823e379ba023c176299c4034b3b28d09c2336
2021-07-19 10:14:25 +00:00
wan 1dd3f0db85 [FIX] l10n_cl: do not change master data with localized values 2021-07-19 10:14:24 +00:00
wan 060b26e95e [FIX] l10n_cl: do not remove document type for other countries
You don't want this for other latam countries.
2021-07-19 10:14:24 +00:00
wan 8dc9e64421 [FIX] l10n_ch: test with l10n_au
When l10n_au_aba is installed, the bank type recognized is `aba` and not
`bank`. The only thing we care here is that it is not `postal`.
2021-07-19 10:14:24 +00:00
william-andre dbc1aab1fc [FIX] l10n_ar: add journal_id in account.move.reversal demo
Because of
https://github.com/odoo/odoo/commit/6adaec714a9d8635b4ac4b1c0bf7c0be25b73af9
2021-07-19 10:14:24 +00:00
wan ac09bf94e2 [FIX] l10n_ar: do not touch other countries' document types 2021-07-19 10:14:24 +00:00
wan 4924a27247 [FIX] l10n_ar: do not change master data with country specific stuff 2021-07-19 10:14:24 +00:00
wan 8098fe42fd [FIX] l10n_ar_website_sale: chose right company for demo data 2021-07-19 10:14:24 +00:00
wan 07f5c94e05 [FIX] l10n*: remove duplicate strings
Some field strings are duplicated and raising a warning in the CI.
Solution is to remove duplicated fields and put them in a common module,
or to change the string in the field declaration and put the right one
in the view.
2021-07-19 10:14:24 +00:00
william-andre c1d24ce9cc [FIX] account_edi: only try to lock if there is something to lock
This check was done before cc67b5ac95 but
removed without apparent reason.
2021-07-19 10:14:24 +00:00
william-andre 502f74c1a7 [FIX] account: do not put empty narration
Having a field with an empty string makes EDIs put an empty node
Followup of
https://github.com/odoo/odoo/commit/48592a6b7548c0b2af03e0cc49180ff02943cca9
2021-07-19 10:14:24 +00:00
wan 6ad65b2ccb [IMP] account: add country to all_l10n test 2021-07-19 10:14:24 +00:00
wan 1010de2310 [FIX] l10n*: adapt test tags external + post_install
Add a static test to ensure all l10n tests are tagged in order to be
able to be run in runbot/mergebot.
2021-07-19 10:14:24 +00:00
Younn Olivier e90e7c3e00 [FIX] web_editor: fix colorpicker display on html fields
ISSUE
When selecting colors options from the editor toolbar on a html field,
the colorpicker was not displayed under the toolbar.

CAUSE
Before this commit, the colorpicker dropdown position was computed with
top, bottom and height css properties.

After a new colorpicker was introduced with multiple sections of
different sizes, the size of the dropdown-menu could not be fixed
anymore and [1] broke the existing computation to display the dropdown
above or below the toolbar.

SOLUTION
Using bootstrap dropdown 'dropup' class instead of top, bottom and
height css properties.

[1]: https://github.com/odoo/odoo/commit/96ab729850983162a0039e40c77537ef65cd039e

closes odoo/odoo#73947

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-07-19 09:19:14 +00:00
Aaron Bohy 8c1d226284 [IMP] web: dropdown: add "toggler" props
This commit adds an optional "toggler" props to the Dropdown
component. If set to 'parent', no toggler will be generated by
the Dropdown component. Instead, the parent element of the dropdown
will be its toggler.

closes odoo/odoo#73858

Related: odoo/enterprise#19702
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-07-19 09:12:31 +00:00
Aaron Bohy 923ba830db [REF] web: dropdown: make "menu" the default slot
The dropdown Component takes 2 slots: one for the toggler, and one
for the actual dropdown content. Before this commit, the default
slot was the toggler, and the other one was named "menu".

However, as the toggler is actually optional, and the "menu" slot
contains the central information about the dropdown, we decided to
swap them. The content of the dropdown is now the default slot and
the toggler can be specified with the "toggler" slot.
2021-07-19 08:54:31 +00:00
Francois (fge) a1c983250e [FIX] web: focused command style
adds the lines deleted by mistake in the commit:
d7ddd5de53

closes odoo/odoo#73749

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-07-19 09:11:14 +00:00
Francois (fge) 7dc28604d7 [FIX] web: traceback generated by hotkeys
This commit fixes the erroneous tracebacks generated by keyup events
in the hotkey overlay. (alt + key)

TASK-2591069 - BUG 3
2021-07-19 09:11:14 +00:00
Francois (fge) 55dab0e7d1 [IMP] web: use of a default OS for tests
The purpose of this commit is to have a test environment
that does not depend on the OS of the machine
on which the Odoo server is deployed.

Because the navigator.platform is deprecated, we will use the
navigator.userAgent to identify the OS.
2021-07-19 09:07:09 +00:00
Swapnesh Shah b42c4fed9e [FIX] crm: correctly label opportunities count in partner kanban view
Use correct label. This link leads to opportunities, not to "Favorites"
whatever that means.

closes odoo/odoo#60036

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-07-19 08:30:45 +00:00
Swapnesh Shah d73c841abf [IMP] survey: make error message required when validation is enabled
Before this commit *Validation Error message* was not required for questions
with *Validate Required*. This leads to having `False` displayed if
*Validation Error message* is empty.

With this commit we make *Validation Error message* required for these types
of questions which requires validation. Indeed it makes no sense to required
a validation but having no message explaning why it failed.

closes odoo/odoo#58083

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-07-19 08:34:32 +00:00
Julien Banken 8ab2adfbdd [FIX] slides: prevent the # anchors of the PDF controllers from triggering a scroll jump
PURPOSE

Currently, the PDF viewer is loaded from an iframe and the PDF controllers
contains empty anchor links. When the user clicks on one of these links,
the browsers based on Chromium will trigger a "scroll jump" and the iframe
will be placed at the top of the browser window.

When the PDF document is larger than the viewport, this behavior can be
quite annoying: The user will have to scroll the browser window to
see the controllers each time they click on a controller (-> link) as
(1) the controllers triggers a scroll jump and (2) the controllers are
below the document that does not fit entirely on screen. To avoid that,
the links of the PDF controllers will be replaced with spans. The
controllers will then no longer trigger a scroll jump.

SPECS

- Replace the links of the PDF controllers with spans.
- Add css rules to prevent user selection.

LINKS

Task id: 2500574

closes odoo/odoo#73937

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-07-19 06:54:10 +00:00
Samuel Degueldre 637967b1f9 [FIX] website: fix upload logo button being unresponsive
Since odoo/odoo#72675 the core services are now available in the
frontend, this includes the scroller service that will call
preventDefault on click events when the clicked link has an empty anchor
as this is usually used to change the cursor appearance, but we don't
want to mess with the hash which contains the webclient state.

In the configurator, the file input for logo upload is inside such an
anchor with an empty href, and so preventDefault is called, preventing
the file picker from opening. While in the configurator, we don't have
any state stored in the hash, not calling preventDefault on anchor
clicks may still cause scrolling issues among other things.

Since there is no reason other than styling for this node to be an
anchor tag, this commit replaces it with a div, and appropriate CSS to
style it.

closes odoo/odoo#73936

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-07-19 05:31:16 +00:00
Samuel Degueldre 2b185ca98f [FIX] website: remove double inclusion of owl library
This double inclusion was causing issues by overwriting the global QWeb
instance, thus removing previously registered templates.
2021-07-19 05:30:19 +00:00
Nicolas Bayet d1fcb9ac74 [FIX] web_editor: prevent double insert link on paste
When pasting text containing url, the url was pasted twice.
One being simple text and the other one being a link.

Task ID: 2602785

closes odoo/odoo#73709

Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
2021-07-19 07:38:07 +00:00
ijas ahammed 6113a8c48c [IMP] iap_mail: improve the UI for 'enrich_company' template
Currently, when sending the mail for enrichment with template
`enrich_company`, we display few data with pills, like phones,
emails, industries, sectors etc. When there are too many pills
for these information, pills sometimes break into another line
if there's no enough space and the mail looks ugly.

This commit improves the behavior by improving the inline style
for those pills, and thus by making sure that it will always
display entire information in one line, instead of breaking
them into multiple lines.

Apart from that, this commit also makes the template responsive
so that is doesn't look mess in Odoo's chatter while viewing
from small devices.

TaskID-2577809

closes odoo/odoo#72507

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-07-16 13:21:31 +00:00