Add company to context

This commit is contained in:
Jared Esparza 2022-05-04 15:05:10 +02:00
parent e1588e5667
commit 767eaa4613
1 changed files with 4 additions and 1 deletions

View File

@ -1,12 +1,15 @@
from trytond.pool import PoolMeta
from trytond.model import fields
from trytond.pyson import Eval
class PurchaseLine(metaclass=PoolMeta):
'Purchase Line'
__name__ = 'purchase.line'
party = fields.Function(fields.Many2One('party.party',
'Party'), 'get_party', searcher = 'search_party')
'Party', context={
'company': Eval('company'),
}, depends=['company']), 'get_party', searcher='search_party')
def get_party(self, name):
return self.purchase.party.id