Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Kunstig intelligens
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-forretningsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp
Du skal være registreret for at interagere med fællesskabet.
Alle bidrag Personer Emblemer
Tags (Vis alle)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
Alle bidrag Personer Emblemer
Tags (Vis alle)
odoo accounting v14 pos v15
Om dette forum
Hjælp

Remove Empty Space Between Widget

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
width
1 Svar
195 Visninger
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
Kassér
Avatar
Muhammad Farooq Iqbal
Bedste svar

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
Kassér
Kan du lide at diskutere? Læs ikke bare med, deltag aktivt i debatten!

Opret en konto i dag for at få glæde af eksklusive funktioner, og bliv en del af vores skønne fællesskab!

Tilmeld dig
Relaterede indlæg Besvarelser Visninger Aktivitet
Increase the width of the product description
column width
Avatar
Avatar
2
maj 24
3083
Fields [width & height]
width Height
Avatar
0
jun. 22
3631
How to register width and length of each item in a sale order? Løst
sale.order.line width
Avatar
Avatar
1
mar. 18
5056
Width of selection field Løst
selection width
Avatar
Avatar
Avatar
3
aug. 17
7541
Kanban cards on 2 columns
kanban width
Avatar
0
maj 17
5891
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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