On 12/05/11 09:45 +0200, Paul J Stevens wrote:
> > sale.py#l887> unit_price = fields.Numeric('Unit Price', digits=(16, 4),
> > sale.py#l888> states={
> > sale.py#l889> 'invisible': Not(Equal(Eval('type'), 'line')),
> > sale.py#l890> 'required': Equal(Eval('type'), 'line'),
> > sale.py#l891> })
>
> Brian,
>
> afaik, you need to override the unit_price field by writing a small
> tryton module with a sale.py along these lines:
>
> class SaleLine(ModelSQL, ModelView):
> _name = 'sale.line'
> _rec_name = 'description'
> _description = __doc__
>
> unit_price = fields.Numeric('Unit Price', digits=(16, 4),
> states={
> 'invisible': Not(Equal(Eval('type'), 'line')),
> })
>
> SaleLine()
>
> basically dropping the required-ness for unit-price.This is not the rigth way. You must modify the states attribute of unit_price in the __init__ method. Here you are smashing any other extentions from other modules. -- 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/
pgppk7PqayMlA.pgp
Description: PGP signature
