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'))

However, this may not help you in achieving what you want because you will
also have to modify the workflow related to the object in most cases.


[1] 
http://hg.tryton.org/2.2/trytond/file/835240a4a5f8/trytond/model/fields/selection.py#l31

Thanks,

Sharoon

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to