[IMP] stock_picking_batch_custom: configuraciones de bloqueo por pestaña
This commit is contained in:
parent
05a8908007
commit
18fd73ed1b
7 changed files with 211 additions and 25 deletions
|
|
@ -176,6 +176,12 @@ class TestBatchSummary(TransactionCase):
|
|||
batch._compute_summary_line_ids()
|
||||
return batch
|
||||
|
||||
def _set_batch_restriction_config(self, **vals):
|
||||
company = self.env.company
|
||||
previous = {key: company[key] for key in vals}
|
||||
company.write(vals)
|
||||
self.addCleanup(lambda: company.write(previous))
|
||||
|
||||
# Tests
|
||||
def test_totals_and_pending_with_conversion(self):
|
||||
"""Totals aggregate per product with UoM conversion and pending."""
|
||||
|
|
@ -421,3 +427,38 @@ class TestBatchSummary(TransactionCase):
|
|||
|
||||
# Should not raise
|
||||
batch._check_all_products_collected()
|
||||
|
||||
def test_summary_restriction_blocks_when_enabled(self):
|
||||
"""Product Summary restriction can be enabled independently."""
|
||||
|
||||
self._set_batch_restriction_config(
|
||||
batch_summary_restriction_enabled=True,
|
||||
batch_summary_restriction_scope="processed",
|
||||
batch_detailed_restriction_enabled=False,
|
||||
)
|
||||
|
||||
batch = self._create_batch_with_pickings()
|
||||
batch.action_confirm()
|
||||
batch._compute_summary_line_ids()
|
||||
|
||||
# Detailed lines are collected, but Product Summary stays unchecked
|
||||
batch.move_line_ids.filtered(lambda line: line.quantity > 0).write(
|
||||
{"is_collected": True}
|
||||
)
|
||||
|
||||
with self.assertRaisesRegex(UserError, "product summary"):
|
||||
batch.action_done()
|
||||
|
||||
def test_detailed_scope_all_blocks_unprocessed_lines(self):
|
||||
"""Detailed scope 'all' must include non-processed detailed lines."""
|
||||
|
||||
self._set_batch_restriction_config(
|
||||
batch_summary_restriction_enabled=False,
|
||||
batch_detailed_restriction_enabled=True,
|
||||
batch_detailed_restriction_scope="all",
|
||||
)
|
||||
|
||||
batch = self._create_partial_batch(extra_move=True)
|
||||
|
||||
with self.assertRaisesRegex(UserError, self.product_2.display_name):
|
||||
batch._check_all_products_collected(batch.picking_ids)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue