-
Notifications
You must be signed in to change notification settings - Fork 15
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
[ADD] website_portal_medical_insurance: Insurance Portal #233
base: release/10.0
Are you sure you want to change the base?
[ADD] website_portal_medical_insurance: Insurance Portal #233
Conversation
Codecov Report
@@ Coverage Diff @@
## release/10.0 #233 +/- ##
================================================
- Coverage 88.01% 83.37% -4.64%
================================================
Files 124 128 +4
Lines 2328 2328
================================================
- Hits 2049 1941 -108
- Misses 279 387 +108
|
dedc28c
to
7c1fa4f
Compare
c93043f
to
a35d14a
Compare
a35d14a
to
5c06ad0
Compare
5c06ad0
to
2472461
Compare
website=True, | ||
methods=['GET'], | ||
) | ||
def insurance_plan_show(self, plan=None, redirect=None, **kwargs): |
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.
@lasley for this method. When the user wants to create a new insurance plan, the 'ADD' link will pass in /medical/insurance/plans/0
. Which will show a 404 page.
Before, you instead had the <int:id>
or something like that instead of the <model...
. in the url. With your version we could browse and get an empty record and the form would display. When using <model . . .
I don't think that's possible as it seems I get a 404 before the method logic even runs. I think awhile ago you were mentioning <model ...
does validations to ensure the record exists.
With that in mind, to stay consistent, should we:
- Have all urls use the
<int:id>
to account for creating new recs instead of<model...
or have something like: /medical/insurance/plans/new
for creating new recs. That way the logic for showing forms for existing records and for showing a form to create a new one are separated.
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.
Ah dang sorry it doesn't show the method's url in preview. The URL for this method is:
@http.route(
['/medical/insurance/plans/<model("medical.insurance.plan"):plan>'],
type='http',
auth='user',
website=True,
methods=['GET'],
)
def insurance_plan_show(self, plan=None, redirect=None, **kwargs):
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.
No need for a /new
, just listen on /medical/insurance/plans
for POST
& act on that instead?
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.
Also it should all be singular /plan
not plans
. My bad there
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.
ah I see. Those should be modelled after the model name, not pluralized. I had changed to plans to stay consistent with patients. I'll need to edit the patient portals then too back to patient and not patients.
For the case of POST though, that's covered by your website_form method in website_portal_medical.
Perhaps I'm misunderstanding, but what I'm trying to get at is let's say the user is at /medical/insurance/plan
, displaying all the plans. There is a link on that page that says ADD
with an href to /medical/insurance/plan/0
. This is to display a form to create a new plan.
Your code is as follows (at the bottom), which allows the rendering of the view even if no record exists. This allows for the display of a form when a user wants to create a new plan.
However if I change to ['/medical/insurance/plan/<model("medical.insurance.plan"):plan>']
, I get a 404.
So I'm just trying to figure out what would be the best way to display a form for a record that does not exist in the database yet.
Should we have a /medical/insurance/plan/new
uri specified as GET
? Or should the logic be as what you have done?
Or perhaps what you specified in your comment using post. That doesn't really make sense to me to use post though.
@http.route(
['/medical/insurance/plan/<int:plan_id>'],
type='http',
auth='user',
website=True,
methods=['GET'],
)
def insurance_plan_show(self, plan_id=None, redirect=None, **kwargs):
values = {
'error': {},
'error_message': [],
'success_page': kwargs.get('success_page', '/my/medical')
}
Plans = http.request.env['medical.insurance.plan']
if plan_id:
plan = Plans.browse(plan_id)
else:
plan = Plans.browse()
values.update({
'insurance_plan': plan and plan.sudo(),
})
return request.render(
'website_portal_medical_insurance_us.insurance_plan', values,
)
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.
Reason I'm asking is that medical patient portal is following what I have done, using model in the uri.
Upon looking here, it made me realize you can't create a patient from the frontend. So just wanted to confirm to either change to what you are doing for insurance plans, or if another idea is better.
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.
/plans
would display all plans, /plan/x
would would display plan ID x. /plan
should display a blank form. We should align this everywhere
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.
Awesome that clears things up. Sorry for the long comments : \
6382516
to
6081c9d
Compare
<field name="groups" eval="[(4, ref('base.group_portal'))]"/> | ||
<field name="domain_force">['|', | ||
('create_uid', '=', user.id), | ||
('is_verified', '=', True), |
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.
@lasley I'm having some issues with this security rule, causing Travis to fail.
https://travis-ci.org/LasLabs/vertical-medical/jobs/274413214#L2432
The code generating the plans for the view is here
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.
Seems like create_uid is causing the problem.
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.
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.
hmm. Well that was another issue. There were security errors when accessing patient, on product.uom.categ in the wizard on those exact lines. I noticed you used sudo in other parts of the file so figured that might work.
Could just be moving the poop train further down the line so I guess I'll re-look at them.
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.
Did you create the test company with the same user you are testing with?
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.
Or mark it as verified?
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.
Alright so I fixed the issue with the product.uom.categ error (at least locally).
Interestingly, after disabling all the security rules other than the access rules, the issue for accessing the medical plans still persists.
create a new plan as portal user then navigate back to the plans view. Following error happening. The interesting thing is that you clearly have a portal access rule for medical.insurance.company.
Runbot and travis may tell another story once done but this is what I'm getting locally.
Traceback (most recent call last):
File "/opt/odoo/addons/website/models/ir_http.py", line 265, in _handle_exception
response = super(Http, cls)._handle_exception(exception)
File "/opt/odoo/odoo/addons/base/ir/ir_http.py", line 169, in _handle_exception
return request._handle_exception(exception)
File "/opt/odoo/odoo/http.py", line 766, in _handle_exception
return super(HttpRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo/addons/base/ir/ir_http.py", line 195, in _dispatch
result = request.dispatch()
File "/opt/odoo/odoo/http.py", line 825, in dispatch
r = self._call_function(**self.params)
File "/opt/odoo/odoo/http.py", line 331, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo/service/model.py", line 119, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/odoo/http.py", line 327, in checked_call
result.flatten()
File "/opt/odoo/odoo/http.py", line 1257, in flatten
self.response.append(self.render())
File "/opt/odoo/odoo/http.py", line 1250, in render
return env["ir.ui.view"].render_template(self.template, self.qcontext)
File "/opt/odoo/odoo/addons/base/ir/ir_ui_view.py", line 1029, in render_template
return self.browse(self.get_view_id(template)).render(values, engine)
File "/opt/odoo/addons/website/models/ir_ui_view.py", line 110, in render
return super(View, self).render(values, engine=engine)
File "/opt/odoo/addons/web_editor/models/ir_ui_view.py", line 26, in render
return super(IrUiView, self).render(values=values, engine=engine)
File "/opt/odoo/odoo/addons/base/ir/ir_ui_view.py", line 1049, in render
return self.env[engine].render(self.id, qcontext)
File "/opt/odoo/odoo/addons/base/ir/ir_qweb/ir_qweb.py", line 53, in render
return super(IrQWeb, self).render(id_or_xml_id, values=values, **context)
File "/opt/odoo/odoo/addons/base/ir/ir_qweb/qweb.py", line 248, in render
self.compile(template, options)(self, body.append, values or {})
File "/opt/odoo/odoo/addons/base/ir/ir_qweb/qweb.py", line 322, in _compiled_fn
raise QWebException("Error to render compiling AST", e, path, node and etree.tostring(node[0]), name)
QWebException: (u'The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: medical.insurance.company, Operation: read)', None)
Traceback (most recent call last):
File "/opt/odoo/odoo/addons/base/ir/ir_qweb/qweb.py", line 315, in _compiled_fn
return compiled(self, append, values, options, log)
File "<template>", line 1, in template_website_portal_medical_insurance_us_insurances_1075
File "<template>", line 3, in body_call_content_1074
File "<template>", line 15, in foreach_1073
File "/opt/odoo/odoo/addons/base/ir/ir_qweb/ir_qweb.py", line 261, in _get_field
content = converter.record_to_html(record, field_name, field_options)
File "/opt/odoo/odoo/addons/base/ir/ir_qweb/fields.py", line 100, in record_to_html
value = record[field_name]
File "/opt/odoo/odoo/models.py", line 5177, in __getitem__
return self._fields[key].__get__(self, type(self))
File "/opt/odoo/odoo/fields.py", line 871, in __get__
value = record._cache[self]
File "/opt/odoo/odoo/models.py", line 5526, in __getitem__
return value.get() if isinstance(value, SpecialValue) else value
File "/opt/odoo/odoo/fields.py", line 48, in get
raise self.exception
AccessError: (u'The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: medical.insurance.company, Operation: read)', None)
Error to render compiling AST
AccessError: (u'The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: medical.insurance.company, Operation: read)', None)
Template: website_portal_medical_insurance_us.insurances
Path: /templates/t/t/t[2]/div/t/div/div/div[2]/div[1]/div
Node: <div class="h5" t-field="plan.insurance_company_id.name"/>
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.
Dang yeah travis is showing the same thing.
values = { | ||
'error': {}, | ||
'error_message': [], | ||
'success_page': kwargs.get('success_page', '/my/medical') |
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.
set to /medical/insurance/plans
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_medical_insurance_template_portal,medical.insurance.template.portal,medical_insurance.model_medical_insurance_template,base.group_portal,1,1,1,0 | ||
access_medical_insurance_plan_portal,medical.insurance.plan.portal,medical_insurance.model_medical_insurance_plan,base.group_portal,1,1,1,0 | ||
access_medical_insurance_company_portal,medical.insurance.company.portal,medical_insurance.model_medical_insurance_company,base.group_portal,1,1,1,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.
@lasley this is a little weird haha. So I commented out the domain force rules in the manifest and only have these access records. What I don't get is that after creating a plan as portal user with the insurance company field populated, it's showing access errors when showing /medical/insurance/plans
after that.
Yet we clearly have access granted to the portal user for medical.insurance.company. in the csv file.
Error to render compiling AST
AccessError: (u'The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: medical.insurance.company, Operation: read)', None)
Template: website_portal_medical_insurance_us.insurances
Path: /templates/t/t/t[2]/div/t/div/div/div[2]/div[1]/div
Node: <div class="h5" t-field="plan.insurance_company_id.name"/>
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.
Insurance companies inherit from abstract entity, which delegate inherits from partner. Try adding a domain_force to allow the showing of partners when create_uid == user.id
261b42b
to
6ed5d8d
Compare
<t t-if="insurance_plans"> | ||
<span class='badge'><t t-esc="len(insurance_plans)" /></span> | ||
</t> | ||
<t t-if="not patient_count"> |
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.
Should be insurance plans
* Add an insurance portal for use in user studies, add a security group so that default users cannot see it
* Redesign around new medical portal.
* Add create_uid to whitelist and to wizard * Fix groups_demo missing name field
6ed5d8d
to
5250dc9
Compare
Oops this one I can clear up (DMCA) because it's on our end |
* Add copyright headers on files that have not been entirely rewritten * Add modified work statements on modules that evolved from GNUHealth
e1320e7
to
fb8587c
Compare
fb8587c
to
56464a1
Compare
No description provided.