跳至內容
選單
此問題已被標幟
1 回覆
19312 瀏覽次數

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>

頭像
捨棄
作者

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"/>

最佳答案

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>
 

頭像
捨棄
作者

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.

作者

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"??

作者

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

作者

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

作者

patience*

Thanks, Atchuthan

+1

相關帖文 回覆 瀏覽次數 活動
8
8月 15
16562
1
3月 15
8124
1
3月 15
3219
2
7月 25
661
14
1月 25
123750