Skip to content

Commit

Permalink
[IMP] joint_buying_sale : when creating a transport request from sale…
Browse files Browse the repository at this point in the history
… : 1) compute the route, if possible ; 2) display the transport request in a form view
  • Loading branch information
legalsylvain committed Dec 4, 2023
1 parent ea6ec67 commit ad1a3aa
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,27 @@ def create_transport_request(self):

self.sale_order_id.recalculate_weight()

# Create new transport request
request_vals = {
"sale_order_id": self.sale_order_id.id,
"manual_availability_date": self.availability_date,
"manual_start_partner_id": self.start_partner_id.id,
"manual_arrival_partner_id": self.arrival_partner_id.id,
}

self.env["joint.buying.transport.request"].create(request_vals)
request = self.env["joint.buying.transport.request"].create(request_vals)

# Try to find a route, if possible
request.button_compute_tour()

# Display the new created transport request
res = self.env["ir.actions.act_window"].for_xml_id(
"joint_buying_base", "action_joint_buying_transport_request"
)
res.update(
{
"views": [(False, "form"), (False, "tree")],
"res_id": request.id,
}
)
return res

0 comments on commit ad1a3aa

Please sign in to comment.