Initial commit: Odoo 18.0-20251222 extra-addons
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled

This commit is contained in:
tocmo0nlord
2026-03-13 20:43:25 +00:00
parent 36e847a7df
commit adbe430761
9472 changed files with 1265727 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
/* Copyright 2018 Simone Orsi - Camptocamp SA
License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html). */
import {UrlField, formUrlField, urlField} from "@web/views/fields/url/url_field";
import {copyClipboardURLField} from "@web/views/fields/copy_clipboard/copy_clipboard_field";
import {patch} from "@web/core/utils/patch";
const AdvancedUrlFieldProps = {
text_field: {type: String, optional: true},
prefix_name: {type: String, optional: true},
};
patch(UrlField.props, AdvancedUrlFieldProps);
patch(copyClipboardURLField.component.props, AdvancedUrlFieldProps);
patch(UrlField.prototype, {
_get_text_field() {
if (this.props.text_field) {
let field_value = this.props.record.data[this.props.text_field];
if (Array.isArray(field_value) && field_value.length === 2) {
field_value = field_value[1];
}
return field_value;
}
return false;
},
get title() {
return (
this._get_text_field() ||
this.props.text ||
this.props.record.data[this.props.name] ||
""
);
},
get formattedHrefWithPrefix() {
let value = this.formattedHref;
if (this.props.prefix_name) {
value = this.props.prefix_name + ":" + value;
}
return value;
},
});
const patchExtractProps = () => ({
extractProps({attrs, options}) {
const props = super.extractProps(...arguments);
props.text_field = attrs.text_field || options.text_field;
props.prefix_name = attrs.prefix_name || options.prefix_name;
return props;
},
});
patch(urlField, patchExtractProps());
patch(formUrlField, patchExtractProps());
patch(copyClipboardURLField, patchExtractProps());

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates id="template" xml:space="preserve">
<t
t-name="web_widget_url_advanced.UrlField"
t-inherit="web.UrlField"
t-inherit-mode="extension"
>
<xpath expr="//a[hasclass('o_field_widget')]" position="attributes">
<attribute name="t-esc">title</attribute>
<attribute name="t-att-href">formattedHrefWithPrefix</attribute>
</xpath>
</t>
<t
t-name="web_widget_url_advanced.FormUrlField"
t-inherit="web.FormUrlField"
t-inherit-mode="extension"
>
<xpath expr="//a[hasclass('o_field_widget')]" position="attributes">
<attribute name="t-esc">title</attribute>
<attribute name="t-att-href">formattedHrefWithPrefix</attribute>
</xpath>
</t>
</templates>