mirror of
https://gitlab.com/flectra-community/server-ux.git
synced 2024-11-24 23:22:06 +00:00
38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
|
# Copyright 2019 Creu Blanca
|
||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||
|
|
||
|
from flectra import fields, api, models
|
||
|
|
||
|
|
||
|
class TierDefinition(models.Model):
|
||
|
_inherit = 'tier.definition'
|
||
|
|
||
|
python_code = fields.Text(
|
||
|
string='Tier Definition Expression',
|
||
|
help="Write Python code that defines when this tier confirmation "
|
||
|
"will be needed. The result of executing the expresion must be "
|
||
|
"a boolean.",
|
||
|
default="""# Available locals:\n# - rec: current record""",
|
||
|
)
|
||
|
definition_type = fields.Selection(
|
||
|
selection_add=[('formula', 'Formula')]
|
||
|
)
|
||
|
reviewer_expression = fields.Text(
|
||
|
string='Review Expression',
|
||
|
help="Write Python code that defines the reviewer. "
|
||
|
"The result of executing the expression must be a res.users "
|
||
|
"recordset.",
|
||
|
default="# Available locals:\n# - rec: current record\n"
|
||
|
"# - Expects a recordset of res.users",
|
||
|
)
|
||
|
review_type = fields.Selection(
|
||
|
selection_add=[("expression", "Python Expression")]
|
||
|
)
|
||
|
|
||
|
@api.onchange('review_type')
|
||
|
def onchange_review_type(self):
|
||
|
super(TierDefinition, self).onchange_review_type()
|
||
|
self.reviewer_expression = "# Available locals:\n" \
|
||
|
"# - rec: current record\n" \
|
||
|
"# - Expects a recordset of res.users"
|