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
10 changes: 6 additions & 4 deletions report_qweb_operating_unit/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,16 @@ Authors

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

Contributors
------------

- ForgeFlow S.L. <contact@forgeflow.com>
- Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
- Jarsa Sistemas <info@jarsa.com.mx>
- Juany Davila <juany.davila@forgeflow.com>
- ForgeFlow S.L. <contact@forgeflow.com>
- 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>\>
2 changes: 2 additions & 0 deletions report_qweb_operating_unit/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ <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">
Expand All @@ -408,6 +409,7 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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