ir-rule: condition --> Eval('user_id', -1)
This commit is contained in:
parent
52eec322b5
commit
e25e6b6dee
4 changed files with 24 additions and 2 deletions
|
@ -10,6 +10,7 @@ from .currency import Currency
|
|||
from .evaluation_context import EvaluationContext
|
||||
from .evaluation_wizard import OpenChartWizard
|
||||
from .investment import InvestmentEvaluation, InvestmentLine
|
||||
from .ir import Rule
|
||||
|
||||
|
||||
def register():
|
||||
|
@ -18,6 +19,7 @@ def register():
|
|||
Evaluation,
|
||||
EvaluationLine,
|
||||
EvaluationContext,
|
||||
Rule,
|
||||
module='cashbook_report', type_='model')
|
||||
Pool.register(
|
||||
OpenChartWizard,
|
||||
|
|
|
@ -96,7 +96,7 @@ full copyright notices and license terms. -->
|
|||
</record>
|
||||
<record model="ir.rule" id="rg_eval_rw_owner-1">
|
||||
<field name="domain" eval="[
|
||||
('create_uid', '=', Eval('user', {}).get('id', -1)),
|
||||
('create_uid', '=', Eval('user_id', -1)),
|
||||
]" pyson="1"/>
|
||||
<field name="rule_group" ref="rg_eval_rw_owner"/>
|
||||
</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() + [
|
||||
'ir.action.act_window', 'cashbook_report.evaluation']
|
||||
|
||||
# end Rule
|
2
ir.xml
2
ir.xml
|
@ -20,7 +20,7 @@ full copyright notices and license terms. -->
|
|||
<field name="domain" eval="[
|
||||
('res_model', '=', 'cashbook_report.eval_line'),
|
||||
['OR',
|
||||
('create_uid', '=', Eval('user', {}).get('id', -1)),
|
||||
('create_uid', '=', Eval('user_id', -1)),
|
||||
('create_uid', '=', 0),
|
||||
],
|
||||
]" pyson="1"/>
|
||||
|
|
Loading…
Reference in a new issue