Skip to content

Commit

Permalink
Merge pull request OCA#2471 from legalsylvain/13.0-FIX-disable-pre-in…
Browse files Browse the repository at this point in the history
…it-mrp

[FIX] mrp + openupgrade_records : do not create column when installing mrp
  • Loading branch information
pedrobaeza committed Dec 7, 2020
2 parents 2fe4606 + cd80fed commit e392f28
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions addons/mrp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@ def _pre_init_mrp(cr):
leads to "Out of Memory" crashes
- stock.move.line.done_move is a stored+related on the former...
- Also set the default value for unit_factor in the same UPDATE query to save some SQL constraint checks"""
cr.execute("""ALTER TABLE "stock_move" ADD COLUMN "unit_factor" float;""")
cr.execute("""ALTER TABLE "stock_move" ADD COLUMN "is_done" bool;""")
cr.execute("""ALTER TABLE "stock_move_line" ADD COLUMN "done_move" bool;""")
cr.execute("""UPDATE stock_move
SET is_done=COALESCE(state in ('done', 'cancel'), FALSE),
unit_factor=1.0;""")
cr.execute("""UPDATE stock_move_line
SET done_move=sm.is_done
FROM stock_move sm
WHERE move_id=sm.id;""")
# Openupgrade: the following lines will generate an errors, when running
# openupgrade_records.
# cr.execute("""ALTER TABLE "stock_move" ADD COLUMN "unit_factor" float;""")
# cr.execute("""ALTER TABLE "stock_move" ADD COLUMN "is_done" bool;""")
# cr.execute("""ALTER TABLE "stock_move_line" ADD COLUMN "done_move" bool;""")
# cr.execute("""UPDATE stock_move
# SET is_done=COALESCE(state in ('done', 'cancel'), FALSE),
# unit_factor=1.0;""")
# cr.execute("""UPDATE stock_move_line
# SET done_move=sm.is_done
# FROM stock_move sm
# WHERE move_id=sm.id;""")
pass

def _create_warehouse_data(cr, registry):
""" This hook is used to add a default manufacture_pull_id, manufacture
Expand Down

0 comments on commit e392f28

Please sign in to comment.