Skip to content

Commit

Permalink
[MIG] delivery_postlogistics: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BT-dmoreno committed Jul 8, 2024
1 parent aafff63 commit 7d854fa
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 20 deletions.
2 changes: 1 addition & 1 deletion delivery_postlogistics/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "AGPL-3",
"category": "Delivery",
"complexity": "normal",
"depends": ["delivery", "mail", "base", "stock"],
"depends": ["mail", "base", "stock_delivery"],
"website": "https://github.com/OCA/delivery-carrier",
"data": [
"security/ir.model.access.csv",
Expand Down
8 changes: 8 additions & 0 deletions delivery_postlogistics/tests/common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright 2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

import requests

from odoo.tests.common import TransactionCase

from ..postlogistics.web_service import PostlogisticsWebService
Expand Down Expand Up @@ -114,8 +116,14 @@ def create_picking(cls, partner=None, product_matrix=None):
def setUpClassWebservice(cls):
cls.service_class = PostlogisticsWebService(cls.env.user.company_id)

@classmethod
def _request_handler(cls, s, r, /, **kw):
"""Don't block external requests."""
return cls._super_send(s, r, **kw)

@classmethod
def setUpClass(cls):
cls._super_send = requests.Session.send
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
cls.setUpClassLicense()
Expand Down
22 changes: 11 additions & 11 deletions delivery_postlogistics/views/delivery.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
<page
name="postlogistics"
string="PostLogistics"
attrs="{'invisible': [('delivery_type', '!=', 'postlogistics')]}"
invisible="delivery_type != 'postlogistics'"
>
<group>
<group string="Credentials">
<field
name="postlogistics_endpoint_url"
attrs="{'required': [('delivery_type', '=', 'postlogistics')]}"
required="delivery_type == 'postlogistics'"
/>
<field
name="postlogistics_client_id"
attrs="{'required': [('delivery_type', '=', 'postlogistics')]}"
required="delivery_type == 'postlogistics'"
/>
<field
name="postlogistics_client_secret"
attrs="{'required': [('delivery_type', '=', 'postlogistics')]}"
required="delivery_type == 'postlogistics'"
/>
<button
name="verify_credentials"
Expand All @@ -37,33 +37,33 @@
<group string="Template">
<field
name="postlogistics_label_layout"
attrs="{'required': [('delivery_type', '=', 'postlogistics')]}"
required="delivery_type == 'postlogistics'"
/>
<field
name="postlogistics_output_format"
attrs="{'required': [('delivery_type', '=', 'postlogistics')]}"
required="delivery_type == 'postlogistics'"
/>
<field
name="postlogistics_resolution"
attrs="{'required': [('delivery_type', '=', 'postlogistics')]}"
required="delivery_type == 'postlogistics'"
/>
</group>
<group string="Misc.">
<field
name="postlogistics_license_id"
attrs="{'required': [('delivery_type', '=', 'postlogistics')]}"
required="delivery_type == 'postlogistics'"
/>
<field
name="postlogistics_default_package_type_id"
attrs="{'required': [('delivery_type', '=', 'postlogistics')]}"
required="delivery_type == 'postlogistics'"
/>
<field
name="postlogistics_tracking_format"
attrs="{'required': [('delivery_type', '=', 'postlogistics')]}"
required="delivery_type == 'postlogistics'"
/>
<field
name="postlogistics_proclima_logo"
attrs="{'required': [('delivery_type', '=', 'postlogistics')]}"
required="delivery_type == 'postlogistics'"
/>
<field name="postlogistics_office" />
</group>
Expand Down
2 changes: 1 addition & 1 deletion delivery_postlogistics/views/postlogistics_license.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<tree editable="bottom">
<field name="name" />
<field name="number" />
<field name="sequence" invisible="True" />
<field name="sequence" column_invisible="1" />
<field name="company_id" groups="base.group_multi_company" />
</tree>
</field>
Expand Down
9 changes: 6 additions & 3 deletions delivery_postlogistics/views/stock.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
<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="//page//group[@name='carrier_data']/.." position="after">
<separator
string="Delivery instructions"
attrs="{'invisible': [('delivery_type', '!=', 'postlogistics')]}"
invisible="delivery_type != 'postlogistics'"
/>
<group>
<group
name="delivery_instructions"
attrs="{'invisible': [('delivery_type', '!=', 'postlogistics')]}"
invisible="delivery_type != 'postlogistics'"
>
<field name="delivery_fixed_date" />
<field name="delivery_place" />
Expand Down
11 changes: 7 additions & 4 deletions delivery_postlogistics/views/stock_package_type_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@
<record id="stock_package_type_form_delivery" model="ir.ui.view">
<field name="name">stock.package.type.form.inherit</field>
<field name="model">stock.package.type</field>
<field name="inherit_id" ref="delivery.stock_package_type_form_delivery" />
<field
name="inherit_id"
ref="stock_delivery.stock_package_type_form_delivery"
/>
<field name="arch" type="xml">
<field name="shipper_package_code" position="attributes">
<attribute
name="attrs"
>{"required": [("package_carrier_type", "=", "postlogistics")]}</attribute>
name="required"
>package_carrier_type == 'postlogistics'</attribute>
</field>
<field name="shipper_package_code" position="after">
<span
colspan="2"
attrs="{'invisible': [('package_carrier_type', '!=', 'postlogistics')]}"
invisible="package_carrier_type != 'postlogistics'"
>See section 8.10 of <a
target="new"
href="https://developer.post.ch/en/digital-commerce-api"
Expand Down
2 changes: 2 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vcrpy
vcrpy-unittest

0 comments on commit 7d854fa

Please sign in to comment.