Commit Graph
5357 Commits
Author SHA1 Message Date
Romain Derie 5afd3b996b [REM] base: remove dead code
This code was no more called, as there is the same-ish condition a few lines
above:
```
if (tools.config['test_enable'] or tools.config['test_file']) ...:
```

Moreover, that code was wrong and was crashing if you remove the first if
condition to test that code, as the method is expected to return a tuple.
It would just raise a traceback
```
too many values to unpack (expected 2)
```

Part of #75377

Related: odoo/enterprise#20449
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2021-08-26 10:21:29 +00:00
Romain Derie 88b19cfa92 [FIX] base, mail: _render_qweb_pdf should return a bytes-like object
`result` might be a Markup object (eg during tests) or a bytes-like object.

Step to reproduce: click on "Send by Mail" on a SO -> Traceback

Step to reproduce (2):
- Install website_sale
- Add something to the cart
- Go through checkout and click on Pay Now
- Crash, 500 error page, as this step is trying to generate the SO PDF to send
  by mail to the customer, which tries to encode a bytes-like object.

```
AttributeError: 'bytes' object has no attribute 'encode'
```

But if you do that flow during a test, eg
```
./odoo-bin -d mydb --test-tags=.test_02_admin_checkout
```
You have a Markup object, thus you had to encode it.

Now, even during test, we return a bytes-like object.

Related to #68299

Community: https://github.com/odoo/odoo/pull/75377
Enterprise: https://github.com/odoo/enterprise/pull/20449
Part-of: odoo/odoo#75377
2021-08-26 10:21:28 +00:00
Jeremy Kersten e9a33a436f [ADD] (website_sale_)delivery_mondialrelay: allow to use MondialRelay
This commit let you choose a Point Relais® as your shipping address.
It instantiates the Widget only.
It will not handle the print label.

Part-of: odoo/odoo#75281
2021-08-26 10:21:16 +00:00
Xavier-Do bd851a24ca [FIX] base: add missing nodeattr in ormcache keys
No real bug was found regarding this issue but it looks
like `nodeAttrs and nodeAttrs.get("media")` was missing from
`ormcache_context` since it is used to generate the output.

closes odoo/odoo#75248

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2021-08-26 10:21:11 +00:00
Xavier-Do fdaee845d5 [FIX] base: remove options parameters
Regarding previous commit, the option parameter can be removed
from _get_asset_content api, followed by a nice snowball effect.

Part-of: odoo/odoo#75248
2021-08-26 10:21:10 +00:00
Xavier-Do 2921f60055 [IMP] base: remove dead code
options are not used anymore since 8cc066173d

This was discovered by @d-fence

Part-of: odoo/odoo#75248
2021-08-26 10:21:10 +00:00
Rémy Voet (ryv) 0e3dcf091c [IMP] base: add warning if Chrome not installed
For test tours.
2021-08-24 14:13:33 +00:00
Xavier-Do 157651f7b0 [FIX] profiling: add profile entry manually before calling libsass
This commit proposes a mechanism to manually add a frame before a
blocking c-call and triggers it before calling libsaas.compile.

closes odoo/odoo#75519

X-original-commit: f836ff3a67d446cd8b3ab2cf573fab649153e6da
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-08-24 12:31:44 +00:00
Xavier-Do f4d0c72816 [FIX] profiling: manage long calls with the GIL
Sometimes the profiler provides confusing information.  This happens
when calling a C library without releasing the GIL (Python's global
interpreter lock).  The time spent in the call will be attributed by the
profiler to the former stack trace, because the collector cannot run
during the call.

This commit adds information on the frame when a given stack frame has
lasted for too long.

X-original-commit: 5e193c5dbcdfbdbab38309ed292131ae1f5d3026
2021-08-24 12:31:43 +00:00
Florent THOMAS 56ca5e9297 [FIX] Marshall frozendict in XMLRPC controller
PR #42723 changed the public method context_get on res.users return a
frozendict instead of a classic CPython dict.

Since the default XMLRPC Marshaller does not know how to serialize a
frozendict, this would result in errors when calling the method directly
via the XMLRPC layer.

