From f3f5e28fef6cd758329f576586d894fc172e8dda Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Thu, 6 Oct 2022 06:39:11 +0000 Subject: [PATCH] [FIX] account, web: restore single line layout for order line in edition When the section and note fields were converted, the section and note text field ignored the list-specialisation of the text field, resulting in a textarea with a minimum height of 50 in list view which causes the line to be too high. It was also not using the o_field_text class which among other things hides the resize handle on the text area which looks weird in list view. This commit fixes that. closes odoo/odoo#102465 X-original-commit: 5735f89245f8efa980069973b3dbe94beac59061 Signed-off-by: Aaron Bohy (aab) --- .../section_and_note_fields_backend.js | 12 +++++++++++- .../web/static/src/views/fields/text/text_field.js | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/addons/account/static/src/components/section_and_note_fields_backend/section_and_note_fields_backend.js b/addons/account/static/src/components/section_and_note_fields_backend/section_and_note_fields_backend.js index 4c615c7de31..ec37200c5a6 100644 --- a/addons/account/static/src/components/section_and_note_fields_backend/section_and_note_fields_backend.js +++ b/addons/account/static/src/components/section_and_note_fields_backend/section_and_note_fields_backend.js @@ -3,7 +3,7 @@ import { registry } from "@web/core/registry"; import { ListRenderer } from "@web/views/list/list_renderer"; import { X2ManyField } from "@web/views/fields/x2many/x2many_field"; -import { TextField } from "@web/views/fields/text/text_field"; +import { TextField, ListTextField } from "@web/views/fields/text/text_field"; import { CharField } from "@web/views/fields/char/char_field"; const { Component, useEffect } = owl; @@ -82,6 +82,16 @@ export class SectionAndNoteText extends Component { } } SectionAndNoteText.template = "account.SectionAndNoteText"; +SectionAndNoteText.additionalClasses = ["o_field_text"]; + +export class ListSectionAndNoteText extends SectionAndNoteText { + get componentToUse() { + return this.props.record.data.display_type !== "line_section" + ? ListTextField + : super.componentToUse; + } +} registry.category("fields").add("section_and_note_one2many", SectionAndNoteFieldOne2Many); registry.category("fields").add("section_and_note_text", SectionAndNoteText); +registry.category("fields").add("list.section_and_note_text", ListSectionAndNoteText); 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 a62a8faaf9a..b18e736f904 100644 --- a/addons/web/static/src/views/fields/text/text_field.js +++ b/addons/web/static/src/views/fields/text/text_field.js @@ -80,7 +80,7 @@ TextField.extractProps = ({ attrs, field }) => { registry.category("fields").add("text", TextField); -class ListTextField extends TextField { +export class ListTextField extends TextField { get minimumHeight() { return 0; }