Skip to content

Commit

Permalink
[FIX] joint_buying_* : restore cool / fresh / normal distinction on r…
Browse files Browse the repository at this point in the history
…eport
  • Loading branch information
legalsylvain committed Dec 3, 2023
1 parent d6ed237 commit 30563fa
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 78 deletions.
5 changes: 5 additions & 0 deletions joint_buying_base/models/joint_buying_tour.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,8 @@ def _prepare_base_data(transport_request_line):

res = sorted(res, key=key)
return res

def get_report_tour_category_url(self, category):
"""Overload in other module, to return the path to an image
for the given category"""
return ""

Check warning on line 412 in joint_buying_base/models/joint_buying_tour.py

View check run for this annotation

Codecov / codecov/patch

joint_buying_base/models/joint_buying_tour.py#L412

Added line #L412 was not covered by tests
12 changes: 0 additions & 12 deletions joint_buying_base/models/joint_buying_transport_request_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,3 @@ class JointBuyingTransportRequestLine(models.Model):
)

distance = fields.Float(related="tour_line_id.distance")

# def get_report_information(self):
# self.ensure_one()
# if self.request_id.order_id:
# order_lines = self.mapped("request_id.order_id.line_ids").filtered(
# lambda x: x.qty != 0
# )
# return {
# "all": [
# (x.product_id, f"{x.qty} x {x.uom_id.name}") for x in order_lines
# ]
# }
15 changes: 11 additions & 4 deletions joint_buying_base/reports/report_joint_buying_tour.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@

<t t-foreach="data_list" t-as="data_item">
<!-- New STEP (HANDLING SEQUENCE) -->
<h3 t-if="data_item['handling_sequence'] != handling_sequence"
<t t-if="data_item['handling_sequence'] != handling_sequence"
t-att-style="title_style"
>
<t t-set="handling_sequence" t-value="data_item['handling_sequence']" />
<t t-set="action_type" t-value="" />
<t t-set="product_category" t-value="" />
<span t-esc="handling_sequence" /> / <span t-esc="doc.stop_qty + 2" /> -
<span t-esc="data_item['handling_partner'].name"/>
</h3>
<hr size="3"/>
<h3>
<span t-esc="handling_sequence" /> / <span t-esc="doc.stop_qty + 2" /> -
<span t-esc="data_item['handling_partner'].name"/>
</h3>
<hr size="3"/>
</t>

<t t-if="data_item['action_type'] == '2_loading'">
<t t-set="section_style" t-value="'background-color:#FFA;'"/>
Expand All @@ -36,6 +40,9 @@
<t t-set="action_type" t-value="data_item['action_type']" />
<t t-set="request_id" t-value="" />
<t t-set="product_category" t-value="data_item['product_category']" />
<t t-if="product_category">
<img style="width:32px;height:32px;" t-att-src="doc.get_report_tour_category_url(product_category)"/>
</t>
<t t-if="action_type == '1_unloading'">Unloading</t>
<t t-if="action_type == '2_loading'">Loading</t>
</h4>
Expand Down
1 change: 0 additions & 1 deletion joint_buying_product_food/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"data": [
"views/view_res_partner.xml",
"views/view_product_product.xml",
"reports/report_joint_buying_tour.xml",
],
"installable": True,
"auto_install": True,
Expand Down
3 changes: 2 additions & 1 deletion joint_buying_product_food/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import joint_buying_transport_request_line
from . import product_product
from . import joint_buying_tour
12 changes: 12 additions & 0 deletions joint_buying_product_food/models/joint_buying_tour.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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 JointBuyingTour(models.Model):
_inherit = "joint.buying.tour"

def get_report_tour_category_url(self, category):
return f"/joint_buying_product_food/static/description/{category}.png"

This file was deleted.

15 changes: 15 additions & 0 deletions joint_buying_product_food/models/product_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 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 ProductProduct(models.Model):
_inherit = "product.product"

def _get_report_tour_category(self):
"""Overload in other module, to return category that
will impact order in the joint.buying.tour report"""
self.ensure_one()
return self.storage_method or "normal"
30 changes: 0 additions & 30 deletions joint_buying_product_food/reports/report_joint_buying_tour.xml

This file was deleted.

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 30563fa

Please sign in to comment.