-
-
Notifications
You must be signed in to change notification settings - Fork 601
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] [mig] pos_user_restriction #649
Conversation
Restrict some users to only access their assigned points of sale
Currently translated at 100.0% (7 of 7 strings) Translation: pos-12.0/pos-12.0-pos_user_restriction Translate-URL: https://translation.odoo-community.org/projects/pos-12-0/pos-12-0-pos_user_restriction/es/
…taurant module is installed
fff2693
to
5a25402
Compare
@etobella It would be nice if you could review the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional review LGTM. Some comments that need to be resolved.
pos_configs = self.pos_config_model.with_user( | ||
self.pos_user_assigned_pos.id | ||
).search([]) | ||
# self.assertFalse(pos_configs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why you have commented this line?
@@ -7,7 +7,8 @@ access_stock_warehouse_pos_user,stock.warehouse pos_user,stock.model_stock_wareh | |||
access_stock_move_pos_user,stock.move pos_user,stock.model_stock_move,group_assigned_points_of_sale_user,1,1,1,1 | |||
access_report_pos_order,report.pos.order,point_of_sale.model_report_pos_order,group_assigned_points_of_sale_user,1,1,1,1 | |||
access_account_journal_pos_user,account.journal pos_user,account.model_account_journal,group_assigned_points_of_sale_user,1,0,0,0 | |||
access_account_bank_statement,account.bank.statement,account.model_account_bank_statement,group_assigned_points_of_sale_user,1,1,1,0 | |||
access_account_payment_method_pos_user,account.payment.method pos_user,account.model_account_payment_method,group_assigned_points_of_sale_user,1,0,0,0 | |||
access_account_bank_statement,account.bank.statement,account.model_account_bank_statement,group_assigned_points_of_sale_user,1,1,1,0Assigned users |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please check I think Assigned users added at the end of this line?
@@ -14,29 +15,29 @@ | |||
/> | |||
</record> | |||
|
|||
<data noupdate="1"> | |||
<data noupdate="0"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this is changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry I forgot it
assigned_user_ids = fields.Many2many( | ||
"res.users", | ||
string="Assigned users", | ||
help="Restrict some users to only access their assigned points of sale. " | ||
"In order to apply the restriction, the user needs the " | ||
"'User: Assigned POS Only' group", | ||
) | ||
set_pos_user_group = fields.Boolean( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we need new field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch the cashier according to the code of the Owl Structure in v14 for the switch cashier (employee) calls the (pos_user_group) method to switch cashier easily and can start a session so I have put a new field and method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not ok.
Try making the group_pos_user_id
field a computed field instead, it should probably work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ivantodorovich Thanks for the review suggestions are implemented you can re-review it.
pos_configs = self.pos_config_model.with_user( | ||
self.pos_user_assigned_pos.id | ||
).search([]) | ||
# self.assertTrue(pos_configs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here please remove the comment from this line.
1b51b18
to
e437619
Compare
@dsolanki-initos that suggestions are implemented you can re-review it |
@chienandalu can you please add this to the 14.0 milestone and merge this PR? |
@eLBati It would be nice if you could review the PR. |
@hkapatel-initos sorry I'm not using v14 at the moment so I am not able to evaluate the correctness of the changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hkapatel-initos sorry I'm not using v14 at the moment so I am not able to evaluate the correctness of the changes
okay
@@ -14,29 +15,29 @@ | |||
/> | |||
</record> | |||
|
|||
<data noupdate="1"> | |||
<data noupdate="0"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry I forgot it
@legalsylvain It would be nice if you could review the PR. |
@ivantodorovich can you please review this PR? |
e437619
to
5736708
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small comments otherwise LGTM
I'm pre-approving
) | ||
|
||
@api.depends("assigned_user_ids") | ||
def _compute_set_pos_user_group(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def _compute_set_pos_user_group(self): | |
def _compute_group_pos_user_id(self): |
As per OCA guidelines, use _compute_<field_name>
for compute method names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check this comment as I think it hasn't been taken care of
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ivantodorovich that suggestions are implemented can you Re-check it
).search([]) | ||
self.assertFalse(pos_configs) | ||
|
||
self.pos_config_main._compute_set_pos_user_group() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.pos_config_main._compute_set_pos_user_group() |
You can probably remove this line
@HaraldPanten can u please review this pr ? |
@christophlsa can you please review this pr? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional review 👍
This PR has the |
@hkapatel-initos can you answer to the @ivantodorovich remarks ? |
5736708
to
d5ca514
Compare
Done |
Thanks !! 🎉 /ocabot merge nobump |
This PR looks fantastic, let's merge it! |
Congratulations, your PR was merged at 3c8c30f. Thanks a lot for contributing to OCA. ❤️ |
Migration to 14.0.
In v12.0 there is no restricted group at the opening of session time and in version 14.0 system strictly allows to set a minimal access group of point of sale.
Only if there is a default user in version 14, the user will be set. The point of sale session is open
so select Allowed Employees.
Allowed Employees
Then assign "Authorized Employees" Select the same user(cashier) that is in "Assigned POS Only" Use employee credentials to log in to the PoS session and switch cashier.