Re: [tryton-dev] Best way to test for a date in a date field

2017-05-05 Thread Vincent Bastos


On Wednesday, May 3, 2017 at 5:31:49 PM UTC+10, Sergi Almacellas Abellana 
wrote:
>
> El 02/05/17 a les 07:59, Vincent Bastos ha escrit: 
> > Hi, 
> > 
> > I wanted to know what the best way to write a domain for a search call 
> > to test for records that have a date in a particular field. 
> > 
> > My idea is something like this: 
> > 
> > nodate = Date(0) 
> > 
> > invoices = Invoice.search([ 
> > ('lease', '=', self.id), 
> > ('state', '!=', 'paid'), 
> > ('mydate', '!=', nodate), 
> > ], order=[('invoice_date', 'ASC')]) 
> Not sure to understand, but if you want to search for invoices where the 
> mydate field is empty you can search for None as values. The clause will 
> be: 
>
> ('mydate', '=', None) 
>

Thanks ... I realised after asking the question ...

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/fc5d84c2-dce6-4648-957d-5e2850f4855d%40googlegroups.com.


Re: [tryton-dev] Best way to test for a date in a date field

2017-05-03 Thread Sergi Almacellas Abellana

El 02/05/17 a les 07:59, Vincent Bastos ha escrit:

Hi,

I wanted to know what the best way to write a domain for a search call
to test for records that have a date in a particular field.

My idea is something like this:

nodate = Date(0)

invoices = Invoice.search([
('lease', '=', self.id),
('state', '!=', 'paid'),
('mydate', '!=', nodate),
], order=[('invoice_date', 'ASC')])
Not sure to understand, but if you want to search for invoices where the 
mydate field is empty you can search for None as values. The clause will be:


('mydate', '=', None)

Hope it helps.

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

--
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/a3d39cd9-3534-6baa-020d-551ba2f345ad%40koolpi.com.


[tryton-dev] Best way to test for a date in a date field

2017-05-03 Thread Vincent Bastos
Hi,

I wanted to know what the best way to write a domain for a search call to 
test for records that have a date in a particular field.

My idea is something like this:

nodate = Date(0)

invoices = Invoice.search([
('lease', '=', self.id),
('state', '!=', 'paid'),
('mydate', '!=', nodate),
], order=[('invoice_date', 'ASC')])

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/8355fce6-1a12-45e8-be59-b963d4fc3909%40googlegroups.com.