-
Notifications
You must be signed in to change notification settings - Fork 11
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
[FIX] g2p_programs: access error on approve #674
base: 17.0
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 17.0 #674 +/- ##
=======================================
Coverage 72.73% 72.73%
=======================================
Files 667 667
Lines 17259 17259
Branches 2195 2195
=======================================
Hits 12553 12553
Misses 4305 4305
Partials 401 401 ☔ View full report in Codecov by Sentry. |
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.
@shashikala1998 don't recreate the module g2p_programs in openspp repo. If you're trying to change or add something in the g2p_programs module, you should use the forked repo https://github.com/OpenSPP/openg2p-program.git, push your changes there, and create a PR on that repo
or you can just use the spp_programs
module of openspp-modules repo and add your changes/update on this repo by inherting whatever function or xml data you're trying to change
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.
@shashikala1998 i'm encountering an error when i'm trying to install the module spp_programs
. I suggest you just inherit the g2p_program_cycle_approver
since what you did is to recreate the g2p_program_cycle_approver
.
here is the error traceback
RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
File "/Users/red/odoo/odoo/tools/convert.py", line 556, in _tag_root
f(rec)
File "/Users/red/odoo/odoo/tools/convert.py", line 456, in _tag_record
record = model._load_records([data], self.mode == 'update')
File "/Users/red/odoo/odoo/models.py", line 5069, in _load_records
records = self._load_records_create([data['values'] for data in to_create])
File "/Users/red/odoo/odoo/models.py", line 4980, in _load_records_create
return self.create(values)
File "<decorator-gen-111>", line 2, in create
File "/Users/red/odoo/odoo/api.py", line 415, in _model_create_multi
return create(self, arg)
File "/Users/red/odoo/odoo/addons/base/models/res_users.py", line 1459, in create
groups = super().create(vals_list)
File "<decorator-gen-109>", line 2, in create
File "/Users/red/odoo/odoo/api.py", line 415, in _model_create_multi
return create(self, arg)
File "/Users/red/odoo/odoo/addons/base/models/res_users.py", line 1337, in create
groups = super(GroupsImplied, self).create(vals_list)
File "<decorator-gen-12>", line 2, in create
File "/Users/red/odoo/odoo/api.py", line 415, in _model_create_multi
return create(self, arg)
File "/Users/red/odoo/odoo/models.py", line 4608, in create
records = self._create(data_list)
File "/Users/red/odoo/odoo/models.py", line 4796, in _create
cr.execute(SQL(
File "/Users/red/odoo/odoo/sql_db.py", line 332, in execute
res = self._obj.execute(query, params)
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "res_groups_name_uniq"
DETAIL: Key (category_id, name)=(97, {"en_US": "Program Cycle Approver"}) already exists.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/red/odoo/odoo/http.py", line 1764, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/Users/red/odoo/odoo/service/model.py", line 133, in retrying
result = func()
File "/Users/red/odoo/odoo/http.py", line 1791, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/Users/red/odoo/odoo/http.py", line 1995, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "/Users/red/odoo/odoo/addons/base/models/ir_http.py", line 222, in _dispatch
result = endpoint(**request.params)
File "/Users/red/odoo/odoo/http.py", line 741, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/Users/red/odoo/addons/web/controllers/dataset.py", line 28, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/Users/red/odoo/addons/web/controllers/dataset.py", line 20, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/Users/red/odoo/odoo/api.py", line 468, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/Users/red/odoo/odoo/api.py", line 453, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-71>", line 2, in button_immediate_install
File "/Users/red/odoo/odoo/addons/base/models/ir_module.py", line 75, in check_and_log
return method(self, *args, **kwargs)
File "/Users/red/odoo/odoo/addons/base/models/ir_module.py", line 466, in button_immediate_install
return self._button_immediate_function(self.env.registry[self._name].button_install)
File "/Users/red/odoo/odoo/addons/base/models/ir_module.py", line 590, in _button_immediate_function
registry = modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "<decorator-gen-16>", line 2, in new
File "/Users/red/odoo/odoo/tools/func.py", line 87, in locked
return func(inst, *args, **kwargs)
File "/Users/red/odoo/odoo/modules/registry.py", line 113, in new
odoo.modules.load_modules(registry, force_demo, status, update_module)
File "/Users/red/odoo/odoo/modules/loading.py", line 480, in load_modules
processed_modules += load_marked_modules(env, graph,
File "/Users/red/odoo/odoo/modules/loading.py", line 364, in load_marked_modules
loaded, processed = load_module_graph(
File "/Users/red/odoo/odoo/modules/loading.py", line 227, in load_module_graph
load_data(env, idref, mode, kind='data', package=package)
File "/Users/red/odoo/odoo/modules/loading.py", line 71, in load_data
tools.convert_file(env, package.name, filename, idref, mode, noupdate, kind)
File "/Users/red/odoo/odoo/tools/convert.py", line 627, in convert_file
convert_xml_import(env, module, fp, idref, mode, noupdate)
File "/Users/red/odoo/odoo/tools/convert.py", line 693, in convert_xml_import
obj.parse(doc.getroot())
File "/Users/red/odoo/odoo/tools/convert.py", line 613, in parse
self._tag_root(de)
File "/Users/red/odoo/odoo/tools/convert.py", line 569, in _tag_root
raise ParseError('while parsing %s:%s, somewhere inside\n%s' % (
odoo.tools.convert.ParseError: while parsing /Users/red/odoo/custom_addons/openspp-registry/spp_programs/security/program_security.xml:2, somewhere inside
<record id="g2p_program_cycle_approver" model="res.groups">
<field name="name">Program Cycle Approver</field>
<field name="category_id" ref="g2p_registry_base.openg2p_module"/>
<field name="implied_ids" eval="[Command.link(ref('g2p_programs.g2p_program_validator')), Command.link(ref('account.group_account_invoice'))]"/>
</record>
The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
RPCError@http://localhost:8080/web/assets/f788f9b/web.assets_web.min.js:2871:324
makeErrorFromResponse@http://localhost:8080/web/assets/f788f9b/web.assets_web.min.js:2874:175
@http://localhost:8080/web/assets/f788f9b/web.assets_web.min.js:2878:34
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.
@shashikala1998 LGTM. The error is not showing anymore when i'm trying to install it. Thank you.
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.
We do not want to provide access to the accounting module to the program module groups. Please add the required access rights to https://github.com/OpenSPP/openspp-modules/blob/648-openspp-modules/spp_programs/security/ir.model.access.csv.
Quality Gate passedIssues Measures |
Why is this change needed?
When a user logs in with Global Cycle Approver credentials and the auto-approve feature is enabled, an error occurs while attempting to approve a cycle. This happens because the Global Cycle Approver does not have sufficient access rights to manage entitlements, which prevents the approval process from completing successfully.
How was the change implemented?
By extending the access rights of the Global Cycle Approver to include the permissions of the Program Cycle Manager in the res.groups, the error can be resolved.
New unit tests
N/A
Unit tests executed by the author
N/A
How to test manually
Global Cycle Approver Login:
The user logs in using the credentials of a Global Cycle Approver.
Auto Approve Feature Enabled:
The Auto Approve feature is turned on.
Attempt to Approve a Cycle:
The Global Cycle Approver tries to approve a cycle.
Access Rights Issue:
An error is displayed because the Global Cycle Approver does not have sufficient access rights to manage entitlements. This should be fixed and should be approved.
Related links
#648