Skip to content

[18.0][IMP] delivery_dhl_parcel_de: Added DHL configuration in delive…#253

Open
hitesh-erpharbor wants to merge 10 commits into18.0from
18.0-delivery_dhl_parcel_de
Open

[18.0][IMP] delivery_dhl_parcel_de: Added DHL configuration in delive…#253
hitesh-erpharbor wants to merge 10 commits into18.0from
18.0-delivery_dhl_parcel_de

Conversation

@hitesh-erpharbor
Copy link

…ry method account

from . import delivery_carrier
from . import package_details
from . import res_company
from . import res_company # Tempororily model
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we remove this import statement?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because the data comes from the old model and is being used during migration into the new model. We can remove this file after the data migration is completed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're moving the current data from res_company to a temporary table before module is being loaded, so we don't need to have the old model in place ('res.company' in this case). Or am I missing something?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're correct. Since the data is now being migrated to a temporary table before the module loads, the old 'res.company' model is no longer required. I have removed it.

company_id = data.pop("company_id")
use_dhl = data.pop("use_dhl_parcel_de_shipping_provider")

if not use_dhl:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In pre-migration script we're creating 'temp_dhl_company_data' table based on companies that have this checkbox enabled, so I think these two lines are not needed here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

continue

existing = env.ref("delivery_dhl_parcel_de.dhl_carrier_account")
if existing and existing.use_dhl_parcel_de_shipping_provider:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this check?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the code

string="Use DHL Parcel DE Shipping Provider",
help="If use DHL Parcel DE shipping provider than value set TRUE.",
default=False,
) # Tempororily field
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we wanted to use this field for migrating existing credentials, right? Why not just set 'delivery_type' field value? We can then not use this field, for post-migration script as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it because it's no longer needed.

account_vals = {
"company_id": company_id,
"carrier_id": dhl_carrier.id,
"use_dhl_parcel_de_shipping_provider": True,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove this field and set 'delivery_type' value to 'dhl_parcel_de_provider' instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

<record id="dhl_carrier_account" model="carrier.account">
<field name="name">DHL Parcel DE Account</field>
<field name="delivery_type">dhl_parcel_de_provider</field>
<field name="account">dummy</field>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<field name="account">dummy</field>

Copy link
Author

@hitesh-erpharbor hitesh-erpharbor Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a required field, so we need to set something.

<field name="name">DHL Parcel DE Account</field>
<field name="delivery_type">dhl_parcel_de_provider</field>
<field name="account">dummy</field>
<field name="password">dummy</field>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<field name="password">dummy</field>

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a required field, so we need to set something.

continue

existing = env.ref("delivery_dhl_parcel_de.dhl_carrier_account")
if existing and existing.use_dhl_parcel_de_shipping_provider:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if existing and existing.use_dhl_parcel_de_shipping_provider:
if existing and existing.account and existing.password:

Copy link
Author

@hitesh-erpharbor hitesh-erpharbor Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have implemented it.

account_vals = {
"company_id": company_id,
"carrier_id": dhl_carrier.id,
"use_dhl_parcel_de_shipping_provider": True,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"use_dhl_parcel_de_shipping_provider": True,

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

from . import delivery_carrier
from . import package_details
from . import res_company
from . import res_company # Tempororily model
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're moving the current data from res_company to a temporary table before module is being loaded, so we don't need to have the old model in place ('res.company' in this case). Or am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants