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

[FIX] stock: picking to scratch location with BO #31076

Closed
wants to merge 2 commits into
base: 11.0
from

Conversation

Projects
None yet
4 participants
@amoyaux
Copy link
Contributor

amoyaux commented Feb 13, 2019

Usecase to reproduce:

  • Create an internal picking from stock to scrap
  • Add some scrap move inside due to scrap button in header
  • Add some move with initial demand for future
  • Mark the picking as done and validate it
  • The wizard asking for a backorder appear -> Validate or No backorder

The moves with initial demand are duplicated(one new move for each
without intial demand nor quantity done)
A note is logged in the chatter with backorder False has been created.

There is a problem since _action_done on a scrap move from scrap model
will process the scrap move individualy but will create a back order
(commit e088acb try to fix this issue)
However when we create a picking that goes to scrap location, the back
order will not be created since all moves are scrapped.
With the current configuration we can't guess in _action_done if
it comes from scrap or picking validate that goes to a scrap location.

The current solution is to use a context key in order to indicate if the
call come from picking validate or scrap. If it comes from scrap do not
create a back order no matter the case. If it comes from picking, follow
the standard beahvior with a backorder or not.

opw-1934835

@robodoo robodoo added the seen 🙂 label Feb 13, 2019

@C3POdoo C3POdoo added the RD label Feb 13, 2019

@amoyaux amoyaux force-pushed the odoo-dev:11.0-scrap-arm branch 2 times, most recently Feb 14, 2019

@amoyaux amoyaux changed the title [FIX] stock: internal picking to scrap location [FIX] stock: picking to scratch location with BO Feb 14, 2019

@amoyaux amoyaux requested a review from sle-odoo Feb 14, 2019

@robodoo robodoo added the CI 🤖 label Feb 14, 2019

@@ -708,7 +708,7 @@ def button_validate(self):
# If no lots when needed, raise error
picking_type = self.picking_type_id
precision_digits = self.env['decimal.precision'].precision_get('Product Unit of Measure')
no_quantities_done = all(float_is_zero(move_line.qty_done, precision_digits=precision_digits) for move_line in self.move_line_ids)
no_quantities_done = all(float_is_zero(move_line.qty_done, precision_digits=precision_digits) for move_line in self.move_line_ids.filtered(lambda m: m.state not in ('done', 'cancel')))

This comment has been minimized.

@sle-odoo

sle-odoo Feb 18, 2019

Contributor

another commit test_immediate_validate_7 please :)

@@ -105,7 +105,7 @@ def _prepare_move_values(self):
def do_scrap(self):
for scrap in self:
move = self.env['stock.move'].create(scrap._prepare_move_values())
move._action_done()
move.with_context(is_scrap=True)._action_done()

This comment has been minimized.

@sle-odoo

sle-odoo Feb 18, 2019

Contributor

add a comment: in master; replace by cancel_backorder

[FIX] stock: picking to scratch location with BO
Usecase to reproduce:
- Create an internal picking from stock to scrap
- Add some scrap move inside due to scrap button in header
- Add some move with initial demand for future
- Mark the picking as done and validate it
- The wizard asking for a backorder appear -> Validate or No backorder

The moves with initial demand are duplicated(one new move for each
without intial demand nor quantity done)
A note is logged in the chatter with backorder False has been created.

There is a problem since _action_done on a scrap move from scrap model
will process the scrap move individualy but will create a back order
(commit e088acb try to fix this issue)
However when we create a picking that goes to scrap location, the back
order will not be created since all moves are scrapped.
With the current configuration we can't guess in _action_done if
it comes from scrap or picking validate that goes to a scrap location.

The current solution is to use a context key in order to indicate if the
call come from picking validate or scrap. If it comes from scrap do not
create a back order no matter the case. If it comes from picking, follow
the standard beahvior with a backorder or not.

opw-1934835

@amoyaux amoyaux force-pushed the odoo-dev:11.0-scrap-arm branch Feb 18, 2019

@robodoo robodoo removed the CI 🤖 label Feb 18, 2019

[FIX] stock: validate a picking with only scrap
Usecase:
- Create a planned transfer
- Add line with initial demand
- Create a scrap
- Click on button validate

The wizard asking for a backorder or not is diplayed. The UserError
that prevent to validate a picking without quantity done or reserved
should have been raised. The scrap moves are directly processed once
the user validates his scrap order. Validate a picking with only done
moves, will not have any effect.

@amoyaux amoyaux force-pushed the odoo-dev:11.0-scrap-arm branch to a7e35e6 Feb 20, 2019

@robodoo robodoo added the CI 🤖 label Feb 20, 2019

@sle-odoo

This comment has been minimized.

Copy link
Contributor

sle-odoo commented Feb 25, 2019

robodoo r+

@robodoo robodoo added the r+ 👌 label Feb 25, 2019

@robodoo

This comment has been minimized.

Copy link
Contributor

robodoo commented Feb 25, 2019

Because this PR has multiple commits, I need to know how to merge it:

  • merge to merge directly, using the PR as merge commit message
  • rebase-merge to rebase and merge, using the PR as merge commit message
  • rebase-ff to rebase and fast-forward
@sle-odoo

This comment has been minimized.

Copy link
Contributor

sle-odoo commented Feb 25, 2019

robodoo rebase-ff

robodoo pushed a commit that referenced this pull request Feb 25, 2019

[FIX] stock: validate a picking with only scrap
Usecase:
- Create a planned transfer
- Add line with initial demand
- Create a scrap
- Click on button validate

The wizard asking for a backorder or not is diplayed. The UserError
that prevent to validate a picking without quantity done or reserved
should have been raised. The scrap moves are directly processed once
the user validates his scrap order. Validate a picking with only done
moves, will not have any effect.

closes #31076
@robodoo

This comment has been minimized.

Copy link
Contributor

robodoo commented Feb 25, 2019

Merge method set to rebase and fast-forward

@robodoo

This comment has been minimized.

Copy link
Contributor

robodoo commented Feb 25, 2019

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.