This commit solves this issue by defining a marshalling procedure for
frozendict objects in our custom OdooMarshaller class, this simply
converts the frozendict into a dict and uses the default dict-to-xml
dump procedure (dump_struct).

Fixes #75412

closes odoo/odoo#75478

X-original-commit: e80a299ed910cacac4aa4e64164909af36ce62ad
Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
2021-08-24 06:32:51 +00:00
Adrian TorresandRaphael Collet d543f53c33 [FIX] base: avoid recursion depth errors during uninstall
For some reason _logger.info with exc_info=True inside a recursive
function generates RecursionErrors, presumably because the logger uses
recursion itself to generate the stack trace that is logged.

A simple solution would be to remove exc_info=True, but I've decided to
move the log out of the delete function and simply call it once per
uninstall process with all undeletable IDs, so it's kind of a fix +
optimization.

closes odoo/odoo#75445

X-original-commit: 3a04de569bca10a1d1a01f719635de6842e747b2
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
2021-08-23 10:51:57 +00:00
Alvaro Fuentes d766744b1c [FIX] base: fix ir_attachment read_group
When called with a `srt` as readgroup parameter we get a traceback.
Example:
`read_group([('partner_id', 'in', self.ids)], 'partner_id', 'partner_id')`
TB:
```
 Traceback (most recent call last):
   File "/home/odoo/src/odoo/14.0/odoo/tools/safe_eval.py", line 330, in safe_eval
    return unsafe_eval(c, globals_dict, locals_dict)
   File "", line 2, in <module>
   File "/home/odoo/src/odoo/14.0/odoo/addons/base/models/ir_attachment.py", line 420, in read_group
    if any('(' in field for field in fields + groupby):
 TypeError: can only concatenate list (not "str") to list
 ```

 Observed on the upgrade request 22627.

closes odoo/odoo#75416

X-original-commit: 8e7990dd5c069f7b0dba9f3d27f620f0fcad5441
Signed-off-by: Christophe Simonis <chs@odoo.com>
2021-08-20 18:52:19 +00:00
Pierre Masereel a46c9b0f21 [IMP] point_of_sale,pos_sale: Sale Order integration
Since now, there was no possibilities to pay a Sale Order in a point of
sale without re-encoding every lines of the sale order in a pos order.

So we've now added the possibility to choose a sale order from the point
of sale, and apply a down payment or settle the selected order. You
still get the possibility to invoice it, and the stock is correctly
managed.

The SO is then updated accordingly to what have been done throught the
POS.

closes odoo/odoo#74096

Task-id: 2500902
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2021-08-23 12:26:24 +00:00
dht-odoo a02a258451 [IMP] contact: improve action helper messages
This commit improves action helper message for different
contact menus for better onboarding.

Menus

1) Contact Tags(action -> action_partner_category_form)
2) Contact Titles(action -> action_partner_title_contact)
3) Contact Industries(action -> res_partner_industry_action)
4) Countries(action -> action_country)
5) Fed. States(action -> action_country_state)
6) Country Groups(action -> action_country_group)
7) Banks(action -> action_res_bank_form)
8) Bank Accounts(action -> action_res_partner_bank_account_form)

Task-2584073
PR odoo/odoo#74082
2021-08-20 13:10:55 +00:00
Jérémy Hennecart b785cdc211 [MOV] appointment: rename module to match enterprise part
Rename website_calendar module by appointment in order to match
the changes on the enterprise part.

We now no longer use the website module to manage the basics of
online appointments. The portal module is now used in its place.

For additional info, check the enterprise PR.

task-2427015

closes odoo/odoo#72241

Related: odoo/upgrade#2492
Related: odoo/enterprise#18426
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-08-20 06:50:33 +00:00
Julien Castiaux df885bb4fa [FIX] base: drop milliseconds in default trigger
closes odoo/odoo#75325

Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
2021-08-19 13:48:19 +00:00
Thibault Delavallée 461a1ef460 [IMP] mail: add tests for email finding tools
Purpose is to better understand the use of email_re regex (find emails in a
text) and email_split_tuples (find name and email in a string used in email
headers or as email_from / email_to / email_cc).

