Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4239 Widoki

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>


Awatar
Odrzuć
Najlepsza odpowiedź

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>

Awatar
Odrzuć
Autor

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>