Перейти к содержимому
Odoo Меню
  • Войти
  • Попробовать бесплатно
  • Модули
    Финансы
    • Бухгалтерия
    • Выставление счетов
    • Расходы
    • Таблицы
    • Документооборот
    • Подпись
    Продажи
    • CRM
    • Продажи
    • POS Магазин
    • POS Ресторан
    • Подписки
    • Аренда
    Вебсайты
    • Конструктор вебсайтов
    • eCommerce
    • Блог
    • Форум
    • Онлайн-чат
    • Электронное обучение
    Логистика
    • Склад
    • Производство
    • PLM
    • Закупки
    • Обслуживание
    • Качество
    Отдел кадров
    • Сотрудники
    • Подбор персонала
    • Отпуска
    • Оценка персонала
    • Реферальная программа
    • Автопарк
    Маркетинг
    • SMM
    • E-mail рассылки
    • СМС рассылки
    • Мероприятия
    • Автоматизация маркетинга
    • Опросы
    Услуги
    • Проекты
    • Табели
    • Выездной сервис
    • Поддержка
    • Планирование
    • Встречи
    Продуктивность
    • Обсуждения
    • Искусственный интеллект
    • IoT
    • VoIP-телефония
    • Knowledge
    • WhatsApp
    Сторонние приложения Модуль Студия Odoo Платформа Odoo Cloud
  • Индустрии
    Розничная торговля
    • Книжный магазин
    • Магазин одежды
    • Мебельный магазин
    • Продуктовый магазин
    • Строительный магазин
    • Магазин игрушек
    Гостинично-ресторанный бизнес
    • Бар и паб
    • Ресторан
    • Фастфуд
    • Гостевой дом
    • Дистрибьютор напитков
    • Отель
    Недвижимость
    • Агентство недвижимости
    • Архитектурное бюро
    • Строительство
    • Управление недвижимостью
    • Ландшафтный дизайн
    • Товарищество собственников жилья
    Консалтинг
    • Бухгалтерская фирма
    • Партнер Odoo
    • Маркетинговое агентство
    • Юридическая фирма
    • Подбор персонала
    • Аудиторское бюро
    Производство
    • Текстиль
    • Металл
    • Мебель
    • Продукты питания
    • Пивоварня
    • Корпоративные сувениры
    Здоровье и фитнес
    • Спортивный комплекс
    • Магазин оптики
    • Фитнес-клуб
    • Велнес-центр
    • Аптека
    • Салон красоты
    Услуги
    • Специалист по бытовым услугам
    • Продажа и обслуживание IT-оборудования
    • Солнечные энергосистемы
    • Производство обуви
    • Клининг
    • Системы ОВКВ
    Прочее
    • Некоммерческая организация
    • Консалтинг в сфере устойчивого развития
    • Аренда рекламных щитов
    • Бизнес по фотосъемке
    • Прокат велосипедов
    • Реселлер программного обеспечения
    Все индустрииInauguration Odoo Lyon
  • Community
    Обучение
    • Видео уроки
    • Документация
    • Сертификация
    • Тренинг
    • Блог
    • Подкаст
    Образование и развитие
    • Образовательная программа
    • Деловая игра Scale Up!
    • Экскурсия в офис Odoo
    ПО
    • Скачать
    • Сравнить версии
    • Релизы
    Сотрудничество
    • Github
    • Форум
    • Мероприятия
    • Перевод
    • Стать партнером
    • Услуги для партнеров
    • Зарегистрировать бухгалтерскую фирму
    Услуги
    • Найти партнера
    • Найти бухгалтера
    • Встреча с экспертом
    • Услуги по внедрению
    • Отзывы клиентов
    • Поддержка
    • Обновления
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Заказать демонстрацию
  • Цены
  • Поддержка
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Помощь

Remove Empty Space Between Widget

Подписаться

Получайте уведомления о появлении активности в этом посте

Этот вопрос был отмечен
width
1 Ответить
156 Представления
Аватар
Ashilkrishna

Hi,

I added a custom widget field in the invoice_line_ids  view. The widget displays correctly, but it creates a  empty space between the widget , making the layout look uneven.

Screenshot attached.

How can I remove this extra space

<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<record id="inherit_invoice_line" model="ir.ui.view">
<field name="name">inherit.invoice.line</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_line_ids']/list/field[@name='quantity']" position="after">
<field name="current_on_hand_average_cost" optional="hide" groups="zl_account_base.groups_cost_group_manager"/>
<field name="cost" optional="hide" sum="Cost" groups="zl_account_base.groups_cost_group_manager"/>
<field name="product_type" column_invisible="1"/>
<!-- This button opens a wizard to update the cost of the invoice line -->
<button name="%(zl_product_report.action_update_cost_wizard)d"
type="action"
icon="fa-pencil"
aria-label="Update Cost"
title="Update Cost"
groups="zl_account_base.group_management"
invisible="not product_id"/>
<field name="is_cost_updated" column_invisible="1"/>
<field name="total_cost" optional="hide" sum="Total Cost" groups="zl_account_base.groups_cost_group_manager"/>
<field name="margin" optional="hide" sum="Margin" groups="zl_account_base.groups_cost_group_manager"/>
</xpath>