Task ID-2377974
Community PR odoo/odoo#61467
2021-08-18 13:33:28 +00:00
Thibault Delavallée 82de620424 [REM] tools: remove deprecated `email_send` tool
This tool function is deprecated. As explained in docstring: "since OpenERP 6.1
please use ir.mail_server.send_email()". Seems we are allowed to finally remove
it.

Task ID-2377974
Community PR odoo/odoo#61467
2021-08-18 13:33:17 +00:00
dht-odoo c1e0acf4c6 [FIX] base: fix create contact view
Before commit[1] there was only one field image_1920 in group with 'colspan=1'.
In commit[1] a new invisible field avatar_128 is added in this group. But due
to this an empty 'tr' element is added in view and it breaks the view.

With this commit we move avatar_128 field outside of the group and placed it
with other invisible fields, so it doesn't break view. And also adding comment
field in new group because it is html field now so it displays nicely.

Followup of odoo/odoo@cb4f597410 and odoo/enterprise@971f3ed9ae

commit[1]: c53724ebc3

LINKS

Task Id-2558824
PR odoo/odoo#74795
PR odoo/enterprise#2011
2021-08-18 08:24:57 +00:00
Ivan Yelizariev 99787182e4 [FIX] base: skip unneeded update_list call
`update_list` is an expensive operation and could be avoided when no modules are
updated. Particually, it speeds up initial theme installation on website, which
has following code:

```
    themes.filtered(lambda m: m.state == 'installed').button_upgrade()
```

Benchmark for Odoo 15: `/website/configurator_apply` spends 1.3 sec for unneeded
`update_list` call.

closes odoo/odoo#75140

X-original-commit: 82ba4994e54fc46cc55a463629727e840349bb6e
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
2021-08-16 11:01:44 +00:00
Aaron Bohy 436c5023d7 [IMP] odoo: models: add field name in field descr
The fields dict maps field names to their description. Before this
commit, the field name wasn't specified in the description, meaning
that we could never manipulate the field description without its
key, which would often be convenient.

closes odoo/odoo#75121

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-08-16 09:02:47 +00:00
Julien Banken b6974528f9 [FIX] survey: add support for 'disabled' attribute on buttons (in views)
In the xml file of the list view, it is possible to define a button that
will be placed in a new column. When the user clicks on a button from a
list view, the script will execute the action linked to the corresponding
button. Unfortunately, all the buttons of the list views are not necessary
linked to an action: This is for example the case for the trophy icon of
the survey module. An exception can hence be thrown if the user clicks on
such button.

To solve the issue, we will add the 'disabled' property support for the
buttons and we will add that property to the buttons that do not have
an action. With this property, the script will bind no listener to the
button and it will hence not call the listener causing the error.

task-2612033

closes odoo/odoo#75096

X-original-commit: c698d589e7dfa6fe3df8b4014fe30627693e9043
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-08-13 15:34:46 +00:00
Habib (ayh) 44029495bc [IMP] base, account, *: simplify multi currency setup
Automatically activate `group_multi_currency` if there is more than one active currency,
deactivate it if there is only one active currency

retain sale/pos feature of activating group_product_pricelist
adapt tests accordingly

Task 2610735

closes odoo/odoo#74396

Related: odoo/enterprise#20106
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-08-13 14:50:44 +00:00
Habib (ayh) 4f19f29a09 [IMP] base: use helper methods for implied groups
In this PR, we add a helper method to add/remove implied groups - update the base to use these instead

Task 2610735
2021-08-13 14:50:44 +00:00
std-odoo 1b9dd118cb [IMP] base: do no spoof the mail from headers when sending emails
PURPOSE
=======
We want to increase the score of the emails sent by Odoo and we want to
avoid them to be marked as spam by the mail clients (gmail, outook...).

SPECIFICATIONS
===============
From filter
-----------
Add a new field on the "ir.mail_server" which is "from_filter". This
field defines the email address for which the outgoing email server can
be used.

The "from_filter" can either define an email address or a domain name.

Use the system parameter "mail.default.from" which allow us to define
a default email address which is used to encapsulate the emails
(default: notifications@<catch.all.domain>).

Mail server priorities
----------------------
When sending an email, we read the FROM header and,
- We first look for a mail server which match the entire mail FROM
  in that case, we do not change the email header (not needed)
