Skip to content

Commit 716196d

Browse files
committed
[MIG] delivery_gls_asm: Migration to 17.0
1 parent b7c33d7 commit 716196d

File tree

8 files changed

+37
-72
lines changed

8 files changed

+37
-72
lines changed

delivery_gls_asm/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "Delivery GLS-ASM",
55
"summary": "Delivery Carrier implementation for GLS with ASMRed API",
6-
"version": "16.0.1.1.1",
6+
"version": "17.0.1.0.0",
77
"category": "Stock",
88
"website": "https://github.com/OCA/l10n-spain",
99
"author": "Tecnativa, Odoo Community Association (OCA)",

delivery_gls_asm/models/delivery_carrier.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,10 @@ def gls_asm_cancel_shipment(self, pickings):
441441
if picking.delivery_state != "shipping_recorded_in_carrier":
442442
raise UserError(
443443
_(
444-
"Unable to cancel GLS Expedition with reference %(ref)s "
445-
+ "as it is in state %(state)s.\nPlease manage the cancellation "
446-
+ "of this shipment/pickup with GLS via email."
444+
"Unable to cancel GLS Expedition with reference "
445+
"%(ref)s as it is in state %(state)s.\n"
446+
"Please manage the cancellation of this "
447+
"shipment/pickup with GLS via email."
447448
)
448449
% {
449450
"ref": picking.carrier_tracking_ref,

delivery_gls_asm/models/gls_asm_master_data.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@
223223
),
224224
-57: (
225225
"Error, EuroEstandar/EBP service:"
226-
"reported a country that is not included on the service (<Destinatario>.<Pais>)."
226+
"reported a country that is not included "
227+
"on the service (<Destinatario>.<Pais>)."
227228
),
228229
-69: "Error, I can not Channeling, wrong consignee zipcode.",
229230
-70: "Error, The order number already exists to this date and customer code.",

delivery_gls_asm/models/stock_picking.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@ class StockPicking(models.Model):
88

99
# ASM API has two references for each delivery. This one is needed
1010
# for some operations like getting the label
11-
gls_asm_public_tracking_ref = fields.Char(
12-
string="GLS Barcode", readonly=True, copy=False
13-
)
14-
gls_asm_picking_ref = fields.Char(
15-
string="GLS Picking Reference", readonly=True, copy=False
16-
)
11+
gls_asm_public_tracking_ref = fields.Char(string="GLS Barcode", copy=False)
12+
gls_asm_picking_ref = fields.Char(string="GLS Picking Reference", copy=False)
1713
gls_carrier_is_pickup_service = fields.Boolean(
1814
related="carrier_id.gls_is_pickup_service"
1915
)

delivery_gls_asm/tests/test_delivery_gls_asm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def setUpClass(cls):
4242
cls.sale_order.carrier_id = cls.carrier_gls_asm.id
4343
cls.sale_order.action_confirm()
4444
cls.picking = cls.sale_order.picking_ids
45-
cls.picking.move_ids.quantity_done = 20
45+
cls.picking.move_ids.quantity = 20
4646
cls.picking.number_of_packages = 1
4747

4848
def test_01_gls_picking_confirm_simple(self):

delivery_gls_asm/views/delivery_asm_view.xml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,24 @@
77
<field name="inherit_id" ref="delivery.view_delivery_carrier_form" />
88
<field name="arch" type="xml">
99
<xpath expr="//notebook/page[1]" position='before'>
10-
<page
11-
string="GLS Configuration"
12-
attrs="{'invisible': [('delivery_type', '!=', 'gls_asm')]}"
13-
>
10+
<page string="GLS Configuration" invisible="delivery_type != 'gls_asm'">
1411
<group>
1512
<group>
1613
<field
1714
name="gls_asm_uid"
18-
attrs="{'required': [('delivery_type', '=', 'gls_asm'), ('prod_environment', '!=', False)]}"
15+
required="delivery_type == 'gls_asm' and prod_environment"
1916
/>
2017
<field
2118
name="gls_asm_service"
22-
attrs="{'required': [('delivery_type', '=', 'gls_asm'), ('prod_environment', '!=', False)]}"
19+
required="delivery_type == 'gls_asm' and prod_environment"
2320
/>
2421
<field
2522
name="gls_asm_shiptime"
26-
attrs="{'required': [('delivery_type', '=', 'gls_asm'), ('prod_environment', '!=', False)]}"
23+
required="delivery_type == 'gls_asm' and prod_environment"
2724
/>
2825
<field
2926
name="gls_asm_postage_type"
30-
attrs="{'required': [('delivery_type', '=', 'gls_asm'), ('prod_environment', '!=', False)]}"
27+
required="delivery_type == 'gls_asm' and prod_environment"
3128
/>
3229
<field name="gls_asm_cash_on_delivery" />
3330
<field name="gls_asm_with_return" />
@@ -42,7 +39,7 @@
4239
type="object"
4340
class="oe_stat_button"
4441
icon="fa-file-text-o"
45-
attrs="{'invisible': [('delivery_type', '!=', 'gls_asm')]}"
42+
invisible="delivery_type != 'gls_asm'"
4643
/>
4744
</xpath>
4845
</field>

delivery_gls_asm/views/stock_picking_views.xml

Lines changed: 20 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
<odoo>
55
<record id="view_picking_form" model="ir.ui.view">
66
<field name="model">stock.picking</field>
7-
<field name="inherit_id" ref="delivery.view_picking_withcarrier_out_form" />
7+
<field
8+
name="inherit_id"
9+
ref="stock_delivery.view_picking_withcarrier_out_form"
10+
/>
811
<field name="arch" type="xml">
912
<xpath expr="//div[@name='tracking']" position="inside">
1013
<!-- extra button that is visible outside of "done" to cancel pickups -->
@@ -13,41 +16,33 @@
1316
class="fa fa-arrow-right oe_link"
1417
name="cancel_shipment"
1518
string="Cancel"
16-
attrs="{'invisible':[
17-
'|',
18-
'|',
19-
'|',
20-
'|',
21-
('carrier_tracking_ref','=',False),
22-
('delivery_type','in', ['fixed', 'base_on_rule']),
23-
('delivery_type','=',False),
24-
('delivery_type','!=','gls_asm'),
25-
('state','=','done')]
26-
}"
19+
invisible="not carrier_tracking_ref or delivery_type != 'gls_asm' or state == 'done'"
2720
/>
2821
</xpath>
2922
<xpath expr="//div[@name='tracking']" position="after">
3023
<field
3124
name="gls_asm_public_tracking_ref"
32-
attrs="{'invisible':[('gls_asm_public_tracking_ref', '!=', 'False')]}"
25+
invisible="not gls_asm_public_tracking_ref"
26+
readonly="True"
3327
/>
3428
<field
3529
name="gls_asm_picking_ref"
36-
attrs="{'invisible':[('gls_asm_picking_ref', '=', False)]}"
30+
invisible="not gls_asm_picking_ref"
31+
readonly="True"
3732
/>
3833
</xpath>
3934
<xpath expr="//header" position='inside'>
4035
<button
4136
name="gls_asm_get_label"
4237
string="GLS Label"
4338
type="object"
44-
attrs="{'invisible':['|', ('gls_asm_public_tracking_ref', '=', False), ('state', '!=', 'done')]}"
39+
invisible="not gls_asm_public_tracking_ref or state != 'done'"
4540
/>
4641
<button
4742
name="gls_asm_send_pickup"
4843
string="Send pick-up"
4944
type="object"
50-
attrs="{'invisible':['|', '|', ('gls_carrier_is_pickup_service', '=', False), ('carrier_tracking_ref', '!=', False), ('state', 'in', ['draft','cancel'])]}"
45+
invisible="not gls_carrier_is_pickup_service or carrier_tracking_ref or state in ['draft','cancel']"
5146
/>
5247
<field name="gls_carrier_is_pickup_service" invisible="1" />
5348
</xpath>
@@ -61,44 +56,24 @@
6156
/>
6257
<field name="arch" type="xml">
6358
<xpath expr="//group[@name='delivery_tracking']" position="attributes">
64-
<attribute name="attrs">{
65-
'invisible': [
66-
'|',
67-
('carrier_id', '=', False),
68-
'|',
69-
'&amp;',
70-
('gls_carrier_is_pickup_service', '=', False),
71-
('state', '!=', 'done'),
72-
'&amp;',
73-
('gls_carrier_is_pickup_service', '=', True),
74-
('state', '=', 'draft')
75-
]
76-
}</attribute>
59+
<attribute name="invisible">
60+
not carrier_id or not gls_carrier_is_pickup_service and state != 'done' or gls_carrier_is_pickup_service and state == 'draft'
61+
</attribute>
7762
</xpath>
7863
<xpath expr="//button[@name='tracking_state_update']" position="attributes">
79-
<attribute name="attrs">{
80-
'invisible': [('delivery_type', 'in', ['base_one_rule', 'fixed'])]
81-
}</attribute>
64+
<attribute
65+
name="invisible"
66+
>delivery_type in ['base_one_rule', 'fixed']</attribute>
8267
</xpath>
8368
<xpath expr="//field[@name='tracking_state']" position="after">
8469
<field name="gls_carrier_is_pickup_service" invisible="1" />
8570
<field
8671
name="gls_pickup_state"
87-
attrs="{
88-
'invisible': [
89-
('gls_carrier_is_pickup_service', '=', False)
90-
]
91-
}"
72+
invisible="not gls_carrier_is_pickup_service"
9273
/>
9374
<field
9475
name="gls_shipment_state"
95-
attrs="{
96-
'invisible': [
97-
'|',
98-
('gls_carrier_is_pickup_service', '=', True),
99-
('delivery_type', '!=', 'gls_asm')
100-
]
101-
}"
76+
invisible="gls_carrier_is_pickup_service or delivery_type != 'gls_asm'"
10277
/>
10378
</xpath>
10479
</field>
@@ -111,13 +86,7 @@
11186
<field
11287
name="gls_shipping_notes"
11388
placeholder="Notas para GLS"
114-
attrs="{
115-
'invisible': [
116-
'|',
117-
('gls_carrier_is_pickup_service', '=', True),
118-
('delivery_type', '!=', 'gls_asm')
119-
]
120-
}"
89+
invisible="gls_carrier_is_pickup_service or delivery_type != 'gls_asm'"
12190
/>
12291
</xpath>
12392
</field>

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ cryptography
44
cryptography==3.4.8
55
pycountry
66
pycryptodome
7+
suds-py3
78
unidecode
89
xmlsig
910
zeep

0 commit comments

Comments
 (0)