Skip to content

Commit

Permalink
[MIG] delivery_correos_express: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-cort-s73 committed Nov 29, 2024
1 parent c05891a commit 9378e94
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 49 deletions.
2 changes: 1 addition & 1 deletion delivery_correos_express/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Delivery Correos Express",
"summary": "Delivery Carrier implementation for Correos Express using their API",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"category": "Stock",
"website": "https://github.com/OCA/delivery-carrier",
"author": "Studio73, Odoo Community Association (OCA)",
Expand Down
6 changes: 3 additions & 3 deletions delivery_correos_express/models/correos_express_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ def _check_for_error(self, result):
return_code = 999
message = "Webservice ERROR."

Check warning on line 97 in delivery_correos_express/models/correos_express_request.py

View check run for this annotation

Codecov / codecov/patch

delivery_correos_express/models/correos_express_request.py#L96-L97

Added lines #L96 - L97 were not covered by tests
# shipment
if type(result.get("codigoRetorno", "false")) != str:
if type(result.get("codigoRetorno", "false")) != isinstance(str):
return_code = result.get("codigoRetorno")
message = result.get("mensajeRetorno") or ""

Check warning on line 101 in delivery_correos_express/models/correos_express_request.py

View check run for this annotation

Codecov / codecov/patch

delivery_correos_express/models/correos_express_request.py#L100-L101

Added lines #L100 - L101 were not covered by tests
# label
if type(result.get("codErr", "false")) != str:
if type(result.get("codErr", "false")) != isinstance(str):
return_code = result.get("codErr")
message = result.get("desErr") or ""

Check warning on line 105 in delivery_correos_express/models/correos_express_request.py

View check run for this annotation

Codecov / codecov/patch

delivery_correos_express/models/correos_express_request.py#L104-L105

Added lines #L104 - L105 were not covered by tests
# tracking
if type(result.get("error", "false")) != str:
if type(result.get("error", "false")) != isinstance(str):
return_code = result.get("error")
message = result.get("mensajeError") or ""
return return_code, message

Check warning on line 110 in delivery_correos_express/models/correos_express_request.py

View check run for this annotation

Codecov / codecov/patch

delivery_correos_express/models/correos_express_request.py#L108-L110

Added lines #L108 - L110 were not covered by tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def setUpClass(cls):
cls.sale_order.carrier_id = cls.carrier_correos_express.id
cls.sale_order.action_confirm()
cls.picking = cls.sale_order.picking_ids[0]
cls.picking.move_ids.quantity_done = 20
cls.picking.move_ids.quantity = 20

@mock.patch(
"%s.create_shipment" % request_model,
Expand Down
44 changes: 8 additions & 36 deletions delivery_correos_express/views/delivery_carrier_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,66 +7,38 @@
<xpath expr="//notebook/page[1]" position='before'>
<page
string="Correos Express Configuration"
attrs="{'invisible': [('delivery_type', '!=', 'correos_express')]}"
invisible="delivery_type != 'correos_express'"
>
<group>
<group>
<field
name="correos_express_username"
attrs="{
'required': [
('delivery_type', '=', 'correos_express')
]
}"
required="delivery_type == 'correos_express'"
/>
<field
name="correos_express_password"
password="True"
attrs="{
'required': [
('delivery_type', '=', 'correos_express')
]
}"
required="delivery_type == 'correos_express'"
/>
<field
name="correos_express_customer_code"
attrs="{
'required': [
('delivery_type', '=', 'correos_express')
]
}"
required="delivery_type == 'correos_express'"
/>
<field
name="correos_express_sender_code"
attrs="{
'required': [
('delivery_type', '=', 'correos_express')
]
}"
required="delivery_type == 'correos_express'"
/>
<field
name="correos_express_label_type"
attrs="{
'required': [
('delivery_type', '=', 'correos_express')
]
}"
required="delivery_type == 'correos_express'"
/>
<field
name="correos_express_product"
attrs="{
'required': [
('delivery_type', '=', 'correos_express')
]
}"
required="delivery_type == 'correos_express'"
/>
<field
name="correos_express_transport"
attrs="{
'required': [
('delivery_type', '=', 'correos_express')
]
}"
required="delivery_type == 'correos_express'"
/>
</group>
</group>
Expand Down
13 changes: 5 additions & 8 deletions delivery_correos_express/views/stock_picking_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@
<odoo>
<record id="view_picking_withcarrier_out_form" model="ir.ui.view">
<field name="model">stock.picking</field>
<field name="inherit_id" ref="delivery.view_picking_withcarrier_out_form" />
<field
name="inherit_id"
ref="stock_delivery.view_picking_withcarrier_out_form"
/>
<field name="arch" type="xml">
<xpath expr="//button[@name='print_return_label']/.." position='inside'>
<button
name="correos_express_get_label"
string="Print Correos Express Label"
type="object"
attrs="{'invisible':[
'|',
'|',
('carrier_tracking_ref', '=', False),
('delivery_type', '!=', 'correos_express'),
('state', '!=', 'done')
]}"
invisible="(carrier_tracking_ref != True) or (delivery_type != 'correos_express') or (state != 'done')"
/>
</xpath>
</field>
Expand Down

0 comments on commit 9378e94

Please sign in to comment.