From 03301cf5d7d8d1c5843bbe2687ba6e797fa51dac Mon Sep 17 00:00:00 2001 From: Jared Esparza Date: Tue, 17 May 2022 11:13:39 +0200 Subject: [PATCH] Add company to conext only in account.invoice setup --- invoice.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/invoice.py b/invoice.py index 998099e..05c2dc7 100644 --- a/invoice.py +++ b/invoice.py @@ -97,6 +97,14 @@ class Invoice(ContactMixin, metaclass=PoolMeta): __name__ = 'account.invoice' _contact_config_name = 'account.invoice.configuration' + @classmethod + def __setup__(cls): + super().__setup__() + cls.allowed_invoice_contacts.context = {'company': Eval('company')} + cls.allowed_invoice_contacts.depends.add('company') + cls.invoice_contact.context = {'company': Eval('company')} + cls.invoice_contact.depends.add('company') + def _credit(self, **values): credit = super(Invoice, self)._credit(**values) credit.invoice_contact = self.invoice_contact