-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[16.0] mig delivery pickup (TODO) #5
base: 16.0
Are you sure you want to change the base?
[16.0] mig delivery pickup (TODO) #5
Conversation
…d add the name of the recipient
…elivery_pickup In the same time, when setting the pickup site, the the set_delivry method is not set on the sale order
This service can be used to search for pickup sites available for the site
Co-Authored-By: Laurent Mignon (ACSONE) <[email protected]>
98c42b6
to
8705c0a
Compare
@sebastienbeau ,can you do a review. |
6182121
to
6170e7f
Compare
pickup_site_id = data.pickup_site_id | ||
pickup_site_obj = self.env["dropoff.site"] | ||
pickup_site = pickup_site_obj.search([("id", "=", pickup_site_id.id)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pickup_site_id = data.pickup_site_id | |
pickup_site_obj = self.env["dropoff.site"] | |
pickup_site = pickup_site_obj.search([("id", "=", pickup_site_id.id)]) | |
picking_site = self.env["dropoff.site"].search([("id", "=", data.pickup_site_id)]) |
pickup_site = pickup_site_obj.search([("id", "=", pickup_site_id.id)]) | ||
if not pickup_site: | ||
raise UserError(_("Invalid code for pickup site")) | ||
self._set_carrier(cart, pickup_site) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self._set_carrier(cart, pickup_site) | |
if pickup_site.carrier_id not in cart.shopinvader_available_carrier_ids: | |
raise UserError(_("This delivery method is not available for your order")) | |
self._set_carrier_and_price(cart, pickup_site.carrier_id.id) |
@@ -0,0 +1,13 @@ | |||
# Copyright 2019 ACSONE SA/NV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed, file can be removed
if cart and cart.shopinvader_available_carrier_ids: | ||
available_carriers = cart.shopinvader_available_carrier_ids | ||
domain = self._get_domain_dropoff_site(params, available_carriers) | ||
return self.env["dropoff.site"].search(domain) | ||
return self.env["dropoff.site"].search([]) | ||
|
||
def _get_domain_dropoff_site(self, params, available_carriers): | ||
carrier_id = params.carrier_id | ||
if carrier_id: | ||
if carrier_id not in available_carriers.ids: | ||
return FALSE_DOMAIN | ||
return [("carrier_id", "=", carrier_id)] | ||
return [("carrier_id", "in", available_carriers.ids)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if cart and cart.shopinvader_available_carrier_ids: | |
available_carriers = cart.shopinvader_available_carrier_ids | |
domain = self._get_domain_dropoff_site(params, available_carriers) | |
return self.env["dropoff.site"].search(domain) | |
return self.env["dropoff.site"].search([]) | |
def _get_domain_dropoff_site(self, params, available_carriers): | |
carrier_id = params.carrier_id | |
if carrier_id: | |
if carrier_id not in available_carriers.ids: | |
return FALSE_DOMAIN | |
return [("carrier_id", "=", carrier_id)] | |
return [("carrier_id", "in", available_carriers.ids)] | |
domain = data.to_odoo_domain() | |
if cart: | |
domain = expression.AND([domain, [("carrier_id", "in", cart.shopinvader_available_carrier_ids.ids)]) | |
return self.env["dropoff.site"].search(domain) |
3082d19
to
ddc0dfc
Compare
ddc0dfc
to
046785c
Compare
046785c
to
75fff45
Compare
75fff45
to
9073abf
Compare
9073abf
to
0ca4616
Compare
14fdb58
to
d87684c
Compare
3b4f49d
to
c4065c2
Compare
c4065c2
to
6b93a80
Compare
No description provided.