diff --git a/addons/account/static/src/components/account_payment_field/account_payment_field.js b/addons/account/static/src/components/account_payment_field/account_payment_field.js index 2d123abafc4..0a8646effde 100644 --- a/addons/account/static/src/components/account_payment_field/account_payment_field.js +++ b/addons/account/static/src/components/account_payment_field/account_payment_field.js @@ -24,7 +24,7 @@ export class AccountPaymentField extends Component { } formatData(props) { - const info = props.value || { + const info = props.record.data[props.name] || { content: [], outstanding: false, title: "", diff --git a/addons/account/static/src/components/account_resequence/account_resequence_field.js b/addons/account/static/src/components/account_resequence/account_resequence_field.js index 4f33b087dba..4f81c146357 100644 --- a/addons/account/static/src/components/account_resequence/account_resequence_field.js +++ b/addons/account/static/src/components/account_resequence/account_resequence_field.js @@ -15,7 +15,7 @@ class ShowResequenceRenderer extends Component { } formatData(props) { - this.data = props.value ? JSON.parse(props.value) : { changeLines: [], ordering: "date" }; + this.data = props.record.data[props.name] ? JSON.parse(props.record.data[props.name]) : { changeLines: [], ordering: "date" }; } } ShowResequenceRenderer.template = "account.ResequenceRenderer"; diff --git a/addons/account/static/src/components/grouped_view_widget/grouped_view_widget.js b/addons/account/static/src/components/grouped_view_widget/grouped_view_widget.js index 6f06f801316..77021996ae2 100644 --- a/addons/account/static/src/components/grouped_view_widget/grouped_view_widget.js +++ b/addons/account/static/src/components/grouped_view_widget/grouped_view_widget.js @@ -20,8 +20,8 @@ class ShowGroupedList extends Component { } formatData(props) { - this.data = props.value - ? JSON.parse(props.value) + this.data = props.record.data[props.name] + ? JSON.parse(props.record.data[props.name]) : { groups_vals: [], options: { discarded_number: "", columns: [] } }; } } diff --git a/addons/account/static/src/components/journal_dashboard_activity/journal_dashboard_activity.js b/addons/account/static/src/components/journal_dashboard_activity/journal_dashboard_activity.js index ace961bc683..3f7d9f0bb56 100644 --- a/addons/account/static/src/components/journal_dashboard_activity/journal_dashboard_activity.js +++ b/addons/account/static/src/components/journal_dashboard_activity/journal_dashboard_activity.js @@ -13,7 +13,7 @@ export class JournalDashboardActivity extends Component { } formatData(props) { - this.info = JSON.parse(this.props.value); + this.info = JSON.parse(this.props.record.data[this.props.name]); this.info.more_activities = false; if (this.info.activities.length > this.MAX_ACTIVITY_DISPLAY) { this.info.more_activities = true; diff --git a/addons/account/static/src/components/open_move_line_move_widget/open_move_line_move_widget.js b/addons/account/static/src/components/open_move_line_move_widget/open_move_line_move_widget.js index ba7ad0119de..7baa63d999d 100644 --- a/addons/account/static/src/components/open_move_line_move_widget/open_move_line_move_widget.js +++ b/addons/account/static/src/components/open_move_line_move_widget/open_move_line_move_widget.js @@ -5,7 +5,7 @@ import { Many2OneField, many2OneField } from "@web/views/fields/many2one/many2on class LineOpenMoveWidget extends Many2OneField { async openAction() { - const action = await this.orm.call("account.move.line", "action_open_business_doc", [this.props.value[0]], {}); + const action = await this.orm.call("account.move.line", "action_open_business_doc", [this.props.record.data[this.props.name][0]], {}); await this.action.doAction(action); } } diff --git a/addons/account/static/src/components/open_move_widget/open_move_widget.xml b/addons/account/static/src/components/open_move_widget/open_move_widget.xml index a28a240f874..2c8ecace54c 100644 --- a/addons/account/static/src/components/open_move_widget/open_move_widget.xml +++ b/addons/account/static/src/components/open_move_widget/open_move_widget.xml @@ -2,7 +2,7 @@ - + diff --git a/addons/account/static/src/components/tax_totals/tax_totals.js b/addons/account/static/src/components/tax_totals/tax_totals.js index cf1053ed746..12428d1c864 100644 --- a/addons/account/static/src/components/tax_totals/tax_totals.js +++ b/addons/account/static/src/components/tax_totals/tax_totals.js @@ -107,11 +107,11 @@ TaxGroupComponent.template = "account.TaxGroupComponent"; export class TaxTotalsComponent extends Component { setup() { super.setup(); - this.totals = this.props.value; + this.totals = this.props.record.data[this.props.name]; this.readonly = this.props.readonly; onWillUpdateProps((nextProps) => { // We only reformat tax groups if there are changed - this.totals = nextProps.value; + this.totals = nextProps.record.data[nextProps.name]; this.readonly = nextProps.readonly; this._computeTotalsFormat(); }); diff --git a/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.js b/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.js index 05b5109af28..165991881aa 100644 --- a/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.js +++ b/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.js @@ -47,6 +47,8 @@ export class AnalyticDistribution extends Component { this.focusSelector = false; this.activeGroup = false; + this.currentValue = this.props.record.data[this.props.name]; + onWillStart(this.willStart); onWillUpdateProps(this.willUpdate); onPatched(this.patched); @@ -87,7 +89,9 @@ export class AnalyticDistribution extends Component { // and thus different applicabilities apply // or a model applies that contains unavailable plans // This should only execute when these fields have changed, therefore we use the `_field` props. - const valueChanged = JSON.stringify(this.props.value) !== JSON.stringify(nextProps.value); + const valueChanged = + JSON.stringify(this.currentValue) !== + JSON.stringify(nextProps.record.data[nextProps.name]); const currentAccount = this.props.account_field && this.props.record.data[this.props.account_field] || false; const currentProduct = this.props.product_field && this.props.record.data[this.props.product_field] || false; const accountChanged = !shallowEqual(this.lastAccount, currentAccount); @@ -100,6 +104,7 @@ export class AnalyticDistribution extends Component { this.lastProduct = productChanged && currentProduct || this.lastProduct; await this.formatData(nextProps); } + this.currentValue = nextProps.record.data[nextProps.name]; } patched() { @@ -107,7 +112,7 @@ export class AnalyticDistribution extends Component { } async formatData(nextProps) { - const data = nextProps.value; + const data = nextProps.record.data[nextProps.name]; const analytic_account_ids = Object.keys(data).map((id) => parseInt(id)); const records = analytic_account_ids.length ? await this.fetchAnalyticAccounts([["id", "in", analytic_account_ids]]) : []; if (records.length < data.length) { @@ -150,7 +155,7 @@ export class AnalyticDistribution extends Component { if (this.props.force_applicability) { args['applicability'] = this.props.force_applicability; } - const existing_account_ids = Object.keys(nextProps.value).map((i) => parseInt(i)); + const existing_account_ids = Object.keys(nextProps.record.data[nextProps.name]).map((i) => parseInt(i)); if (existing_account_ids.length) { args['existing_account_ids'] = existing_account_ids; } diff --git a/addons/auth_password_policy/static/src/password_field.js b/addons/auth_password_policy/static/src/password_field.js index 8e10f8ea8b2..abd56a6e9f4 100644 --- a/addons/auth_password_policy/static/src/password_field.js +++ b/addons/auth_password_policy/static/src/password_field.js @@ -9,7 +9,7 @@ import { useInputField } from "@web/views/fields/input_field_hook"; import { recommendations, ConcretePolicy } from "./password_policy"; import { Meter } from "./password_meter"; -const { Component, xml, onWillStart, useState } = owl; +const { Component, onWillStart, useState } = owl; export class PasswordField extends Component { setup() { @@ -19,7 +19,7 @@ export class PasswordField extends Component { }); useInputField({ - getValue: () => this.props.value || "", + getValue: () => this.props.record.data[this.props.name] || "", }); const orm = useService("orm"); @@ -32,17 +32,7 @@ export class PasswordField extends Component { } PasswordField.props = standardFieldProps; PasswordField.components = { Meter }; -PasswordField.template = xml` - - - - - -`; +PasswordField.template = "auth_password_policy.PasswordField"; export const passwordField = { component: PasswordField, diff --git a/addons/auth_password_policy/static/src/password_field.xml b/addons/auth_password_policy/static/src/password_field.xml new file mode 100644 index 00000000000..0b76ac44e6f --- /dev/null +++ b/addons/auth_password_policy/static/src/password_field.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/addons/event/static/src/icon_selection_field/icon_selection_field.js b/addons/event/static/src/icon_selection_field/icon_selection_field.js index 2389f7b23fe..88ec4227f50 100644 --- a/addons/event/static/src/icon_selection_field/icon_selection_field.js +++ b/addons/event/static/src/icon_selection_field/icon_selection_field.js @@ -8,10 +8,13 @@ const { Component } = owl; export class IconSelectionField extends Component { get icon() { - return this.props.icons[this.props.value]; + return this.props.icons[this.props.record.data[this.props.name]]; } get title() { - return this.props.value.charAt(0).toUpperCase() + this.props.value.slice(1); + return ( + this.props.record.data[this.props.name].charAt(0).toUpperCase() + + this.props.record.data[this.props.name].slice(1) + ); } } IconSelectionField.template = "event.IconSelectionField"; diff --git a/addons/loyalty/static/src/js/filterable_selection_field/filterable_selection_field.js b/addons/loyalty/static/src/js/filterable_selection_field/filterable_selection_field.js index 70b9c5a8197..e27de0e3f0d 100644 --- a/addons/loyalty/static/src/js/filterable_selection_field/filterable_selection_field.js +++ b/addons/loyalty/static/src/js/filterable_selection_field/filterable_selection_field.js @@ -16,11 +16,11 @@ export class FilterableSelectionField extends SelectionField { let options = super.options; if (this.props.whitelisted_values) { options = options.filter((option) => { - return option[0] === this.props.value || this.props.whitelisted_values.includes(option[0]) + return option[0] === this.props.record.data[this.props.name] || this.props.whitelisted_values.includes(option[0]) }); } else if (this.props.blacklisted_values) { options = options.filter((option) => { - return option[0] === this.props.value || !this.props.blacklisted_values.includes(option[0]); + return option[0] === this.props.record.data[this.props.name] || !this.props.blacklisted_values.includes(option[0]); }); } return options; diff --git a/addons/mail/static/src/backend_components/activity_exception/activity_exception.js b/addons/mail/static/src/backend_components/activity_exception/activity_exception.js index 3f0a910b77e..2d994539783 100644 --- a/addons/mail/static/src/backend_components/activity_exception/activity_exception.js +++ b/addons/mail/static/src/backend_components/activity_exception/activity_exception.js @@ -7,9 +7,12 @@ import { Component } from "@odoo/owl"; class ActivityException extends Component { get textClass() { - if (this.props.value) { + if (this.props.record.data[this.props.name]) { return ( - "text-" + this.props.value + " fa " + this.props.record.data.activity_exception_icon + "text-" + + this.props.record.data[this.props.name] + + " fa " + + this.props.record.data.activity_exception_icon ); } return undefined; diff --git a/addons/mail/static/src/backend_components/activity_exception/activity_exception.xml b/addons/mail/static/src/backend_components/activity_exception/activity_exception.xml index 43ea100b7ee..50e58a35d27 100644 --- a/addons/mail/static/src/backend_components/activity_exception/activity_exception.xml +++ b/addons/mail/static/src/backend_components/activity_exception/activity_exception.xml @@ -2,7 +2,7 @@
{ + 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 + 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/boolean_field.xml b/addons/web/static/src/views/fields/boolean/boolean_field.xml index d8d77374e63..0c6ea588536 100644 --- a/addons/web/static/src/views/fields/boolean/boolean_field.xml +++ b/addons/web/static/src/views/fields/boolean/boolean_field.xml @@ -2,7 +2,7 @@ - + diff --git a/addons/web/static/src/views/fields/boolean_favorite/boolean_favorite_field.js b/addons/web/static/src/views/fields/boolean_favorite/boolean_favorite_field.js index e5f0af08a75..858bae22872 100644 --- a/addons/web/static/src/views/fields/boolean_favorite/boolean_favorite_field.js +++ b/addons/web/static/src/views/fields/boolean_favorite/boolean_favorite_field.js @@ -18,7 +18,7 @@ export class BooleanFavoriteField 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_favorite/boolean_favorite_field.xml b/addons/web/static/src/views/fields/boolean_favorite/boolean_favorite_field.xml index 16b399a041c..d6d37fedb9c 100644 --- a/addons/web/static/src/views/fields/boolean_favorite/boolean_favorite_field.xml +++ b/addons/web/static/src/views/fields/boolean_favorite/boolean_favorite_field.xml @@ -7,11 +7,11 @@ - +
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 @@ -