Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
18718 Представления

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!

Аватар
Отменить
Лучший ответ

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.

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
июл. 15
4237
0
мар. 15
3319
0
мая 17
3271
0
дек. 16
4023
0
июл. 15
3401