mirror of
https://github.com/bringout/oca-report.git
synced 2026-04-21 11:22:08 +02:00
Initial commit: OCA Report packages (45 packages)
This commit is contained in:
commit
2f4db400df
2543 changed files with 469120 additions and 0 deletions
|
|
@ -0,0 +1,3 @@
|
|||
from . import report_paperformat_label
|
||||
from . import ir_actions_server
|
||||
from . import ir_actions_report
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
from odoo import api, models
|
||||
|
||||
|
||||
class IrActionsReport(models.Model):
|
||||
_inherit = "ir.actions.report"
|
||||
|
||||
@api.model
|
||||
def get_paperformat(self):
|
||||
# Allow to define paperformat via context
|
||||
res = super().get_paperformat()
|
||||
if self.env.context.get("paperformat_id"):
|
||||
res = self.env["report.paperformat"].browse(
|
||||
self.env.context.get("paperformat_id")
|
||||
)
|
||||
return res
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
# 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",
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
from odoo import fields, models
|
||||
|
||||
|
||||
class ReportPaperformatLabel(models.Model):
|
||||
_name = "report.paperformat.label"
|
||||
_description = "Label Paper Format"
|
||||
|
||||
name = fields.Char(required=True)
|
||||
|
||||
paperformat_id = fields.Many2one(
|
||||
"report.paperformat",
|
||||
string="Paper Format",
|
||||
required=True,
|
||||
ondelete="cascade",
|
||||
)
|
||||
label_width = fields.Float(
|
||||
"Label Width (mm)",
|
||||
default=60,
|
||||
required=True,
|
||||
)
|
||||
label_height = fields.Float(
|
||||
"Label Height (mm)",
|
||||
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)
|
||||
label_padding_left = fields.Float("Label Padding Left (mm)", default=2)
|
||||
label_margin_top = fields.Float("Label Margin Top (mm)", default=2)
|
||||
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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue