Re: [tryton] Creating this search doman

2012-09-28 Thread Jean Cavallo
 Here's the current domain that I have:


What is the problem with this domain ? (error, does not work as intended...)

Jean

-- 
-- 
tryton@googlegroups.com mailing list





Re: [tryton] Creating this search doman

2012-09-28 Thread mohit sarla
dom = [
  ['OR',
  [('lastname', '=', name)],
  [('firstname', '=', name)]
 ],

this is write for  all the records of a model for which one or both of
two fields have
 the same value
On Fri, Sep 28, 2012 at 4:37 PM, mohit sarla mohitsa...@gmail.com wrote:
 Domain takes AND by default.

 On Fri, Sep 28, 2012 at 2:08 PM, Cédric Krier cedric.kr...@b2ck.com wrote:
 On 27/09/12 15:12 -0700, Tristian Paul wrote:
 Hi I've been struggling to create the following domain

 I want all the records of a model for which one or both of two fields have
  the same value

 and where created on a list of given days, each day starts at 0:0:0 and
  ends at 23:59:59


 For example in a person database containing the following model

 class Person(ModelSQL):
 # implicit create date
 firstname = Char('Firstname')
 lastname = Char('Lastname')

 Here's the current domain that I have:
 given that

   dates = [date(2012, 9, 10, date(2012, 9, 2), date(2012,9,3) ]
  name = 'Smith'
 dom = [
   ['OR',
   [('lastname', '=', name)],
   [('firstname', '=', name)]
  ],
  ['OR',
   [ [

 Here it becomes a 'AND' because list without 'AND' or 'OR' are by
 default 'AND' so you must append your list comprehension to the list
 with ['OR'].

   (CD, '=', dt(date(d.year, d.month, d.day), time(0,
 0, 0))),
   (CD, '', dt(date(d.year, d.month, d.day), time(23,
 59, 59))),
   ] for d in dates ]
   ]
   ]



 --
 Cédric Krier

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



 --
 Mohit Sarla



-- 
Mohit Sarla

-- 
-- 
tryton@googlegroups.com mailing list





[tryton] Creating this search doman

2012-09-27 Thread Tristian Paul
Hi I've been struggling to create the following domain

I want all the records of a model for which one or both of two fields have 
 the same value 

and where created on a list of given days, each day starts at 0:0:0 and 
 ends at 23:59:59


For example in a person database containing the following model

class Person(ModelSQL):
# implicit create date
firstname = Char('Firstname')
lastname = Char('Lastname')

Here's the current domain that I have:
given that 
 
  dates = [date(2012, 9, 10, date(2012, 9, 2), date(2012,9,3) ]
 name = 'Smith'
dom = [
  ['OR',
  [('lastname', '=', name)],
  [('firstname', '=', name)]
 ],
 ['OR',
  [ [
  (CD, '=', dt(date(d.year, d.month, d.day), time(0, 
0, 0))),
  (CD, '', dt(date(d.year, d.month, d.day), time(23, 
59, 59))),
  ] for d in dates ]
  ]
  ]
   
Any help is really appreciated.

-- 
-- 
tryton@googlegroups.com mailing list