-
-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IMP] base_delivery_carrier_label: Externalize automatic package creation #643
Conversation
@florian-dacosta Following our discussion about this. I've added a separate module in order to isolate the functionnality and did it configurable. So, this is a breaking change from former behaviour but easily configurable (see module README) |
69c4907
to
2b12c8d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (Code review)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rousseldenis I wonder if we really want all this..
I mean, base_delivery_carrier_package
has now no link at all with delivery_automatic_package
In the tests, you actually just test that delivery_automatic_package
works, we could do the same in delivery
module or any module depending on it. It is quite strange to add these tests in this module when there is really no link.
I understand the initial purpose of course, which would be not to remove a functionality from the module out of nowhere, but even with the dependency is is a breaking change, since configured with no package by default.
Couldn't we just remove drop the tests and the dependency on delivery_automatic_package
and just remove _set_a_default_package
method in this PR?
It would still be a breaking change quite easily solved with the intallation of the module... I mean, since the user will need to be aware of this change to make it continue to work...
Moreover, this feature is probably not really use yet in v16, at least willingly, for now...
IMO, the new module is mainly usefull for carrier modules which needs pack to work, and for customer that' don't want to manage PACK when there is only one PACK by picking, so it should be a dependency of those module but not of base_delivery_carrier_label.
For instance, delivery_roulier needs packs on the picking to be able to generate the labels. This one should/may depend on delivery_automatic_package
. And in fact, I think I won't add this dependency in delivery_roulier, I'd probably prefer to raise in case there is no pack and willingly install/configure delivery_automatic_package for customers that need it.
What do you think?
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
@rousseldenis Any news ? |
2b12c8d
to
6ba7e0c
Compare
@rousseldenis what's the status of this one? |
I'll fix this now |
90a7232
to
1f08c71
Compare
@@ -55,6 +55,7 @@ def setUp(self): | |||
"delivery_type": "test", | |||
"product_id": delivery_product.id, | |||
"carrier_account_id": self.account.id, | |||
"automatic_package_creation_at_delivery": True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@florian-dacosta I've updated the test here to get the same behavior as before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A migration script is missing to set the value also on existing carriers,
otherwise it is a breaking change.
bd9244c
to
242cb68
Compare
@chienandalu Could you review this too as this is a breaking change ? I think we need to update your ctt express module too to get the automatic package creation with the new module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @rousseldenis thanks for the heads up 🙂 Anyway, we don't use base_delivery_carrier_label
in our carrier integrations, so I can't judge properly
Ok, I haven't put my head in the code. But could you explain the test fail here ? Thanks |
Ok, I didn't see that 🤦♂️ |
I can't see how your changes might affect that integration. Could relaunch them to give them another shot? |
Done |
@chienandalu @florian-dacosta That's because delivery_package_number uses a 'set_default_package' context... but does not depends on base_delivery_carrier_label... @chienandalu So, your module was working by chance (I suppose you have base_delivery_carrier_label installed on your projects too 😅 ) |
@florian-dacosta @chienandalu I propose to add package_automatic module in delivery_package_number dependencies |
I see it's intentional and the only purpose is to avoid OCA's tests fail: delivery-carrier/delivery_package_number/wizard/stock_inmediate_transfer.py Lines 13 to 16 in 31b6df1
|
Mmmh ok, didn't see the False value. So, there is something that put a new package before this that makes your tests happy because cttexpress requires a package I see. |
I'd say is the opposite, as the issue is that we're declaring 0 packages to the carrier (and this will happen for every carrier integration using this methods). Somehow this new chain of dependencies make that this compute is triggered after we've already set the number of packages: delivery-carrier/delivery_package_number/models/stock_picking.py Lines 19 to 23 in 31b6df1
My only guess is that somehow the company stays with the automatic package setting to Things I'd try:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -55,6 +55,7 @@ def setUp(self): | |||
"delivery_type": "test", | |||
"product_id": delivery_product.id, | |||
"carrier_account_id": self.account.id, | |||
"automatic_package_creation_at_delivery": True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A migration script is missing to set the value also on existing carriers,
otherwise it is a breaking change.
Which methods are called in delivery_postlogistics from base_delivery_carrier_label without super? |
@rousseldenis could you give an update on this? |
I'm ok with @florian-dacosta: don't add a new dependency to base_delivery_label (opposit of this pr) In delivery_roulier package have to exist and it has to fail if no packages are defined. |
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
Depends on :
I've added delivery_postlogistics in rebel modules as it overrides base_delivery_carrier_label methods without calling super. @lehoangan @simahawk