Public release from ruodoo-project: 19.0 - 2026-05-31 21:19:12 UTC
This commit is contained in:
41
docx_report/models/docx_custom_field.py
Normal file
41
docx_report/models/docx_custom_field.py
Normal file
@ -0,0 +1,41 @@
|
||||
from odoo import api, fields, models, _
|
||||
|
||||
|
||||
class DocxCustomField(models.Model):
|
||||
_name = "docx.custom.field"
|
||||
_description = "Кастомная переменная для DOCX-шаблона"
|
||||
|
||||
report_id = fields.Many2one(
|
||||
"ir.actions.report",
|
||||
string="DOCX-отчёт",
|
||||
required=True,
|
||||
ondelete="cascade",
|
||||
)
|
||||
|
||||
technical_name = fields.Char(
|
||||
string="Техническое имя",
|
||||
required=True,
|
||||
help="Имя переменной, используемое в шаблоне",
|
||||
)
|
||||
|
||||
name = fields.Char(
|
||||
string="Название",
|
||||
required=True,
|
||||
help="Имя для интерфейса.",
|
||||
)
|
||||
|
||||
value_python = fields.Text(
|
||||
string="Значение (Python)",
|
||||
required=True,
|
||||
help=(
|
||||
"Python-выражение, которое будет вычислено в контексте отчёта.\n"
|
||||
),
|
||||
)
|
||||
|
||||
_sql_constraints = [
|
||||
(
|
||||
"uniq_report_technical_name",
|
||||
"unique(report_id, technical_name)",
|
||||
"Техническое имя кастомной переменной должно быть уникально в рамках одного отчёта.",
|
||||
)
|
||||
]
|
||||
Reference in New Issue
Block a user