Skip to content
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

[18.0][MIG] delivery_package_number: Migration to 18.0 #932

Open
wants to merge 21 commits into
base: 18.0
Choose a base branch
from

Conversation

CarlosRoca13
Copy link
Contributor

chienandalu and others added 20 commits January 15, 2025 08:14
[UPD] Update delivery_package_number.pot

[UPD] README.rst
[UPD] Update delivery_package_number.pot

[UPD] README.rst

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: delivery-carrier-14.0/delivery-carrier-14.0-delivery_package_number
Translate-URL: https://translation.odoo-community.org/projects/delivery-carrier-14-0/delivery-carrier-14-0-delivery_package_number/
…ransfer wizard if picking have not carrier.

TT38549
If we don't return the print action the label won't be downloaded.

TT48759
@CarlosRoca13 CarlosRoca13 force-pushed the 18.0-MIG-delivery_package_number branch from 61324bd to 5331e6a Compare January 15, 2025 09:47
@pedrobaeza
Copy link
Member

/ocabot migration delivery_package_number

if picking.package_ids:
picking.number_of_packages = len(picking.package_ids)
packages = picking.move_line_ids.result_package_id
if packages:
Copy link
Contributor

Choose a reason for hiding this comment

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

why this if ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because we don't want to loose the info set on number_of_packages when no packages are set when modifying the move_line_ids

Copy link
Contributor

@jbaudoux jbaudoux left a comment

Choose a reason for hiding this comment

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

Some delivery modules depend on this field number_of_packages on the picking but not everyone need this wizard to manually enter a number of parcels.
In my opinion, this module deserves to be split in 2 modules.
I remember some old discussions on this matter. cc @mt-software-de

And it would be the occasion to make it compatible with https://github.com/OCA/delivery-carrier/pull/973/files#diff-c8a077a1b4a9e53784be8d2bd8afc36a7ef4a45e87e29ba9bd5712f1927e71c7R10
cc @rousseldenis @lmignon

Comment on lines +11 to +18
number_of_packages = fields.Integer(
string="Number of Packages",
compute="_compute_number_of_packages",
readonly=False,
store=True,
default=0,
copy=False,
)
Copy link
Contributor

@jbaudoux jbaudoux Feb 17, 2025

Choose a reason for hiding this comment

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

Any chance to extract this in a separate module stock_picking_number_package in stock-logistics-warehouse ?

@mt-software-de
Copy link
Contributor

Some delivery modules depend on this field number_of_packages on the picking but not everyone need this wizard to manually enter a number of parcels. In my opinion, this module deserves to be split in 2 modules. I remember some old discussions on this matter. cc @mt-software-de

And it would be the occasion to make it compatible with https://github.com/OCA/delivery-carrier/pull/973/files#diff-c8a077a1b4a9e53784be8d2bd8afc36a7ef4a45e87e29ba9bd5712f1927e71c7R10 cc @rousseldenis @lmignon

Yes but the discussion was on the automatic package creation. Which was a problem when running the unittests.
#854

But still i think it would be great to separate it.

@sergio-teruel
Copy link
Contributor

sergio-teruel commented Feb 17, 2025

Hi, maybe other option is add an option to ask or not the number of packages...

def _compute_ask_number_of_packages(self):
"""To Know if is needed raise wizard to ask user by package number"""
for picking in self:
picking.ask_number_of_packages = bool(
picking.carrier_id
and not picking.move_line_ids.result_package_id
or picking.picking_type_id.force_set_number_of_packages
)

Copy link
Contributor

@jbaudoux jbaudoux left a comment

Choose a reason for hiding this comment

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

Another remark regarding module name.
Several carrier API use the term of package number to identify the "position" of the package in a list of packages. For example, when you have 3 packages and you number them 1/3, 2/3, 3/3, the package number is 1 (2 and 3 resp.) and the package total is 3.

What about renaming this module to stock_delivery_number_packages ?

# Copyright 2020 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Stock Picking Package Number",
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe align with module name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@pedrobaeza
Copy link
Member

Just a remark: module names shouldn't contain plurals

@CarlosRoca13 CarlosRoca13 force-pushed the 18.0-MIG-delivery_package_number branch from 5331e6a to 45212d5 Compare February 27, 2025 10:00
@CarlosRoca13
Copy link
Contributor Author

I have added an option to prevent the wizard from popping up in the operation type.

@jbaudoux
Copy link
Contributor

I have added an option to prevent the wizard from popping up in the operation type.

@CarlosRoca13 Thanks. I prefer opt-in than opt-out options. Otherwise, set opt-out default to True

@CarlosRoca13
Copy link
Contributor Author

CarlosRoca13 commented Feb 27, 2025

I have added an option to prevent the wizard from popping up in the operation type.

@CarlosRoca13 Thanks. I prefer opt-in than opt-out options. Otherwise, set opt-out default to True

And what about the customers who already have these modules? Will they lose a feature during the migration, or will it be necessary to include a script to disable the field for existing operation types?

From my point of view, the field should remain as it is now to avoid giving customers the impression that they are losing a feature and to prevent spending extra time creating a script that would achieve the same result.

What do you think? @pedrobaeza @sergio-teruel

@pedrobaeza
Copy link
Member

Yes, the default for the option should preserve the existing behavior. Those not wanting them should change that default option on their installations.

@mt-software-de
Copy link
Contributor

I have added an option to prevent the wizard from popping up in the operation type.

@CarlosRoca13 Thanks. I prefer opt-in than opt-out options. Otherwise, set opt-out default to True

And what about the customers who already have these modules? Will they lose a feature during the migration, or will it be necessary to include a script to disable the field for existing operation types?

From my point of view, the field should remain as it is now to avoid giving customers the impression that they are losing a feature and to prevent spending extra time creating a script that would achieve the same result.

What do you think? @pedrobaeza @sergio-teruel

It should be like @jbaudoux mentioned it, if someone using it already you should create a migration for it.
But in my opinion the best way would be to separate those features, then we wouldn't need a option to enable or disable the wizard.

@jbaudoux
Copy link
Contributor

Just a remark: module names shouldn't contain plurals

stock_delivery_number_package then ? Is that helping to remove confusion? FYI, the planned package number module would be named stock_quant_package_number in stock-logistics-tracking repo

@pedrobaeza
Copy link
Member

Well, it's true that splitting into 2 modules is not something wild: delivery_package_number and delivery_package_number_report or similar. A migration script should force the installation of the second for not having troubles on the migration path.

@jbaudoux
Copy link
Contributor

Well, it's true that splitting into 2 modules is not something wild: delivery_package_number and delivery_package_number_report or similar. A migration script should force the installation of the second for not having troubles on the migration path.

(edited)

  • stock_picking_number_package in stock-logistics-warehouse for the computed field on stock.picking used by other modules
  • (stock_)delivery_number_package in delivery-carrier for the wizard with the option to opt-out
  • stock_picking_report_number_package in stock-logistics-reporting for the report

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

Successfully merging this pull request may close these issues.