[MIG] report_label: Migration to 14.0

This commit is contained in:
Stefan Rijnhart
2021-04-20 17:28:12 +02:00
parent c6c0ef3fd4
commit c55eea9714
10 changed files with 58 additions and 46 deletions

View File

@@ -1,11 +1,13 @@
from odoo import api, fields, models
# 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")]
selection_add=[("report_label", "Print self-adhesive labels")],
ondelete={"report_label": "cascade"},
)
label_template = fields.Char(
"Label QWeb Template",
@@ -18,7 +20,6 @@ class IrActionsServer(models.Model):
states={"report_label": [("required", True)]},
)
@api.multi
def report_label_associated_view(self):
"""View the associated qweb templates"""
self.ensure_one()
@@ -34,22 +35,21 @@ class IrActionsServer(models.Model):
]
return res
@api.model
def run_action_report_label_multi(self, action, eval_context=None):
def _run_action_report_label_multi(self, eval_context=None):
"""Show report label wizard"""
context = dict(self.env.context)
context.update(
{
"label_template": action.label_template,
"label_paperformat_id": action.label_paperformat_id.id,
"res_model_id": action.model_id.id,
"label_template": self.label_template,
"label_paperformat_id": self.label_paperformat_id.id,
"res_model_id": self.model_id.id,
}
)
return {
"name": action.name,
"name": self.name,
"type": "ir.actions.act_window",
"res_model": "report.label.wizard",
"context": str(context),
"context": context,
"view_mode": "form",
"target": "new",
}