Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
3 Besvarelser
3801 Visninger

store = []
for products in self.order_line:
store.append ((0,0, {'name': products.name, 'project_id': project_id,
'sale_order': products.id}))

for l in store:
self.env ['project.task']. create (l)



But i am getting this error: project_id = vals.get ('project_id') or self.env.context.get ('default_project_id')
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 639, in _handle_exception
return super (JsonRequest, self) ._ handle_exception (exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 315, in _handle_exception
raise exception.with_traceback (None) from new_cause
AttributeError: 'int' object has no attribute 'get'

Avatar
Kassér
Bedste svar

store.append ((0,0, {'name': products.name, 'project_id': project_id,
'sale_order': products.id}))

->store.append ((0,0, {'name': products.name, 'project_id': products.project_id,
'sale_order': products.id}))


Avatar
Kassér
Bedste svar

I don't understand exactly the code that you posted, but I think that it is possible that the vals variable has the id of the project and it is a int variable without get method

Avatar
Kassér
Forfatter Bedste svar

How to use get method on int? Just simply tell how to create multiple task in existing project by code. I tried to fetch Id of existing project and then create task in it but I get this attribute error.

Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
1
apr. 24
4422
2
sep. 23
4498
1
jun. 23
4797
0
feb. 22
2443
1
jun. 21
5567