<!-- ONE XPATH - both icons together, right after product_id -->
<xpath expr="//field[@name='invoice_line_ids']/list/field[@name='product_id']" position="after">
<button data-hotkey="w"
name="action_open_product_transactions_wizard" type="object"
class="fa fa-info-circle btn-primary"
/>
<field name="company_stock_info" widget="company_stock_widget" nolabel="1" width="10px"/>
</xpath>
<xpath expr="//field[@name='invoice_line_ids']/list/field[@name='account_id']" position="attributes">
<attribute name="optional">hide</attribute>
</xpath>
<!-- <xpath expr="//field[@name='invoice_line_ids']/list/field[@name='tax_ids']" position="after">-->
<!-- <field name="line_tax_amount" optional="show" sum="Total Tax Amount"/>-->
<!-- </xpath>-->

</field>
</record>

<record id="view_move_form_margin_recompute" model="ir.ui.view">
<field name="name">account.move.form.margin.recompute</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//header" position="inside">
<!-- Button for Customer Invoices -->
<button name="button_recompute_margins" type="object" string="Recompute Margins"
class="oe_highlight"
groups="zl_account_base.group_management" invisible="move_type not in ['out_invoice','out_refund']"/>

<!-- Button for Vendor Bills -->
<button name="recompute_margins_on_related_invoices" type="object" string="Update Sales Margins"
class="oe_highlight"
groups="zl_account_base.groups_cost_group_manager" invisible="move_type != 'in_invoice' or state != 'posted'"/>
help="Manually triggers the recalculation of margins on all sales invoices affected by this bill."/>
</xpath>
</field>
</record>

<!-- 2. Custom List View -->
<record id="view_invoice_line_analysis_tree" model="ir.ui.view">
<field name="name">account.move.line.analysis.tree</field>
<field name="model">account.move.line</field>
<field name="arch" type="xml">
<list string="Invoice Lines" create="false" edit="false" delete="false">
<field name="invoice_date" optional="show"/>
<field name="move_id"/>
<field name="partner_id" optional="show"/>
<field name="product_id"/>
<field name="quantity"/>
<field name="price_unit"/>
<field name="cost" optional="show"/>
<field name="margin" optional="show"/>
<field name="price_subtotal" sum="Total"/>
<field name="line_tax_amount" sum="Total Tax" optional="hide"/>
<button name="button_update_line_cost" type="object" icon="fa-refresh" help="Update Cost &amp; Margin for this line"/>
</list>
</field>
</record>


<!-- 1. Main Action Window -->
<record id="action_invoice_line_analysis" model="ir.actions.act_window">
<field name="name">Invoice Lines</field>
<field name="res_model">account.move.line</field>
<field name="view_mode">list,form</field>
<field name="view_id" ref="view_invoice_line_analysis_tree"/>
<field name="domain">[('display_type', '=', 'product'), ('move_id.state', '=', 'posted')]</field>
<field name="context">{
'search_default_sales_invoices': 1,
'create': False,
'edit': False,
'delete':False
}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No invoice lines found. Let's create one!
</p>
</field>
</record>

<!-- 3. Custom Search View with Filters -->
<record id="view_invoice_line_analysis_search" model="ir.ui.view">
<field name="name">account.move.line.analysis.search</field>
<field name="model">account.move.line</field>
<field name="arch" type="xml">
<search string="Search Invoice Lines">
<field name="product_id"/>
<field name="partner_id"/>
<field name="move_id"/>
<separator/>
<filter string="Sales Invoices" name="sales_invoices" domain="[('move_id.move_type', '=', 'out_invoice')]"/>
<filter string="Purchase Bills" name="purchase_bills" domain="[('move_id.move_type', '=', 'in_invoice')]"/>
<filter string="Credit Notes" name="credit_notes" domain="[('move_id.move_type', '=', 'out_refund')]"/>
<filter string="Refunds" name="refunds" domain="[('move_id.move_type', '=', 'in_refund')]"/>
<group expand="0" string="Group By">
<filter string="Invoice/Bill" name="groupby_move" context="{'group_by': 'move_id'}"/>
<filter string="Product" name="groupby_product" context="{'group_by': 'product_id'}"/>
<filter string="Partner" name="groupby_partner" context="{'group_by': 'partner_id'}"/>
</group>
</search>
</field>
</record>

<!-- 4. Server Action for Mass Update -->
<record id="action_server_update_line_cost" model="ir.actions.server">
<field name="name">Update Cost &amp; Margin</field>
<field name="model_id" ref="account.model_account_move_line"/>
<field name="binding_model_id" ref="account.model_account_move_line"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">
if records:
records.button_update_line_cost()
</field>
</record>

<record id="account_move_list_view_inherited" model="ir.ui.view">
<field name="name">account.move.list.view</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_out_invoice_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='amount_total_in_currency_signed']" position="after">
<field name="total_margin" sum="Total Margin"/>
</xpath>
</field>
</record>

