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][ADD] product_category_usage_group #1590

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from

Conversation

quentinDupont
Copy link
Contributor

@quentinDupont quentinDupont commented Apr 19, 2024

This module extends the functionality of the product module, to restrict usage
of product categories to users that belong to a given group.

Migration from 12.0 of our custom module that we try to share with the OCA now :)

Use case for us : restrict a category where account code is not set by default

product_category_form
product_template_warning

# Overload Section
@api.model_create_multi
def create(self, vals_list):
templates = super(ProductTemplate, self).create(vals_list)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
templates = super(ProductTemplate, self).create(vals_list)
templates = super().create(vals_list)

@rousseldenis rousseldenis added this to the 16.0 milestone Apr 29, 2024
return res

# Custom Section
def _check_usage_product_category(self, categ_id):
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

@quentinDupont Why not using a constraint instead ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great point 😆

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I change the code and it makes it simpler

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.

None yet

3 participants