{
+ activities: props.record.data[props.name].records.map((activityData) => {
return {
id: activityData.resId,
};
diff --git a/addons/mail/static/src/backend_components/list_field_activity_view/list_field_activity_view_container.js b/addons/mail/static/src/backend_components/list_field_activity_view/list_field_activity_view_container.js
index f5525e1912e..f5c13574615 100644
--- a/addons/mail/static/src/backend_components/list_field_activity_view/list_field_activity_view_container.js
+++ b/addons/mail/static/src/backend_components/list_field_activity_view/list_field_activity_view_container.js
@@ -58,7 +58,7 @@ export class ListFieldActivityViewContainer extends Component {
const listFieldActivityView = messaging.models["ListFieldActivityView"].insert({
id: this.listFieldActivityViewId,
thread: {
- activities: props.value.records.map((activityData) => {
+ activities: props.record.data[props.name].records.map((activityData) => {
return {
id: activityData.resId,
};
diff --git a/addons/mail/static/src/views/fields/assign_user_command_hook.js b/addons/mail/static/src/views/fields/assign_user_command_hook.js
index a6e2f5d5b3c..47621be0c1c 100644
--- a/addons/mail/static/src/views/fields/assign_user_command_hook.js
+++ b/addons/mail/static/src/views/fields/assign_user_command_hook.js
@@ -21,10 +21,10 @@ export function useAssignUserCommand() {
}
const getCurrentIds = () => {
- if (type === "many2one" && component.props.value) {
- return [component.props.value[0]];
+ if (type === "many2one" && component.props.record.data[component.props.name]) {
+ return [component.props.record.data[component.props.name][0]];
} else if (type === "many2many") {
- return component.props.value.currentIds;
+ return component.props.record.data[component.props.name].currentIds;
}
return [];
};
diff --git a/addons/mail/static/src/views/fields/many2many_avatar_user_field/many2many_avatar_user_field.js b/addons/mail/static/src/views/fields/many2many_avatar_user_field/many2many_avatar_user_field.js
index cbd88dd5211..a2940336605 100644
--- a/addons/mail/static/src/views/fields/many2many_avatar_user_field/many2many_avatar_user_field.js
+++ b/addons/mail/static/src/views/fields/many2many_avatar_user_field/many2many_avatar_user_field.js
@@ -61,13 +61,14 @@ export class KanbanMany2ManyTagsAvatarUserField extends ListKanbanMany2ManyTagsA
get displayText() {
return (
- (this.props.displayText && this.props.value.records.length === 1) ||
+ (this.props.displayText && this.props.record.data[this.props.name].records.length === 1) ||
!this.props.readonly
);
}
get tags() {
- const recordFromId = (id) => this.props.value.records.find((rec) => rec.id === id);
+ const recordFromId = (id) =>
+ this.props.record.data[this.props.name].records.find((rec) => rec.id === id);
return super.tags.map((tag) => ({
...tag,
onImageClicked: () => {
diff --git a/addons/mail/static/src/views/fields/many2many_tags_email/many2many_tags_email.js b/addons/mail/static/src/views/fields/many2many_tags_email/many2many_tags_email.js
index 99593fced9f..e9da76df343 100644
--- a/addons/mail/static/src/views/fields/many2many_tags_email/many2many_tags_email.js
+++ b/addons/mail/static/src/views/fields/many2many_tags_email/many2many_tags_email.js
@@ -44,7 +44,9 @@ export class FieldMany2ManyTagsEmail extends Many2ManyTagsField {
}
async checkEmails(props) {
- const invalidRecords = props.value.records.filter((record) => !record.data.email);
+ const invalidRecords = props.record.data[props.name].records.filter(
+ (record) => !record.data.email
+ );
// Remove records with invalid data, open form view to edit those and readd them if they are updated correctly.
const dialogDefs = [];
for (const record of invalidRecords) {
@@ -59,8 +61,10 @@ export class FieldMany2ManyTagsEmail extends Many2ManyTagsField {
this.openedDialogs += invalidRecords.length;
const invalidRecordIds = invalidRecords.map((rec) => rec.resId);
if (invalidRecordIds.length) {
- this.props.value.replaceWith(
- props.value.currentIds.filter((id) => !invalidRecordIds.includes(id))
+ this.props.record.data[this.props.name].replaceWith(
+ props.record.data[props.name].currentIds.filter(
+ (id) => !invalidRecordIds.includes(id)
+ )
);
}
return Promise.all(dialogDefs).then(() => {
@@ -68,7 +72,7 @@ export class FieldMany2ManyTagsEmail extends Many2ManyTagsField {
if (this.openedDialogs || !this.recordsIdsToAdd.length) {
return;
}
- props.value.add(this.recordsIdsToAdd, { isM2M: true });
+ props.record.data[props.name].add(this.recordsIdsToAdd, { isM2M: true });
this.recordsIdsToAdd = [];
});
}
@@ -76,10 +80,13 @@ export class FieldMany2ManyTagsEmail extends Many2ManyTagsField {
get tags() {
// Add email to our tags
const tags = super.tags;
- const emailByResId = this.props.value.records.reduce((acc, record) => {
- acc[record.resId] = record.data.email;
- return acc;
- }, {});
+ const emailByResId = this.props.record.data[this.props.name].records.reduce(
+ (acc, record) => {
+ acc[record.resId] = record.data.email;
+ return acc;
+ },
+ {}
+ );
tags.forEach((tag) => (tag.email = emailByResId[tag.resId]));
return tags;
}
diff --git a/addons/mail/static/src/views/fields/many2one_avatar_user_field/many2one_avatar_user_field.js b/addons/mail/static/src/views/fields/many2one_avatar_user_field/many2one_avatar_user_field.js
index 117c642eaa9..d3a97c08a93 100644
--- a/addons/mail/static/src/views/fields/many2one_avatar_user_field/many2one_avatar_user_field.js
+++ b/addons/mail/static/src/views/fields/many2one_avatar_user_field/many2one_avatar_user_field.js
@@ -24,7 +24,7 @@ export class Many2OneAvatarUserField extends Many2OneAvatarField {
}
onClickAvatar() {
- this.openChat(this.props.value[0]);
+ this.openChat(this.props.record.data[this.props.name][0]);
}
}
Many2OneAvatarUserField.template = "mail.Many2OneAvatarUserField";
diff --git a/addons/mrp/static/src/views/fields/google_slides_viewer.js b/addons/mrp/static/src/views/fields/google_slides_viewer.js
index 507a57cd5c4..7f7b4c8dfe7 100644
--- a/addons/mrp/static/src/views/fields/google_slides_viewer.js
+++ b/addons/mrp/static/src/views/fields/google_slides_viewer.js
@@ -18,15 +18,15 @@ export class SlidesViewer extends CharField {
}
get fileName() {
- return this.state.fileName || this.props.value || "";
+ return this.state.fileName || this.props.record.data[this.props.name] || "";
}
get url() {
var src = false;
- if (this.props.value) {
+ if (this.props.record.data[this.props.name]) {
// check given google slide url is valid or not
var googleRegExp = /(^https:\/\/docs.google.com).*(\/d\/e\/|\/d\/)([A-Za-z0-9-_]+)/;
- var google = this.props.value.match(googleRegExp);
+ var google = this.props.record.data[this.props.name].match(googleRegExp);
if (google && google[3]) {
src =
"https://docs.google.com/presentation" +
diff --git a/addons/mrp/static/src/widgets/timer.js b/addons/mrp/static/src/widgets/timer.js
index 1f7d7678891..7654f7bbde5 100644
--- a/addons/mrp/static/src/widgets/timer.js
+++ b/addons/mrp/static/src/widgets/timer.js
@@ -29,7 +29,7 @@ export class MrpTimer extends Component {
this.state = useState({
// duration is expected to be given in minutes
duration:
- this.props.value !== undefined ? this.props.value : this.props.record.data.duration,
+ this.props.record.data[this.props.name] !== undefined ? this.props.record.data[this.props.name] : this.props.record.data.duration,
});
this.lastDateTime = Date.now();
useInputField({
@@ -61,7 +61,7 @@ export class MrpTimer extends Component {
const rerun = !this.ongoing && newOngoing;
this.ongoing = newOngoing;
if (rerun) {
- this.state.duration = nextProps.value;
+ this.state.duration = nextProps.record.data[nextProps.name];
this._runTimer();
this._runSleepTimer()
}
@@ -70,8 +70,12 @@ export class MrpTimer extends Component {
}
get durationFormatted() {
- if(this.props.value != this.state.duration && this.props.record && this.props.record.isDirty){
- this.state.duration = this.props.value;
+ if (
+ this.props.record.data[this.props.name] != this.state.duration &&
+ this.props.record &&
+ this.props.record.isDirty
+ ) {
+ this.state.duration = this.props.record.data[this.props.name];
}
return formatMinutes(this.state.duration);
}
@@ -102,7 +106,6 @@ MrpTimer.props = {
...standardFieldProps,
duration: { type: Number, optional: true },
ongoing: { type: Boolean, optional: true },
- value: { optional: true },
};
MrpTimer.template = "mrp.MrpTimer";
diff --git a/addons/partner_autocomplete/static/src/js/partner_autocomplete_fieldchar.js b/addons/partner_autocomplete/static/src/js/partner_autocomplete_fieldchar.js
index a8140107080..3c27dcf42c8 100644
--- a/addons/partner_autocomplete/static/src/js/partner_autocomplete_fieldchar.js
+++ b/addons/partner_autocomplete/static/src/js/partner_autocomplete_fieldchar.js
@@ -18,7 +18,7 @@ export class PartnerAutoCompleteCharField extends CharField {
this.partner_autocomplete = usePartnerAutocomplete();
this.inputRef = useChildRef();
- useInputField({ getValue: () => this.props.value || "", parse: (v) => this.parse(v), ref: this.inputRef});
+ useInputField({ getValue: () => this.props.record.data[this.props.name] || "", parse: (v) => this.parse(v), ref: this.inputRef});
}
sanitizeVAT(request) {
diff --git a/addons/partner_autocomplete/static/src/xml/partner_autocomplete.xml b/addons/partner_autocomplete/static/src/xml/partner_autocomplete.xml
index 8f38c4bf26a..da4242d1838 100644
--- a/addons/partner_autocomplete/static/src/xml/partner_autocomplete.xml
+++ b/addons/partner_autocomplete/static/src/xml/partner_autocomplete.xml
@@ -4,7 +4,7 @@
- props.value
+ props.record.data[props.name]
Private
diff --git a/addons/project/static/src/components/project_status_with_color_selection/project_status_with_color_selection_field.js b/addons/project/static/src/components/project_status_with_color_selection/project_status_with_color_selection_field.js
index e840c3802fb..8718c981564 100644
--- a/addons/project/static/src/components/project_status_with_color_selection/project_status_with_color_selection_field.js
+++ b/addons/project/static/src/components/project_status_with_color_selection/project_status_with_color_selection_field.js
@@ -13,7 +13,7 @@ export class ProjectStatusWithColorSelectionField extends SelectionField {
}
get currentValue() {
- return this.props.value || this.options[0][0];
+ return this.props.record.data[this.props.name] || this.options[0][0];
}
statusColor(value) {
diff --git a/addons/project/static/src/components/subtask_kanban_list/subtask_kanban_list.xml b/addons/project/static/src/components/subtask_kanban_list/subtask_kanban_list.xml
index 8766d7414db..101244657cb 100644
--- a/addons/project/static/src/components/subtask_kanban_list/subtask_kanban_list.xml
+++ b/addons/project/static/src/components/subtask_kanban_list/subtask_kanban_list.xml
@@ -17,7 +17,7 @@
style="color: inherit;"
t-esc="subTask.data.display_name"
t-on-click.prevent="() => this.goToSubtask(subTask.resId)"/>
- this.props.value !== id,
+ isAvailable: () => this.props.record.data[this.props.name] !== id,
},
]);
}
diff --git a/addons/purchase_product_matrix/static/src/js/purchase_product_field.js b/addons/purchase_product_matrix/static/src/js/purchase_product_field.js
index e42daab6869..c9dc721eb08 100644
--- a/addons/purchase_product_matrix/static/src/js/purchase_product_field.js
+++ b/addons/purchase_product_matrix/static/src/js/purchase_product_field.js
@@ -13,12 +13,13 @@ export class PurchaseOrderLineProductField extends Many2OneField {
setup() {
super.setup();
this.dialog = useService("dialog");
+ this.currentValue = this.value;
onWillUpdateProps(async (nextProps) => {
- if (nextProps.record.mode === 'edit' && nextProps.value) {
+ if (nextProps.record.mode === 'edit' && nextProps.record.data[nextProps.name]) {
if (
- !this.props.value ||
- this.props.value[0] != nextProps.value[0]
+ !this.currentValue ||
+ this.currentValue[0] != nextProps.record.data[nextProps.name][0]
) {
// Field was updated if line was open in edit mode,
// field is not emptied,
@@ -27,6 +28,7 @@ export class PurchaseOrderLineProductField extends Many2OneField {
this._onProductTemplateUpdate();
}
}
+ this.currentValue = nextProps.record.data[nextProps.name];
});
}
diff --git a/addons/sale/static/src/js/product_discount_field.js b/addons/sale/static/src/js/product_discount_field.js
index d5e3e78f580..c952c55217d 100644
--- a/addons/sale/static/src/js/product_discount_field.js
+++ b/addons/sale/static/src/js/product_discount_field.js
@@ -37,7 +37,7 @@ export class ProductDiscountField extends FloatField {
return {
operation: "UPDATE",
record: line,
- data: {["discount"]: this.props.value},
+ data: {["discount"]: this.props.record.data[this.props.name]},
};
});
diff --git a/addons/sale/static/src/js/sale_product_field.js b/addons/sale/static/src/js/sale_product_field.js
index 6fb068c4baf..40b3a3741da 100644
--- a/addons/sale/static/src/js/sale_product_field.js
+++ b/addons/sale/static/src/js/sale_product_field.js
@@ -14,7 +14,7 @@ export class SaleOrderLineProductField extends Many2OneField {
// NB: quick creation doesn't go through here, but through quickCreate
// below
if (value) {
- if (Array.isArray(value[0]) && this.props.value != value[0]) {
+ if (Array.isArray(value[0]) && this.props.record.data[this.props.name] != value[0]) {
// product (existing)
newValue = true;
} else {
@@ -61,7 +61,7 @@ export class SaleOrderLineProductField extends Many2OneField {
// Keep external button, even if field is specified as 'no_open' so that the user is not
// redirected to the product when clicking on the field content
const res = super.hasExternalButton;
- return res || (!!this.props.value && !this.state.isFloating);
+ return res || (!!this.props.record.data[this.props.name] && !this.state.isFloating);
}
get hasConfigurationButton() {
return this.isConfigurableLine || this.isConfigurableTemplate;
diff --git a/addons/sms/static/src/components/phone_field/phone_field.xml b/addons/sms/static/src/components/phone_field/phone_field.xml
index 7a189668636..c46b9fb3768 100644
--- a/addons/sms/static/src/components/phone_field/phone_field.xml
+++ b/addons/sms/static/src/components/phone_field/phone_field.xml
@@ -3,7 +3,7 @@
-
+
@@ -11,7 +11,7 @@
-
+
diff --git a/addons/sms/static/src/components/sms_widget/fields_sms_widget.js b/addons/sms/static/src/components/sms_widget/fields_sms_widget.js
index 5ecf85bd8e1..5a14117907b 100644
--- a/addons/sms/static/src/components/sms_widget/fields_sms_widget.js
+++ b/addons/sms/static/src/components/sms_widget/fields_sms_widget.js
@@ -20,10 +20,10 @@ export class SmsWidget extends EmojisTextField {
}
get encoding() {
- return this._extractEncoding(this.props.value || '');
+ return this._extractEncoding(this.props.record.data[this.props.name] || '');
}
get nbrChar() {
- const content = this.props.value || '';
+ const content = this.props.record.data[this.props.name] || '';
return content.length + (content.match(/\n/g) || []).length;
}
get nbrSMS() {
@@ -77,7 +77,7 @@ export class SmsWidget extends EmojisTextField {
* @private
*/
async onBlur() {
- var content = this.props.value || '';
+ var content = this.props.record.data[this.props.name] || '';
if( !content.trim().length && content.length > 0) {
this.notification.add(
this.env._t("Your SMS Text Message must include at least one non-whitespace character"),
diff --git a/addons/stock/static/src/widgets/counted_quantity_widget.js b/addons/stock/static/src/widgets/counted_quantity_widget.js
index 9c3c59f5461..195dec9546d 100644
--- a/addons/stock/static/src/widgets/counted_quantity_widget.js
+++ b/addons/stock/static/src/widgets/counted_quantity_widget.js
@@ -41,7 +41,7 @@ export class CountedQuantityWidgetField extends FloatField {
get formattedValue() {
if (
this.props.readonly &&
- !this.props.value & !this.props.record.data.inventory_quantity_set
+ !this.props.record.data[this.props.name] & !this.props.record.data.inventory_quantity_set
) {
return "";
}
diff --git a/addons/stock/static/src/widgets/json_widget.js b/addons/stock/static/src/widgets/json_widget.js
index d34ab220c08..53da36f536e 100644
--- a/addons/stock/static/src/widgets/json_widget.js
+++ b/addons/stock/static/src/widgets/json_widget.js
@@ -9,9 +9,9 @@ const { Component, onWillStart, onWillUpdateProps } = owl;
export class JsonPopOver extends Component {
setup(){
- this.jsonValue = JSON.parse(this.props.value);
+ this.jsonValue = JSON.parse(this.props.record.data[this.props.name]);
onWillUpdateProps(nextProps => {
- this.jsonValue = JSON.parse(nextProps.value);
+ this.jsonValue = JSON.parse(nextProps.record.data[nextProps.name]);
});
}
}
diff --git a/addons/web/static/src/core/debug/profiling/profiling_qweb.js b/addons/web/static/src/core/debug/profiling/profiling_qweb.js
index b3cac1eff66..959f6639500 100644
--- a/addons/web/static/src/core/debug/profiling/profiling_qweb.js
+++ b/addons/web/static/src/core/debug/profiling/profiling_qweb.js
@@ -69,8 +69,8 @@ export class ProfilingQwebView extends Component {
* @returns {archs, data: {template, xpath, directive, time, duration, query }[]}
*/
get profile() {
- if (this.props.value) {
- return JSON.parse(this.props.value)[0].results;
+ if (this.props.record.data[this.props.name]) {
+ return JSON.parse(this.props.record.data[this.props.name])[0].results;
}
return { archs: {}, data: [] };
}
diff --git a/addons/web/static/src/views/fields/ace/ace_field.js b/addons/web/static/src/views/fields/ace/ace_field.js
index 76c2d0cb575..35a2bce7f1b 100644
--- a/addons/web/static/src/views/fields/ace/ace_field.js
+++ b/addons/web/static/src/views/fields/ace/ace_field.js
@@ -75,7 +75,7 @@ export class AceField extends Component {
this.aceEditor.on("blur", this.commitChanges.bind(this));
}
- updateAce({ mode, readonly, value }) {
+ updateAce({ mode, readonly, record }) {
if (!this.aceEditor) {
return;
}
@@ -97,7 +97,7 @@ export class AceField extends Component {
this.aceEditor.renderer.$cursorLayer.element.style.display = readonly ? "none" : "block";
- const formattedValue = formatText(value);
+ const formattedValue = formatText(record.data[this.props.name]);
if (this.aceSession.getValue() !== formattedValue) {
this.aceSession.setValue(formattedValue);
}
@@ -112,7 +112,7 @@ export class AceField extends Component {
commitChanges() {
if (!this.props.readonly) {
const value = this.aceSession.getValue();
- if (this.props.value !== value) {
+ if (this.props.record.data[this.props.name] !== value) {
return this.props.record.update({ [this.props.name]: value });
}
}
diff --git a/addons/web/static/src/views/fields/attachment_image/attachment_image_field.xml b/addons/web/static/src/views/fields/attachment_image/attachment_image_field.xml
index 7a008ce893c..efd12acae80 100644
--- a/addons/web/static/src/views/fields/attachment_image/attachment_image_field.xml
+++ b/addons/web/static/src/views/fields/attachment_image/attachment_image_field.xml
@@ -3,7 +3,7 @@
-
![Image]()
+
diff --git a/addons/web/static/src/views/fields/badge/badge_field.js b/addons/web/static/src/views/fields/badge/badge_field.js
index 1f5675c38d7..de2ba8967d9 100644
--- a/addons/web/static/src/views/fields/badge/badge_field.js
+++ b/addons/web/static/src/views/fields/badge/badge_field.js
@@ -20,7 +20,7 @@ export class BadgeField extends Component {
get formattedValue() {
const formatter = formatters.get(this.props.record.fields[this.props.name].type);
- return formatter(this.props.value, {
+ return formatter(this.props.record.data[this.props.name], {
selection: this.props.record.fields[this.props.name].selection,
});
}
diff --git a/addons/web/static/src/views/fields/badge/badge_field.xml b/addons/web/static/src/views/fields/badge/badge_field.xml
index bfd48b173c5..58c0d2ac1cb 100644
--- a/addons/web/static/src/views/fields/badge/badge_field.xml
+++ b/addons/web/static/src/views/fields/badge/badge_field.xml
@@ -2,7 +2,7 @@
-
+
diff --git a/addons/web/static/src/views/fields/badge_selection/badge_selection_field.js b/addons/web/static/src/views/fields/badge_selection/badge_selection_field.js
index a14bb587ab9..545eaccb93e 100644
--- a/addons/web/static/src/views/fields/badge_selection/badge_selection_field.js
+++ b/addons/web/static/src/views/fields/badge_selection/badge_selection_field.js
@@ -29,17 +29,19 @@ export class BadgeSelectionField extends Component {
get string() {
switch (this.props.record.fields[this.props.name].type) {
case "many2one":
- return this.props.value ? this.props.value[1] : "";
+ return this.props.record.data[this.props.name]
+ ? this.props.record.data[this.props.name][1]
+ : "";
case "selection":
- return this.props.value !== false
- ? this.options.find((o) => o[0] === this.props.value)[1]
+ return this.props.record.data[this.props.name] !== false
+ ? this.options.find((o) => o[0] === this.props.record.data[this.props.name])[1]
: "";
default:
return "";
}
}
get value() {
- const rawValue = this.props.value;
+ const rawValue = this.props.record.data[this.props.name];
return this.props.record.fields[this.props.name].type === "many2one" && rawValue
? rawValue[0]
: rawValue;
diff --git a/addons/web/static/src/views/fields/binary/binary_field.js b/addons/web/static/src/views/fields/binary/binary_field.js
index b1f64b6718a..35a5b5f9334 100644
--- a/addons/web/static/src/views/fields/binary/binary_field.js
+++ b/addons/web/static/src/views/fields/binary/binary_field.js
@@ -36,7 +36,7 @@ export class BinaryField extends Component {
}
get fileName() {
- return this.state.fileName || this.props.value || "";
+ return this.state.fileName || this.props.record.data[this.props.name] || "";
}
update({ data, name }) {
@@ -58,7 +58,9 @@ export class BinaryField extends Component {
filename_field: this.fileName,
filename: this.fileName || "",
download: true,
- data: isBinarySize(this.props.value) ? null : this.props.value,
+ data: isBinarySize(this.props.record.data[this.props.name])
+ ? null
+ : this.props.record.data[this.props.name],
},
url: "/web/content",
});
diff --git a/addons/web/static/src/views/fields/binary/binary_field.xml b/addons/web/static/src/views/fields/binary/binary_field.xml
index ca732d1bbce..02eddd78303 100644
--- a/addons/web/static/src/views/fields/binary/binary_field.xml
+++ b/addons/web/static/src/views/fields/binary/binary_field.xml
@@ -3,7 +3,7 @@
-
+
diff --git a/addons/web/static/src/views/fields/boolean_icon/boolean_icon_field.js b/addons/web/static/src/views/fields/boolean_icon/boolean_icon_field.js
index 3fdf54b0760..13f0fdcb7d9 100644
--- a/addons/web/static/src/views/fields/boolean_icon/boolean_icon_field.js
+++ b/addons/web/static/src/views/fields/boolean_icon/boolean_icon_field.js
@@ -17,7 +17,7 @@ export class BooleanIconField extends Component {
};
update() {
- this.props.record.update({ [this.props.name]: !this.props.value });
+ this.props.record.update({ [this.props.name]: !this.props.record.data[this.props.name] });
}
}
diff --git a/addons/web/static/src/views/fields/boolean_icon/boolean_icon_field.xml b/addons/web/static/src/views/fields/boolean_icon/boolean_icon_field.xml
index d3b9e5c9cae..c0c3805a2c8 100644
--- a/addons/web/static/src/views/fields/boolean_icon/boolean_icon_field.xml
+++ b/addons/web/static/src/views/fields/boolean_icon/boolean_icon_field.xml
@@ -2,7 +2,7 @@
-
+
diff --git a/addons/web/static/src/views/fields/boolean_toggle/list_boolean_toggle_field.js b/addons/web/static/src/views/fields/boolean_toggle/list_boolean_toggle_field.js
index 1043a688593..9c6c321cb10 100644
--- a/addons/web/static/src/views/fields/boolean_toggle/list_boolean_toggle_field.js
+++ b/addons/web/static/src/views/fields/boolean_toggle/list_boolean_toggle_field.js
@@ -8,7 +8,9 @@ export class ListBooleanToggleField extends BooleanToggleField {
onClick() {
if (!this.props.readonly) {
- this.props.record.update({ [this.props.name]: !this.props.value });
+ this.props.record.update({
+ [this.props.name]: !this.props.record.data[this.props.name],
+ });
}
}
}
diff --git a/addons/web/static/src/views/fields/char/char_field.js b/addons/web/static/src/views/fields/char/char_field.js
index 3fd63a3fd43..86a90d7cb10 100644
--- a/addons/web/static/src/views/fields/char/char_field.js
+++ b/addons/web/static/src/views/fields/char/char_field.js
@@ -35,7 +35,10 @@ export class CharField extends Component {
dynamicPlaceholder.updateModel(this.props.dynamicPlaceholderModelReferenceField)
);
}
- useInputField({ getValue: () => this.props.value || "", parse: (v) => this.parse(v) });
+ useInputField({
+ getValue: () => this.props.record.data[this.props.name] || "",
+ parse: (v) => this.parse(v),
+ });
}
get shouldTrim() {
@@ -48,7 +51,9 @@ export class CharField extends Component {
return this.props.record.fields[this.props.name].translate;
}
get formattedValue() {
- return formatChar(this.props.value, { isPassword: this.props.isPassword });
+ return formatChar(this.props.record.data[this.props.name], {
+ isPassword: this.props.isPassword,
+ });
}
parse(value) {
diff --git a/addons/web/static/src/views/fields/color/color_field.js b/addons/web/static/src/views/fields/color/color_field.js
index 57c68c42818..238bace55f5 100644
--- a/addons/web/static/src/views/fields/color/color_field.js
+++ b/addons/web/static/src/views/fields/color/color_field.js
@@ -13,11 +13,11 @@ export class ColorField extends Component {
setup() {
this.state = useState({
- color: this.props.value || "",
+ color: this.props.record.data[this.props.name] || "",
});
onWillUpdateProps((nextProps) => {
- this.state.color = nextProps.value || "";
+ this.state.color = nextProps.record.data[nextProps.name] || "";
});
}
diff --git a/addons/web/static/src/views/fields/color_picker/color_picker_field.xml b/addons/web/static/src/views/fields/color_picker/color_picker_field.xml
index 3ac645263d5..0fc789efcc4 100644
--- a/addons/web/static/src/views/fields/color_picker/color_picker_field.xml
+++ b/addons/web/static/src/views/fields/color_picker/color_picker_field.xml
@@ -2,7 +2,7 @@
-
+
diff --git a/addons/web/static/src/views/fields/copy_clipboard/copy_clipboard_field.xml b/addons/web/static/src/views/fields/copy_clipboard/copy_clipboard_field.xml
index 48ee7ce4063..dd38df23300 100644
--- a/addons/web/static/src/views/fields/copy_clipboard/copy_clipboard_field.xml
+++ b/addons/web/static/src/views/fields/copy_clipboard/copy_clipboard_field.xml
@@ -4,12 +4,12 @@
-
+
-
+
diff --git a/addons/web/static/src/views/fields/date/date_field.js b/addons/web/static/src/views/fields/date/date_field.js
index 94003a48494..44adee1fb2e 100644
--- a/addons/web/static/src/views/fields/date/date_field.js
+++ b/addons/web/static/src/views/fields/date/date_field.js
@@ -35,13 +35,18 @@ export class DateField extends Component {
return this.props.record.fields[this.props.name].type === "datetime";
}
get date() {
- return this.props.value && this.props.value.startOf("day");
+ return (
+ this.props.record.data[this.props.name] &&
+ this.props.record.data[this.props.name].startOf("day")
+ );
}
get formattedValue() {
return this.isDateTime
- ? formatDateTime(this.props.value, { format: localization.dateFormat })
- : formatDate(this.props.value);
+ ? formatDateTime(this.props.record.data[this.props.name], {
+ format: localization.dateFormat,
+ })
+ : formatDate(this.props.record.data[this.props.name]);
}
onDateTimeChanged(date) {
diff --git a/addons/web/static/src/views/fields/daterange/daterange_field.js b/addons/web/static/src/views/fields/daterange/daterange_field.js
index d9a114feb3a..7ae6d9db5b3 100644
--- a/addons/web/static/src/views/fields/daterange/daterange_field.js
+++ b/addons/web/static/src/views/fields/daterange/daterange_field.js
@@ -59,7 +59,7 @@ export class DateRangeField extends Component {
}
};
},
- () => [this.root.el, this.props.value]
+ () => [this.root.el, this.props.record.data[this.props.name]]
);
}
@@ -70,7 +70,7 @@ export class DateRangeField extends Component {
return this.formatType === "datetime";
}
get formattedValue() {
- return this.formatValue(this.formatType, this.props.value);
+ return this.formatValue(this.formatType, this.props.record.data[this.props.name]);
}
get formattedEndDate() {
return this.formatValue(this.formatType, this.endDate);
diff --git a/addons/web/static/src/views/fields/datetime/datetime_field.js b/addons/web/static/src/views/fields/datetime/datetime_field.js
index 406730e345e..196769741f6 100644
--- a/addons/web/static/src/views/fields/datetime/datetime_field.js
+++ b/addons/web/static/src/views/fields/datetime/datetime_field.js
@@ -31,11 +31,11 @@ export class DateTimeField extends Component {
}
get formattedValue() {
- return formatDateTime(this.props.value);
+ return formatDateTime(this.props.record.data[this.props.name]);
}
onDateTimeChanged(date) {
- if (!areDateEquals(this.props.value || "", date)) {
+ if (!areDateEquals(this.props.record.data[this.props.name] || "", date)) {
this.props.record.update({ [this.props.name]: date });
}
}
diff --git a/addons/web/static/src/views/fields/datetime/datetime_field.xml b/addons/web/static/src/views/fields/datetime/datetime_field.xml
index 353ee429950..b9f91c63953 100644
--- a/addons/web/static/src/views/fields/datetime/datetime_field.xml
+++ b/addons/web/static/src/views/fields/datetime/datetime_field.xml
@@ -8,7 +8,7 @@
{
- this.displayedDomain = this.props.value;
+ this.displayedDomain = this.props.record.data[this.props.name];
this.loadCount(this.props);
});
onWillUpdateProps((nextProps) => {
this.isDebugEdited = this.isDebugEdited && this.props.readonly === nextProps.readonly;
if (!this.isDebugEdited) {
- this.displayedDomain = nextProps.value;
+ this.displayedDomain = nextProps.record.data[nextProps.name];
this.loadCount(nextProps);
}
});
@@ -79,7 +79,10 @@ export class DomainField extends Component {
noCreate: true,
multiSelect: false,
resModel: this.getResModel(this.props),
- domain: this.getDomain(this.props.value).toList(this.getContext(this.props)) || [],
+ domain:
+ this.getDomain(this.props.record.data[this.props.name]).toList(
+ this.getContext(this.props)
+ ) || [],
context: this.getContext(this.props) || {},
},
{
@@ -90,7 +93,7 @@ export class DomainField extends Component {
}
get isValidDomain() {
try {
- this.getDomain(this.props.value).toList();
+ this.getDomain(this.props.record.data[this.props.name]).toList();
return true;
} catch {
// WOWL TODO: rethrow error when not the expected type
@@ -108,7 +111,9 @@ export class DomainField extends Component {
let recordCount;
try {
- const domain = this.getDomain(props.value).toList(this.getContext(props));
+ const domain = this.getDomain(props.record.data[props.name]).toList(
+ this.getContext(props)
+ );
recordCount = await this.orm.silent.call(
this.getResModel(props),
"search_count",
@@ -131,7 +136,7 @@ export class DomainField extends Component {
onEditDialogBtnClick() {
this.addDialog(DomainSelectorDialog, {
resModel: this.getResModel(this.props),
- initialValue: this.props.value || "[]",
+ initialValue: this.props.record.data[this.props.name] || "[]",
readonly: this.props.readonly,
isDebugMode: !!this.env.debug,
onSelected: (value) => this.props.record.update({ [this.props.name]: value }),
diff --git a/addons/web/static/src/views/fields/domain/domain_field.xml b/addons/web/static/src/views/fields/domain/domain_field.xml
index 980ba3dd47f..ea03dcadb2e 100644
--- a/addons/web/static/src/views/fields/domain/domain_field.xml
+++ b/addons/web/static/src/views/fields/domain/domain_field.xml
@@ -10,7 +10,7 @@
readonly="props.readonly or props.editInDialog"
update.bind="update"
isDebugMode="!!env.debug"
- debugValue="props.value || '[]'"
+ debugValue="props.record.data[props.name] || '[]'"
className="props.readonly ? 'o_read_mode' : 'o_edit_mode'"
/>
diff --git a/addons/web/static/src/views/fields/email/email_field.js b/addons/web/static/src/views/fields/email/email_field.js
index 630650e1b42..949c58fca5c 100644
--- a/addons/web/static/src/views/fields/email/email_field.js
+++ b/addons/web/static/src/views/fields/email/email_field.js
@@ -15,7 +15,7 @@ export class EmailField extends Component {
};
setup() {
- useInputField({ getValue: () => this.props.value || "" });
+ useInputField({ getValue: () => this.props.record.data[this.props.name] || "" });
}
}
diff --git a/addons/web/static/src/views/fields/email/email_field.xml b/addons/web/static/src/views/fields/email/email_field.xml
index c570a3f522f..f50f08cc07c 100644
--- a/addons/web/static/src/views/fields/email/email_field.xml
+++ b/addons/web/static/src/views/fields/email/email_field.xml
@@ -3,7 +3,7 @@
-
+
@@ -22,8 +22,8 @@
diff --git a/addons/web/static/src/views/fields/field.js b/addons/web/static/src/views/fields/field.js
index 4ed4f3e6efa..aa40ab76689 100644
--- a/addons/web/static/src/views/fields/field.js
+++ b/addons/web/static/src/views/fields/field.js
@@ -140,7 +140,6 @@ export class Field extends Component {
delete props.type;
return {
- value: this.props.record.data[this.props.name],
readonly: !record.isInEdition || readonlyFromModifiers || false,
...propsFromNode,
...props,
diff --git a/addons/web/static/src/views/fields/float/float_field.js b/addons/web/static/src/views/fields/float/float_field.js
index 5f0767b2095..4dcb661ceea 100644
--- a/addons/web/static/src/views/fields/float/float_field.js
+++ b/addons/web/static/src/views/fields/float/float_field.js
@@ -48,7 +48,7 @@ export class FloatField extends Component {
}
get value() {
- return this.props.value;
+ return this.props.record.data[this.props.name];
}
}
diff --git a/addons/web/static/src/views/fields/float_factor/float_factor_field.js b/addons/web/static/src/views/fields/float_factor/float_factor_field.js
index 4e0b4c290c3..bda0b4f42a7 100644
--- a/addons/web/static/src/views/fields/float_factor/float_factor_field.js
+++ b/addons/web/static/src/views/fields/float_factor/float_factor_field.js
@@ -22,7 +22,7 @@ export class FloatFactorField extends FloatField {
}
get value() {
- return this.props.value * this.props.factor;
+ return this.props.record.data[this.props.name] * this.props.factor;
}
}
diff --git a/addons/web/static/src/views/fields/float_time/float_time_field.js b/addons/web/static/src/views/fields/float_time/float_time_field.js
index 2164e935c15..080728bb3ac 100644
--- a/addons/web/static/src/views/fields/float_time/float_time_field.js
+++ b/addons/web/static/src/views/fields/float_time/float_time_field.js
@@ -27,7 +27,7 @@ export class FloatTimeField extends Component {
}
get formattedValue() {
- return formatFloatTime(this.props.value);
+ return formatFloatTime(this.props.record.data[this.props.name]);
}
}
diff --git a/addons/web/static/src/views/fields/float_toggle/float_toggle_field.js b/addons/web/static/src/views/fields/float_toggle/float_toggle_field.js
index 9b6e7b0e874..8c34bc24adf 100644
--- a/addons/web/static/src/views/fields/float_toggle/float_toggle_field.js
+++ b/addons/web/static/src/views/fields/float_toggle/float_toggle_field.js
@@ -24,7 +24,9 @@ export class FloatToggleField extends Component {
// TODO perf issue (because of update round trip)
// we probably want to have a state and a useEffect or onWillUpateProps
onChange() {
- let currentIndex = this.props.range.indexOf(this.props.value * this.factor);
+ let currentIndex = this.props.range.indexOf(
+ this.props.record.data[this.props.name] * this.factor
+ );
currentIndex++;
if (currentIndex > this.props.range.length - 1) {
currentIndex = 0;
@@ -44,7 +46,7 @@ export class FloatToggleField extends Component {
return !this.props.digits && Array.isArray(fieldDigits) ? fieldDigits : this.props.digits;
}
get formattedValue() {
- return formatFloat(this.props.value * this.factor, {
+ return formatFloat(this.props.record.data[this.props.name] * this.factor, {
digits: this.digits,
});
}
diff --git a/addons/web/static/src/views/fields/font_selection/font_selection_field.js b/addons/web/static/src/views/fields/font_selection/font_selection_field.js
index 2d7ff16be63..4f0e29f3c5e 100644
--- a/addons/web/static/src/views/fields/font_selection/font_selection_field.js
+++ b/addons/web/static/src/views/fields/font_selection/font_selection_field.js
@@ -23,7 +23,9 @@ export class FontSelectionField extends Component {
return this.props.record.isRequired(this.props.name);
}
get string() {
- return formatSelection(this.props.value, { selection: this.options });
+ return formatSelection(this.props.record.data[this.props.name], {
+ selection: this.options,
+ });
}
stringify(value) {
diff --git a/addons/web/static/src/views/fields/font_selection/font_selection_field.xml b/addons/web/static/src/views/fields/font_selection/font_selection_field.xml
index 6699f82b4e8..29af79a58b1 100644
--- a/addons/web/static/src/views/fields/font_selection/font_selection_field.xml
+++ b/addons/web/static/src/views/fields/font_selection/font_selection_field.xml
@@ -3,10 +3,10 @@
-
+
-
diff --git a/addons/web/static/src/views/fields/iframe_wrapper/iframe_wrapper_field.js b/addons/web/static/src/views/fields/iframe_wrapper/iframe_wrapper_field.js
index fc1717d2b01..037cf826145 100644
--- a/addons/web/static/src/views/fields/iframe_wrapper/iframe_wrapper_field.js
+++ b/addons/web/static/src/views/fields/iframe_wrapper/iframe_wrapper_field.js
@@ -31,7 +31,7 @@ export class IframeWrapperField extends Component {
iframeDoc.write(value);
iframeDoc.close();
},
- () => [this.props.value]
+ () => [this.props.record.data[this.props.name]]
);
}
}
diff --git a/addons/web/static/src/views/fields/image/image_field.js b/addons/web/static/src/views/fields/image/image_field.js
index da63b46ef2a..43b03a3757f 100644
--- a/addons/web/static/src/views/fields/image/image_field.js
+++ b/addons/web/static/src/views/fields/image/image_field.js
@@ -81,7 +81,9 @@ export class ImageField extends Component {
return style;
}
get hasTooltip() {
- return this.props.enableZoom && this.props.readonly && this.props.value;
+ return (
+ this.props.enableZoom && this.props.readonly && this.props.record.data[this.props.name]
+ );
}
get tooltipAttributes() {
return {
@@ -91,8 +93,8 @@ export class ImageField extends Component {
}
getUrl(previewFieldName) {
- if (this.state.isValid && this.props.value) {
- if (isBinarySize(this.props.value)) {
+ if (this.state.isValid && this.props.record.data[this.props.name]) {
+ if (isBinarySize(this.props.record.data[this.props.name])) {
if (!this.rawCacheKey) {
this.rawCacheKey = this.props.record.data.write_date;
}
@@ -104,8 +106,9 @@ export class ImageField extends Component {
});
} else {
// Use magic-word technique for detecting image type
- const magic = fileTypeMagicWordMap[this.props.value[0]] || "png";
- return `data:image/${magic};base64,${this.props.value}`;
+ const magic =
+ fileTypeMagicWordMap[this.props.record.data[this.props.name][0]] || "png";
+ return `data:image/${magic};base64,${this.props.record.data[this.props.name]}`;
}
}
return placeholder;
diff --git a/addons/web/static/src/views/fields/image/image_field.xml b/addons/web/static/src/views/fields/image/image_field.xml
index 2b589075c42..0a735526959 100644
--- a/addons/web/static/src/views/fields/image/image_field.xml
+++ b/addons/web/static/src/views/fields/image/image_field.xml
@@ -18,7 +18,7 @@
diff --git a/addons/web/static/src/views/fields/percentage/percentage_field.js b/addons/web/static/src/views/fields/percentage/percentage_field.js
index 481629c99dc..e7575c8087b 100644
--- a/addons/web/static/src/views/fields/percentage/percentage_field.js
+++ b/addons/web/static/src/views/fields/percentage/percentage_field.js
@@ -21,7 +21,7 @@ export class PercentageField extends Component {
setup() {
useInputField({
getValue: () =>
- formatPercentage(this.props.value, {
+ formatPercentage(this.props.record.data[this.props.name], {
digits: this.digits,
noSymbol: true,
}),
@@ -36,7 +36,7 @@ export class PercentageField extends Component {
return !this.props.digits && Array.isArray(fieldDigits) ? fieldDigits : this.props.digits;
}
get formattedValue() {
- return formatPercentage(this.props.value, {
+ return formatPercentage(this.props.record.data[this.props.name], {
digits: this.digits,
});
}
diff --git a/addons/web/static/src/views/fields/phone/phone_field.js b/addons/web/static/src/views/fields/phone/phone_field.js
index b40dde5e190..c7a3667a0f2 100644
--- a/addons/web/static/src/views/fields/phone/phone_field.js
+++ b/addons/web/static/src/views/fields/phone/phone_field.js
@@ -15,7 +15,7 @@ export class PhoneField extends Component {
};
setup() {
- useInputField({ getValue: () => this.props.value || "" });
+ useInputField({ getValue: () => this.props.record.data[this.props.name] || "" });
}
}
diff --git a/addons/web/static/src/views/fields/phone/phone_field.xml b/addons/web/static/src/views/fields/phone/phone_field.xml
index bcd57958694..844122c74bf 100644
--- a/addons/web/static/src/views/fields/phone/phone_field.xml
+++ b/addons/web/static/src/views/fields/phone/phone_field.xml
@@ -4,7 +4,7 @@
-
+
Call
diff --git a/addons/web/static/src/views/fields/priority/priority_field.js b/addons/web/static/src/views/fields/priority/priority_field.js
index 9b80ed782c0..df734fdf5ee 100644
--- a/addons/web/static/src/views/fields/priority/priority_field.js
+++ b/addons/web/static/src/views/fields/priority/priority_field.js
@@ -60,7 +60,7 @@ export class PriorityField extends Component {
get index() {
return this.state.index > -1
? this.state.index
- : this.options.findIndex((o) => o[0] === this.props.value);
+ : this.options.findIndex((o) => o[0] === this.props.record.data[this.props.name]);
}
get isReadonly() {
return this.props.record.isReadonly(this.props.name);
@@ -75,7 +75,7 @@ export class PriorityField extends Component {
* @param {string} value
*/
onStarClicked(value) {
- if (this.props.value === value) {
+ if (this.props.record.data[this.props.name] === value) {
this.state.index = -1;
this.updateRecord(this.options[0][0]);
} else {
diff --git a/addons/web/static/src/views/fields/properties/properties_field.js b/addons/web/static/src/views/fields/properties/properties_field.js
index 74944ad61c3..17d27557aaf 100644
--- a/addons/web/static/src/views/fields/properties/properties_field.js
+++ b/addons/web/static/src/views/fields/properties/properties_field.js
@@ -92,7 +92,9 @@ export class PropertiesField extends Component {
* @returns {array}
*/
get propertiesList() {
- const propertiesValues = JSON.parse(JSON.stringify(this.props.value || []));
+ const propertiesValues = JSON.parse(
+ JSON.stringify(this.props.record.data[this.props.name] || [])
+ );
return propertiesValues.filter((definition) => !definition.definition_deleted);
}
@@ -428,7 +430,7 @@ export class PropertiesField extends Component {
// initial properties values, if the type or the model changed, the
// name will be regenerated in order to reset the value on the children
this.initialValues = {};
- for (const propertiesValues of this.props.value || []) {
+ for (const propertiesValues of this.props.record.data[this.props.name] || []) {
this.initialValues[propertiesValues.name] = {
name: propertiesValues.name,
type: propertiesValues.type,
diff --git a/addons/web/static/src/views/fields/properties/property_tags.js b/addons/web/static/src/views/fields/properties/property_tags.js
index 8dd5d261b4c..31ecc0a3cd8 100644
--- a/addons/web/static/src/views/fields/properties/property_tags.js
+++ b/addons/web/static/src/views/fields/properties/property_tags.js
@@ -312,7 +312,7 @@ export class PropertyTagsField extends Component {
get propertyTagsProps() {
return {
- selectedTags: this.props.value || [],
+ selectedTags: this.props.record.data[this.props.name] || [],
tags: this.props.record.fields[this.props.name].tags || [],
deleteAction: "value",
readonly: this.props.readonly,
diff --git a/addons/web/static/src/views/fields/radio/radio_field.js b/addons/web/static/src/views/fields/radio/radio_field.js
index 672b59f0a1d..84d68c3419c 100644
--- a/addons/web/static/src/views/fields/radio/radio_field.js
+++ b/addons/web/static/src/views/fields/radio/radio_field.js
@@ -42,9 +42,11 @@ export class RadioField extends Component {
get value() {
switch (this.props.record.fields[this.props.name].type) {
case "selection":
- return this.props.value;
+ return this.props.record.data[this.props.name];
case "many2one":
- return Array.isArray(this.props.value) ? this.props.value[0] : this.props.value;
+ return Array.isArray(this.props.record.data[this.props.name])
+ ? this.props.record.data[this.props.name][0]
+ : this.props.record.data[this.props.name];
default:
return null;
}
diff --git a/addons/web/static/src/views/fields/reference/reference_field.js b/addons/web/static/src/views/fields/reference/reference_field.js
index 6acee8fae91..14452566bc5 100644
--- a/addons/web/static/src/views/fields/reference/reference_field.js
+++ b/addons/web/static/src/views/fields/reference/reference_field.js
@@ -28,14 +28,17 @@ export class ReferenceField extends Component {
resModel: this.relation,
});
+ this.currentValue = this.getValue(this.props);
+
onWillUpdateProps((nextProps) => {
if (
- valuesEqual(this.getValue(this.props) || {}, this.getValue(nextProps) || {}) &&
+ valuesEqual(this.currentValue || {}, this.getValue(nextProps) || {}) &&
this.state.resModel &&
this.getRelation(nextProps) !== this.state.resModel
) {
nextProps.record.update({ [this.props.name]: false });
}
+ this.currentValue = this.getValue(this.props);
});
}
@@ -54,7 +57,7 @@ export class ReferenceField extends Component {
displayName: pdata.data.display_name,
};
} else {
- return p.value;
+ return p.record.data[p.name];
}
}
get m2oProps() {
diff --git a/addons/web/static/src/views/fields/remaining_days/remaining_days_field.js b/addons/web/static/src/views/fields/remaining_days/remaining_days_field.js
index 3cbd1712771..ccc9dae71a2 100644
--- a/addons/web/static/src/views/fields/remaining_days/remaining_days_field.js
+++ b/addons/web/static/src/views/fields/remaining_days/remaining_days_field.js
@@ -24,17 +24,21 @@ export class RemainingDaysField extends Component {
}
get diffDays() {
- if (!this.props.value) {
+ if (!this.props.record.data[this.props.name]) {
return null;
}
const today = luxon.DateTime.local().startOf("day");
- return Math.floor(this.props.value.startOf("day").diff(today, "days").days);
+ return Math.floor(
+ this.props.record.data[this.props.name].startOf("day").diff(today, "days").days
+ );
}
get formattedValue() {
return this.hasTime
- ? formatDateTime(this.props.value, { format: localization.dateFormat })
- : formatDate(this.props.value);
+ ? formatDateTime(this.props.record.data[this.props.name], {
+ format: localization.dateFormat,
+ })
+ : formatDate(this.props.record.data[this.props.name]);
}
onDateTimeChanged(datetime) {
diff --git a/addons/web/static/src/views/fields/remaining_days/remaining_days_field.xml b/addons/web/static/src/views/fields/remaining_days/remaining_days_field.xml
index c1e844f4f62..cec5885218f 100644
--- a/addons/web/static/src/views/fields/remaining_days/remaining_days_field.xml
+++ b/addons/web/static/src/views/fields/remaining_days/remaining_days_field.xml
@@ -25,7 +25,7 @@
-
+
diff --git a/addons/web/static/src/views/fields/selection/selection_field.js b/addons/web/static/src/views/fields/selection/selection_field.js
index 32ba1266b5c..3cce2d64a7d 100644
--- a/addons/web/static/src/views/fields/selection/selection_field.js
+++ b/addons/web/static/src/views/fields/selection/selection_field.js
@@ -28,17 +28,19 @@ export class SelectionField extends Component {
get string() {
switch (this.props.record.fields[this.props.name].type) {
case "many2one":
- return this.props.value ? this.props.value[1] : "";
+ return this.props.record.data[this.props.name]
+ ? this.props.record.data[this.props.name][1]
+ : "";
case "selection":
- return this.props.value !== false
- ? this.options.find((o) => o[0] === this.props.value)[1]
+ return this.props.record.data[this.props.name] !== false
+ ? this.options.find((o) => o[0] === this.props.record.data[this.props.name])[1]
: "";
default:
return "";
}
}
get value() {
- const rawValue = this.props.value;
+ const rawValue = this.props.record.data[this.props.name];
return this.props.record.fields[this.props.name].type === "many2one" && rawValue
? rawValue[0]
: rawValue;
diff --git a/addons/web/static/src/views/fields/signature/signature_field.js b/addons/web/static/src/views/fields/signature/signature_field.js
index 1afad51c821..af07aae0eb8 100644
--- a/addons/web/static/src/views/fields/signature/signature_field.js
+++ b/addons/web/static/src/views/fields/signature/signature_field.js
@@ -53,8 +53,9 @@ export class SignatureField extends Component {
});
} else {
// Use magic-word technique for detecting image type
- const magic = fileTypeMagicWordMap[this.props.value[0]] || "png";
- return `data:image/${magic};base64,${this.props.value}`;
+ const magic =
+ fileTypeMagicWordMap[this.props.record.data[this.props.name][0]] || "png";
+ return `data:image/${magic};base64,${this.props.record.data[this.props.name]}`;
}
}
return placeholder;
diff --git a/addons/web/static/src/views/fields/signature/signature_field.xml b/addons/web/static/src/views/fields/signature/signature_field.xml
index 8cf11c837e7..d52feb52423 100644
--- a/addons/web/static/src/views/fields/signature/signature_field.xml
+++ b/addons/web/static/src/views/fields/signature/signature_field.xml
@@ -2,7 +2,7 @@
-
+
this.props.value !== value,
+ isAvailable: () => this.props.record.data[this.props.name] !== value,
}
);
}
@@ -52,11 +52,14 @@ export class StateSelectionField extends Component {
});
}
get currentValue() {
- return this.props.value || this.options[0][0];
+ return this.props.record.data[this.props.name] || this.options[0][0];
}
get label() {
- if (this.props.value && this.props.record.data[`legend_${this.props.value[0]}`]) {
- return this.props.record.data[`legend_${this.props.value[0]}`];
+ if (
+ this.props.record.data[this.props.name] &&
+ this.props.record.data[`legend_${this.props.record.data[this.props.name][0]}`]
+ ) {
+ return this.props.record.data[`legend_${this.props.record.data[this.props.name][0]}`];
}
return formatSelection(this.currentValue, { selection: this.options });
}
diff --git a/addons/web/static/src/views/fields/statusbar/statusbar_field.js b/addons/web/static/src/views/fields/statusbar/statusbar_field.js
index 95b25ce146a..1483f3c225c 100644
--- a/addons/web/static/src/views/fields/statusbar/statusbar_field.js
+++ b/addons/web/static/src/views/fields/statusbar/statusbar_field.js
@@ -67,8 +67,8 @@ export class StatusBarField extends Component {
(option) =>
option.id ===
(this.type === "many2one"
- ? this.props.value[0]
- : this.props.value)
+ ? this.props.record.data[this.props.name][0]
+ : this.props.record.data[this.props.name])
) + 1
];
this.selectItem(nextOption);
@@ -82,7 +82,9 @@ export class StatusBarField extends Component {
!this.props.readonly &&
!this.props.isDisabled &&
options[options.length - 1].id !==
- (this.type === "many2one" ? this.props.value[0] : this.props.value)
+ (this.type === "many2one"
+ ? this.props.record.data[this.props.name][0]
+ : this.props.record.data[this.props.name])
);
},
}
@@ -94,12 +96,16 @@ export class StatusBarField extends Component {
switch (this.type) {
case "many2one": {
const item = this.options.find(
- (item) => this.props.value && item.id === this.props.value[0]
+ (item) =>
+ this.props.record.data[this.props.name] &&
+ item.id === this.props.record.data[this.props.name][0]
);
return item ? item.display_name : "";
}
case "selection": {
- const item = this.options.find((item) => item[0] === this.props.value);
+ const item = this.options.find(
+ (item) => item[0] === this.props.record.data[this.props.name]
+ );
return item ? item[1] : "";
}
}
@@ -147,7 +153,9 @@ export class StatusBarField extends Component {
});
return items.map((item) => ({
...item,
- isSelected: this.props.value && item.id === this.props.value[0],
+ isSelected:
+ this.props.record.data[this.props.name] &&
+ item.id === this.props.record.data[this.props.name][0],
}));
}
@@ -156,13 +164,14 @@ export class StatusBarField extends Component {
if (this.props.visibleSelection.length) {
selection = selection.filter(
(item) =>
- this.props.visibleSelection.includes(item[0]) || item[0] === this.props.value
+ this.props.visibleSelection.includes(item[0]) ||
+ item[0] === this.props.record.data[this.props.name]
);
}
return selection.map((item) => ({
id: item[0],
name: item[1],
- isSelected: item[0] === this.props.value,
+ isSelected: item[0] === this.props.record.data[this.props.name],
isFolded: false,
}));
}
diff --git a/addons/web/static/src/views/fields/text/text_field.js b/addons/web/static/src/views/fields/text/text_field.js
index 21cbf5da34f..37fdd1bda5e 100644
--- a/addons/web/static/src/views/fields/text/text_field.js
+++ b/addons/web/static/src/views/fields/text/text_field.js
@@ -38,7 +38,10 @@ export class TextField extends Component {
dynamicPlaceholder.updateModel(this.props.dynamicPlaceholderModelReferenceField)
);
}
- useInputField({ getValue: () => this.props.value || "", refName: "textarea" });
+ useInputField({
+ getValue: () => this.props.record.data[this.props.name] || "",
+ refName: "textarea",
+ });
useSpellCheck({ refName: "textarea" });
useEffect(() => {
diff --git a/addons/web/static/src/views/fields/text/text_field.xml b/addons/web/static/src/views/fields/text/text_field.xml
index d374ec6ee21..7cf86ef9b69 100644
--- a/addons/web/static/src/views/fields/text/text_field.xml
+++ b/addons/web/static/src/views/fields/text/text_field.xml
@@ -3,7 +3,7 @@
-
+
diff --git a/addons/web/static/src/views/fields/timezone_mismatch/timezone_mismatch_field.js b/addons/web/static/src/views/fields/timezone_mismatch/timezone_mismatch_field.js
index 6d5e506b211..8783b38adf2 100644
--- a/addons/web/static/src/views/fields/timezone_mismatch/timezone_mismatch_field.js
+++ b/addons/web/static/src/views/fields/timezone_mismatch/timezone_mismatch_field.js
@@ -24,19 +24,19 @@ export class TimezoneMismatchField extends SelectionField {
get mismatch() {
const userOffset = this.props.record.data[this.props.tzOffsetField];
- if (userOffset && this.props.value) {
+ if (userOffset && this.props.record.data[this.props.name]) {
const offset = -new Date().getTimezoneOffset();
let browserOffset = offset < 0 ? "-" : "+";
browserOffset += _.str.sprintf("%02d", Math.abs(offset / 60));
browserOffset += _.str.sprintf("%02d", Math.abs(offset % 60));
return browserOffset !== userOffset;
- } else if (!this.props.value) {
+ } else if (!this.props.record.data[this.props.name]) {
return true;
}
return false;
}
get mismatchTitle() {
- if (!this.props.value) {
+ if (!this.props.record.data[this.props.name]) {
return this.env._t("Set a timezone on your user");
}
return this.props.mismatchTitle;
@@ -47,7 +47,7 @@ export class TimezoneMismatchField extends SelectionField {
}
return super.options.map((option) => {
const [value, label] = option;
- if (value === this.props.value) {
+ if (value === this.props.record.data[this.props.name]) {
const offset = this.props.record.data[this.props.tzOffsetField].match(
/([+-])([0-9]{2})([0-9]{2})/
);
diff --git a/addons/web/static/src/views/fields/url/url_field.js b/addons/web/static/src/views/fields/url/url_field.js
index cdd8aa6edae..0480a00c088 100644
--- a/addons/web/static/src/views/fields/url/url_field.js
+++ b/addons/web/static/src/views/fields/url/url_field.js
@@ -17,18 +17,20 @@ export class UrlField extends Component {
};
setup() {
- useInputField({ getValue: () => this.props.value || "" });
+ useInputField({ getValue: () => this.props.record.data[this.props.name] || "" });
}
get formattedHref() {
let value = "";
- if (typeof this.props.value === "string") {
+ if (typeof this.props.record.data[this.props.name] === "string") {
const shouldaddPrefix = !(
this.props.websitePath ||
- this.props.value.includes("://") ||
- /^\//.test(this.props.value)
+ this.props.record.data[this.props.name].includes("://") ||
+ /^\//.test(this.props.record.data[this.props.name])
);
- value = shouldaddPrefix ? `http://${this.props.value}` : this.props.value;
+ value = shouldaddPrefix
+ ? `http://${this.props.record.data[this.props.name]}`
+ : this.props.record.data[this.props.name];
}
return value;
}
diff --git a/addons/web/static/src/views/fields/url/url_field.xml b/addons/web/static/src/views/fields/url/url_field.xml
index 22d234df2f7..0ad8c2fa417 100644
--- a/addons/web/static/src/views/fields/url/url_field.xml
+++ b/addons/web/static/src/views/fields/url/url_field.xml
@@ -3,7 +3,7 @@
-
+
@@ -22,7 +22,7 @@
saveRecord(resIds),
onCreateEdit: ({ context }) => this._openRecord({ context }),
@@ -112,7 +112,11 @@ export class X2ManyField extends Component {
this.selectCreate = (params) => {
const p = Object.assign({}, params);
- p.domain = [...(p.domain || []), "!", ["id", "in", this.props.value.currentIds]];
+ p.domain = [
+ ...(p.domain || []),
+ "!",
+ ["id", "in", this.props.record.data[this.props.name].currentIds],
+ ];
return selectCreate(p);
};
}
@@ -138,7 +142,7 @@ export class X2ManyField extends Component {
}
get list() {
- return this.props.value;
+ return this.props.record.data[this.props.name];
}
get nestedKeyOptionalFieldsData() {
diff --git a/addons/web/static/src/views/fields/x2many/x2many_field.xml b/addons/web/static/src/views/fields/x2many/x2many_field.xml
index 03a0a0252ce..73cc12099a7 100644
--- a/addons/web/static/src/views/fields/x2many/x2many_field.xml
+++ b/addons/web/static/src/views/fields/x2many/x2many_field.xml
@@ -21,7 +21,7 @@
className="`${create.className}`"
clickParams="create.clickParams"
icon="create.icon"
- record="props.value"
+ record="props.record.data[props.name]"
string="create.string"
title="create.title"
/>
@@ -29,7 +29,7 @@
diff --git a/addons/web_editor/static/src/js/backend/html_field.js b/addons/web_editor/static/src/js/backend/html_field.js
index 36b865825a9..4a8fb33c43b 100644
--- a/addons/web_editor/static/src/js/backend/html_field.js
+++ b/addons/web_editor/static/src/js/backend/html_field.js
@@ -24,7 +24,6 @@ import {
import { toInline } from 'web_editor.convertInline';
import { loadJS } from '@web/core/assets';
import {
- markup,
Component,
useRef,
useSubEnv,
@@ -152,7 +151,7 @@ export class HtmlField extends Component {
} else {
const codeViewEl = this._getCodeViewEl();
if (codeViewEl) {
- codeViewEl.value = this.props.value;
+ codeViewEl.value = this.props.record.data[this.props.name];
}
}
})();
@@ -174,7 +173,7 @@ export class HtmlField extends Component {
return this.props.record.fields[this.props.name].translate;
}
get markupValue () {
- return markup(this.props.value);
+ return this.props.record.data[this.props.name];
}
get showIframe () {
return this.props.readonly && this.props.cssReadonlyAssetId;
@@ -220,7 +219,7 @@ export class HtmlField extends Component {
}
return {
- value: this.props.value,
+ value: this.props.record.data[this.props.name],
autostart: false,
onAttachmentChange: this._onAttachmentChange.bind(this),
onWysiwygBlur: this._onWysiwygBlur.bind(this),
@@ -288,7 +287,7 @@ export class HtmlField extends Component {
}
async updateValue() {
const value = this.getEditingValue();
- const lastValue = (this.props.value || "").toString();
+ const lastValue = (this.props.record.data[this.props.name] || "").toString();
if (
value !== null &&
!(!lastValue && stripHistoryIds(value) === "
") &&
@@ -391,7 +390,7 @@ export class HtmlField extends Component {
}
}
_isDirty() {
- const strippedPropValue = stripHistoryIds(String(this.props.value));
+ const strippedPropValue = stripHistoryIds(String(this.props.record.data[this.props.name]));
const strippedEditingValue = stripHistoryIds(this.getEditingValue());
return !this.props.readonly && strippedPropValue !== strippedEditingValue;
}
@@ -401,13 +400,13 @@ export class HtmlField extends Component {
async _setupReadonlyIframe() {
const iframeTarget = this.iframeRef.el.contentDocument.querySelector('#iframe_target');
if (this.iframePromise && iframeTarget) {
- if (iframeTarget.innerHTML !== this.props.value) {
- iframeTarget.innerHTML = this.props.value;
+ if (iframeTarget.innerHTML !== this.props.record.data[this.props.name]) {
+ iframeTarget.innerHTML = this.props.record.data[this.props.name];
}
return this.iframePromise;
}
this.iframePromise = new Promise((resolve) => {
- let value = this.props.value;
+ let value = this.props.record.data[this.props.name];
if (this.props.wrapper) {
value = this._wrap(value);
}
diff --git a/addons/web_kanban_gauge/static/src/gauge_field.js b/addons/web_kanban_gauge/static/src/gauge_field.js
index e7ee5ee6f46..2404b4dc312 100644
--- a/addons/web_kanban_gauge/static/src/gauge_field.js
+++ b/addons/web_kanban_gauge/static/src/gauge_field.js
@@ -30,11 +30,14 @@ export class GaugeField extends Component {
}
get formattedValue() {
- return formatFloat(this.props.value, { humanReadable: true, decimals: 1 });
+ return formatFloat(this.props.record.data[this.props.name], {
+ humanReadable: true,
+ decimals: 1,
+ });
}
renderChart() {
- const gaugeValue = this.props.value;
+ const gaugeValue = this.props.record.data[this.props.name];
let maxValue = Math.max(gaugeValue, this.props.record.data[this.props.maxValueField]);
let maxLabel = maxValue;
if (gaugeValue === 0 && maxValue === 0) {
diff --git a/addons/web_kanban_gauge/static/src/gauge_field.xml b/addons/web_kanban_gauge/static/src/gauge_field.xml
index 98eef0e9302..c7ac681ed18 100644
--- a/addons/web_kanban_gauge/static/src/gauge_field.xml
+++ b/addons/web_kanban_gauge/static/src/gauge_field.xml
@@ -4,7 +4,7 @@
-
+
diff --git a/addons/website/static/src/components/fields/fields.js b/addons/website/static/src/components/fields/fields.js
index 8a6b3492ce9..24f09ed04c1 100644
--- a/addons/website/static/src/components/fields/fields.js
+++ b/addons/website/static/src/components/fields/fields.js
@@ -38,7 +38,7 @@ class PageUrlField extends Component {
}
get fieldURL() {
- const value = this.props.value;
+ const value = this.props.record.data[this.props.name];
return (value.url !== undefined ? value.url : value).replace(/^\//g, '');
}
diff --git a/addons/website/static/src/components/fields/fields.xml b/addons/website/static/src/components/fields/fields.xml
index e15af1f7b00..36b95925572 100644
--- a/addons/website/static/src/components/fields/fields.xml
+++ b/addons/website/static/src/components/fields/fields.xml
@@ -3,7 +3,7 @@
-
+
@@ -46,7 +46,7 @@
-
![]()
+
diff --git a/addons/website/static/src/components/fields/redirect_field.js b/addons/website/static/src/components/fields/redirect_field.js
index 3d45914365c..0d09f8c56b7 100644
--- a/addons/website/static/src/components/fields/redirect_field.js
+++ b/addons/website/static/src/components/fields/redirect_field.js
@@ -7,7 +7,7 @@ const { Component } = owl;
class RedirectField extends Component {
get info() {
- return this.props.value ? this.env._t("Published") : this.env._t("Unpublished");
+ return this.props.record.data[this.props.name] ? this.env._t("Published") : this.env._t("Unpublished");
}
onClick() {
diff --git a/addons/website/static/src/components/fields/redirect_field.xml b/addons/website/static/src/components/fields/redirect_field.xml
index 5721d29a0f4..3214d36cff4 100644
--- a/addons/website/static/src/components/fields/redirect_field.xml
+++ b/addons/website/static/src/components/fields/redirect_field.xml
@@ -6,7 +6,7 @@
t-on-click="onClick"
t-att-aria-label="info"
t-att-title="info">
-
+
Go to
Website
diff --git a/addons/website/static/src/components/fields/widget_iframe.xml b/addons/website/static/src/components/fields/widget_iframe.xml
index 1eca10fb563..bd5d4a03cd6 100644
--- a/addons/website/static/src/components/fields/widget_iframe.xml
+++ b/addons/website/static/src/components/fields/widget_iframe.xml
@@ -3,13 +3,13 @@
-
+
+ t-att-src="props.record.data[props.name]"/>
-