Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Umělá inteligence
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Remove Empty Space Between Widget

Odebírat

Get notified when there's activity on this post

This question has been flagged
width
1 Odpovědět
158 Zobrazení
Avatar
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
Avatar
Zrušit
Avatar
Muhammad Farooq Iqbal
Nejlepší odpověď

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
Avatar
Zrušit
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Increase the width of the product description
column width
Avatar
Avatar
2
kvě 24
3078
Fields [width & height]
width Height
Avatar
0
čvn 22
3606
How to register width and length of each item in a sale order? Vyřešeno
sale.order.line width
Avatar
Avatar
1
bře 18
5047
Width of selection field Vyřešeno
selection width
Avatar
Avatar
Avatar
3
srp 17
7533
Kanban cards on 2 columns
kanban width
Avatar
0
kvě 17
5888
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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