- If not found, we search a mail server which matches the domain name of
  the mail from (do not need to change the headers in that case)
- If not found, find the mail server linked to the "notifications"
  email (defined in the system parameter). Then change the FROM header
  to the notification email, and put the old one in the name part of
  this header.
  E.g.
      Initial mail from: "Admin" < admin@example.com >
      Final mail from:   "Admin (admin@odoo.com)" < notifications@odoo.com >
- If no notification email is configured or if no mail server are
  found for the notification email, fallback to the old system and
  spoof the FROM header. In that case we do not have the choice if we
  want to send the email, he will probably be marked as spam.

Sending method priority
-----------------------
In the mail server models, we defined some priorities,
1. Forced SMTP session
2. Forced mail server
3. Try to find the best mail server (see "Mail server priorities")
4. If not found, read the odoo-bin arguments

Bounce
------
As there's no standard for bounce address, we put it in the envelope
(smtp_from). But in some case, it might be considered as spoofing. So,
we use the bounce address ONLY if the mail server is configured for the
entire domain name.

One behavior which might be broken is the following; we send an email as
"std@gmail.com" and the bounce address is on the domain "odoo.com".
Before we received the bounce notifications but we were spoofing the
local part and the domain.

Now
- if a mail server is configured for GMAIL, we do not use the bounce
  address (and we might not receive the bounce notification)
- if no mail server is configured for GMAIL, but one is configured for
  "odoo.com"
    - the FROM header will be "notifications@odoo.com"
    - the FROM envelope will be the bounce address
=> In this situation we are spoofing only the local part of the email
   but it's allowed as the mail server is configured for the entire
   domain name

LINKS
=====

Task-2367946
odoo/odoo#61853
odoo/upgrade#1903
2021-08-13 12:27:04 +00:00
std-odoo fced25d086 [IMP] mail: split the code of "send_email" to prepare the next commit
Purpose
=======
Split the code of "send_email" in "ir.mail_server" so the changes will
be easier to review.

Task-2367946
odoo/odoo#61853
odoo/upgrade#1903
2021-08-13 12:27:01 +00:00
std-odoo a4d513034e [IMP] base: SMTP authentication with SSL certificates
PURPOSE
=======
We want to be able to authenticate our servers with a certificate
for the entire domain name instead of using a username and a password.

SPECIFICATIONS
==============
Add 2 fields on the `ir.mail_server`, which are
- the SSL certificate
- the SSL private key

When we uploaded both files, we use them to authenticate the client of
the SSL connection.

Add 2 options on the Odoo binary, so we can provide the filenames of both
files (like we do for the SMTP username/password).

SETTINGS
========
Note that this type of authentication doesn't work locally for Microsoft
office 365. It seems like Microsoft is blocking non-static IP address
(not able to ping the host locally, but it works on the server).

The host name of the server is defined in the MX DNS record. Then, on
Office 365 you must create an SMTP relay based on a certificate and not
based on a hard coded IP address. The certificate must be valid for your
domain name.

e.g.
    Host: openerp-org.mail.protection.outlook.com
    Port: 25
    Username: <keep it blank>
    Password: <keep it blank>
    Security: STARTTLS
    Email: admin@odoobe.com

New Python dependence
=====================
The standard SSL python library only takes a filename to the certificate
/ private key.

But, we do not want to use attachments and take the full path to the
file (in the filestore) or to create temporary file.

So, we need to use a new library "PyOpenSSL" which allows you to load
a certificate / private key from a byte array.

To make this library work with SMTPLIB we use a wrapper developed
in urllib3 (PyOpenSSLContext).

LINKS
=====

Task-2367946
odoo/odoo#61853
odoo/upgrade#1903
2021-08-13 12:26:55 +00:00
std-odoo 10a1466cd5 [REM] base: revert the rewriting of the FROM of the emails sent
Purpose
=======
Revert the commit a757cab857
because the rewriting of the FROM of the emails sent will
be done in a smarter way in master.

