Skip to content

Commit

Permalink
[14.0][FEAT]: Improve l10n_ch_invoice_reports
Browse files Browse the repository at this point in the history
  • Loading branch information
victorvermot committed Sep 11, 2024
1 parent 6009409 commit cdc74ac
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 15 deletions.
8 changes: 6 additions & 2 deletions l10n_ch_invoice_reports/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
{
"name": "Switzerland - Invoice Reports with payment option",
"summary": "Extend invoice to add ISR/QR payment slip",
"version": "14.0.1.3.0",
"version": "14.0.1.4.0",
"author": "Camptocamp,Odoo Community Association (OCA)",
"category": "Localization",
"website": "https://github.com/OCA/l10n-switzerland",
"license": "AGPL-3",
"depends": ["account", "l10n_ch", "web"],
"data": ["data/reports.xml", "data/mail_template.xml"],
"data": [
"data/reports.xml",
"data/mail_template.xml",
"views/res_config_settings.xml",
],
"auto_install": False,
"installable": True,
}
9 changes: 6 additions & 3 deletions l10n_ch_invoice_reports/models/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ def _render_qweb_pdf(self, res_ids=None, data=None):
if self.report_name not in reports or not res_ids:
return super()._render_qweb_pdf(res_ids, data)

inv_report = self._get_report_from_name("account.report_invoice")
qr_report = self._get_report_from_name("l10n_ch.qr_report_main")

inv_report = self.env["ir.actions.report"].browse(

Check warning on line 45 in l10n_ch_invoice_reports/models/report.py

View check run for this annotation

Codecov / codecov/patch

l10n_ch_invoice_reports/models/report.py#L45

Added line #L45 was not covered by tests
int(self.env["ir.config_parameter"].sudo().get_param("invoice_report_id"))
) or self._get_report_from_name("account.report_invoice")
qr_report = self.env["ir.actions.report"].browse(

Check warning on line 48 in l10n_ch_invoice_reports/models/report.py

View check run for this annotation

Codecov / codecov/patch

l10n_ch_invoice_reports/models/report.py#L48

Added line #L48 was not covered by tests
int(self.env["ir.config_parameter"].sudo().get_param("qr_report_id"))
) or self._get_report_from_name("l10n_ch.qr_report_main")
io_list = []
for inv in self.env["account.move"].browse(res_ids):
invoice_pdf, _ = inv_report._render_qweb_pdf(inv.id, data)
Expand Down
2 changes: 2 additions & 0 deletions l10n_ch_invoice_reports/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ class ResCompany(models.Model):
string="Print invoice with QR bill",
default=True,
)
invoice_report_id = fields.Many2one("ir.actions.report", string="Invoice Report")
qr_report_id = fields.Many2one("ir.actions.report", string="QR Report")
12 changes: 12 additions & 0 deletions l10n_ch_invoice_reports/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,15 @@ class ResConfigSettings(models.TransientModel):
string="Print invoice with QR bill",
readonly=False,
)
invoice_report_id = fields.Many2one(
related="company_id.invoice_report_id",
string="Invoice Report",
readonly=False,
config_parameter="invoice_report_id",
)
qr_report_id = fields.Many2one(
related="company_id.qr_report_id",
string="QR Report",
readonly=False,
config_parameter="qr_report_id",
)
12 changes: 7 additions & 5 deletions l10n_ch_invoice_reports/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand All @@ -9,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -433,7 +433,9 @@ <h2><a class="toc-backref" href="#toc-entry-6">Other credits</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
Expand Down
27 changes: 22 additions & 5 deletions l10n_ch_invoice_reports/views/res_config_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,34 @@
</div>
<div class="mt16">
<div class="content-group" id="invoice_report_options">
<div class="row">
<field
name="print_qr_invoice"
class="col-lg-1 ml16"
<field name="print_qr_invoice" class="mb16" />
<label for="print_qr_invoice" />
<span
class="fa fa-lg fa-building-o"
title="Values set here are company-specific."
/>
<div>
<label for="invoice_report_id" />
<span
class="fa fa-lg fa-building-o"
title="Values set here are company-specific."
/>
<label for="print_qr_invoice" />
</div>
<div class="text-muted">
Report invoice printed
</div>
<field name="invoice_report_id" class="mb16" />
<div>
<label for="qr_report_id" />
<span
class="fa fa-lg fa-building-o"
title="Values set here are company-specific."
/>
</div>
<div class="text-muted">
QR invoice printed
</div>
<field name="qr_report_id" class="mb16" />
</div>
</div>
</div>
Expand Down

0 comments on commit cdc74ac

Please sign in to comment.