From 2fd9a3c6958b2e5d1c03a286be74d7d989891631 Mon Sep 17 00:00:00 2001 From: Jared Esparza Date: Thu, 5 May 2022 15:10:47 +0200 Subject: [PATCH] Add company to context --- contract.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contract.py b/contract.py index 1474119..bce7d45 100644 --- a/contract.py +++ b/contract.py @@ -2,6 +2,7 @@ # the full copyright notices and license terms. from trytond.model import fields from trytond.pool import Pool, PoolMeta +from trytond.pyson import Eval from trytond.modules.account_bank.account import BankMixin __all__ = ['PaymentType', 'Contract', 'ContractConsumption'] @@ -24,6 +25,12 @@ class Contract(BankMixin, metaclass=PoolMeta): ('kind', 'in', ['both', 'receivable']), ]) + @classmethod + def __setup__(cls): + super().__setup__() + cls.account_bank_from.context = {'company': Eval('company')} + cls.account_bank_from.depends.append('company') + @classmethod def default_payment_type(cls): PaymentType = Pool().get('account.payment.type')