Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
18619 Vistas

Hello, I have Odoo 8 and I am developing a module.

I want to add a new filter button in Accounting->Invoices, with this domain:

domain="[('date_invoice','<=',((context_today()-datetime.timedelta(days=10)).strftime('%Y-%m-%d'))), ('state', '=', 'open')]"

How must I define the .xml view to add the filter with this domain? I was searching and trying but I don't found the way. Thanks!

Avatar
Descartar
Mejor respuesta

Hi Jose,

You try like this:

       <record id="view_account_invoice_filter_inherited" model="ir.ui.view">
                <field name="name">view.account.invoice.filter</field>
                <field name="model">account.invoice</field>
                <field name="type">search</field>
                <field name="inherit_id" ref="account.view_account_invoice_filter"/>
                <field name="arch" type="xml">
                        <xpath expr="/search/filter[1]" position="after">
                               <filter name="open" string="Open" domain="[('date_invoice','&lt;=',((context_today()-datetime.timedelta(days=10)).strftime('%Y-%m-%d'))), ('state', '=', 'open')]" help="Invoices Open"/>
                        </xpath>
                </field>
        </record>

Add this record to the xml file of your custom module. If your domain condition is correct, then I think this should work for you. Hope this helps you.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
jul 15
4166
0
mar 15
3261
0
may 17
3195
0
dic 16
3963
0
jul 15
3324