Skip to content

Commit

Permalink
fix: type-cast while saving an item (backport #32549) (#32578)
Browse files Browse the repository at this point in the history
fix: type-cast while saving an item (#32549)

(cherry picked from commit 43037d8)

Co-authored-by: Rohan <Alchez@users.noreply.github.com>
  • Loading branch information
mergify[bot] and Alchez committed Oct 13, 2022
1 parent 0674d42 commit 829a0ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions erpnext/stock/doctype/item/item.py
Expand Up @@ -232,10 +232,10 @@ def validate_retain_sample(self):

def clear_retain_sample(self):
if not self.has_batch_no:
self.retain_sample = None
self.retain_sample = False

if not self.retain_sample:
self.sample_quantity = None
self.sample_quantity = 0

def add_default_uom_in_conversion_factor_table(self):
if not self.is_new() and self.has_value_changed("stock_uom"):
Expand Down
4 changes: 2 additions & 2 deletions erpnext/stock/doctype/item/test_item.py
Expand Up @@ -722,8 +722,8 @@ def test_retain_sample(self):

item.has_batch_no = None
item.save()
self.assertEqual(item.retain_sample, None)
self.assertEqual(item.sample_quantity, None)
self.assertEqual(item.retain_sample, False)
self.assertEqual(item.sample_quantity, 0)
item.delete()

def consume_item_code_with_differet_stock_transactions(
Expand Down

0 comments on commit 829a0ff

Please sign in to comment.