diff --git a/report_qweb_operating_unit/README.rst b/report_qweb_operating_unit/README.rst index 27b2a887cb..584f77270d 100644 --- a/report_qweb_operating_unit/README.rst +++ b/report_qweb_operating_unit/README.rst @@ -54,14 +54,16 @@ Authors * ForgeFlow S.L. * Serpent Consulting Services Pvt. Ltd. +* Onestein Contributors ------------ -- ForgeFlow S.L. -- Serpent Consulting Services Pvt. Ltd. -- Jarsa Sistemas -- Juany Davila +- ForgeFlow S.L. +- 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 dba1972fed..c8e86dd463 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 704e84a387..a3a81a7b08 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 4858f7e954..43f50dbbdc 100644 --- a/report_qweb_operating_unit/static/description/index.html +++ b/report_qweb_operating_unit/static/description/index.html @@ -399,6 +399,7 @@

Authors

  • ForgeFlow S.L.
  • Serpent Consulting Services Pvt. Ltd.
  • +
  • Onestein
@@ -408,6 +409,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>
  • 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 e70222b32c..38df090cdd 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 @@ -39,3 +39,17 @@ def test_rendering(self): .decode("utf8") ) self.assertIn(self.ou.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 @@ + +