Hello,
I tried to migrate an existing tryton installation and get the following error:
AssertionError: <class 'trytond.pool.sale.line'>.margin not callable
The definition of the field looks like this:
margin = fields.Function(fields.Numeric('Margin',
digits=(16, Eval('_parent_sale', {}).get('currency_digits', 2)),
states={
'invisible': ~Eval('type').in_(['line', 'subtotal']),
'readonly': ~Eval('_parent_sale'),
},
depends=['type', 'amount']),
'on_change_with_margin')
and for the implementation:
@fields.depends('type', 'amount', 'quantity', 'cost_price',
'_parent_sale.currency',
'_parent_sale.lines')
def on_change_with_margin(self):
'''
Return the margin of each sale lines
'''
...
I thought, that it is enough, to declare all fields, which are used within the
method.
Actual, I have read the documentation and saw, that the dependency of fields
has been introduced, but I cannot understand, what is missing concretely in
this case.
Thank you and best regards,
Hendrik Brandes
--
You received this message because you are subscribed to the Google Groups
"tryton-dev" group.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tryton-dev/6bb94289-7a1a-496a-acf1-2e605ad01fc5%40googlegroups.com.