Skip to content

Commit 8b4ed3b

Browse files
committed
[ADD] web_font_size_report_layout: web_font_size_report_layout module added.
1 parent 0f77378 commit 8b4ed3b

18 files changed

+974
-0
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
===================================
2+
Report Font Size in Document Layout
3+
===================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:ee6f96a1077aace09df8bdf60b5d93ee172924b3bf73a462880b7c52adf87ab2
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
18+
:alt: License: LGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
20+
:target: https://github.com/OCA/web/tree/17.0/web_font_size_report_layout
21+
:alt: OCA/web
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_font_size_report_layout
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This Odoo module adds the capability to customize font size in all PDF
32+
reports throughout the system. Through a simple configuration,
33+
administrators can select from a range of predefined font sizes
34+
(measured in points) to optimize readability and appearance of invoices,
35+
quotations, sales orders, and other printed documents.
36+
37+
The module offers the following font size options (in points):
38+
39+
============ ==== =========================
40+
Option Size Description
41+
============ ==== =========================
42+
Extra Small 9pt For maximum compactness
43+
Standard 10pt Odoo's default size
44+
Small 11pt Just a little larger
45+
Large 12pt Better readability
46+
Extra Large 13pt Really Large
47+
2Extra Large 14pt For high visibility needs
48+
============ ==== =========================
49+
50+
**Table of contents**
51+
52+
.. contents::
53+
:local:
54+
55+
Installation
56+
============
57+
58+
1. Copy the ``web_font_size_report_layout`` directory to your Odoo
59+
addons folder
60+
2. Update the module list from developer mode
61+
3. Search for "Report Font Size in Document Layout" in the app store and
62+
install it.
63+
64+
Usage
65+
=====
66+
67+
Once installed:
68+
69+
1. Go to **Settings → General Settings → Companies → Configure Document
70+
Layout**
71+
2. Locate the new **"Font Size"** field
72+
3. Select your preferred size from the dropdown list
73+
4. Look at Preview or Download PDF Preview
74+
5. Save changes
75+
76+
Bug Tracker
77+
===========
78+
79+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
80+
In case of trouble, please check there if your issue has already been reported.
81+
If you spotted it first, help us to smash it by providing a detailed and welcomed
82+
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_font_size_report_layout%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
83+
84+
Do not contact contributors directly about support or help with technical issues.
85+
86+
Credits
87+
=======
88+
89+
Authors
90+
-------
91+
92+
* Binhex
93+
94+
Contributors
95+
------------
96+
97+
- `Binhex <https://www.binhex.cloud>`__:
98+
- Mario Montes<[email protected]>
99+
- Abraham J. Febres <[email protected]>
100+
101+
Maintainers
102+
-----------
103+
104+
This module is maintained by the OCA.
105+
106+
.. image:: https://odoo-community.org/logo.png
107+
:alt: Odoo Community Association
108+
:target: https://odoo-community.org
109+
110+
OCA, or the Odoo Community Association, is a nonprofit organization whose
111+
mission is to support the collaborative development of Odoo features and
112+
promote its widespread use.
113+
114+
This module is part of the `OCA/web <https://github.com/OCA/web/tree/17.0/web_font_size_report_layout>`_ project on GitHub.
115+
116+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "Report Font Size in Document Layout",
3+
"version": "17.0.1.1.0",
4+
"summary": "Adds a font size selector (pt) to the Document Layout wizard",
5+
"author": "Binhex," "Odoo Community Association (OCA)",
6+
"website": "https://github.com/OCA/web",
7+
"license": "LGPL-3",
8+
"depends": ["web"],
9+
"data": [
10+
"views/base_document_layout_views.xml",
11+
"views/report_templates_inherit.xml",
12+
],
13+
"assets": {
14+
"web.report_assets_common": [
15+
"web_font_size_report_layout/static/src/scss/report_font_size.scss"
16+
],
17+
"web.report_assets_pdf": [
18+
"web_font_size_report_layout/static/src/scss/report_font_size.scss"
19+
],
20+
},
21+
"installable": True,
22+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import res_company
2+
from . import base_document_layout
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# web_font_size_report_layout/models/base_document_layout.py
2+
import logging
3+
4+
from odoo import api, fields, models
5+
6+
_logger = logging.getLogger(__name__)
7+
8+
9+
class BaseDocumentLayout(models.TransientModel):
10+
_inherit = "base.document.layout"
11+
12+
report_font_size = fields.Selection(
13+
related="company_id.report_font_size",
14+
readonly=False,
15+
string="Font size",
16+
)
17+
18+
@api.onchange("report_font_size")
19+
def _onchange_report_font_size(self):
20+
func = getattr(self, "_compute_preview", None)
21+
if not callable(func):
22+
return
23+
try:
24+
func()
25+
except Exception as exc: # pylint: disable=broad-except
26+
_logger.debug("Failed computing document layout preview: %s", exc)
27+
self.preview = False
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
from odoo import api, fields, models
2+
3+
4+
class ResCompany(models.Model):
5+
_inherit = "res.company"
6+
7+
report_font_size = fields.Selection(
8+
selection=[
9+
("9", "9 pt"),
10+
("10", "10 pt"),
11+
("11", "11 pt"),
12+
("12", "12 pt"),
13+
("13", "13 pt"),
14+
("14", "14 pt"),
15+
],
16+
string="Report font size",
17+
default="11",
18+
help="Base font size for PDF content (in points), applied on the external "
19+
"report layout.",
20+
)
21+
22+
@api.model_create_multi
23+
def create(self, vals_list):
24+
companies = super().create(vals_list)
25+
style_fields = {
26+
"external_report_layout_id",
27+
"font",
28+
"report_font_size",
29+
"primary_color",
30+
"secondary_color",
31+
}
32+
if any(not style_fields.isdisjoint(values) for values in vals_list):
33+
self._update_asset_style()
34+
return companies
35+
36+
def write(self, values):
37+
res = super().write(values)
38+
style_fields = {
39+
"external_report_layout_id",
40+
"font",
41+
"report_font_size",
42+
"primary_color",
43+
"secondary_color",
44+
}
45+
if not style_fields.isdisjoint(values):
46+
self._update_asset_style()
47+
return res
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- [Binhex](https://www.binhex.cloud):
2+
- Mario Montes\<<[email protected]>\>
3+
- Abraham J. Febres \<<[email protected]>\>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
This Odoo module adds the capability to customize font size in all PDF reports throughout the system. Through a simple configuration, administrators can select from a range of predefined font sizes (measured in points) to optimize readability and appearance of invoices, quotations, sales orders, and other printed documents.
2+
3+
The module offers the following font size options (in points):
4+
5+
| Option | Size | Description |
6+
|--------|------|-------------|
7+
| Extra Small | 9pt | For maximum compactness |
8+
| Standard | 10pt | Odoo's default size |
9+
| Small | 11pt | Just a little larger |
10+
| Large | 12pt | Better readability |
11+
| Extra Large | 13pt | Really Large |
12+
| 2Extra Large | 14pt | For high visibility needs |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1. Copy the `web_font_size_report_layout` directory to your Odoo addons folder
2+
2. Update the module list from developer mode
3+
3. Search for "Report Font Size in Document Layout" in the app store and install it.

0 commit comments

Comments
 (0)