-
Notifications
You must be signed in to change notification settings - Fork 105
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
[12.0] Add shopinvader_customer_multi_user #471
[12.0] Add shopinvader_customer_multi_user #471
Conversation
Thank you @simahawk once again 'Cristal clear code' ! Looks good to me at first read. I'll test it into the coming days... |
default=False, # let's be explicit here :) | ||
help="Turn on this flag to enable multiple users per each customers. " | ||
"Customers will be able to register many users that will use " | ||
"the same data for shipping and invoicing.", |
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.
@simahawk We should explain that the multi user is by company....
@simahawk can you fix the pylint error PLZ https://travis-ci.org/shopinvader/odoo-shopinvader/jobs/601762911#L389 Thanks |
3a95376
to
472543a
Compare
Codecov Report
@@ Coverage Diff @@
## 12.0 #471 +/- ##
===========================================
- Coverage 91.03% 57.29% -33.74%
===========================================
Files 121 56 -65
Lines 3456 2323 -1133
===========================================
- Hits 3146 1331 -1815
- Misses 310 992 +682
Continue to review full report at Codecov.
|
472543a
to
83cb5fb
Compare
@lmignon I've drafted a bit of refactoring here:
if we find a good way to track changes (eg: post a message or a notification when the sub user edits something) I think we are almost good. Then probably, we should lock editing on "protected" records by raising errors. |
83cb5fb
to
01bbc83
Compare
|
||
def profile(self, partner=None): | ||
return { | ||
"create": False, |
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.
I've listed here CRUD operations, but create
here makes little sense because you cannot create a new profile w/out registration.
|
||
def address(self, address_id): | ||
return { | ||
# TODO: create should be a global params |
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.
at the same time create
here makes little sense because create address
permission should be global.
I'd say we should have anaccess
or permission
key in the global payload which states what you can do or not.
This seems to be the right place (when you get the customer/profile information).
We could have something like:
def get(self):
if self.partner:
customer = self._get_customer_info()
return {
"data": customer,
"store_cache": {
"customer": customer,
"permissions": self.access_info.permissions(),
}
}
else:
return {"data": {}}
@lmignon @sebastienbeau what to you think?
01bbc83
to
417ff23
Compare
I've rebased this on top of #495 as it unifies customer info handling |
Then the registration workflow changes as following: | ||
|
||
* for each company binding a unique token is generated, you can see it in the Shopinvader tab on company form | ||
* on Locomotive registration page users can enter the company token (if your theme does not support this yet, just add a text field named `company_token`) |
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 addon doesn't depend on locomotive. we should explain how the addon works reagrding the service layer...
"update": False, | ||
"delete": False, | ||
# easy check on client side for being able to edit | ||
"readonly": False, |
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.
@simahawk Why not "readonly" : True
?
( | ||
"unique_invader_user_token", | ||
"unique(invader_user_token)", | ||
"Already exists in database", |
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.
what already exists?
1dff5fe
to
3283363
Compare
I've implemented it here https://github.com/shopinvader/odoo-shopinvader/pull/471/files#diff-6a87955a2b1b8be929d84353c6449701R37-R50 Basically by default they can do everything. Then customer multi user module overrides it to block creation of new addresses. Hence, the current behavior is:
The WIP PR for the template is here shopinvader/shopinvader-template#21. I don't think we need anymore to raise a specific error for users not validated. We could also get rid of the validation methods in the controller and maybe just leave an hook. The addition of Once we agreed on the current implementation I clean up and add proper test coverage (I left tests aside as I had to test w/ the UI as well). @lmignon @sebastienbeau your feedback is appreciated 😉 |
058a658
to
1d1e43a
Compare
1d1e43a
to
3002c3f
Compare
3002c3f
to
945589f
Compare
6342e3c
to
6cb9f7f
Compare
6cb9f7f
to
cd0e325
Compare
extrapolated permission handling to #533 |
moving to v13 #545 |
Includes #469, look at last commit only,
@lmignon @sebastienbeau one more thing we've talked about in LLN.
Specs as we defined are here #454.