Task-2367946
odoo/odoo#61853
odoo/upgrade#1903
2021-08-13 12:26:16 +00:00
Munaf Khan ac34cb5938 [IMP] web,base: improve UI of no content helper in settings
Currently, empty screen of the settings is not very beautiful
without proper action helper and decoration. It displays only
'no record found' string when no setting is found for the
search string.

With this commit, we make the no content helper for the settings
consistent with other apps. It now displays empty folder and
proper helper message.

TaskID-2588387

closes odoo/odoo#74570

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-08-03 04:55:32 +00:00
Gorash 3dbee80c10 [FIX] all: add missing encoding for the templates
following the change 7df343dd1b

closes odoo/odoo#74768

Related: odoo/enterprise#20098
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-08-11 09:54:36 +00:00
Gorash 48da9ae973 [FIX] base: t-esc does not escape Markdown content and is equal to t-out
This is the same behavior as javascript. Which had been changed during
the refactoring of qweb. t-esc asked for escaping whatever the content.
However, a lot of templates still use t-esc. It is easier to go back to
the previous functionality.
2021-08-11 09:51:41 +00:00
Xavier Morel f1f0a60643 [FIX] base: XML-RPC serialization error on HTML fields (bis)
odoo/odoo#74678 fixed the universal traceback which would happen any
time an HTML field would be read, however it's incomplete because:

* it was tested on a field which wasn't HTML in 14.4
* and no markup was put in the field anyway

So the markup being embedded in the XML-RPC document unescaped was
missed, leading to:

* corrupted (partial) responses when the HTML content is XML-valid,
  depending on the exact API of the client it might only return the
  first or last text segment, or all the text without markup, or
  something else
* outright deserialisation error on XML-invalid content (e.g. void
  elements like <br>)

The cause being that `Markup` overrides all `str` methods to first
escape their parameters before actually applying on the object. This
means `xmlrpc.client.escape` would basically do nothing, then would
concatenate the `Markup` into the document (stringifying it) and send
the entire thing on its way.

Fixes #74884

closes odoo/odoo#74957

X-original-commit: 8a0f7d820cb2296f410be215ffeadd1cefae174c
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-08-11 09:07:55 +00:00
Martin Trigaux 9aedb999f5 [IMP] *: remove xmlid_to_object helper
Use env.ref instead of the xmlid_to_object
To make it more readable and be able to clean old helpers
2021-08-10 14:24:11 +02:00
Martin Trigaux fd67339a3e [IMP] base: remove get_object helper
Not used anywhere, similar to env.ref
2021-08-10 13:49:05 +02:00
Martin Trigaux 15692f3948 [IMP] *: merge ir.model.data helpers
remove _get_id and _get_object_reference that were one liner to
_xmlid_lookup
2021-08-10 13:49:05 +02:00
Martin Trigaux c7bac3dee0 [IMP] *: make ir.model.data helper private
No reason to interfact with them directly in RPC
2021-08-10 13:49:04 +02:00
Martin Trigaux 03ff8d4d58 [FIX] *: retrieve model with sudo in selection fields 2021-08-10 13:49:04 +02:00
Martin Trigaux 5dc4cff60a [IMP] base: remove read access to ir.model*
Model, fields and selections are no longer readable
Removes metadata access
2021-08-10 13:49:04 +02:00
Samuel Degueldre 2d3dbe9217 [IMP] tests: allow browser_js ready code to be a promise and await it
closes odoo/odoo#74789

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-08-06 12:33:54 +00:00
Guenael Labois 04daf0b1e7 [IMP] l10n_ec, base: Moved EC states to base, with a proper code
closes odoo/odoo#74066

Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-08-06 15:19:29 +00:00
qsm-odoo ebf8d67485 [MOV] website, *: merge the website_animate app into the website app
*: tools

The app received many fixes and its code was improved and cleaned. It
was about time to include it directly into the website features.

task-2215118

closes odoo/odoo#74697

Related: odoo/design-themes#478
Related: odoo/upgrade#2709
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-08-05 14:59:10 +00:00
Xavier Morel addf220fc3 [FIX] base: XML-RPC serialization error on HTML fields
In 01875541b1, HTML fields (and various
methods) were made to return markupsafe.Markup objects.

