Skip to content

Commit 78ff26f

Browse files
committed
[MIG] l10n_it_central_journal_reportlab: Migration to 16.0
1 parent 783039e commit 78ff26f

8 files changed

Lines changed: 85 additions & 83 deletions

File tree

l10n_it_central_journal_reportlab/README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ ITA - Libro giornale - Reportlab
1414
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1515
:alt: License: AGPL-3
1616
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
17-
:target: https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_central_journal_reportlab
17+
:target: https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_central_journal_reportlab
1818
:alt: OCA/l10n-italy
1919
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20-
:target: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_central_journal_reportlab
20+
:target: https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_central_journal_reportlab
2121
:alt: Translate me on Weblate
2222
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23-
:target: https://runbot.odoo-community.org/runbot/122/14.0
23+
:target: https://runbot.odoo-community.org/runbot/122/16.0
2424
:alt: Try me on Runbot
2525

2626
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -44,7 +44,7 @@ Bug Tracker
4444
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
4545
In case of trouble, please check there if your issue has already been reported.
4646
If you spotted it first, help us smashing it by providing a detailed and welcomed
47-
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_central_journal_reportlab%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
47+
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_central_journal_reportlab%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
4848

4949
Do not contact contributors directly about support or help with technical issues.
5050

@@ -77,6 +77,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
7777
mission is to support the collaborative development of Odoo features and
7878
promote its widespread use.
7979

80-
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_central_journal_reportlab>`_ project on GitHub.
80+
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_central_journal_reportlab>`_ project on GitHub.
8181

8282
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

l10n_it_central_journal_reportlab/__manifest__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33

