changeset e7c0b6446e17 in modules/analytic_invoice:5.4
details:
https://hg.tryton.org/modules/analytic_invoice?cmd=changeset;node=e7c0b6446e17
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 4fc81c90c6a4 -r e7c0b6446e17 asset.py
--- a/asset.py Sat Apr 04 16:33:32 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()