Add company to context

This commit is contained in:
Jared Esparza 2022-05-05 15:10:47 +02:00
parent eb77889d59
commit 2fd9a3c695

View file

@ -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')