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
[IMP/REF] *: pickup point delivery cleanup #160187
base: master
Are you sure you want to change the base?
[IMP/REF] *: pickup point delivery cleanup #160187
Conversation
30378d2
to
59373ab
Compare
59373ab
to
9b2fd96
Compare
cf30690
to
a04f23d
Compare
a4cbff6
to
8d10ed6
Compare
|
||
import { Component } from "@odoo/owl"; | ||
|
||
export class FedexLocations extends Component { |
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.
Those template should be in enterprise no?
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.
The comment I put are only some details. However there is a bigger issue in the current state. It would be great to have a single template for each carrier.
The idea would be to define a set of variable in the ChoosePickupPointForm and the server would have to do the matching between data received by the carrier and the date required by the form view (so in carrier_get_close_location)
That way we will avoid the annoying part of creating a new template by carrier and the majority of the code would be in 2 functions. The ones that receive data from the carrier and format it to a single syntax used by our client. And the other part that receive the formated data of our client to the carrier when we ask for a rate or a shipment
@@ -7,3 +7,4 @@ class ResPartner(models.Model): | |||
_inherit = 'res.partner' | |||
|
|||
property_delivery_carrier_id = fields.Many2one('delivery.carrier', company_dependent=True, string="Delivery Method", help="Default delivery method used in sales orders.") | |||
external_id = fields.Json(string="External Identifier", help="Information needed by shipping providers in case of pickup point addresses.") |
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_point_address no? is it really an id stored in it?
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.
It is different from a provider to another. In case of Sendcloud, it's just and id used by the provider later to process the shipment when the delivery is validated. In case of Fedex, it's an id in addition to other fields.
addons/delivery/models/sale_order.py
Outdated
@@ -25,6 +34,24 @@ def _compute_amount_total_without_delivery(self): | |||
delivery_cost = sum([l.price_total for l in self.order_line if l.is_delivery]) | |||
return self.amount_total - delivery_cost | |||
|
|||
@api.depends('carrier_id') | |||
def _compute_shipping_method(self): |
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.
Should we really need a compute for it?
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.
I.M.O it's not because the carrier allow to select a pickup point that we have to define it as a default
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.
As far as I understand, if the delivery carrier has <carrier>_use_locations
field and if it is true at the same time, then it's always used as a pickup delivery. Isn't this what happens here or am I missing something?
@@ -88,6 +115,23 @@ def action_open_delivery_wizard(self): | |||
} | |||
} | |||
|
|||
def action_open_pickup_point_wizard(self): | |||
if not self.partner_shipping_id.country_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.
Only allow it if the carrier allow to use pickup point
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.
Alright, but isn't it enough to hide the button using this action when the carrier is not applicable?
|
||
import { Component } from "@odoo/owl"; | ||
|
||
export class SendcloudLocations extends Component { |
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.
should be in sendcloud module
<t t-if="this.carrier[0].delivery_type === 'sendcloud'"> | ||
<SendcloudLocations locations="this.pickupPoints.data" showDistance="!this.searchByZipCode.value" onSelectPickupPoint.bind="this.onSelectPickupPoint"/> | ||
</t> | ||
<t t-else=""> | ||
<FedexLocations locations="this.pickupPoints.data" onSelectPickupPoint.bind="this.onSelectPickupPoint"/> | ||
</t> |
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.
Should be in appropriate module. Maybe the slot could be useful in order to extend that
8d10ed6
to
ab29202
Compare
This commit adds the ability to search for pickup points to choose from in shipment methods provided by both Sendcloud and FedEx. Before, users could only see pickup points close to their registered address. Task-3645144
f114cef
to
05e9012
Compare
*: delivery, sale, sale_management, sale_stock, stock_delivery, website_sale This commit introduces several changes and improvements to pickup point delivery feature. ** Behavior before this commit: - Users could choose a pickup address on checkout, if a proper delivery method is enabled. - Data of this address is attached to the sales order in a json field and the delivery address is set to the customer's address as in normal delivery. - On confirming the sale order, a new address for the pickup point is created as a child to the customer's contact. Its data is retrieved from the above mentioned json field. - On confirming the delivery order, the address data to be passed to the shipping provider to process the shipment is retrieved from the related sales order (i.e. pickup delivery orders _must_ have a related sales order). - It was not possible to change the pickup address from the backend after the user confirms the order. ** Behavior after this commit: - The json field is removed from the sales order. - When the user confirms an order with a pickup delivery, a new address is created with the point data and is attached to the customer as a child address (if there's no existing address with the same data). - A new json field is added to `res.partner` to capture the info needed by the shipping provider later when processing the shipment. - Pickup address can be changed from sales/delivery order through a special wizard that can be opened only when the delivery is pickup. - Pickup addresses can be searched by postal code from this wizard to enable getting all points from the provider, not necessarily ones close to the customer. Task-3645144
05e9012
to
d967636
Compare
*: delivery, sale, sale_management, sale_stock, stock_delivery, website_sale
This PR introduces several changes and improvements to pickup point delivery feature.
Behavior before this PR:
Behavior after this PR:
res.partner
to capture the info needed by the shipping provider later when processing the shipment.Enterprise PR: odoo/enterprise#59935
Upgrade PR: odoo/upgrade#5920
Task-3645144
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr