On 11/02/12 13:15 -0300, Felipe Alvarez Harnecker wrote:
> On Sábado 11 Febrero 2012 10:34:55 Cédric Krier escribió:
> > On 10/02/12 18:11 -0300, Felipe Alvarez Harnecker wrote:
> > > i'm trying to do something like
> > > 
> > > <field name="producto"
> > > 
> > > domain="If(Equal(Eval('tipo'),'servicio'),[('type','=','service')],[('typ
> > > e','!=','service')])"/>
> > > 
> > > that fails. How is the right way to do this in tryton?
> > 
> > What is failing?
> > What is the definition of the Model?
> 
> Ok. Here are the models ( simplified) 
> 
> class Report(ModelSQL,  ModelView):
>     'Report'
>     _name = 'ql_maquinaria.report'
>     _description = __doc__
> 
>     tipo = 
> fields.Selection([('servicio','Servicio'),('venta','Venta')],'Tipo', 
> required=True, 
> select=1)
>     lineas = fields.One2Many('ql_maquinaria.report.linea', 'report', 'Lineas')
> 
> 
> 
> class LineaReport(ModelSQL,  ModelView):
> 
>     'LineaReport'
>     _name = 'ql_maquinaria.report.linea'
>     _description = __doc__
>     
>     report = fields.Many2One('ql_maquinaria.report', 'Report',  
> required=True, ondelete='CASCADE')
     producto = fields.Many2One('product.product', 'Producto', required=True,
        domain=If(Equal(Get(Eval('_parent_report', {}), 'tipo'), 'servicio'),
            [('type', '=', 'service')],
            [('type', '!=', 'service')]))
> 
> 
> 
> what i need is: if Report.tipo == 'servicio' then when the user choose a 
> product the widget ( in 
> LineaRepot )  must show only products of type 'service' and when Report.tipo 
> == 'venta' the widgets 
> show only products of type != 'service' 

It must be something like that.

-- 
Cédric Krier

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

Attachment: pgpSJYpQPL6kN.pgp
Description: PGP signature

Reply via email to