changeset 95e207047ded in modules/analytic_invoice:5.2
details:
https://hg.tryton.org/modules/analytic_invoice?cmd=changeset;node=95e207047ded
description:
Add company domain on asset analytic accounts
issue7198
review46471002
(grafted from 23df221a67f36eaeee402abfa6678de41824f9fe)
diffstat:
asset.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diffs (26 lines):
diff -r 5a9da57b2b91 -r 95e207047ded asset.py
--- a/asset.py Sat Apr 04 17:03:44 2020 +0200
+++ b/asset.py Sat Apr 18 17:44:36 2020 +0200
@@ -2,6 +2,7 @@
# this repository contains 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.transaction import Transaction
from trytond.modules.analytic_account import AnalyticMixin
@@ -12,6 +13,14 @@
class Asset(AnalyticMixin, metaclass=PoolMeta):
__name__ = 'account.asset'
+ @classmethod
+ def __setup__(cls):
+ super(Asset, cls).__setup__()
+ cls.analytic_accounts.domain = [
+ ('company', '=', Eval('company', -1)),
+ ]
+ cls.analytic_accounts.depends.append('company')
+
@fields.depends('supplier_invoice_line', 'analytic_accounts')
def on_change_supplier_invoice_line(self):
pool = Pool()