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: start the next workorder in a function to allow for overrides #31774

Closed
wants to merge 2 commits into from

Conversation

Projects
None yet
5 participants
@len-odoo
Copy link
Contributor

len-odoo commented Mar 12, 2019

When a workorder is processed, it starts the next workorder.
We put that logic in a function to allow other modules to override it.

opw 1943674

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:

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

[FIX] mrp: start the next workorder in a function to allow for overrides
When a workorder is processed, it starts the next workorder.
We put that logic in a function to allow other modules to override it.

opw 1943674

@len-odoo len-odoo requested a review from Whenrow Mar 12, 2019

@robodoo robodoo added the CI 🤖 label Mar 12, 2019

@C3POdoo C3POdoo added the OE label Mar 12, 2019

@@ -409,6 +408,12 @@ def record_production(self):
self.button_finish()
return True

@api.multi
def _start_nextworkorder(self):
for record in self:

This comment has been minimized.

Copy link
@fmdl

fmdl Mar 13, 2019

Contributor

one write for better performance : self.mapped('next_work_order_id').filtered(lambda x: x.state == 'pending').write({'state':'ready'})

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Mar 21, 2019

@len-odoo len-odoo force-pushed the odoo-dev:12.0-opw1943674-mrp-len branch from c0d4f0f to 3dd374b Mar 21, 2019

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Mar 21, 2019

@@ -583,6 +583,7 @@ def _workorders_create(self, bom, bom_data):
})
if workorders:
workorders[-1].next_work_order_id = workorder.id
workorders[-1]._init_nextworkorder_states()

This comment has been minimized.

Copy link
@Whenrow

Whenrow Apr 1, 2019

Contributor

it's already done line 580

This comment has been minimized.

Copy link
@len-odoo

len-odoo Apr 1, 2019

Author Contributor

No, l580 we give it an initial value (for all but the first, pending) but if there is a batch_size of 0, then we want to allow workorders to start in parallel.
That's why we go over the state once again, but using the info from workorders[-1] to decide what its state should really be (although it's only really used in mrp_workorder...).

This comment has been minimized.

Copy link
@Whenrow

Whenrow Apr 2, 2019

Contributor

ok you are right

[IMP] mrp: start work orders in the right state
To be able to override the initialisation of the work orders states,
we put that in a function.

opw 1943674

@len-odoo len-odoo force-pushed the odoo-dev:12.0-opw1943674-mrp-len branch from 3dd374b to 953d446 Apr 3, 2019

@robodoo robodoo removed the CI 🤖 label Apr 3, 2019

@len-odoo

This comment has been minimized.

Copy link
Contributor Author

len-odoo commented Apr 3, 2019

robodoo r+

@len-odoo

This comment has been minimized.

Copy link
Contributor Author

len-odoo commented Apr 3, 2019

robodoo rebase-ff

@robodoo

This comment has been minimized.

Copy link
Contributor

robodoo commented Apr 3, 2019

Merge method set to rebase and fast-forward

@robodoo robodoo added the merging 👷 label Apr 3, 2019

@robodoo robodoo closed this in 295690c Apr 3, 2019

@robodoo robodoo added merged 🎉 and removed merging 👷 labels Apr 3, 2019

@robodoo

This comment has been minimized.

Copy link
Contributor

robodoo commented Apr 3, 2019

Merged, thanks!

@len-odoo len-odoo deleted the odoo-dev:12.0-opw1943674-mrp-len branch Apr 3, 2019

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.