<!-- 5. Menu Item -->
<menuitem
id="menu_invoice_line_analysis"
name="Invoice Lines"
parent="account.menu_finance_reports"
groups="zl_account_base.groups_cost_group_manager"
action="action_invoice_line_analysis"
sequence="100"/>
</data>
</odoo>

Any guidance would be appreciated.

Thanks.

0
Аватар
Отменить
Аватар
Muhammad Farooq Iqbal
Лучший ответ

Below is a clean updated version. The main change is: remove width="10px" from the XML and control the widget column using a CSS/SCSS class.

1. Updated XML

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <data>

        <record id="inherit_invoice_line" model="ir.ui.view">
            <field name="name">inherit.invoice.line</field>
            <field name="model">account.move</field>
            <field name="inherit_id" ref="account.view_move_form"/>
            <field name="arch" type="xml">

                <!-- Add icon button + custom widget after product -->
                <xpath expr="//field[@name='invoice_line_ids']/list/field[@name='product_id']" position="after">

                    <button data-hotkey="w"
                            name="action_open_product_transactions_wizard"
                            type="object"
                            icon="fa-info-circle"
                            title="Product Info"
                            class="btn-link o_invoice_line_icon_btn"/>

                    <field name="company_stock_info"
                           widget="company_stock_widget"
                           nolabel="1"
                           class="o_company_stock_widget_col"/>

                </xpath>

                <!-- Add cost/margin fields after quantity -->
                <xpath expr="//field[@name='invoice_line_ids']/list/field[@name='quantity']" position="after">

                    <field name="current_on_hand_average_cost"
                           optional="hide"
                           groups="zl_account_base.groups_cost_group_manager"/>

                    <field name="cost"
                           optional="hide"
                           sum="Cost"
                           groups="zl_account_base.groups_cost_group_manager"/>

                    <field name="product_type"
                           column_invisible="1"/>

                    <button name="%(zl_product_report.action_update_cost_wizard)d"
                            type="action"
                            icon="fa-pencil"
                            aria-label="Update Cost"
                            title="Update Cost"
                            class="btn-link o_invoice_line_icon_btn"
                            groups="zl_account_base.group_management"
                            invisible="not product_id"/>

                    <field name="is_cost_updated"
                           column_invisible="1"/>

                    <field name="total_cost"
                           optional="hide"
                           sum="Total Cost"
                           groups="zl_account_base.groups_cost_group_manager"/>

                    <field name="margin"
                           optional="hide"
                           sum="Margin"
                           groups="zl_account_base.groups_cost_group_manager"/>

                </xpath>

                <!-- Hide account field by default -->
                <xpath expr="//field[@name='invoice_line_ids']/list/field[@name='account_id']" position="attributes">
                    <attribute name="optional">hide</attribute>
                </xpath>

            </field>
        </record>

    </data>
</odoo>

2. Add SCSS/CSS file

Create this file:

your_module/static/src/scss/invoice_line_widget.scss

Add this:

/* Reduce spacing for custom invoice line icons/widgets */

.o_field_x2many_list_row_add,
.o_list_view {
    .o_invoice_line_icon_btn {
        padding-left: 2px !important;
        padding-right: 2px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        min-width: 24px !important;
        width: 24px !important;
        text-align: center;
    }

    .o_company_stock_widget_col {
        width: 28px !important;
        min-width: 28px !important;
        max-width: 28px !important;
        padding-left: 2px !important;
        padding-right: 2px !important;
        text-align: center;
        white-space: nowrap;
    }

    .o_company_stock_widget_col > * {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}
0
Аватар
Отменить
Не оставайтесь в стороне – присоединяйтесь к обсуждению!

Создайте аккаунт сегодня, чтобы получить доступ к эксклюзивным функциям и стать частью нашего замечательного сообщества!

Регистрация
Похожие посты Ответы Просмотры Активность
Increase the width of the product description
column width
Аватар
Аватар
2
мая 24
3077
Fields [width & height]
width Height
Аватар
0
июн. 22
3599
How to register width and length of each item in a sale order? Решено
sale.order.line width
Аватар
Аватар
1
мар. 18
5047
Width of selection field Решено
selection width
Аватар
Аватар
Аватар
3
авг. 17
7532
Kanban cards on 2 columns
kanban width
Аватар
0
мая 17
5888
Сообщество
  • Видео уроки
  • Документация
  • Форум
Открытый исходный код
  • Скачать
  • Github
  • Runbot
  • Перевод
Услуги
  • Хостинг Odoo.sh
  • Поддержка
  • Обновление
  • Индивидуальные решения по доработке
  • Образование
  • Найти бухгалтера
  • Найти партнера
  • Стать партнером
О нас
  • Наша компания
  • Активы бренда
  • Cвяжитесь с нами
  • Вакансии
  • Мероприятия
  • Подкаст
  • Блог
  • Клиенты
  • Правовые документы • Конфиденциальность
  • Безопасность
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk Slovenščina Español (América Latina) Español Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo – это набор бизнес-модулей с открытым исходным кодом, который закроет все потребности вашей компании: CRM, E-commerce, Бухгалтерия, Склад, POS, управление проектами и др.

Odoo сочетает в себе простоту использования и полную интеграцию всех бизнес-процессов в одной системе.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now