Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions report_qweb_operating_unit/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

===============================
Qweb Report With Operating Unit
===============================
Expand All @@ -17,7 +13,7 @@ Qweb Report With Operating Unit
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github
Expand Down Expand Up @@ -58,6 +54,7 @@ Authors

* ForgeFlow S.L.
* Serpent Consulting Services Pvt. Ltd.
* Onestein

Contributors
------------
Expand All @@ -66,6 +63,7 @@ Contributors
- Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
- Jarsa Sistemas <info@jarsa.com.mx>
- Juany Davila <juany.davila@forgeflow.com>
- Dennis Sluijk <d.sluijk@onestein.nl>

Maintainers
-----------
Expand Down
1 change: 1 addition & 0 deletions report_qweb_operating_unit/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"license": "LGPL-3",
"author": "ForgeFlow S.L., "
"Serpent Consulting Services Pvt. Ltd.,"
"Onestein,"
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/operating-unit",
"depends": ["operating_unit"],
Expand Down
14 changes: 14 additions & 0 deletions report_qweb_operating_unit/models/operating_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ class OperatingUnit(models.Model):
is_operating_unit_details_empty = fields.Boolean(
compute="_compute_empty_operating_unit_details"
)
partner_image = fields.Image(
string="Logo",
compute="_compute_partner_image",
inverse="_inverse_partner_image",
)

@api.depends("partner_id", "partner_id.image_1920")
def _compute_partner_image(self):
for operating_unit in self:
operating_unit.partner_image = operating_unit.partner_id.image_1920

def _inverse_partner_image(self):
for operating_unit in self:
operating_unit.partner_id.image_1920 = operating_unit.partner_image

@api.depends("company_id")
def _compute_report_header(self):
Expand Down
1 change: 1 addition & 0 deletions report_qweb_operating_unit/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
- Serpent Consulting Services Pvt. Ltd. \<<support@serpentcs.com>\>
- Jarsa Sistemas \<<info@jarsa.com.mx>\>
- Juany Davila \<<juany.davila@forgeflow.com>\>
- Dennis Sluijk \<<d.sluijk@onestein.nl>\>
26 changes: 11 additions & 15 deletions report_qweb_operating_unit/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>Qweb Report With Operating Unit</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,21 +360,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="qweb-report-with-operating-unit">
<h1 class="title">Qweb Report With Operating Unit</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="qweb-report-with-operating-unit">
<h1>Qweb Report With Operating Unit</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:15241c0b3e7fd452963ef2390802c16ff7d144796e7e14af19e7f0736200f986
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" 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 image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/license-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/operating-unit/tree/18.0/report_qweb_operating_unit"><img alt="OCA/operating-unit" src="https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/operating-unit-18-0/operating-unit-18-0-report_qweb_operating_unit"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/operating-unit&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" 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 image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/operating-unit/tree/18.0/report_qweb_operating_unit"><img alt="OCA/operating-unit" src="https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/operating-unit-18-0/operating-unit-18-0-report_qweb_operating_unit"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/operating-unit&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to use custom operating unit headers for any report
in Odoo</p>
<p><strong>Table of contents</strong></p>
Expand All @@ -390,33 +385,35 @@ <h1>Qweb Report With Operating Unit</h1>
</ul>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/operating-unit/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/operating-unit/issues/new?body=module:%20report_qweb_operating_unit%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#toc-entry-2">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-3">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<ul class="simple">
<li>ForgeFlow S.L.</li>
<li>Serpent Consulting Services Pvt. Ltd.</li>
<li>Onestein</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-4">Contributors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<ul class="simple">
<li>ForgeFlow S.L. &lt;<a class="reference external" href="mailto:contact&#64;forgeflow.com">contact&#64;forgeflow.com</a>&gt;</li>
<li>Serpent Consulting Services Pvt. Ltd. &lt;<a class="reference external" href="mailto:support&#64;serpentcs.com">support&#64;serpentcs.com</a>&gt;</li>
<li>Jarsa Sistemas &lt;<a class="reference external" href="mailto:info&#64;jarsa.com.mx">info&#64;jarsa.com.mx</a>&gt;</li>
<li>Juany Davila &lt;<a class="reference external" href="mailto:juany.davila&#64;forgeflow.com">juany.davila&#64;forgeflow.com</a>&gt;</li>
<li>Dennis Sluijk &lt;<a class="reference external" href="mailto:d.sluijk&#64;onestein.nl">d.sluijk&#64;onestein.nl</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-5">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" />
Expand All @@ -429,6 +426,5 @@ <h3><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,17 @@ def test_rendering(self):
.decode("utf8")
)
self.assertIn(self.ou1.report_header, html)

def test_compute_partner_image(self):
empty_image = (
b"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC"
b"0lEQVR42mP8/x8AAwMCAO5WCKsAAAAASUVORK5CYII="
)
other_image = (
b"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC"
b"0lEQVR42mNgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII="
)
self.ou.partner_image = empty_image
self.assertEqual(self.ou.partner_id.image_1920, empty_image)
self.ou.partner_id.image_1920 = other_image
self.assertEqual(self.ou.partner_image, other_image)
10 changes: 10 additions & 0 deletions report_qweb_operating_unit/views/operating_unit_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
<notebook>
<page string="Report Layout">
<group>
<field
name="partner_image"
widget="image"
options="{'size': [100, 100]}"
/>
<p
class="alert alert-info"
colspan="2"
role="alert"
>Address and other information that appear on the report can be changed on the partner form</p>
<field name="report_header" />
<field name="report_footer" />
<field name="operating_unit_details" />
Expand Down
Loading