summaryrefslogtreecommitdiff
path: root/addons/web/models
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2018-07-26 09:55:01 +0200
committerChristophe Matthieu <chm@odoo.com>2018-08-13 17:09:28 +0200
commit61eef73b52c078daaae37f8d57e93830a2e53410 (patch)
tree8b144174691de487a584bf8ac449fb55d3ad12ab /addons/web/models
parent149eb38b07cace0ec2118d214c56995402008efc (diff)
[IMP] base, *: use a many2one for the company report layout
Before this rev. one could set the report layout on the company using a hardcoded list (background, clean, standard, etc.). Other modules (typically accounting modules) could add options in this list. The used template was built on the layout key. Now, the layout is a many2one field to a newly created model `report.layout`, which is linked to a view with the layout architecture. This gives more control to customize reports and create a new layout (without creating a python module that extend the layout selection).
Diffstat (limited to 'addons/web/models')
-rw-r--r--addons/web/models/__init__.py1
-rw-r--r--addons/web/models/report_layout.py17
2 files changed, 18 insertions, 0 deletions
diff --git a/addons/web/models/__init__.py b/addons/web/models/__init__.py
index 29ae76aa206..cafe5fa2816 100644
--- a/addons/web/models/__init__.py
+++ b/addons/web/models/__init__.py
@@ -4,3 +4,4 @@
from . import ir_qweb
from . import ir_http
from . import models
+from . import report_layout
diff --git a/addons/web/models/report_layout.py b/addons/web/models/report_layout.py
new file mode 100644
index 00000000000..f70129ec89d
--- /dev/null
+++ b/addons/web/models/report_layout.py
@@ -0,0 +1,17 @@
+# -*- coding: ascii -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+import logging
+
+from odoo import fields, models
+
+_logger = logging.getLogger(__name__)
+
+
+class View(models.Model):
+
+ _name = "report.layout"
+
+ view_id = fields.Many2one('ir.ui.view', 'Document Template', required=True)
+ image = fields.Char(string="Preview image src")
+ pdf = fields.Char(string="Preview pdf src")