Skip to content

[FIX] stock: assign SN on move Lines - #41284

Closed
svs-odoo wants to merge 2 commits into
odoo:13.0from
odoo-dev:13.0-fix-assign-sn-on-move-line-svs
Closed

[FIX] stock: assign SN on move Lines#41284
svs-odoo wants to merge 2 commits into
odoo:13.0from
odoo-dev:13.0-fix-assign-sn-on-move-line-svs

Conversation

@svs-odoo

@svs-odoo svs-odoo commented Dec 3, 2019

Copy link
Copy Markdown
Contributor

Before this commit, we can't use the Generate and Assign Serial Numbers on already existing move line. It always creates new one, even if the picking type use "Pre-fill Detailed Operations".
Now, it will edit existing lines, except if we ask to generate more SN than we have unassigned move lines, or if the picking don't use the "Pre-fill Detailed Operations" option, in which cases it will still create new move line with the generated SN.

task-2150561

@C3POdoo C3POdoo added the RD research & development, internal work label Dec 3, 2019
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Dec 3, 2019
@svs-odoo
svs-odoo force-pushed the 13.0-fix-assign-sn-on-move-line-svs branch from 3299476 to 1bf703c Compare December 4, 2019 09:48
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Dec 4, 2019
@svs-odoo
svs-odoo force-pushed the 13.0-fix-assign-sn-on-move-line-svs branch from 06fb3c2 to 76440e2 Compare December 4, 2019 13:47
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Dec 4, 2019
Comment thread addons/stock/models/stock_move.py Outdated
Comment thread addons/stock/models/stock_move.py Outdated
Comment thread addons/stock/views/stock_move_views.xml Outdated
Comment thread addons/stock/models/stock_move.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not sure it's more concise than typing this whole filer two times

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Indeed it's longer, but I find this:

if self.picking_type_id.show_reserved:
    move_lines = self.move_line_ids.filtered(without_lot_filter)
else:
    move_lines = self.move_line_nosuggest_ids.filtered(without_lot_filter)

... is clearer than that:

if self.picking_type_id.show_reserved:
    move_lines = self.move_line_ids.filtered(lambda ml: not ml.lot_id and not ml.lot_name)
else:
    move_lines = self.move_line_nosuggest_ids.filtered(lambda ml: not ml.lot_id and not ml.lot_name)

But we can use the lambda one, I don't mind.

Comment thread addons/stock/models/stock_move.py Outdated
Comment thread addons/stock/models/stock_move.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do you really need origin_move_line?

Comment thread addons/stock/models/stock_move.py Outdated
Comment thread addons/stock/models/stock_move.py Outdated
Comment thread addons/stock/models/stock_move.py Outdated
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Dec 16, 2019
@svs-odoo
svs-odoo force-pushed the 13.0-fix-assign-sn-on-move-line-svs branch 6 times, most recently from c1586c8 to bd48426 Compare December 19, 2019 14:08
Comment thread addons/stock/models/stock_move.py Outdated
@svs-odoo
svs-odoo force-pushed the 13.0-fix-assign-sn-on-move-line-svs branch 2 times, most recently from 54ceaaa to b352bec Compare December 23, 2019 12:40
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Dec 23, 2019
Comment thread addons/stock/models/stock_move.py Outdated
Before this commit, we can't use the Generate and Assign Serial Numbers
on already existing move line. It always creates new one, even if the
picking type use "Pre-fill Detailed Operations".
Now, it will edit existing lines, except if we ask to generate more SN
than we have unassigned move lines, or if the picking don't use the
"Pre-fill Detailed Operations" option, in which cases it will still
create new move line with the generated SN.

Also, before this commit, paste a list of serial numbers to assign them
on multiple move lines in once work only with creation of a new move
line for each serial number.
Now, it's also work with existing move lines.

Finally, some code shared the same logic in `stock.move` in the move
line onchange method and in the `_generate_serial_numbers` method.
Moves this code in a new method, `_generate_serial_move_line_commands`,
and call it in the two previous methods.

task-2150561
The onchange on move lines will generates and assigns lot names.
However it's useless to do that if the picking type doesn't allow
creation of new lots.
@svs-odoo
svs-odoo force-pushed the 13.0-fix-assign-sn-on-move-line-svs branch from b352bec to 96a8180 Compare December 23, 2019 14:52
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Dec 23, 2019
@sle-odoo

Copy link
Copy Markdown
Contributor

robodoo r+ rebase-ff

@robodoo

robodoo commented Dec 23, 2019

Copy link
Copy Markdown
Contributor

Merge method set to rebase and fast-forward

@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Dec 23, 2019
@robodoo robodoo closed this in ac62c90 Dec 23, 2019
@robodoo
robodoo temporarily deployed to merge December 23, 2019 16:24 Inactive
@fw-bot
fw-bot deleted the 13.0-fix-assign-sn-on-move-line-svs branch January 6, 2020 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI 🤖 Robodoo has seen passing statuses RD research & development, internal work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants