odoo/documentation#19049
Created by fw-bot
Merged
at 86e0b6d10109a7e1d6d16b2f3a881a0cafd02a46
Statuses:
- ci/documentation: (runtime 830s)
- ci/codeowner_coverage: (runtime 64s)
- label
- odoo-dev:18.0-17.0-xpath-replace-typo-jacw-549051-fw
- head
- 0a707d17577f4b37160428d5ed2acc16b03b42b2
- merged
- 2 days ago by Jacob Was (jacw)
| odoo/documentation | |
|---|---|
| 17.0 | #19047 |
| 18.0 | #19049 |
| saas-18.3 | #19051 |
| saas-18.4 | #19054 |
| 19.0 | #19055 |
| saas-19.1 | #19056 |
| saas-19.2 | #19057 |
| saas-19.3 | #19058 |
| saas-19.4 | #19059 |
| master | #19060 |
[FIX] reference/user_interface: typo in xpath replace position example
The xpath node has a feature in the replace position which copies the node matched by the xpath expression. This feature looks for an element with text exactly equal to $0; newlines, whitespace characters, and other nodes will prevent the characters from being recognized.
This behavior is defined in the following odoo Community file. Note that text()='$0' looks for an exact match, while contains(text(),'$0') would instead match on any text containing those characters.
for loc in spec.xpath(".//*[text()='$0']"):
loc.text = ''
copied_node = copy.deepcopy(node)
# TODO: Remove 'inherit_branding' logic if possible;
# currently needed to track node removal for branding
# distribution. Avoid marking root nodes to prevent
# sibling branding issues.
if inherit_branding:
copied_node.set('data-oe-no-branding', '1')
loc.append(copied_node)
https://github.com/odoo/odoo/blob/17.0/odoo/tools/template_inheritance.py#L151-L160
Thus, the example code for this behavior is incorrect, as it includes several newlines and spaces.
Forward-Port-Of: #19047