Skip to content

Commit

Permalink
[FIX] joint_buying_base : Use Case : product availability is after th…
Browse files Browse the repository at this point in the history
…e truck has left, but before it passes through
  • Loading branch information
legalsylvain committed Dec 11, 2023
1 parent ea6ec67 commit e81e9c7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
12 changes: 12 additions & 0 deletions joint_buying_base/demo/joint_buying_transport_request.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@
]]></field>
</record>

<record id="request_vev_lse_week_1" model="joint.buying.transport.request">
<field name="manual_start_partner_id" model="res.partner" eval="obj().env.ref('joint_buying_base.company_VEV').joint_buying_partner_id.id"/>
<field name="manual_arrival_partner_id" model="res.partner" eval="obj().env.ref('joint_buying_base.company_LSE').joint_buying_partner_id.id"/>
<field name="manual_availability_date" eval="(DateTime.today() + timedelta(days=1)).strftime('%Y-%m-%d 07:01')"/>
<field name="manual_amount_untaxed">111</field>
<field name="manual_total_weight">22</field>
<field name="manual_description"><![CDATA[
Products that should be taken in VEV, because it is available after
the begining of the tour, but before the truck pass over VEV
]]></field>
</record>

<record id="request_vev_fumet_dombes_week_1" model="joint.buying.transport.request">
<field name="manual_start_partner_id" model="res.partner" eval="obj().env.ref('joint_buying_base.company_VEV').joint_buying_partner_id.id"/>
<field name="manual_arrival_partner_id" ref="joint_buying_base.supplier_fumet_dombes"/>
Expand Down
12 changes: 12 additions & 0 deletions joint_buying_base/tests/test_joint_buying_wizard_find_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ def test_24_transport_request_vev_che_week_2(self):
"computed",
)

def test_25_transport_request_vev_LSE_week_1(self):
"""Complex case: product availability is after the truck has left,
but before it passes through"""
self._verify_tour_lines_computation(
"joint_buying_base.request_vev_lse_week_1",
[
"joint_buying_base.tour_lyon_loire_1_line_4", # VEV->CDA
"joint_buying_base.tour_lyon_loire_1_line_6", # CDA->LSE
],
"computed",
)

def _verify_tour_lines_computation(
self, request_xml_id, tour_line_xml_ids, expected_state
):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def _populate_tree(self, transport_request):
)
tours = self.env["joint.buying.tour"].search(
[
("start_date", ">=", transport_request.availability_date),
("end_date", ">=", transport_request.availability_date),
("start_date", "<=", max_date),
],
order="start_date",
Expand Down

0 comments on commit e81e9c7

Please sign in to comment.