mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[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
This commit is contained in:
@@ -9,8 +9,10 @@ class IrActionsServer(models.Model):
|
||||
selection_add=[("report_label", "Print self-adhesive labels")],
|
||||
ondelete={"report_label": "cascade"},
|
||||
)
|
||||
label_template = fields.Char(
|
||||
"Label QWeb Template",
|
||||
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)]},
|
||||
)
|
||||
@@ -20,27 +22,12 @@ class IrActionsServer(models.Model):
|
||||
states={"report_label": [("required", True)]},
|
||||
)
|
||||
|
||||
def report_label_associated_view(self):
|
||||
"""View the associated qweb templates"""
|
||||
self.ensure_one()
|
||||
action = self.env.ref("base.action_ui_view", raise_if_not_found=False)
|
||||
if not action or len(self.label_template.split(".")) < 2:
|
||||
return False
|
||||
res = action.read()[0]
|
||||
res["domain"] = [
|
||||
("type", "=", "qweb"),
|
||||
"|",
|
||||
("name", "ilike", self.label_template.split(".")[1]),
|
||||
("key", "=", self.label_template),
|
||||
]
|
||||
return res
|
||||
|
||||
def _run_action_report_label_multi(self, eval_context=None):
|
||||
"""Show report label wizard"""
|
||||
context = dict(self.env.context)
|
||||
context.update(
|
||||
{
|
||||
"label_template": self.label_template,
|
||||
"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,
|
||||
}
|
||||
|
||||
@@ -3,9 +3,10 @@ from odoo import fields, models
|
||||
|
||||
class ReportPaperformatLabel(models.Model):
|
||||
_name = "report.paperformat.label"
|
||||
_inherits = {"report.paperformat": "paperformat_id"}
|
||||
_description = "Label Paper Format"
|
||||
|
||||
name = fields.Char(required=True)
|
||||
|
||||
paperformat_id = fields.Many2one(
|
||||
"report.paperformat",
|
||||
string="Paper Format",
|
||||
@@ -22,6 +23,7 @@ class ReportPaperformatLabel(models.Model):
|
||||
default=42.3,
|
||||
required=True,
|
||||
)
|
||||
label_background_color = fields.Char(default="#FFFFFF")
|
||||
label_padding_top = fields.Float("Label Padding Top (mm)", default=2)
|
||||
label_padding_right = fields.Float("Label Padding Right (mm)", default=2)
|
||||
label_padding_bottom = fields.Float("Label Padding Bottom (mm)", default=2)
|
||||
@@ -30,9 +32,3 @@ class ReportPaperformatLabel(models.Model):
|
||||
label_margin_right = fields.Float("Label Margin Right (mm)", default=2)
|
||||
label_margin_bottom = fields.Float("Label Margin Bottom (mm)", default=2)
|
||||
label_margin_left = fields.Float("Label Margin Left (mm)", default=2)
|
||||
|
||||
# Overload inherits defaults
|
||||
orientation = fields.Selection(inherited=True, default="Portrait")
|
||||
header_spacing = fields.Integer(inherited=True, default=0)
|
||||
margin_top = fields.Float(inherited=True, default=7)
|
||||
margin_bottom = fields.Float(inherited=True, default=7)
|
||||
|
||||
Reference in New Issue
Block a user