Skip to content

Commit

Permalink
[IMP] stock_move_line_lock_qty_done: prevent test cases from other mo…
Browse files Browse the repository at this point in the history
…dules from failing
  • Loading branch information
AungKoKoLin1997 committed Nov 12, 2024
1 parent ff4ac9b commit f863bd7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions stock_move_line_lock_qty_done/models/stock_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@

from odoo import _, models
from odoo.exceptions import UserError
from odoo.tools import config


class StockMoveLine(models.Model):

_inherit = "stock.move.line"

def _check_qty_done_change_allowed(self, vals):
if config["test_enable"] and not self.env.context.get(
"test_stock_move_line_lock_qty_done"
):
return True
if vals.get("qty_done", None) is None:
return True
has_group = self.env.user.has_group(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ def setUpClass(cls):
cls.assigned_picking = cls.env["stock.picking"].search(
[("state", "=", "assigned")], limit=1
)
cls.move_line = cls.assigned_picking.move_line_ids[0]
cls.move_line = cls.assigned_picking.move_line_ids[0].with_context(
test_stock_move_line_lock_qty_done=True
)

def test_0(self):
self.assertEqual(self.assigned_picking.state, "assigned")
Expand Down

0 comments on commit f863bd7

Please sign in to comment.