Элемент ошибки '<xpath expr = "// form / footer / button [@ name =' create_payment ']" name = "">' не может быть расположен в родительском представлении - PullRequest
0 голосов
/ 15 мая 2018

Почему я получаю эту ошибку:

Element '<xpath expr="//form/footer/button[@name='create_payment']" 
name="">' cannot be located in parent view

Error context:
View `account.register.payments.wizard.from.invoices.inherited`
[view_id: 660, xml_id: 
account_bankgiro_payment_file.view_account_payment_from_invoices_inherit_account_bankgiro, model: account.register.payments, parent_id: 384]
None" while parsing /home/prachh/odoo-new/11/apps/account_bankgiro_payment_file/views/inherited_account_register_payments.xml:11, near

пока все кажется правильным? Вот мой код:

        <record id="view_bankgiro_transfer_download" model="ir.ui.view">
            <field name="name">account.payment.bankgiro.download</field>
            <field name="model">account.payment.bankgiro</field>
            <field name="arch" type="xml">
                <form string="Download BankGiro Transfer File" version="7.0">
                    <group>
                        <p class="oe_grey" colspan="4">
                           Click on the file to save it somewhere on your computer. Then upload that file on your bank's homebanking website.
                        </p>
                        <field name="file" filename="filename"/>
                        <field name="filename" invisible="True"/>
                    </group>
                    <group>
                    </group>
                    <footer>
                        <button string="Cancel" class="oe_link" special="cancel" invisible="1"/>
                    </footer>
                </form>
            </field>
        </record>

         <record id="inv_bankgiro_pay_tree" model="ir.ui.view">
            <field name="name">account.bankgiro.pay.tree</field>
            <field name="model">account.payment.bankgiro</field>
            <field name="arch" type="xml">
                <form string="Invoices to be paid via BankGiro">
                    <field name="vendor_invoice">
                        <tree editable="bottom" delete="true" create="false" decoration-danger="(recip_bankgiro_acct == False) or (memo == '') or (bool_red == True)">
                            <field name="id" invisible="1"/>
                            <field name="partner_id"/>
                            <field name="recip_bankgiro_acct"/>
                            <field name="number"/>
                            <field name="ocr_number"/>
                            <field name="memo"/>
                            <field name="date_due" invisible="1"/>
                            <field name="pay_date"/>
                            <field name="origin"/>
                            <field name="residual" string="Payment Amount" sum="Total"/>
                            <field name="state"/>
                            <field name="currency_id"/>
                            <field name="bool_red" invisible="1"/>
                        </tree>
                    </field>
                    <footer>
                        <button name="btn_generate_bankgiro" string="Generate BankGiro Payment File"
                            type="object" class="btn btn-primary"/>
                        <button string="Cancel" class="btn-default" special="cancel"/>
                    </footer>
                </form>
            </field>
        </record>

         <record id="inv_tree" model="ir.ui.view">
            <field name="name">account.invoice.pay.tree</field>
            <field name="model">account.invoice</field>
            <field name="arch" type="xml">
                <tree>
                    <field name="id" invisible="1"/>
                    <field name="partner_id"/>
                    <field name="recip_bankgiro_acct"/>
                    <field name="number"/>
                    <field name="ocr_number"/>
                    <field name="memo"/>
                    <field name="date_due" invisible="1"/>
                    <field name="pay_date"/>
                    <field name="origin"/>
                    <field name="pay_amt" string="Payment Amount" sum="Total"/>
                    <field name="state"/>
                    <field name="currency_id"/>
                    <field name="bool_red" invisible="1"/>
                </tree>
            </field>
        </record>

        <record id="view_account_bankgiro_payment_tree" model="ir.ui.view">
            <field name="name">account.payment.bankgiro.tree</field>
            <field name="model">account.payment.bankgiro</field>
            <field name="arch" type="xml">
                <tree create="false">
                    <field name="name"/>
                    <field name="currency_id" invisible="1"/>
                    <field name="date"/>
                    <field name="total_amount" options="{'currency_field': 'currency_id'}"/>
                </tree>
            </field>
        </record>

        <record id="view_account_bankgiro_payment_form" model="ir.ui.view">
            <field name="name">account.payment.bankgiro.form</field>
            <field name="model">account.payment.bankgiro</field>
            <field name="arch" type="xml">
                <form create="false" edit="false">
                    <sheet>
                        <div class="oe_button_box" name="button_box">
                            <button class="oe_stat_button" name="button_invoices"
                                    string="Invoices" type="object"
                                    icon="fa-bars"/>
                            <button class="oe_stat_button" name="button_payments"
                                    string="Payments" type="object"
                                    icon="fa-bars"/>
                        </div>
                        <div class="oe_title">
                            <h1><field name="name"/></h1>
                        </div>
                        <group>
                            <group>
                                <field name="filename" invisible="1"/>
                                <field name="file" filename="filename" readonly="True"/>

                            </group>
                            <group>
                                <field name="currency_id" invisible="1"/>
                                <field name="date" readonly="True"/>
                                <field name="total_amount" options="{'currency_field': 'currency_id'}" readonly="True"/>
                            </group>
                        </group>
                    </sheet>
                </form>
            </field>
        </record>








    <record id="account_payment_method_bankgiro_transfer" model="account.payment.method">
        <field name="name">BankGiro Transfer</field>
        <field name="code">bankgiro_tr</field>
        <field name="payment_type">outbound</field>
    </record>

    <record id="view_account_payment_from_invoices_inherit_account_bankgiro" model="ir.ui.view">
        <field name="name">account.register.payments.wizard.from.invoices.inherited</field>
        <field name="model">account.register.payments</field>
        <field name="inherit_id" ref="account.view_account_payment_from_invoices"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='payment_date']" position="attributes">
                <attribute name="attrs">{'invisible':[('payment_method_code','=','bankgiro_tr')]}</attribute>
            </xpath>
            <xpath expr="//field[@name='communication']" position="attributes">
                <attribute name="attrs">{'invisible':[('payment_method_code','=','bankgiro_tr')]}</attribute>
            </xpath>
            <xpath expr="//field[@name='amount']" position="attributes">
                <attribute name="attrs">{'invisible':[('payment_method_code','=','bankgiro_tr')]}</attribute>
            </xpath>
           <xpath expr="//form/footer/button[@name='create_payment']" position="attributes" name="" >
                <attribute name="attrs">{'invisible':[('payment_method_code','=','bankgiro_tr')]}</attribute>
            </xpath>
            <xpath expr="//form/footer/button[@special='cancel']" position="before">
                <button string='Validate' name="create_bankgiro_payment" type="object" class="btn-primary" attrs="{'invisible': [('payment_method_code','!=','bankgiro_tr')]}"/>
            </xpath>
        </field>
    </record>

1 Ответ

0 голосов
/ 16 мая 2018

xpath не имеет атрибута name, просто удалите его из вида.

У вас есть это:

<xpath expr="//form/footer/button[@name='create_payment']" position="attributes" name="" >
    <attribute name="attrs">{'invisible':[('payment_method_code','=','bankgiro_tr')]}</attribute>
</xpath>

Вам нужно написать это:

<xpath expr="//form/footer/button[@name='create_payment']" position="attributes">
    <attribute name="attrs">{'invisible':[('payment_method_code','=','bankgiro_tr')]}</attribute>
</xpath>

РЕДАКТИРОВАТЬ

Прокомментируйте те строки, которые модифицируют кнопку create_payment:

<!-- <xpath expr="//form/footer/button[@name='create_payment']" position="attributes">
    <attribute name="attrs">{'invisible':[('payment_method_code','=','bankgiro_tr')]}</attribute>
</xpath> -->

Затем перезапустите Odoo и обновите через интерфейс модуль account_bankgiro_payment_file .После этого скажите мне, если ошибка исчезла или у вас есть другая.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...