代码之家  ›  专栏  ›  技术社区  ›  Ropo

仅在保存客户后显示标题按钮的条件

  •  0
  • Ropo  · 技术社区  · 7 年前

    <xpath expr="//form/*" position="before">
                        <header>
                            <button name="offer_letter" string="Offer Letter" type="object" class="oe_highlight"
                                    attrs="{'invisible':[('what condition?')]}"/>
                        </header>
                    </xpath>
    

    模型:

    class res_partner(models.Model):
        _inherit = 'res.partner'
    
        baf = fields.Boolean("Application Form", help="Specify customer who bought application form")
    
        @api.multi
        def offer_letter_method(self):
            return self.env['report'].get_action(self, 'sales_custom.offer_letter_view')
    

    <record model="ir.ui.view" id="customer_custom_form_view">
                <field name="name">customer.custom</field>
                <field name="model">res.partner</field>
                <field name="inherit_id" ref="base.view_partner_form"/>
                <field name="arch" type="xml">
                    <xpath expr="//form/*" position="before">
                        <header>
                            <button name="offer_letter" string="Offer Letter" type="object" class="oe_highlight"
                                    attrs="{'invisible':[('what condition?')]}"/>
                        </header>
                    </xpath>
                    <xpath expr="//field[@name='name']" position="after">
                        <field name="baf"/>
                        <label for="baf"/>
                    </xpath>
                </field>
            </record>
    

    请协助。

    1 回复  |  直到 7 年前
        1
  •  2
  •   Emipro Technologies Pvt. Ltd.    7 年前

    <record model="ir.ui.view" id="customer_custom_form_view">
        <field name="name">customer.custom</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_form"/>
        <field name="arch" type="xml">
            <xpath expr="//form/*" position="before">
                <header>
                    <button name="offer_letter" string="Offer Letter" type="object" class="oe_highlight"
                            attrs="{'invisible':[('id','=',False)]}"/>
                           <field name="id" invisible="1"/>
                </header>
            </xpath>
            <xpath expr="//field[@name='name']" position="after">
                <field name="baf"/>
                <label for="baf"/>
            </xpath>
        </field>
    </record>