ir-rule: condition --> Eval('user_id', -1)
This commit is contained in:
parent
176c8d93a7
commit
a98b4387c4
3 changed files with 23 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from .category import Category
|
from .category import Category
|
||||||
from .book import CategoryCashbookRel, Cashbook
|
from .book import CategoryCashbookRel, Cashbook
|
||||||
|
from .ir import Rule
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
@ -13,4 +14,5 @@ def register():
|
||||||
Category,
|
Category,
|
||||||
Cashbook,
|
Cashbook,
|
||||||
CategoryCashbookRel,
|
CategoryCashbookRel,
|
||||||
|
Rule,
|
||||||
module='cashbook_bookcategory', type_='model')
|
module='cashbook_bookcategory', type_='model')
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.rule" id="rg_category_rw_owner-1">
|
<record model="ir.rule" id="rg_category_rw_owner-1">
|
||||||
<field name="domain" eval="[
|
<field name="domain" eval="[
|
||||||
('create_uid.id', '=', Eval('user', {}).get('id', -1)),
|
('create_uid.id', '=', Eval('user_id', -1)),
|
||||||
]" pyson="1"/>
|
]" pyson="1"/>
|
||||||
<field name="rule_group" ref="rg_category_rw_owner"/>
|
<field name="rule_group" ref="rg_category_rw_owner"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
20
ir.py
Normal file
20
ir.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
|
from trytond.transaction import Transaction
|
||||||
|
from trytond.pool import PoolMeta
|
||||||
|
|
||||||
|
|
||||||
|
class Rule(metaclass=PoolMeta):
|
||||||
|
__name__ = 'ir.rule'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _context_modelnames(cls):
|
||||||
|
""" list of models to add 'user_id' to context
|
||||||
|
"""
|
||||||
|
return super(Rule, cls)._context_modelnames() + [
|
||||||
|
'cashbook.bookcategory']
|
||||||
|
|
||||||
|
# end Rule
|
Loading…
Reference in a new issue