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

[14.0][IMP] product_barcode_constraint_per_company: simplify logic #537

Conversation

dessanhemrayev
Copy link

Change old method
Update oca_dependencies file
Fix tests

@dessanhemrayev dessanhemrayev force-pushed the 14.0-t2944-product_barcode_constraint_per_company-refactoring branch 4 times, most recently from bed05b5 to cddf5eb Compare October 21, 2023 22:12
@dessanhemrayev dessanhemrayev force-pushed the 14.0-t2944-product_barcode_constraint_per_company-refactoring branch from cddf5eb to e879582 Compare October 22, 2023 12:50
Copy link
Contributor

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

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

Do not add new dependency to multi barcode module.

@dessanhemrayev
Copy link
Author

dessanhemrayev commented Oct 24, 2023

Do not add new dependency to multi barcode module.

@legalsylvain Do you think we need to create a bridge module for that, or is there possibly another solution?

@dessanhemrayev dessanhemrayev force-pushed the 14.0-t2944-product_barcode_constraint_per_company-refactoring branch from e879582 to 524392e Compare October 24, 2023 21:18
@legalsylvain
Copy link
Contributor

multi barcode module is a module that is really changing a lot of things. The feature is not desired in some implementation. So in that case, indeed glue module looks a good solution, if you want to make the module product_barcode_constraint_per_company working with that module.

@francesco-ooops
Copy link
Contributor

supersedes #526

@dessanhemrayev dessanhemrayev marked this pull request as draft October 29, 2023 09:44
@dessanhemrayev dessanhemrayev force-pushed the 14.0-t2944-product_barcode_constraint_per_company-refactoring branch from 524392e to 7722d53 Compare October 30, 2023 20:25
@dessanhemrayev dessanhemrayev marked this pull request as ready for review October 30, 2023 20:26
Copy link
Contributor

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

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

except the deletion of the README.rst file, LGTM. Thanks !

@dessanhemrayev dessanhemrayev force-pushed the 14.0-t2944-product_barcode_constraint_per_company-refactoring branch 2 times, most recently from bbb5f35 to 33bd632 Compare October 30, 2023 21:45
Copy link
Contributor

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

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

nitpicking : still changes in product_barcode_constraint_per_company/README.rst !

No need to change this file, it will be generated automatically, when mergin the PR, by the bot.

regards.

@dessanhemrayev dessanhemrayev force-pushed the 14.0-t2944-product_barcode_constraint_per_company-refactoring branch 4 times, most recently from a206cd3 to df61843 Compare November 1, 2023 19:17
@geomer198 geomer198 force-pushed the 14.0-t2944-product_barcode_constraint_per_company-refactoring branch from df61843 to 5431e29 Compare November 10, 2023 12:44
@dessanhemrayev dessanhemrayev force-pushed the 14.0-t2944-product_barcode_constraint_per_company-refactoring branch from 60bfe4b to 30a8ce8 Compare November 19, 2023 14:29
Copy link

@geomer198 geomer198 left a comment

Choose a reason for hiding this comment

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

Please fix comments

@api.constrains("name")
def _check_duplicates(self):
for record in self:
barcodes = self.search(

Choose a reason for hiding this comment

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

Why you use search function here?
And why you call super in cycle?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, I'll fix it


def test_create_different_company(self):
"""Verify creating a product with the same barcode for different companies"""
super().test_create_different_company()

Choose a reason for hiding this comment

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

You deactivate parent function. Why do you use super here?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, I'll fix it


def test_create_same_company(self):
"""Verifying the Existence of a Product with the Same Barcode within a Single Company"""
super().test_create_same_company()

Choose a reason for hiding this comment

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

You deactivate parent function. Why do you use super here?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, I'll fix it

Copy link
Contributor

@aleuffre aleuffre left a comment

Choose a reason for hiding this comment

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

Code review, LGTM

@francesco-ooops
Copy link
Contributor

@simahawk good for you?

@francesco-ooops
Copy link
Contributor

@simahawk waiting for your blessing :)

@francesco-ooops
Copy link
Contributor

@simahawk help me Orsi-Wan Kenobi, you're my only hope

@francesco-ooops
Copy link
Contributor

@pedrobaeza can this be merged based on existing reviews?

@pedrobaeza pedrobaeza added this to the 14.0 milestone Jan 16, 2024
@@ -87,4 +87,4 @@ promote its widespread use.

This module is part of the `OCA/stock-logistics-barcode <https://github.com/OCA/stock-logistics-barcode/tree/14.0/product_barcode_constraint_per_company>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Copy link
Member

Choose a reason for hiding this comment

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

Remove this change.

Choose a reason for hiding this comment

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

still here

"summary": "Change the product barcode constraint"
", allowing the same barcode for differents companies",
"summary": """Change the product barcode constraint,
allowing the same barcode for differents companies""",
Copy link
Member

Choose a reason for hiding this comment

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

Don't change this. It was correct. Now, it isn't, as the spaces are included.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for review!)
I'll fix it

Copy link

@simahawk simahawk left a comment

Choose a reason for hiding this comment

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

pls check Pedro's remarks

@@ -6,13 +6,13 @@
"name": "Product Barcode Constraint per Company",
"version": "14.0.1.0.1",

Choose a reason for hiding this comment

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

Detail: as you added a new module in the same PR you should change the version manually here, unless you don't care that the new module will have version 1.1.0 too when we'll bump w/ minor.

if barcode and (
not record.product_id.company_id
or (
barcode.sudo().product_id.company_id == record.product_id.company_id

Choose a reason for hiding this comment

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

I'd move sudo to for record in self.sudo()

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for review!)
I'll fix it

@dessanhemrayev dessanhemrayev force-pushed the 14.0-t2944-product_barcode_constraint_per_company-refactoring branch from e2713a1 to 92adfe2 Compare January 16, 2024 19:53
@francesco-ooops
Copy link
Contributor

@pedrobaeza @simahawk kind reminder :)

Copy link

@simahawk simahawk left a comment

Choose a reason for hiding this comment

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

minor remark, pre-approving

@@ -87,4 +87,4 @@ promote its widespread use.

This module is part of the `OCA/stock-logistics-barcode <https://github.com/OCA/stock-logistics-barcode/tree/14.0/product_barcode_constraint_per_company>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Choose a reason for hiding this comment

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

still here

@dessanhemrayev dessanhemrayev force-pushed the 14.0-t2944-product_barcode_constraint_per_company-refactoring branch 3 times, most recently from c6f40a7 to fed1a4c Compare January 30, 2024 18:55
@dessanhemrayev dessanhemrayev force-pushed the 14.0-t2944-product_barcode_constraint_per_company-refactoring branch from fed1a4c to f1b5832 Compare January 30, 2024 19:13
@dessanhemrayev
Copy link
Author

@pedrobaeza please check, I have corrected your comments)
Thanks

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 14.0-ocabot-merge-pr-537-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 35b1346 into OCA:14.0 Jan 30, 2024
6 of 7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 67df8ca. Thanks a lot for contributing to OCA. ❤️

@dessanhemrayev dessanhemrayev deleted the 14.0-t2944-product_barcode_constraint_per_company-refactoring branch January 30, 2024 19:50
@dessanhemrayev dessanhemrayev restored the 14.0-t2944-product_barcode_constraint_per_company-refactoring branch January 30, 2024 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants