* Betr.: " Re: [tryton] Zero-price items" (Thu, 12 May 2011 11:38:10 -0500):

> 
> > Whether small or not, I think it is important;). JFTR: we had to eliminate
> > the 'required' on unit_price already long time ago, because for us (in
> > Germany) there are many use cases for invoice lines with amount 0.
> So, back to my original question: how does one make unit_price not
> "required"?
> 
> Brian Dunnette
> 

You must define in a module depending on account_invoice something like: 

    def __init__(self):
        super(InvoiceLine, self).__init__()
        self.unit_price = copy.copy(self.unit_price)
        if self.unit_price.states is None:
            self.unit_price.states = {
                    'invisible': Not(Equal(Eval('type'), 'line')),
                    }
        elif 'required' in self.unit_price.states:
            del self.unit_price.states['required']
        self._reset_columns()

This will not remove the NOT NULL constraint in the database, which for us is
not a problem in this case, but wished behavior.


-- 

    Mathias Behrle
    MBSolutions
    Gilgenmatten 10 A
    D-79114 Freiburg

    Tel: +49(761)471023
    Fax: +49(761)4770816
    http://m9s.biz
    UStIdNr: DE 142009020
    PGP/GnuPG key availabable from any keyserver, ID: 0x8405BBF6

Attachment: signature.asc
Description: PGP signature

Reply via email to