İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
4629 Görünümler

Good night,

I am trying to replace the view: (o_kanban_mobil) but the change is not applied, it is installed without error but it is not visualized that it may be missing?

release: odoo12, column you want to add: (new_field)

thanks,

   <record model="ir.ui.view" id="e.view_account_invoice_events">

            <field name="name">Cambios en al vista de formulario de Invoice</field>

            <field name="model">account.invoice</field>

            <field name="inherit_id" ref="account.invoice_form"/>

            <field name="arch" type="xml">

                       

                <xpath expr="//kanban[@class='o_kanban_mobile']" position="replace">       

                                    <field name="name"/>

                                    <field name="product_id"/>

                                    <field name="price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>

                                    <field name="price_total" groups="account.group_show_line_subtotals_tax_included"/>

                                    <field name="quantity"/>

                                    <field name="uom_id" groups="uom.group_uom"/>

                                    <field name="price_unit"/>

                                    <field name="new_field" />

                                    <field name="display_type"/>

                                    <templates>

                                        <t t-name="kanban-box">

                                            <div t-attf-class="oe_kanban_card oe_kanban_global_click {{ record.display_type.raw_value ? 'o_is_' + record.display_type.raw_value : '' }}">

                                                <t t-if="!record.display_type.raw_value">

                                                    <div class="row">

                                                        <div class="col-8">

                                                            <strong>

                                                                <span>

                                                                    <t t-esc="record.product_id.value"/>

                                                                </span>

                                                            </strong>

                                                        </div>

                                                        <div class="col-4">

                                                            <strong>

                                                                <span class="float-right text-right">

                                                                    <t t-esc="record.price_subtotal.value" groups="account.group_show_line_subtotals_tax_excluded"/>

                                                                    <t t-esc="record.price_total.value" groups="account.group_show_line_subtotals_tax_included"/>

                                                                </span>

                                                            </strong>

                                                        </div>

                                                    </div>

                                                    <div class="row">

                                                        <div class="col-12 text-muted">

                                                            <span>

                                                                Quantity:

                                                                <t t-esc="record.quantity.value"/>

                                                                <t t-esc="record.uom_id.value"/>

                                                            </span>

                                                        </div>

                                                    </div>

                                                    <div class="row">

                                                        <div class="col-12 text-muted">

                                                            <span>

                                                                Unit Price:

                                                                <t t-esc="record.price_unit.value"/>

                                                            </span>

                                                        </div>

                                                    </div>

                                                 <div class="row">

                                                        <div class="col-12 text-muted">

                                                            <span>

                                                                Descuento:

                                                                <t t-esc="record.new_field.value"/>

                                                            </span>

                                                        </div>

                                                    </div>


                                                </t>

                                                <t t-if="record.display_type.raw_value === 'line_section' || record.display_type.raw_value === 'line_note'">

                                                    <div class="row">

                                                        <div class="col-12">

                                                            <span>

                                                                <t t-esc="record.name.value"/>

                                                            </span>

                                                        </div>

                                                    </div>

                                                </t>

                                            </div>

                                        </t>

                                    </templates>


                </xpath>  

 </record>


Avatar
Vazgeç
En İyi Yanıt

If you replace the existing element then you need to start from that element in your view only. For example in your case you replace kanban tag from base then in your custom code you need to start from that tag only. So your code will be something like this : 

<xpath expr="//kanban[@class='o_kanban_mobile']" position="replace">
    <kanban class="o_kanban_mobile">
        // your code
    </kanban>

Avatar
Vazgeç
Üretici

Hello, I made the change as indicated and it is not reflected, is there another coast that should be done ?, the model to inherit is ?: <field name = "model"> account.invoice </field>

<field name = "inherit_id" ref = "account.invoice_form" />

****************

field add: descuento_unitario

<xpath expr="//kanban[@class='o_kanban_mobile']" position="replace">

<kanban class="o_kanban_mobile">

<field name="name"/>

<field name="product_id"/>

<field name="price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>

<field name="price_total" groups="account.group_show_line_subtotals_tax_included"/>

<field name="quantity"/>

<field name="uom_id" groups="uom.group_uom"/>

<field name="price_unit"/>

<field name="descuento_unitario" />

<field name="display_type"/>

<templates>

<t t-name="kanban-box">

<div t-attf-class="oe_kanban_card oe_kanban_global_click {{ record.display_type.raw_value ? 'o_is_' + record.display_type.raw_value : '' }}">

<t t-if="!record.display_type.raw_value">

<div class="row">

<div class="col-8">

<strong>

<span>

<t t-esc="record.product_id.value"/>

</span>

</strong>

</div>

<div class="col-4">

<strong>

<span class="float-right text-right">

<t t-esc="record.price_subtotal.value" groups="account.group_show_line_subtotals_tax_excluded"/>

<t t-esc="record.price_total.value" groups="account.group_show_line_subtotals_tax_included"/>

</span>

</strong>

</div>

</div>

<div class="row">

<div class="col-12 text-muted">

<span>

Quantity:

<t t-esc="record.quantity.value"/>

<t t-esc="record.uom_id.value"/>

</span>

</div>

</div>

<div class="row">

<div class="col-12 text-muted">

<span>

Unit Price:

<t t-esc="record.price_unit.value"/>

</span>

</div>

</div>

<div class="row">

<div class="col-12 text-muted">

<span>

Descuento:

<t t-esc="record.descuento_unitario.value"/>

</span>

</div>

</div>

</t>

<t t-if="record.display_type.raw_value === 'line_section' || record.display_type.raw_value === 'line_note'">

<div class="row">

<div class="col-12">

<span>

<t t-esc="record.name.value"/>

</span>

</div>

</div>

</t>

</div>

</t>

</templates>

</kanban>

</xpath>

En İyi Yanıt

You're on the right track tryin' to modify the Kanban view for account_invoice_line. The issue you're facing might be due to mismatches in yur XML definition. FIrst, double-check taht the XML structure is targetting the right view. Make sure these are correct:


1. Verify your inheriting the right view by cheking the inherit_id. It must correspond exactly to the view yor trying to customize, which is account.invoice_form here.


2. Ensure the XPath expression is finding the nodes you want to adjust. If the Kanban class or elements changed, XPath won't match anything, making your changes invisible.


3. Confirm new_field is defined in teh model. It should be in account.invoice.line and set up correctly in the db schema.


4. After changes, fully reload yur app: update the module in Odoo adn pressbly clear the server cache. Odoo sometimes needs a bit of a nudge to reflect view changes.


5. Check for any server logs during the update process if the above isn't solving the problem.


This can be tricky with Odoo (yeah, I've had to tweak this once myself), but these steps should help fix it. If it still doesn't appear right, check if o_kanban_mobile is part of the view hierarchy you think by inspecting the UI's source code.

Avatar
Vazgeç