Files
reporting-engine/report_label/models/ir_actions_server.py
Sylvain LE GAL 85bb60b356 [MIG] report_label
[IMP] allow to create report.paperformat.label without creating each time report.paperformat item
[FIX] Remove useless data that are specific Label: Agipa 114016
[REF] simplify UI, removing custom entry for ir.actions.server
[ADD] migration script to migrate name field
[IMP] Add label_background_color to allow to easily define background-color for label. (That can be usefull to debug label positions)
[DOC] update screenshots to new V16 versions
[IMP] Set body and html margin to 0 to to able to be predictive when designing a label sheet
[IMP] replace style by class in the label template, reducing the size of the html code generated.
[IMP] replace label_template by label_template_view_id on the ir.actions.server model, removing useless xml and python code. (provide migration scripts)
[REF] Split wizard file into wizard and wizard line file, following OCA guidelines
2023-01-05 00:42:04 +01:00

43 lines
1.4 KiB
Python

# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class IrActionsServer(models.Model):
_inherit = "ir.actions.server"
state = fields.Selection(
selection_add=[("report_label", "Print self-adhesive labels")],
ondelete={"report_label": "cascade"},
)
label_template_view_id = fields.Many2one(
string="Label QWeb Template",
comodel_name="ir.ui.view",
domain=[("type", "=", "qweb")],
help="The QWeb template key to render the labels",
states={"report_label": [("required", True)]},
)
label_paperformat_id = fields.Many2one(
"report.paperformat.label",
"Label Paper Format",
states={"report_label": [("required", True)]},
)
def _run_action_report_label_multi(self, eval_context=None):
"""Show report label wizard"""
context = dict(self.env.context)
context.update(
{
"label_template_view_id": self.label_template_view_id.id,
"label_paperformat_id": self.label_paperformat_id.id,
"res_model_id": self.model_id.id,
}
)
return {
"name": self.name,
"type": "ir.actions.act_window",
"res_model": "report.label.wizard",
"context": context,
"view_mode": "form",
"target": "new",
}