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]

Thanks in advance! 

[1] https://github.com/tryton/account/blob/develop/party.py#L75

-- 
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/103a12c0-6333-4294-9598-ac63e31ea937%40googlegroups.com.

Reply via email to