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

[16.0][IMP] barcodes_generator_abstract: Avoid double iteration on base generation #619

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def generate_base(self):
" 'Generate Type' set to 'Base managed by Sequence'"
)
)
else:
elif not item.barcode_base:
item.barcode_base = item.barcode_rule_id.sequence_id.next_by_id()

def generate_barcode(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ def test_generate_sequence_sequence(self):
self.user_fake.generate_barcode()
self.assertEqual(self.user_fake.barcode, "2000001000007")

self.user_fake.generate_base()
self.assertEqual(self.user_fake.barcode_base, 2)
self.user_fake.generate_barcode()
self.assertEqual(self.user_fake.barcode, "2000002000006")

Comment on lines -85 to -89
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you remove this test. It looks valid ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Because it will be the same base and barcode. With this change if the product already has a base, it will not generate a new one

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the code is called two times, It should be fixed. But this change is not desired.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't undestand really well, it make sense that it doesn't change because you can't change the base two times in UI

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I did'nt understood the point. I'll investigate a little.
Thanks for your time.

def test_generate_sequence_sequence_automate(self):
self.barcode_rule_fake.write(
{
Expand Down
Loading