[18.0][IMP] delivery_dhl_parcel_de: Added DHL configuration in delive…#253
[18.0][IMP] delivery_dhl_parcel_de: Added DHL configuration in delive…#253hitesh-erpharbor wants to merge 10 commits into18.0from
Conversation
…ry method account
…r data from company to delivery account
| from . import delivery_carrier | ||
| from . import package_details | ||
| from . import res_company | ||
| from . import res_company # Tempororily model |
There was a problem hiding this comment.
Why can't we remove this import statement?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
| continue | ||
|
|
||
| existing = env.ref("delivery_dhl_parcel_de.dhl_carrier_account") | ||
| if existing and existing.use_dhl_parcel_de_shipping_provider: |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
I'd remove this field and set 'delivery_type' value to 'dhl_parcel_de_provider' instead.
| <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> |
There was a problem hiding this comment.
| <field name="account">dummy</field> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
| <field name="password">dummy</field> |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
| if existing and existing.use_dhl_parcel_de_shipping_provider: | |
| if existing and existing.account and existing.password: |
There was a problem hiding this comment.
I have implemented it.
| account_vals = { | ||
| "company_id": company_id, | ||
| "carrier_id": dhl_carrier.id, | ||
| "use_dhl_parcel_de_shipping_provider": True, |
There was a problem hiding this comment.
| "use_dhl_parcel_de_shipping_provider": True, |
| from . import delivery_carrier | ||
| from . import package_details | ||
| from . import res_company | ||
| from . import res_company # Tempororily model |
There was a problem hiding this comment.
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?
…ry method account