-
-
Notifications
You must be signed in to change notification settings - Fork 360
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
[17.0][ADD] delivery_sendcloud_oca #852
base: 17.0
Are you sure you want to change the base?
Conversation
51c3c10
to
efd86b3
Compare
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.
LGTM! This module was moved and migrated from https://github.com/onesteinbv/addons-sendcloud. We (Onestein) have given permission to transition this to the OCA
@ByteMeAsap Could you rename this to Thanks |
efd86b3
to
f9f5490
Compare
c909c4c
to
7160fea
Compare
ab46bed
to
fb0ba77
Compare
@rousseldenis , Yes , I have renamed the module. Can you help me with how do I go about resolving conflicts as there have been changes in the 17.0 branch since I had raised the PR a while back? |
17824cb
to
3b5536f
Compare
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.
Looks good to me
a6364c1
to
4f240b0
Compare
@OCA/delivery-carrier-maintainers, @rousseldenis , can we have this merged? |
4f240b0
to
63376d2
Compare
Can we please have this merged ?? |
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.
Code review
|
||
@api.depends("sendcloud_service_point_input", "delivery_type") | ||
def _compute_sendcloud_service_point_required(self): | ||
for carrier in 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.
self.update({"sendcloud_service_point_required": False})
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.
@rousseldenis , I have updated the function
@api.depends() | ||
def _compute_sendcloud_country_ids(self): | ||
for carrier in self: | ||
countries = self.env["sendcloud.shipping.method.country"].search( |
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.
Do a search before the loop and then filter in it to improve performances.
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.
Done !!
|
||
@api.onchange("delivery_type") | ||
def _onchange_sendcloud_delivery_type(self): | ||
self._sendcloud_set_countries() |
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.
Is this really to be done in an onchange ? This can be bad from a UX point of view.
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 have updated to set the countries on write
deleted_parcels.append(parcel_code) | ||
elif ( | ||
res.get("status") == "failed" | ||
and res.get("message") == "This shipment is already being cancelled." |
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.
Could not this be translated ?
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.
No, this cannot be translated
elif res.get("error", {}).get("code") == 404: | ||
deleted_parcels.append(parcel_code) # ignore "Not Found" error | ||
elif res.get("error"): | ||
raise ValidationError(_("Sendcloud: %s") % res["error"].get("message")) |
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.
Use translation function arguments instead.
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.
Done
def _compute_can_generate_return(self): | ||
res = super()._compute_can_generate_return() | ||
for carrier in self.filtered(lambda c: c.delivery_type == "sendcloud"): | ||
carrier.can_generate_return = True |
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.
you can use an update() on recordset instead.
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.
Done !!
): | ||
record.country_ids = record._sendcloud_get_countries_from_cache() | ||
|
||
def _sendcloud_get_countries_from_cache(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.
Maybe the method name deos not reflect the current behavior.
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.
Changed the method name
if existing.sendcloud_code not in existing_shipping_methods_map: | ||
existing_shipping_methods_map[existing.sendcloud_code] = self.env[ | ||
"delivery.carrier" | ||
] |
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.env["delivery.carrier"].browse()
is semantically more correct.
shipping_method_country.product_id = item.product_id | ||
shipping_method_country.enable_price_custom = item.enable_price_custom | ||
else: | ||
self.env["sendcloud.shipping.method.country.custom"].create( |
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.
Build a list of create values in the loop, then call create()
once.
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.
Done !
63376d2
to
d809bbd
Compare
Updated requirements.txt file and changed qty_done to quantity_product_uom for stock move lines Updates Updated test scripts
d809bbd
to
60f7cef
Compare
@rousseldenis , please review |
delivery_sendcloud_oca module provides sendcloud shipping integration with Odoo
This module mostly implements what's described in https://docs.sendcloud.sc/api/v2/shipping/
Full documentation for developers is in https://docs.sendcloud.sc/.
This module works for the Community Edition as well as the Enterprise Edition.