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_workorder: various fixes #31132

Closed
wants to merge 4 commits into
base: saas-12.2
from

Conversation

Projects
None yet
6 participants
@Whenrow
Copy link
Contributor

Whenrow commented Feb 15, 2019

Commit 5ef4666 change the workorder
model but some of the old fields was not removed. This clean all
the occurence of these unused part of code.

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

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

@Whenrow

This comment has been minimized.

Copy link
Contributor Author

Whenrow commented Feb 15, 2019

@C3POdoo C3POdoo added the RD label Feb 15, 2019

@Whenrow Whenrow force-pushed the odoo-dev:master-unused-mrp-whe branch Feb 15, 2019

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

@Whenrow Whenrow force-pushed the odoo-dev:master-unused-mrp-whe branch Feb 18, 2019

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

@Whenrow Whenrow force-pushed the odoo-dev:master-unused-mrp-whe branch Feb 19, 2019

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

@Whenrow Whenrow force-pushed the odoo-dev:master-unused-mrp-whe branch Feb 19, 2019

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

addons/mrp/models/mrp_abstract_workorder.py Outdated
@@ -136,7 +135,7 @@ def _generate_lines_values(self, move, qty_to_consume):
'qty_to_consume': to_consume_in_line,
'qty_reserved': move_line.product_uom_qty,
'lot_id': move_line.lot_id.id,
'qty_done': is_tracked and 0 or to_consume_in_line
'qty_done': 0 if is_tracked else to_consume_in_line

This comment has been minimized.

@sle-odoo

sle-odoo Feb 19, 2019

Contributor

with the previous commit

addons/mrp/models/stock_move.py Outdated
@@ -128,6 +128,7 @@ def default_get(self, fields_list):
def _action_assign(self):
res = super(StockMove, self)._action_assign()
for move in self.filtered(lambda x: x.production_id or x.raw_material_production_id):
move.reference = move.raw_material_production_id.name or move.production_id.name

This comment has been minimized.

@sle-odoo

sle-odoo Feb 19, 2019

Contributor

not in _action_assign
better in _action_confirm

if float_compare(qty_todo, 0, precision_rounding=rounding) <= 0:
break
candidate = candidates.pop()

This comment has been minimized.

@sle-odoo

sle-odoo Feb 19, 2019

Contributor

these three lines in a single commit

This comment has been minimized.

@sle-odoo

sle-odoo Feb 19, 2019

Contributor

also this should traceback and the branch is green... add a testcase please :(

addons/mrp/tests/test_order.py Outdated
@@ -512,7 +512,7 @@ def test_product_produce_2(self):

self.assertEqual(len(product_produce.workorder_line_ids), 3, 'You should have 3 produce lines. One for each serial to consume')
product_produce.qty_producing = 1
produce_line_1 = product_produce.workorder_line_ids[0]
produce_line_1 = product_produce.workorder_line_ids.filtered(lambda line: line.product_id == p1)[0]

This comment has been minimized.

@sle-odoo

sle-odoo Feb 19, 2019

Contributor

this change may make sense but i don't get where the change in order comes from.. please explain

addons/mrp/models/mrp_production.py Outdated
@@ -844,6 +844,7 @@ def button_mark_done(self):
for wo in self.workorder_ids:
if wo.time_ids.filtered(lambda x: (not x.date_end) and (x.loss_type in ('productive', 'performance'))):
raise UserError(_('Work order %s is still running') % wo.name)
wo.workorder_line_ids.unlink()

This comment has been minimized.

@sle-odoo

sle-odoo Feb 19, 2019

Contributor

don't unlink in a loop, you'll invalidate the cache more than needed

@Whenrow Whenrow force-pushed the odoo-dev:master-unused-mrp-whe branch 4 times, most recently Feb 19, 2019

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

@Whenrow Whenrow force-pushed the odoo-dev:master-unused-mrp-whe branch Feb 20, 2019

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Feb 20, 2019

addons/mrp/models/stock_move.py Outdated
@@ -142,6 +142,7 @@ def _action_cancel(self):
def _action_confirm(self, merge=True, merge_into=False):
moves = self.env['stock.move']
for move in self:
move.reference = move.raw_material_production_id.name or move.production_id.name

This comment has been minimized.

addons/mrp/models/mrp_production.py Outdated
@@ -844,6 +844,7 @@ def button_mark_done(self):
for wo in self.workorder_ids:
if wo.time_ids.filtered(lambda x: (not x.date_end) and (x.loss_type in ('productive', 'performance'))):
raise UserError(_('Work order %s is still running') % wo.name)
self.workorder_ids.mapped('workorder_line_ids').unlink()

This comment has been minimized.

@amoyaux

amoyaux Feb 20, 2019

Contributor

which case are problematic?

@Whenrow Whenrow force-pushed the odoo-dev:master-unused-mrp-whe branch Feb 21, 2019

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

@Whenrow Whenrow force-pushed the odoo-dev:master-unused-mrp-whe branch Feb 21, 2019

@robodoo robodoo added the error 🙅 label Feb 26, 2019

@robodoo

This comment has been minimized.

Copy link
Contributor

robodoo commented Feb 26, 2019

Staging failed: ci/runbot (view more at http://runbot.odoo.com/runbot/build/470118)

@Whenrow Whenrow force-pushed the odoo-dev:master-unused-mrp-whe branch Feb 26, 2019

@KangOl

This comment has been minimized.

Copy link
Contributor

KangOl commented Feb 26, 2019

@robodoo retry

@robodoo robodoo added CI 🤖 r+ 👌 and removed error 🙅 labels Feb 26, 2019

Whenrow added some commits Feb 19, 2019

[FIX] mrp: remove unused code
Commit 5ef4666 change the workorder
model but some of the old fields was not removed. This clean all
the occurence of these unused part of code.
[FIX] mrp: recordset have not pop() method
The pop() method is not implemented for Odoo recordset. This commit replace it by a simple 'for' loop
[FIX] mrp: missing move reference
A manufacturing order creates its raw move in an onchange when saving the form
view. As the MO has no name at this stage, the raw moves reference stay 'New'
even when marked as done
This commit change the moves reference once the MO is confirmed
[FIX] mrp: finished moves become raw moves
A workorder has a one2Many to stock.move to represent the production raw moves. Putting 'workorder_id' on the production finished move will set it as raw moves in the workorders

@Whenrow Whenrow force-pushed the odoo-dev:master-unused-mrp-whe branch to 779c9b2 Feb 28, 2019

@Whenrow Whenrow changed the title [FIX] mrp: remove unused code [FIX] mrp_workorder: various fixes Feb 28, 2019

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

@amoyaux

This comment has been minimized.

Copy link
Contributor

amoyaux commented Feb 28, 2019

robodoo r+

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

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

[FIX] mrp: finished moves become raw moves
A workorder has a one2Many to stock.move to represent the production raw moves. Putting 'workorder_id' on the production finished move will set it as raw moves in the workorders

closes #31132
@robodoo

This comment has been minimized.

Copy link
Contributor

robodoo commented Mar 1, 2019

Merged, thanks!

@robodoo robodoo closed this Mar 1, 2019

@KangOl KangOl deleted the odoo-dev:master-unused-mrp-whe branch Mar 4, 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.