On 01/11/13 10:46 -0200, Gmail - Iasmini wrote:
> Hi,
>
> When it executes on_change_slx_desconto it raises the error.
>
> class InvoiceLine:
> 'Invoice Line'
> __name__ = 'account.invoice.line'
>
> slx_desconto = fields.Numeric(u'Desconto', digits=(16, 4),
> states={
> 'invisible': Eval('type') != 'line'
> },
> depends=['type'],
> on_change=['amount', 'type',
> 'invoice.currency', 'currency,'
> 'quantity', 'unit_price']
> )
>
> def on_change_slx_desconto(self):
> if self.type == 'line':
> currency = (self.invoice.currency if self.invoice
> else self.currency)
> amount = (Decimal(str(self.quantity or '0.0'))
> * (self.unit_price) or Decimal('0.0')
> - (self.slx_desconto) or Decimal('0.0'))
> if currency:
> return currency.round(amount)
> return amount
> return Decimal('0.0')on_change method must return a dictionary [1] or use on_change_with [2] [1] http://doc.tryton.org/3.0/trytond/doc/ref/models/fields.html?highlight=on_change#trytond.model.fields.Field.on_change [2] http://doc.tryton.org/3.0/trytond/doc/ref/models/fields.html?highlight=on_change#trytond.model.fields.Field.on_change_with -- Cédric Krier - B2CK SPRL Email/Jabber: [email protected] Tel: +32 472 54 46 59 Website: http://www.b2ck.com/
pgp4EF8ua8GYM.pgp
Description: PGP signature
