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] stock_picking_line_sequence #1864

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

Conversation

StefanRijnhart
Copy link
Member

@StefanRijnhart StefanRijnhart commented Feb 3, 2025

Standard migration, based on unmerged #1552.

@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-stock_picking_line_sequence branch from 47c4d60 to 1a3f7c4 Compare February 3, 2025 16:02
serpentcs-dev1 and others added 28 commits February 3, 2025 17:05
OCA Transbot updated translations from Transifex

OCA Transbot updated translations from Transifex
Currently translated at 100.0% (7 of 7 strings)

Translation: stock-logistics-workflow-12.0/stock-logistics-workflow-12.0-stock_picking_line_sequence
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-workflow-12-0/stock-logistics-workflow-12-0-stock_picking_line_sequence/pt_BR/
Currently translated at 100.0% (7 of 7 strings)

Translation: stock-logistics-workflow-12.0/stock-logistics-workflow-12.0-stock_picking_line_sequence
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-workflow-12-0/stock-logistics-workflow-12-0-stock_picking_line_sequence/sl/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: stock-logistics-workflow-12.0/stock-logistics-workflow-12.0-stock_picking_line_sequence
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-workflow-12-0/stock-logistics-workflow-12-0-stock_picking_line_sequence/
Currently translated at 28.5% (2 of 7 strings)

Translation: stock-logistics-workflow-15.0/stock-logistics-workflow-15.0-stock_picking_line_sequence
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-workflow-15-0/stock-logistics-workflow-15-0-stock_picking_line_sequence/it/
only update the sequence number when the line number is an integer.
Currently translated at 100.0% (7 of 7 strings)

Translation: stock-logistics-workflow-16.0/stock-logistics-workflow-16.0-stock_picking_line_sequence
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_picking_line_sequence/es/
Currently translated at 100.0% (7 of 7 strings)

Translation: stock-logistics-workflow-16.0/stock-logistics-workflow-16.0-stock_picking_line_sequence
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_picking_line_sequence/it/
@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-stock_picking_line_sequence branch from 1a3f7c4 to 59fe8d3 Compare February 3, 2025 16:09
@StefanRijnhart StefanRijnhart marked this pull request as ready for review February 3, 2025 16:20
@StefanRijnhart
Copy link
Member Author

/ocabot migration stock_picking_line_sequence

@OCA-git-bot OCA-git-bot added this to the 18.0 milestone Feb 3, 2025
@OCA-git-bot OCA-git-bot mentioned this pull request Feb 3, 2025
41 tasks
@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-stock_picking_line_sequence branch from 59fe8d3 to 61b2bd4 Compare February 3, 2025 16:21
Copy link

@youring youring left a comment

Choose a reason for hiding this comment

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

Functional.

stock_picking_line_sequence/models/stock_move.py Outdated Show resolved Hide resolved
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.

Thanks, LG. Minor remarks

_inherit = "stock.move"

# re-defines the field to change the default
sequence = fields.Integer("HiddenSequence", default=9999)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
sequence = fields.Integer("HiddenSequence", default=9999)
sequence = fields.Integer("Hidden sequence", default=9999)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. I removed the string label entirely analogous to sale_order_line_sequence.


@api.model_create_multi
def create(self, vals_list):
"""(re)initialize the sequences of the moves within a picking"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not change create docstring

Suggested change
"""(re)initialize the sequences of the moves within a picking"""
# (re)initialize the sequences of the moves within a picking"""

Copy link
Member Author

Choose a reason for hiding this comment

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

Isn't a docstring the best way to document what a method (or an override) does?

Copy link
Contributor

Choose a reason for hiding this comment

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

A method yes. An override no as it's overriding the docstring of what create does

Copy link
Member Author

Choose a reason for hiding this comment

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

I must admit that it is out of intuition that I have been doing this, but I have been doing this for over a decade. Do you have a pointer to an Odoo or OCA guideline about this?

Copy link
Contributor

Choose a reason for hiding this comment

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

No I don't. But you can check if my saying is right by opening a shell and running help(env["stock.move"].create)

Copy link
Member Author

@StefanRijnhart StefanRijnhart Feb 11, 2025

Choose a reason for hiding this comment

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

@rousseldenis Do you agree with the suggestion not to mask the original docstring? What would give the best usability in visual IDEs (that I don't use)?

Copy link
Contributor

Choose a reason for hiding this comment

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

@StefanRijnhart yes, your suggestion is the good one.

Copy link
Contributor

Choose a reason for hiding this comment

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

@rousseldenis you mean the one with docstring or comment?

By the way, it's not an override (where docstring would be right) but an extend (where it's debatable)

Copy link
Member Author

Choose a reason for hiding this comment

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

@rousseldenis Indeed, I was talking about jbaudoux' suggestion to replace the docstring by a comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, done.

</xpath>
<xpath expr="//table[2]/thead/tr/th[1]" position="before">
<th>
<strong>Seq.</strong>
Copy link

Choose a reason for hiding this comment

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

Suggested change
<strong>Seq.</strong>
<strong>Line Number</strong>

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

<template id="report_delivery_document" inherit_id="stock.report_delivery_document">
<xpath expr="//table[1]/thead/tr/th[1]" position="before">
<th>
<strong>Seq.</strong>
Copy link

Choose a reason for hiding this comment

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

Suggested change
<strong>Seq.</strong>
<strong>Line Number</strong>

Copy link
Member Author

Choose a reason for hiding this comment

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

Done


# displays sequence on the stock moves
visible_sequence = fields.Integer(
"Sequence",
Copy link

Choose a reason for hiding this comment

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

Suggested change
"Sequence",
"Line Number",

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

current_sequence = 1
for line in rec.move_ids_without_package:
# Check if the record ID is an integer (real ID)
# or a string (virtual ID)

Choose a reason for hiding this comment

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

virtual ID should be of NewId type, not string

Copy link
Member Author

Choose a reason for hiding this comment

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

Comment updated.

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.