Skip to content

Commit

Permalink
Merge PR #723 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by jbaudoux
  • Loading branch information
OCA-git-bot committed Mar 20, 2024
2 parents 1ec5420 + 743a8a3 commit 692bd6c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
12 changes: 12 additions & 0 deletions delivery_schenker/models/delivery_carrier.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ class DeliveryCarrier(models.Model):
help="If set, this contact will be sent as invoice address to Schenker."
"\nIf Address ID is set, it will be part of it instead of the sender",
)
schenker_submit_booking = fields.Boolean(
string="Submit Booking",
default=True,
help="Submit Booking On Schenker site."
"\nIf set, submits booking on site automatically."
"\nIf not set, user has to submit booking manually.",
)

def _get_schenker_credentials(self):
"""Access key is mandatory for every request while group and user are
Expand Down Expand Up @@ -518,6 +525,11 @@ def _prepare_schenker_shipping(self, picking):
"homeDelivery": self.schenker_home_delivery,
"ownPickup": self.schenker_own_pickup,
"pharmaceuticals": self.schenker_pharmaceuticals,
# From the Schenker docs:
# Defines if booking shall be submitted. If false,
# the booking can be edited
# in the frontend and MUST be submitted manually.
"submitBooking": self.schenker_submit_booking,
}
)
vals.update(self._schenker_measures(picking, vals))
Expand Down
4 changes: 0 additions & 4 deletions delivery_schenker/models/schenker_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,6 @@ def _send_shipping(self, picking_vals, method=False):
vals = self._shipping_api_credentials()
method_wrapper = self._scheneker_shipping_api_wrapper(method)
vals[method_wrapper] = picking_vals
# From the Schenker docs:
# Defines if booking shall be submitted. If false, the booking can be edited
# in the frontend and MUST be submitted manually.
vals[method_wrapper].update({"submitBooking": True})
response = self._process_reply(
self.client.service[self._shipping_type_method(method)], vals
)
Expand Down
1 change: 1 addition & 0 deletions delivery_schenker/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def _prepare_schenker_shipping(self, picking, vals=None):
"homeDelivery": True,
"ownPickup": True,
"pharmaceuticals": True,
"submitBooking": True,
"measureUnitVolume": 1.0,
}
res.update(vals)
Expand Down
1 change: 1 addition & 0 deletions delivery_schenker/views/delivery_schenker_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
name="schenker_service_land"
attrs="{'required': [('delivery_type', '=', 'schenker'), ('schenker_booking_type', '=', 'land')], 'invisible': [('schenker_booking_type', '!=', 'land')]}"
/>
<field name="schenker_submit_booking" />
<field name="schenker_indoor_delivery" />
<field name="schenker_express" />
<field name="schenker_food_related" />
Expand Down

0 comments on commit 692bd6c

Please sign in to comment.