However at the time I didn't consider that XML-RPC serialization
remains based on type *identity*, and thus the `Markup` object would
not serialize outbound through XML-RPC, and would blow up instead.

This should fix the issue, by serializing Markup objects as str.

closes odoo/odoo#74684

X-original-commit: 165bd3bf88becc42416e49ad2f430e90675219fa
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-08-04 09:07:42 +00:00
Gorash 7df343dd1b [IMP] base: QWeb _render return Markup unicode instead of utf8 bytes
In order to limit encoding decoding, the _render method returns a
unicode string in the markup safe object instead of a MarkupSafeBytes

closes odoo/odoo#68299

Related: odoo/upgrade#2454
Related: odoo/enterprise#17270
Signed-off-by: Antony Lesuisse (al) <al@openerp.com>
2021-08-03 16:20:22 +00:00
Gorash 5913b7265e [REF] base,*: refactor Qweb engine
* Remove AST in favor of pure Pyhon. This should make it easier for
developers to understand and create new directives because they do not
need to know AST.

* Remove `t-call-options` as it has been merged into `t-options` for more
consistency. Support for t-call-options is retained.

* Use generators for lists. This increases performances as the rendering
can be sent directly without having to wait for the creation of the
entire list.

* Optimize expressions runtime computation by pre-computing the static
parts.
Example:
'<' + 'div' + '>' + '<' + dynamic_value + '>'
Now compiles as:
'<div><' + dynamic_value + '>'
2021-08-03 15:37:54 +00:00
Gorash ddb0946e7a [TEST] base/qweb: add tests for dynamic namespace in qweb python 2021-08-03 15:37:54 +00:00
Louis Wicket (wil) 39cb65f79a [IMP] core: enable top level await in odoo modules
Transpile odoo-modules into async function rather than simple functions.
The aim of this change is to support top-level await.

closes odoo/odoo#74629

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2021-08-03 13:12:37 +00:00
Bruno Boi 3b73095302 [IMP] web: new dropdown design and keynav
As the dropdowns have been reworked in the new webclient framework, here
is an improved version of this preliminary design.

Implemented specs:
- nested dropdowns open themselves horizontally (at right by default)
- keyboard navigation is fully adapted to this new design
  - up/down focus previous/next item in opened menu
  - tab/shift+tab focus next/previous item in opened menu
  - home/end focus first/last item in opened menu
  - right/left open/close a sub dropdown
  - enter selects the focused item
  - escape closes the current dropdown
- add "loop" behaviour for keeping pressed down arrowup and arrowdown keys

Taskid-2578926
2021-08-03 08:51:36 +00:00
Samuel Degueldre c59c92c7ec [FIX] base: avoid compiling css assets twice while in debug=assets 2021-07-30 09:52:27 +00:00
Xavier-Do e27340066b [IMP] core: enforce explicit license in all manifest
The license was missing in most enterprise manifest so
the decision was taken to make it explicit in all cases.

The missing licenses were add in all version starting from
12.0 in repos odoo, enterprise and design-themes.

Starting from this commit, when a license is not defined,
a warning will be triggered.

closes odoo/odoo#74347

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2021-07-30 12:34:11 +00:00
Jeremy KerstenandOkan SUMER be43710ab8 [IMP] tools: xpath - support mode inner for position replace
This commit adds a new attribute mode for position 'replace' to the xpath feature.

This mode can take 2 values:

- 'outer' (default mode if not provided) that will replace the sibling target
- 'inner' that will preserve the sibling target

If base arch is:
```html
<p>
   <field name='x'>yyy</field>
</p>
```

`<field name='x' position="replace" (mode="outer")>zzz</field>`
```html
<p>
   zzz
</p>
```

`<field name='x' position="replace" mode="inner">zzz</field>`
```html
<p>
   <field name='x'>
      zzz
   </field>
</p>
```

Mode inner is useful for theme or render flat content, but not recommanded to
be used in page editable since we ignore the inherit-branding part until now.

task-2172208

closes odoo/odoo#48679

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Co-authored-by: Okan SUMER (osu) <osu@odoo.com>
Co-authored-by: Jérémy Kersten <jke@odoo.com>
2021-07-29 07:04:55 +00:00