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] mrp: auto-generate backorder in "always backorder" setup #164560

Conversation

lase-odoo
Copy link
Contributor

Steps to reproduce:

  • Inventory > Configuration > Warehouse Management > Operations types
  • Click on Manufacturing and put "Always" on create a backorder
  • Create a new MO for 2 units of a product and produce 1 unit

> A wizzard appears to ask you if you want to create a backorder

Cause of the issue:

Clicking on the produce button will call the "button_mark_done" method. However, the parameters of backorder creations are not checked before the wizzard generation:

quantity_issues = self._get_quantity_produced_issues()
if quantity_issues:
return self._action_generate_backorder_wizard(quantity_issues)
will call the

opw-3890886

I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@robodoo
Copy link
Contributor

robodoo commented May 6, 2024

@lase-odoo lase-odoo force-pushed the 17.0-opw-3890886-auto_back_order_production-lase branch from 2249c60 to 5a17203 Compare May 6, 2024 13:18
@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label May 6, 2024
Copy link
Member

@HANNICHE-Walid HANNICHE-Walid left a comment

Choose a reason for hiding this comment

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

LGTM

@HANNICHE-Walid HANNICHE-Walid marked this pull request as ready for review May 6, 2024 14:54
@C3POdoo C3POdoo requested a review from a team May 6, 2024 14:56
@lase-odoo lase-odoo force-pushed the 17.0-opw-3890886-auto_back_order_production-lase branch 2 times, most recently from 3b48acd to e773815 Compare May 7, 2024 06:26
Copy link
Contributor

@Whenrow Whenrow left a comment

Choose a reason for hiding this comment

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

To avoid a big stack of function calls with empty recordset

Comment on lines 2120 to 2121
prods_auto_backorder = [prod for prod in quantity_issues if prod.picking_type_id.create_backorder == "always"]
auto_backorders = self.env['mrp.production.backorder'].create({
Copy link
Contributor

@Whenrow Whenrow May 23, 2024

Choose a reason for hiding this comment

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

Suggested change
prods_auto_backorder = [prod for prod in quantity_issues if prod.picking_type_id.create_backorder == "always"]
auto_backorders = self.env['mrp.production.backorder'].create({
prods_auto_backorder = [prod for prod in quantity_issues if prod.picking_type_id.create_backorder == "always"]
if prods_auto_backorder:
auto_backorders = self.env['mrp.production.backorder'].create({

}) for prod in prods_auto_backorder
],
})
auto_backorders.action_backorder()
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
auto_backorders.action_backorder()
return auto_backorders.action_backorder()

we want to open the backorder automatically at validation

Steps to reproduce:

- Inventory > Configuration > Warehouse Management > Operations types
- Click on Manufacturing and put "Always" on create a backorder
- Create a new MO for 2 units of a product and produce 1 unit

> A wizzard appears to ask you if you want to create a backorder

Cause of the issue:

Clicking on the produce button will call the "button_mark_done" method.
However, the parameters of backorder creations are not checked before
the wizzard generation:
https://github.com/odoo/odoo/blob/5c2f60ae2b8eb6699bd322bc4ea3d5054c7aea37/addons/mrp/models/mrp_production.py#L2118-L2120 will call the

opw-3890886
@lase-odoo lase-odoo force-pushed the 17.0-opw-3890886-auto_back_order_production-lase branch from e773815 to 045351e Compare May 23, 2024 14:29
@lase-odoo
Copy link
Contributor Author

Thanks a lot for the review @Whenrow !

@Whenrow
Copy link
Contributor

Whenrow commented May 24, 2024

robodoo r+
Thank you

robodoo pushed a commit that referenced this pull request May 24, 2024
Steps to reproduce:

- Inventory > Configuration > Warehouse Management > Operations types
- Click on Manufacturing and put "Always" on create a backorder
- Create a new MO for 2 units of a product and produce 1 unit

> A wizzard appears to ask you if you want to create a backorder

Cause of the issue:

Clicking on the produce button will call the "button_mark_done" method.
However, the parameters of backorder creations are not checked before
the wizzard generation:
https://github.com/odoo/odoo/blob/5c2f60ae2b8eb6699bd322bc4ea3d5054c7aea37/addons/mrp/models/mrp_production.py#L2118-L2120 will call the

opw-3890886

closes #164560

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
robodoo pushed a commit that referenced this pull request May 24, 2024
Steps to reproduce:

- Inventory > Configuration > Warehouse Management > Operations types
- Click on Manufacturing and put "Always" on create a backorder
- Create a new MO for 2 units of a product and produce 1 unit

> A wizzard appears to ask you if you want to create a backorder

Cause of the issue:

Clicking on the produce button will call the "button_mark_done" method.
However, the parameters of backorder creations are not checked before
the wizzard generation:
https://github.com/odoo/odoo/blob/5c2f60ae2b8eb6699bd322bc4ea3d5054c7aea37/addons/mrp/models/mrp_production.py#L2118-L2120 will call the

opw-3890886

closes #164560

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
@robodoo robodoo closed this in 6915741 May 24, 2024
@fw-bot
Copy link
Contributor

fw-bot commented May 28, 2024

@lase-odoo @Whenrow this pull request has forward-port PRs awaiting action (not merged or closed):

@fw-bot
Copy link
Contributor

fw-bot commented May 29, 2024

@lase-odoo @Whenrow this pull request has forward-port PRs awaiting action (not merged or closed):

lohwswilson pushed a commit to lohwswilson/odoo that referenced this pull request Jun 5, 2024
Steps to reproduce:

- Inventory > Configuration > Warehouse Management > Operations types
- Click on Manufacturing and put "Always" on create a backorder
- Create a new MO for 2 units of a product and produce 1 unit

> A wizzard appears to ask you if you want to create a backorder

Cause of the issue:

Clicking on the produce button will call the "button_mark_done" method.
However, the parameters of backorder creations are not checked before
the wizzard generation:
https://github.com/odoo/odoo/blob/5c2f60ae2b8eb6699bd322bc4ea3d5054c7aea37/addons/mrp/models/mrp_production.py#L2118-L2120 will call the

opw-3890886

closes odoo#164560

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
@fw-bot fw-bot deleted the 17.0-opw-3890886-auto_back_order_production-lase branch June 7, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OE the report is linked to a support ticket (opw-...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants