Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
19241 Vizualizări

Hey

I have a problem that I cant resolve

I want to remove the button "Imprimir" (Print) on the sale orders I just did all like

<xpath expr="//button[@name='invoice_print']" position="replace">
                 <!--add sometihng-->

</xpath>

or

<button name="invoice_print" string="Print" type="object" attrs="{'invisible':['|',('sent','=',True), ('state', '!=', 'open')]}" class="oe_highlight" groups="base.group_user" position="replace">
                  <!--add something-->

</button>

or 

 <xpath expr="//button[@name='invoice_print']" position="attributes">
                <attribute name="invisible">1</attribute>
              </xpath>

And none of those remove the button....

What I did wrong?

 

Best Regards

 

my code is this 

<record model="ir.ui.view" id="account_invoice_rule_saft_inherit">
            <field name="name">account.invoice.rule.saft.inherit</field>
            <field name="model">account.invoice</field>
            <field name="inherit_id" ref="account.invoice_form"/>
            <field name="arch" type="xml">
        <header>
              <!--<button name="invoice_print" string="Print" type="object" attrs="{'invisible':['|',('sent','=',True), ('state', '!=', 'open')]}" class="oe_highlight" groups="base.group_user" position="replace">
                  
              </button>-->
              <!--<xpath expr="//button[@name='invoice_print']" position="attributes">
                <attribute name="invisible">1</attribute>
              </xpath>-->
              <xpath expr="//button[@name='invoice_print'][0]" position="attributes">
                <attribute name="invisible">True</attribute>
              </xpath>
              <xpath expr="//button[@name='invoice_print'][1]" position="attributes">
                <attribute name="invisible">True</attribute>
              </xpath>

                 <button name="print_original" type="object" string="Original" attrs="{'invisible':['|','|',('impressoori', '=', True),('impressoall', '=', True),('state','=','draft')]}"/>

                <button name="print_duplicado" type="object" string="Duplicado" attrs="{'invisible':['|','|',('impressodupl', '=', True),('impressoall', '=', True),('state','=','draft')]}"/>  

                <button name="print_triplicado" type="object" string="Triplicado" attrs="{'invisible':['|','|',('impressoall','=',True),('impressotri','=',True),('state','=','draft')]}"/>

                <button name="print_all" type="object" string="Todas as Vias" attrs="{'invisible':['|','|','|','|',('impressoall', '=', True),('impressoori', '=', True),('impressodupl', '=', True),('impressotri', '=', True),('state','=','draft')]}" />

                <button name="print_segunda_via" type="object" string="Segunda Via" attrs="{'invisible':['|',('impressoseg', '=', True),('state','=','draft')]}" />
                
            </header>
        <notebook colspan="4" position="after">
            
        <group col="1">
                <field name="impressodupl" nolabel="0" invisible="1" />
                <field name="impressoori" nolabel="0" invisible="1" />
                <field name="impressotri" nolabel="0" invisible="1" />
                <field name="impressoall" nolabel="0" invisible="1" />
          <field name="impressoseg" nolabel="0" invisible="1" />
          
        </group>
           
          </notebook>
               </field>
        </record>

Imagine profil
Abandonează
Autor

hum... didnt work my xml code is: account.invoice.rule.saft.inherit account.invoice account.invoice.rule.saft.inherit account.invoice

<xpath expr="//button[@name='invoice_print']" position="replace"/> <xpath expr="//button[@name='invoice_print']" position="replace"/>

Cel mai bun răspuns

FIRST, your FORM inheritance is wrong.  

Since there are 2 buttons available at Account Invoice Form https://github.com/odoo/odoo/blob/8.0/addons/account/account_invoice_view.xml#L297

METHOD-1:
So replace button twice in your inherited view.
<record id="account_invoice_form_inherit" model="ir.ui.view">
    <field name="name">account.invoice.form.sciencefirst</field>
    <field name="model">account.invoice</field>
    <field name="inherit_id" ref="account.invoice_form"/>
    <field name="arch" type="xml">
        <xpath expr="//button[@name='invoice_print']" position="replace"/>
        <xpath expr="//button[@name='invoice_print']" position="replace"/>

    </field>
</record>

METHOD-2:
<record id="account_invoice_form_inherit" model="ir.ui.view">
    <field name="name">account.invoice.form.sciencefirst</field>
    <field name="model">account.invoice</field>
    <field name="inherit_id" ref="account.invoice_form"/>
    <field name="arch" type="xml">
</record>
<xpath expr="//button[@name='invoice_print'][1]" position="attributes">
    <attribute name="invisible">True</attribute>
</xpath>
<xpath expr="//button[@name='invoice_print'][2]" position="attributes">
    <attribute name="invisible">True</attribute>
</xpath>

    </field>
 

Imagine profil
Abandonează
Autor

the First one dindt do nothing the second one it appears two labels on the Header "True" "True" the button Print is on the same place it just added two new fields on the header

Sorry, I provided code for Account Invoice instead of Sales order. I have corrected the code. Please check it.

Autor

but I think my question is on the account invoice

please provide correct description "I want to remove the button "Imprimir" (Print) on the sale orders I just did all like"??

Autor

I just try all I know and then I said my tries :) sorry

Autor

ok I did the 1st method and it worked thx for the pacience :)

Autor

patience*

Thanks, Atchuthan

+1

Related Posts Răspunsuri Vizualizări Activitate
8
aug. 15
16518
1
mar. 15
8066
1
mar. 15
3186
2
iul. 25
560
14
ian. 25
123478