dhanasingh / redmine_wktime

ERPmine is an open source free ERP for Service Industries. It runs within Redmine
https://erpmine.org/
Other
120 stars 78 forks source link

Error with time entry #292

Closed mohamedmamdouh1 closed 1 year ago

mohamedmamdouh1 commented 1 year ago

Dears,

this issue occur only when ERPmine plugin is installed: When I'm trying to create time entry using API:

from redminelib import Redmine

redmine = Redmine('http://10.2.0.255/', username='admin', password='') issue = redmine.issue.get(5) time_entry = redmine.time_entry.create(issue_id=issue.id, hours=2, activity_id=8, comments='Worked on issue https://github.com/maxtepkeev/python-redmine/issues/1')

then I receive this error: File "d:\test.py", line 47, in time_entry = redmine.time_entry.create(issue_id=issue.id, hours=2, activity_id=8, comments='Worked on issue https://github.com/maxtepkeev/python-redmine/issues/1') File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\redminelib\managers\base.py", line 192, in create resource = self._process_create_response(request, response) File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\redminelib\managers\base.py", line 206, in _process_create_response return self.to_resource(response[self.container]) KeyError: 'time_entry'

cdhana17 commented 1 year ago

Can you check the error in the redmine log and post it here ?

mohamedmamdouh1 commented 1 year ago

I, [2023-06-14T14:56:25.965163 #1275] INFO -- : [1c810300-6afc-492b-820f-2f812241d9f5] Started GET "/issues/26049.json" for 10.2.0.10 at 2023-06-14 14:56:25 +0000 I, [2023-06-14T14:56:25.965652 #1275] INFO -- : [1c810300-6afc-492b-820f-2f812241d9f5] Processing by IssuesController#show as JSON I, [2023-06-14T14:56:25.965679 #1275] INFO -- : [1c810300-6afc-492b-820f-2f812241d9f5] Parameters: {"id"=>"26049"} I, [2023-06-14T14:56:26.041084 #1275] INFO -- : [1c810300-6afc-492b-820f-2f812241d9f5] Current user: MHASSAN (id=184) I, [2023-06-14T14:56:26.076166 #1275] INFO -- : [1c810300-6afc-492b-820f-2f812241d9f5] Rendered issues/show.api.rsb (Duration: 8.2ms | Allocations: 2498) I, [2023-06-14T14:56:26.076414 #1275] INFO -- : [1c810300-6afc-492b-820f-2f812241d9f5] Completed 200 OK in 111ms (Views: 7.5ms | ActiveRecord: 35.3ms | Allocations: 16786) I, [2023-06-14T14:56:26.083746 #1275] INFO -- : [6283128c-5e76-499c-9176-e2fc681c3853] Started POST "/time_entries.json" for 10.2.0.10 at 2023-06-14 14:56:26 +0000 I, [2023-06-14T14:56:26.084267 #1275] INFO -- : [6283128c-5e76-499c-9176-e2fc681c3853] Processing by TimelogController#create as JSON I, [2023-06-14T14:56:26.084301 #1275] INFO -- : [6283128c-5e76-499c-9176-e2fc681c3853] Parameters: {"time_entry"=>{"issue_id"=>26049, "hours"=>2, "activity_id"=>8, "comments"=>"Worked on issue #1"}} I, [2023-06-14T14:56:26.122407 #1275] INFO -- : [6283128c-5e76-499c-9176-e2fc681c3853] Current user: MHASSAN (id=184) I, [2023-06-14T14:56:26.194192 #1275] INFO -- : [6283128c-5e76-499c-9176-e2fc681c3853] Completed 200 OK in 110ms (Views: 0.1ms | ActiveRecord: 57.0ms | Allocations: 13575)

cdhana17 commented 1 year ago

The log says, it completed successfully, it may be an error in python, can you check your python code ?

mohamedmamdouh1 commented 1 year ago

This is the python code:

from redminelib import Redmine

redmine = Redmine('http://10.2.0.200/', username='mhassan', password='') issue = redmine.issue.get(26049) time_entry = redmine.time_entry.create(issue_id=issue.id, hours=2, activity_id=8, comments='Worked on issue #1')

cdhana17 commented 1 year ago

I don't see any issues with this python code, do you want to see for any errors in the line below it ? may be try to print debug statements

mohamedmamdouh1 commented 1 year ago

I receive this error: File "d:\test.py", line 47, in time_entry = redmine.time_entry.create(issue_id=issue.id, hours=2, activity_id=8, comments='") File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\redminelib\managers\base.py", line 192, in create resource = self._process_create_response(request, response) File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\redminelib\managers\base.py", line 206, in _process_create_response return self.to_resource(response[self.container]) KeyError: 'time_entry'

cdhana17 commented 1 year ago

This looks like a python error, you will probably have to get support else where