On 2018-02-15 11:53, Josias Pérez wrote: > Hi, > > I would appreciate if could tell how I can call a functional field from > another module, in this case, I need to call the payable function field from > account module. > > The code is the follow: > > currency_digits = fields.Function(fields.Integer('Currency Digits'), > 'get_currency_digits') > > receivable = fields.Function( > fields.Numeric('Por cobrar', > digits=(16, Eval('currency_digits', 2)), > depends=['currency_digits']), > 'get_receivable_payable') > > @classmethod > def get_currency_digits(cls, parties, name): > pool = Pool() > Company = pool.get('company.company') > company_id = Transaction().context.get('company') > if company_id: > company = Company(company_id) > digits = company.currency.digits > else: > digits = 2 > return {p.id: digits for p in parties} > > @classmethod > def get_receivable_payable(cls, subscriptions, names): > for subscription in subscriptions: > if subscription.party: > amount = subscription.party.receivable > return amount > else: > return 0 > > I'm trying to get the value of the payable field of account module. [1]
You should not try to call getter of Function field directly indeed you should use the ORM and just access the corresponding field. -- Cédric Krier - B2CK SPRL Email/Jabber: cedric.kr...@b2ck.com Tel: +32 472 54 46 59 Website: http://www.b2ck.com/ -- 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/20180216090350.GT24410%40kei.