A Divendres, 3 de febrer de 2012 14:45:40, Sharoon Thomas va escriure:
> On Feb 3, 2012, at 7:41 AM, Felipe Alvarez Harnecker wrote:
> > my intention is to extend account_invoice, as first step i need to add a
> > new state 'nula' to invoices, so my idea is to read from
> > account_invoice.invoice to obtain states values, say STATES, and
> > redefine column state = STATES + ['nula'] , bla
> > 
> > 
> > which is the tryton way todo this ?
> 
> Hi Felipe,
> 
> First things first, as Cedrik said you are still cross posting (See
> http://en.wikipedia.org/wiki/Crossposting) between the general mailing list
> (tryton) and the development mainlining list (tryton-dev).
> 
> Please send only to one mailing list and in topics like this one to the dev
> list.
> 
> And regarding your question, technically speaking adding a new item to an
> existing selection field [1] can be done this way:
> 
> class Invoice( ModelWorkflow, ModelSQL, ModelView):
>     _name = "account.invoice"
> 
>     def __init__(self):
>         super(Invoice, self).__init__()
>         self.state.selection.append(('key', 'Value'))

Shouldn't he copy() self.state.selection before appending the value?

-- 
Albert Cervera i Areny
http://www.NaN-tic.com
Tel: +34 93 553 18 03

http://twitter.com/albertnan 
http://www.nan-tic.com/blog

-- 
[email protected] mailing list

Reply via email to