How do i get invoice view only for today

92 views
Skip to first unread message

Narasimha Murthy

unread,
Oct 14, 2013, 4:22:06 PM10/14/13
to try...@googlegroups.com
Hi,
I want to create a invoice view to show all the invoices pending for today only.
Can i use domain in xml to filter?how do i use domain. domain('invoice_date',Eval(
'datetime.date.today()')) is correct?
I am trying with XML view instead of writing own method.
Thanks,
Murthy

Cédric Krier

unread,
Oct 14, 2013, 5:00:24 PM10/14/13
to try...@googlegroups.com
Use the PYSON Date:
http://doc.tryton.org/2.8/trytond/doc/ref/pyson.html?highlight=pyson#trytond.pyson.Date

--
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: cedric...@b2ck.com
Website: http://www.b2ck.com/

Narasimha Murthy

unread,
Oct 15, 2013, 2:35:21 AM10/15/13
to try...@googlegroups.com
Thank you. It is useful and worked.

Carlos Ibrahim Arias

unread,
Mar 10, 2016, 3:10:04 AM3/10/16
to tryton
Hi Narashimha,

I'm having the same problem and can't make it work. I'm trying to filter a view with the following code using 'domain' and PYSON with  no success.

        <record model="ir.action.act_window.domain" id="act_gnuhealth_appointment_domain_today">
            <field name="name">Today</field>
            <field name="sequence" eval="10"/>
            <field name="domain">[('appointment_date', '>=', PYSONEncoder().encode(DateTime()))]</field>
            <field name="act_window" ref="action_gnuhealth_appointment_view"/>
        </record>

Can you post you solution using PYSON?

Thanks in advanced.

Carlos

Sergi Almacellas Abellana

unread,
Mar 10, 2016, 3:15:26 AM3/10/16
to try...@googlegroups.com
El 10/03/16 a les 03:04, Carlos Ibrahim Arias ha escrit:
> Hi Narashimha,
>
> I'm having the same problem and can't make it work. I'm trying to filter
> a view with the following code using 'domain' and PYSON with no success.
>
> <record model="ir.action.act_window.domain"
> id="act_gnuhealth_appointment_domain_today">
> <field name="name">Today</field>
> <field name="sequence" eval="10"/>
> <field name="domain">[('appointment_date', '>=',
> PYSONEncoder().encode(DateTime()))]</field>
> <field name="act_window"
> ref="action_gnuhealth_appointment_view"/>
> </record>
>
You should not encode Datetime in PYSONEncoder. And use it directly. For
example:

<field name="domain">[('appointment_date', '>=',DateTime(hour=0,
minute=0, second=0, microsecond=0))]</field>

> Can you post you solution using PYSON?
>
> Thanks in advanced.
>
> Carlos
>
> El lunes, 14 de octubre de 2013, 21:22:06 (UTC+1), Narasimha Murthy
> escribió:
>
> Hi,
> I want to create a invoice view to show all the invoices pending for
> today only.
> Can i use domain in xml to filter?how do i use domain.
> domain('invoice_date',Eval(
> 'datetime.date.today()')) is correct?
> I am trying with XML view instead of writing own method.
> Thanks,
> Murthy
>
> --
> You received this message because you are subscribed to the Google
> Groups "tryton" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tryton/27f6ad87-d8ee-4df6-899d-f2d1d4118390%40googlegroups.com
> <https://groups.google.com/d/msgid/tryton/27f6ad87-d8ee-4df6-899d-f2d1d4118390%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

Carlos Ibrahim Arias

unread,
Mar 10, 2016, 4:20:05 PM3/10/16
to try...@googlegroups.com
Funciona! Gracias



--
You received this message because you are subscribed to a topic in the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/56E12D18.4020606%40koolpi.com.

Reply all
Reply to author
Forward
0 new messages