44
{
55
"name": "ITA - Libro giornale - Reportlab",
6-
"version": "14.0.1.0.0",
6+
"version": "16.0.1.0.0",
77
"development_status": "Beta",
88
"category": "Localization/Italy",
99
"author": "Gianmarco Conte - Dinamiche Aziendali srl, "
1010
"Odoo Community Association (OCA)",
1111
"website": "https://github.com/OCA/l10n-italy",
1212
"license": "AGPL-3",
13+
"maintainers": ["MarcoCalcagni", "Borruso"],
1314
"depends": ["account", "date_range"],
1415
"data": [
1516
"security/ir.model.access.csv",

l10n_it_central_journal_reportlab/models/account.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,5 @@ class DateRangeInherit(models.Model):
1515
date_last_print = fields.Date("Last printed date")
1616
progressive_page_number = fields.Integer("Progressive of the page")
1717
progressive_line_number = fields.Integer("Progressive line")
18-
progressive_credit = fields.Float(
19-
"Progressive Credit",
20-
digits="Account",
21-
)
22-
progressive_debit = fields.Float(
23-
"Progressive Debit",
24-
digits="Account",
25-
)
18+
progressive_credit = fields.Float(digits="Account")
19+
progressive_debit = fields.Float(digits="Account")

l10n_it_central_journal_reportlab/static/description/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
44
<head>
55
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6-
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
6+
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
77
<title>ITA - Libro giornale - Reportlab</title>
88
<style type="text/css">
99

@@ -367,7 +367,7 @@ <h1 class="title">ITA - Libro giornale - Reportlab</h1>
367367
!! This file is generated by oca-gen-addon-readme !!
368368
!! changes will be overwritten. !!
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
370-
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_central_journal_reportlab"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_central_journal_reportlab"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/122/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
370+
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_central_journal_reportlab"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_central_journal_reportlab"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/122/16.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
371371
<p><strong>Italiano</strong></p>
372372
<p>Modulo per la stampa del libro giornale con reportlab</p>
373373
<p><strong>English</strong></p>
@@ -389,7 +389,7 @@ <h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
389389
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-italy/issues">GitHub Issues</a>.
390390
In case of trouble, please check there if your issue has already been reported.
391391
If you spotted it first, help us smashing it by providing a detailed and welcomed
392-
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_central_journal_reportlab%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
392+
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_central_journal_reportlab%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
393393
<p>Do not contact contributors directly about support or help with technical issues.</p>
394394
</div>
395395
<div class="section" id="credits">
@@ -416,7 +416,7 @@ <h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
416416
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
417417
mission is to support the collaborative development of Odoo features and
418418
promote its widespread use.</p>
419-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_central_journal_reportlab">OCA/l10n-italy</a> project on GitHub.</p>
419+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_central_journal_reportlab">OCA/l10n-italy</a> project on GitHub.</p>
420420
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
421421
</div>
422422
</div>

l10n_it_central_journal_reportlab/tests/test_central_journal_reportlab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def setUp(self):
3535
)
3636
self.wizard_model = self.env["wizard.giornale.reportlab"]
3737
self.report_model = self.env["ir.actions.report"]
38-
self.report_name = "l10n_it_central_journal_reportlab.report_giornale_reportlab"
38+
self.report_name = "central_journal_reportlab.report_giornale_reportlab"
3939
self.journals = self.env["account.journal"].search([])
4040

4141
def test_wizard_reportlab(self):
Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,44 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<odoo>
3-
<data>
43

5-
<record id="view_central_journal_account_journal_form" model="ir.ui.view">
6-
<field name="name">view.central.journal.account.journal.form</field>
7-
<field name="model">account.journal</field>
8-
<field name="inherit_id" ref="account.view_account_journal_form" />
9-
<field name="arch" type="xml">
10-
<xpath expr="//field[@name='loss_account_id']" position="after">
11-
<field name="central_journal_exclude" />
12-
</xpath>
13-
</field>
14-
</record>
4+
<record id="view_central_journal_account_journal_form" model="ir.ui.view">
5+
<field name="name">view.central.journal.account.journal.form</field>
6+
<field name="model">account.journal</field>
7+
<field name="inherit_id" ref="account.view_account_journal_form" />
8+
<field name="arch" type="xml">
9+
<xpath expr="//field[@name='loss_account_id']" position="after">
10+
<field name="central_journal_exclude" />
11+
</xpath>
12+
</field>
13+
</record>
1514

16-
<record id="view_date_range_form_inherit_view" model="ir.ui.view">
17-
<field name="name">date.range.form</field>
18-
<field name="model">date.range</field>
19-
<field name="inherit_id" ref="date_range.view_date_range_form_view" />
20-
<field name="arch" type="xml">
21-
<xpath expr="/form/group" position="after">
22-
<separator string="General Journal Info" />
23-
<group>
24-
<field name="date_last_print" />
25-
<field name="progressive_page_number" />
26-
<field name="progressive_line_number" />
27-
<field name="progressive_credit" />
28-
<field name="progressive_debit" />
29-
</group>
30-
</xpath>
31-
</field>
32-
</record>
15+
<record id="view_date_range_form_inherit_view" model="ir.ui.view">
16+
<field name="name">date.range.form</field>
17+
<field name="model">date.range</field>
18+
<field name="inherit_id" ref="date_range.view_date_range_form_view" />
19+
<field name="arch" type="xml">
20+
<xpath expr="/form/group" position="after">
21+
<separator string="General Journal Info" />
22+
<group>
23+
<field name="date_last_print" />
24+
<field name="progressive_page_number" />
25+
<field name="progressive_line_number" />
26+
<field name="progressive_credit" />
27+
<field name="progressive_debit" />
28+
</group>
29+
</xpath>
30+
</field>
31+
</record>
3332

34-
<record id="view_date_range_inherit_tree" model="ir.ui.view">
35-
<field name="name">date.range.tree.inherit</field>
36-
<field name="model">date.range</field>
37-
<field name="inherit_id" ref="date_range.view_date_range_tree" />
38-
<field name="arch" type="xml">
39-
<xpath expr="//tree" position="attributes">
40-
<attribute name="editable" />
41-
</xpath>
42-
</field>
43-
</record>
33+
<record id="view_date_range_inherit_tree" model="ir.ui.view">
34+
<field name="name">date.range.tree.inherit</field>
35+
<field name="model">date.range</field>
36+
<field name="inherit_id" ref="date_range.view_date_range_tree" />
37+
<field name="arch" type="xml">
38+
<xpath expr="//tree" position="attributes">
39+
<attribute name="editable" />
40+
</xpath>
41+
</field>
42+
</record>
4443

45-
</data>
4644
</odoo>

l10n_it_central_journal_reportlab/wizard/print_giornale.py

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright 2018 Gianmarco Conte (gconte@dinamicheaziendali.it)
2+
# Copyright 2022 Giuseppe Borruso (gborruso@dinamicheaziendali.it)
23

34
import base64
45
import io
@@ -46,7 +47,7 @@ def _get_journal(self):
4647
company_id = fields.Many2one(
4748
related="daterange_id.company_id", readonly=True, store=True
4849
)
49-
progressive_credit = fields.Float("Progressive Credit")
50+
progressive_credit = fields.Float()
5051
progressive_debit2 = fields.Float("Progressive Debit")
5152
print_state = fields.Selection(
5253
[("print", "Ready for printing"), ("printed", "Printed")],
@@ -65,28 +66,24 @@ def _get_journal(self):
6566
)
6667
target_move = fields.Selection(
6768
[("all", "All"), ("posted", "Posted"), ("draft", "Draft")],
68-
"Target Move",
6969
default="all",
7070
)
7171
fiscal_page_base = fields.Integer("Last printed page", required=True)
7272
start_row = fields.Integer("Start row", required=True)
7373
year_footer = fields.Char(
7474
string="Year for Footer",
75-
help="Value printed near number " "of page in the footer",
75+
help="Value printed near number of page in the footer",
7676
)
77-
report_giornale = fields.Binary(string="Report Giornale")
78-
report_giornale_name = fields.Char(
79-
string="Report Giornale Name",
80-
compute="_compute_report_giornale_name",
81-
)
82-
group_by_account = fields.Boolean(string="Group by account", default=False)
77+
report_giornale = fields.Binary()
78+
report_giornale_name = fields.Char(compute="_compute_report_giornale_name")
79+
group_by_account = fields.Boolean(default=False)
8380

8481
@api.depends("report_giornale", "daterange_id")
8582
def _compute_report_giornale_name(self):
8683
for wizard in self:
8784
if wizard.report_giornale and wizard.daterange_id:
88-
wizard.report_giornale_name = _(
89-
"Account Central Journal - %s.pdf" % wizard.daterange_id.name
85+
wizard.report_giornale_name = (
86+
_("Account Central Journal - %s.pdf") % wizard.daterange_id.name
9087
)
9188
elif wizard.report_giornale:
9289
wizard.report_giornale_name = _("Account Central Journal.pdf")
@@ -204,7 +201,11 @@ def _get_account_name_reportlab(self, line):
204201
def get_template_header_report_giornale(self, report, height_available):
205202
report.setFont("Helvetica-Bold", 12)
206203
height_available -= gap
207-
report.drawString(margin_left, height_available, self.env.user.company_id.name)
204+
report.drawString(
205+
margin_left,
206+
height_available,
207+
self.env.user.company_id.name + _(" Account Central Journal"),
208+
)
208209
report.setFont("Helvetica", 10)
209210
text = ""
210211
if self.env.user.company_id.street:
@@ -223,7 +224,10 @@ def get_template_header_report_giornale(self, report, height_available):
223224

224225
def get_template_footer_report_giornale(self, report):
225226
page_num = report.getPageNumber() + self.fiscal_page_base
226-
page_text = _("Page: %s / %s" % (self.year_footer, page_num))
227+
page_text = _("Page: %(year_footer)s / %(page_num)s") % {
228+
"year_footer": self.year_footer,
229+
"page_num": page_num,
230+
}
227231
report.drawString(margin_left, margin_bottom + 12, page_text)
228232

229233
def get_styles_report_giornale_line(self):
@@ -390,7 +394,10 @@ def get_final_tables_report_giornale(
390394
move = Paragraph(move_name, style_name)
391395
account_name = self._get_account_name_reportlab(line)
392396
account = Paragraph(account_name, style_name)
393-
if line.account_id.user_type_id.type in ["receivable", "payable"]:
397+
if line.account_id.account_type in [
398+
"asset_receivable",
399+
"liability_payable",
400+
]:
394401
name = Paragraph(str(line.partner_id.name or ""), style_name)
395402
else:
396403
name = Paragraph(str(line.name or ""), style_name)
@@ -553,14 +560,13 @@ def create_report_giornale_reportlab(self):
553560
def print_giornale_reportlab(self):
554561
self.create_report_giornale_reportlab()
555562

556-
model_data_obj = self.env["ir.model.data"]
557-
view_rec = model_data_obj.get_object_reference(
558-
"l10n_it_central_journal_reportlab", "wizard_giornale_reportlab"
563+
view_id = self.env.ref(
564+
"l10n_it_central_journal_reportlab.wizard_giornale_reportlab",
565+
raise_if_not_found=False,
559566
)
560-
view_id = view_rec and view_rec[1] or False
561567

562568
return {
563-
"view_id": [view_id],
569+
"view_id": view_id.id,
564570
"view_mode": "form",
565571
"res_model": "wizard.giornale.reportlab",
566572
"res_id": self.id,
@@ -585,14 +591,13 @@ def print_giornale_reportlab_final(self):
585591
}
586592
self.daterange_id.write(daterange_vals)
587593

588-
model_data_obj = self.env["ir.model.data"]
589-
view_rec = model_data_obj.get_object_reference(
590-
"l10n_it_central_journal_reportlab", "wizard_giornale_reportlab"
594+
view_id = self.env.ref(
595+
"l10n_it_central_journal_reportlab.wizard_giornale_reportlab",
596+
raise_if_not_found=False,
591597
)
592-
view_id = view_rec and view_rec[1] or False
593598

594599
return {
595-
"view_id": [view_id],
600+
"view_id": view_id.id,
596601
"view_mode": "form",
597602
"res_model": "wizard.giornale.reportlab",
598603
"res_id": self.id,

l10n_it_central_journal_reportlab/wizard/print_giornale.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<odoo>
3+
34
<record id="wizard_giornale_reportlab" model="ir.ui.view">
45
<field name="name">General Journal Reportlab</field>
56
<field name="model">wizard.giornale.reportlab</field>
@@ -8,7 +9,9 @@
89
<form string="General Journal">
910
<separator string="Dates movements" />
1011
<group>
11-
<field name="daterange_id" />
12+
<!-- use only date range with company set -->
13+
<!-- because company giornale depends on date range -->
14+
<field name="daterange_id" domain="[('company_id', '!=', False)]" />
1215
<field name="company_id" />
1316
<field name="group_by_account" />
1417
<field name="last_def_date_print" readonly="1" />
@@ -81,4 +84,5 @@
8184
action="action_giornale_reportlab"
8285
id="menu_giornale"
8386
/>
87+
8488
</odoo>

0 commit comments

Comments
 (0)