diff --git a/report_qweb_operating_unit/README.rst b/report_qweb_operating_unit/README.rst index c579a22769..e30abf032c 100644 --- a/report_qweb_operating_unit/README.rst +++ b/report_qweb_operating_unit/README.rst @@ -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 =============================== @@ -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 @@ -58,6 +54,7 @@ Authors * ForgeFlow S.L. * Serpent Consulting Services Pvt. Ltd. +* Onestein Contributors ------------ @@ -66,6 +63,7 @@ Contributors - Serpent Consulting Services Pvt. Ltd. - Jarsa Sistemas - Juany Davila +- Dennis Sluijk Maintainers ----------- diff --git a/report_qweb_operating_unit/__manifest__.py b/report_qweb_operating_unit/__manifest__.py index 13e4231dc5..95a82cb209 100644 --- a/report_qweb_operating_unit/__manifest__.py +++ b/report_qweb_operating_unit/__manifest__.py @@ -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"], diff --git a/report_qweb_operating_unit/models/operating_unit.py b/report_qweb_operating_unit/models/operating_unit.py index 23fa3eaaf5..0e4824d4f1 100644 --- a/report_qweb_operating_unit/models/operating_unit.py +++ b/report_qweb_operating_unit/models/operating_unit.py @@ -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): diff --git a/report_qweb_operating_unit/readme/CONTRIBUTORS.md b/report_qweb_operating_unit/readme/CONTRIBUTORS.md index 0e9ebbf5b0..78e3fec250 100644 --- a/report_qweb_operating_unit/readme/CONTRIBUTORS.md +++ b/report_qweb_operating_unit/readme/CONTRIBUTORS.md @@ -2,3 +2,4 @@ - Serpent Consulting Services Pvt. Ltd. \<\> - Jarsa Sistemas \<\> - Juany Davila \<\> +- Dennis Sluijk \<\> diff --git a/report_qweb_operating_unit/static/description/index.html b/report_qweb_operating_unit/static/description/index.html index aa649bdaf5..547ff63916 100644 --- a/report_qweb_operating_unit/static/description/index.html +++ b/report_qweb_operating_unit/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +Qweb Report With Operating Unit -
+
+

Qweb Report With Operating Unit

- - -Odoo Community Association - -
-

Qweb Report With Operating Unit

-

Beta License: LGPL-3 OCA/operating-unit Translate me on Weblate Try me on Runboat

+

Beta License: LGPL-3 OCA/operating-unit Translate me on Weblate Try me on Runboat

This module allows to use custom operating unit headers for any report in Odoo

Table of contents

@@ -390,7 +385,7 @@

Qweb Report With Operating Unit

-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. 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 @@ -398,25 +393,27 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

  • ForgeFlow S.L.
  • Serpent Consulting Services Pvt. Ltd.
  • +
  • Onestein
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -429,6 +426,5 @@

Maintainers

-
diff --git a/report_qweb_operating_unit/tests/test_report_qweb_operating_unit.py b/report_qweb_operating_unit/tests/test_report_qweb_operating_unit.py index 4892cb4c36..dbd18924b6 100644 --- a/report_qweb_operating_unit/tests/test_report_qweb_operating_unit.py +++ b/report_qweb_operating_unit/tests/test_report_qweb_operating_unit.py @@ -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) diff --git a/report_qweb_operating_unit/views/operating_unit_view.xml b/report_qweb_operating_unit/views/operating_unit_view.xml index 9705a532f3..8fbc793d1f 100644 --- a/report_qweb_operating_unit/views/operating_unit_view.xml +++ b/report_qweb_operating_unit/views/operating_unit_view.xml @@ -9,6 +9,16 @@ + +