Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

AttributeError: 'NoneType' object has no attribute 'state'

By
Zouhair
on 8/20/14, 12:13 PM 1,377 views

hi,

im trying to create and process a new move traceability in warehouse, after creating it i can´t process the same move

my code is some thing like that:

create new move

id=self.pool.get('stock.move').create(cr, uid, values, context=context)

processing the move with the same id

super(stock_move, self).action_done(cr,uid,ids,context=context)

but i get an error:

AttributeError: 'NoneType' object has no attribute 'state'

any help, thx in advance

2
Narayanamurthy
On 8/21/14, 3:29 AM

if not values:

     values={}

if not context:

     context={}

process the move with

move_id=self.pool.get('stock.move').create(cr, uid, values, context=context)

super(stock_move, self).action_done(cr,uid,[move_id],context=context)

 

 

thank you very very much :)

Zouhair
on 8/21/14, 3:46 AM
1
Mariusz Mizgier
On 8/21/14, 2:39 AM

From your code you call action_done for ids and you get id as a newly created move.

yes Mariusz, i can create a new move, and i have her id, but i want to process completly my move but i can´t, i give an error. any idea how solve that?

Zouhair
on 8/21/14, 3:02 AM

As I wrote earlier - from your code new move is bound to the variable id, but you want to process the same id calling action_done with ids - change your line of code like: super(stock_move, self).action_done(cr, uid, id, context=context) That way it should work just fine.

Currenda Sp. z o.o., Mariusz Mizgier
on 8/21/14, 3:13 AM

not working :(, with new error: Iteration is not allowed on browse_record

Zouhair
on 8/21/14, 3:40 AM
0
Zouhair
On 8/21/14, 2:35 AM

any one here..?

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/20/14, 12:13 PM
Seen: 1377 times
Last updated: 3/16/15, 8:10 AM