Skip to content

Commit

Permalink
[IMP] joint_buying_product_food : display frozen / cold / etc.. on jo…
Browse files Browse the repository at this point in the history
…int.buying.tour report
  • Loading branch information
legalsylvain committed Nov 20, 2023
1 parent 2c0c8a2 commit 8764760
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 1 deletion.
1 change: 1 addition & 0 deletions joint_buying_product_food/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
6 changes: 5 additions & 1 deletion joint_buying_product_food/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
"joint_buying_product",
"product_food",
],
"data": ["views/view_res_partner.xml", "views/view_product_product.xml"],
"data": [
"views/view_res_partner.xml",
"views/view_product_product.xml",
"reports/report_joint_buying_tour.xml",
],
"installable": True,
"auto_install": True,
}
1 change: 1 addition & 0 deletions joint_buying_product_food/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import joint_buying_transport_request_line
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (C) 2023-Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models


class JointBuyingTransportRequestLine(models.Model):
_inherit = "joint.buying.transport.request.line"

def get_report_information(self):
self.ensure_one()
res = super().get_report_information()

Check warning on line 13 in joint_buying_product_food/models/joint_buying_transport_request_line.py

View check run for this annotation

Codecov / codecov/patch

joint_buying_product_food/models/joint_buying_transport_request_line.py#L12-L13

Added lines #L12 - L13 were not covered by tests
if self.request_id.order_id:
return {
"normal": [
x for x in filter(lambda x: x[0].storage_method, res["all"])
],
"cool": [
x
for x in filter(lambda x: x[0].storage_method == "cool", res["all"])
],
"frozen": [
x
for x in filter(
lambda x: x[0].storage_method == "frozen", res["all"]
)
],
}
return res

Check warning on line 30 in joint_buying_product_food/models/joint_buying_transport_request_line.py

View check run for this annotation

Codecov / codecov/patch

joint_buying_product_food/models/joint_buying_transport_request_line.py#L30

Added line #L30 was not covered by tests
8 changes: 8 additions & 0 deletions joint_buying_product_food/readme/CREDIT.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
* https://www.flaticon.com/fr/icone-gratuite/thermometres_2756893
by https://www.flaticon.com/fr/auteurs/fauzidea

* https://www.flaticon.com/fr/icone-gratuite/temperature_2322701
by https://www.flaticon.com/fr/auteurs/nawicon

* https://www.flaticon.com/fr/icone-gratuite/bonhomme-de-neige_1331175
by https://www.flaticon.com/fr/auteurs/freepik
30 changes: 30 additions & 0 deletions joint_buying_product_food/reports/report_joint_buying_tour.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2023 - Today: GRAP (http://www.grap.coop)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<template id="report_joint_buying_tour_document_request_lines" inherit_id="joint_buying_product.report_joint_buying_tour_document_request_lines">

<xpath expr="//t[@t-as='line_info']" position="before">
<span t-if="all_infos[key] and key == 'normal'" style="float:left;">
<img style="width:32px;height:32px;"
t-att-src="'/joint_buying_product_food/static/description/normal.png'"/>
</span>

<span t-if="all_infos[key] and key == 'cool'" style="float:left;">
<img style="width:32px;height:32px;"
t-att-src="'/joint_buying_product_food/static/description/cool.png'"/>
</span>

<span t-if="all_infos[key] and key == 'frozen'" style="float:left;">
<img style="width:32px;height:32px;"
t-att-src="'/joint_buying_product_food/static/description/frozen.png'"/>
</span>
</xpath>

</template>

</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8764760

Please sign in to comment.