Skip to content

Commit

Permalink
[MIG] delivery_gls_asm: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Tisho99 committed Dec 23, 2024
1 parent b7c33d7 commit 36f1f56
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 69 deletions.
2 changes: 1 addition & 1 deletion delivery_gls_asm/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Delivery GLS-ASM",
"summary": "Delivery Carrier implementation for GLS with ASMRed API",
"version": "16.0.1.1.1",
"version": "17.0.1.1.1",
"category": "Stock",
"website": "https://github.com/OCA/l10n-spain",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand Down
7 changes: 4 additions & 3 deletions delivery_gls_asm/models/delivery_carrier.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,10 @@ def gls_asm_cancel_shipment(self, pickings):
if picking.delivery_state != "shipping_recorded_in_carrier":
raise UserError(

Check warning on line 442 in delivery_gls_asm/models/delivery_carrier.py

View check run for this annotation

Codecov / codecov/patch

delivery_gls_asm/models/delivery_carrier.py#L442

Added line #L442 was not covered by tests
_(
"Unable to cancel GLS Expedition with reference %(ref)s "
+ "as it is in state %(state)s.\nPlease manage the cancellation "
+ "of this shipment/pickup with GLS via email."
"Unable to cancel GLS Expedition with reference "
"%(ref)s as it is in state %(state)s.\n"
"Please manage the cancellation of this "
"shipment/pickup with GLS via email."
)
% {
"ref": picking.carrier_tracking_ref,
Expand Down
3 changes: 2 additions & 1 deletion delivery_gls_asm/models/gls_asm_master_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@
),
-57: (
"Error, EuroEstandar/EBP service:"
"reported a country that is not included on the service (<Destinatario>.<Pais>)."
"reported a country that is not included "
"on the service (<Destinatario>.<Pais>)."
),
-69: "Error, I can not Channeling, wrong consignee zipcode.",
-70: "Error, The order number already exists to this date and customer code.",
Expand Down
4 changes: 1 addition & 3 deletions delivery_gls_asm/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ class StockPicking(models.Model):

# ASM API has two references for each delivery. This one is needed
# for some operations like getting the label
gls_asm_public_tracking_ref = fields.Char(
string="GLS Barcode", readonly=True, copy=False
)
gls_asm_public_tracking_ref = fields.Char(string="GLS Barcode", copy=False)
gls_asm_picking_ref = fields.Char(
string="GLS Picking Reference", readonly=True, copy=False
)
Expand Down
2 changes: 1 addition & 1 deletion delivery_gls_asm/tests/test_delivery_gls_asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def setUpClass(cls):
cls.sale_order.carrier_id = cls.carrier_gls_asm.id
cls.sale_order.action_confirm()
cls.picking = cls.sale_order.picking_ids
cls.picking.move_ids.quantity_done = 20
cls.picking.move_ids.quantity = 20
cls.picking.number_of_packages = 1

def test_01_gls_picking_confirm_simple(self):
Expand Down
15 changes: 6 additions & 9 deletions delivery_gls_asm/views/delivery_asm_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,24 @@
<field name="inherit_id" ref="delivery.view_delivery_carrier_form" />
<field name="arch" type="xml">
<xpath expr="//notebook/page[1]" position='before'>
<page
string="GLS Configuration"
attrs="{'invisible': [('delivery_type', '!=', 'gls_asm')]}"
>
<page string="GLS Configuration" invisible="delivery_type != 'gls_asm'">
<group>
<group>
<field
name="gls_asm_uid"
attrs="{'required': [('delivery_type', '=', 'gls_asm'), ('prod_environment', '!=', False)]}"
required="delivery_type != 'gls_asm' and prod_environment"
/>
<field
name="gls_asm_service"
attrs="{'required': [('delivery_type', '=', 'gls_asm'), ('prod_environment', '!=', False)]}"
required="delivery_type != 'gls_asm' and prod_environment"
/>
<field
name="gls_asm_shiptime"
attrs="{'required': [('delivery_type', '=', 'gls_asm'), ('prod_environment', '!=', False)]}"
required="delivery_type != 'gls_asm' and prod_environment"
/>
<field
name="gls_asm_postage_type"
attrs="{'required': [('delivery_type', '=', 'gls_asm'), ('prod_environment', '!=', False)]}"
required="delivery_type != 'gls_asm' and prod_environment"
/>
<field name="gls_asm_cash_on_delivery" />
<field name="gls_asm_with_return" />
Expand All @@ -42,7 +39,7 @@
type="object"
class="oe_stat_button"
icon="fa-file-text-o"
attrs="{'invisible': [('delivery_type', '!=', 'gls_asm')]}"
invisible="delivery_type != 'gls_asm'"
/>
</xpath>
</field>
Expand Down
71 changes: 20 additions & 51 deletions delivery_gls_asm/views/stock_picking_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
<odoo>
<record id="view_picking_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="//div[@name='tracking']" position="inside">
<!-- extra button that is visible outside of "done" to cancel pickups -->
Expand All @@ -13,41 +16,33 @@
class="fa fa-arrow-right oe_link"
name="cancel_shipment"
string="Cancel"
attrs="{'invisible':[
'|',
'|',
'|',
'|',
('carrier_tracking_ref','=',False),
('delivery_type','in', ['fixed', 'base_on_rule']),
('delivery_type','=',False),
('delivery_type','!=','gls_asm'),
('state','=','done')]
}"
invisible="not carrier_tracking_ref or delivery_type != 'gls_asm' or state == 'done'"
/>
</xpath>
<xpath expr="//div[@name='tracking']" position="after">
<field
name="gls_asm_public_tracking_ref"
attrs="{'invisible':[('gls_asm_public_tracking_ref', '!=', 'False')]}"
invisible="True"
readonly="True"
/>
<field
name="gls_asm_picking_ref"
attrs="{'invisible':[('gls_asm_picking_ref', '=', False)]}"
invisible="not gls_asm_picking_ref"
readonly="True"
/>
</xpath>
<xpath expr="//header" position='inside'>
<button
name="gls_asm_get_label"
string="GLS Label"
type="object"
attrs="{'invisible':['|', ('gls_asm_public_tracking_ref', '=', False), ('state', '!=', 'done')]}"
invisible="not gls_asm_public_tracking_ref or state != 'done'"
/>
<button
name="gls_asm_send_pickup"
string="Send pick-up"
type="object"
attrs="{'invisible':['|', '|', ('gls_carrier_is_pickup_service', '=', False), ('carrier_tracking_ref', '!=', False), ('state', 'in', ['draft','cancel'])]}"
invisible="not gls_carrier_is_pickup_service or carrier_tracking_ref or state in ['draft','cancel']"
/>
<field name="gls_carrier_is_pickup_service" invisible="1" />
</xpath>
Expand All @@ -61,44 +56,24 @@
/>
<field name="arch" type="xml">
<xpath expr="//group[@name='delivery_tracking']" position="attributes">
<attribute name="attrs">{
'invisible': [
'|',
('carrier_id', '=', False),
'|',
'&amp;',
('gls_carrier_is_pickup_service', '=', False),
('state', '!=', 'done'),
'&amp;',
('gls_carrier_is_pickup_service', '=', True),
('state', '=', 'draft')
]
}</attribute>
<attribute name="invisble">
not carrier_id or not gls_carrier_is_pickup_service and state != 'done' or gls_carrier_is_pickup_service and state == 'draft'
</attribute>
</xpath>
<xpath expr="//button[@name='tracking_state_update']" position="attributes">
<attribute name="attrs">{
'invisible': [('delivery_type', 'in', ['base_one_rule', 'fixed'])]
}</attribute>
<attribute
name="invisible"
>delivery_type in ['base_one_rule', 'fixed']</attribute>
</xpath>
<xpath expr="//field[@name='tracking_state']" position="after">
<field name="gls_carrier_is_pickup_service" invisible="1" />
<field
name="gls_pickup_state"
attrs="{
'invisible': [
('gls_carrier_is_pickup_service', '=', False)
]
}"
invisible="not gls_carrier_is_pickup_service"
/>
<field
name="gls_shipment_state"
attrs="{
'invisible': [
'|',
('gls_carrier_is_pickup_service', '=', True),
('delivery_type', '!=', 'gls_asm')
]
}"
invisible="gls_carrier_is_pickup_service or delivery_type != 'gls_asm'"
/>
</xpath>
</field>
Expand All @@ -111,13 +86,7 @@
<field
name="gls_shipping_notes"
placeholder="Notas para GLS"
attrs="{
'invisible': [
'|',
('gls_carrier_is_pickup_service', '=', True),
('delivery_type', '!=', 'gls_asm')
]
}"
invisible="gls_carrier_is_pickup_service or delivery_type != 'gls_asm'"
/>
</xpath>
</field>
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cryptography
cryptography==3.4.8
pycountry
pycryptodome
suds-py3
unidecode
xmlsig
zeep

0 comments on commit 36f1f56

Please sign in to comment.