콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
8550 화면

Hello guy!

I am in Odoo 8. I'm searching the best way to cancel a stock move directly in my Odoo backend.

I don't want to use «  update stock_move set state = 'draft' where id = ?; » in a sql query.

Idea?

Thanks

아바타
취소
작성자

I'm going crazy with this!!!!! Do you have an other solution?

베스트 답변

You're right to not want to do this via direct SQL, as you're ignoring a lot of other data validation steps that will cause errors in your data.

You could do this out of the box in OpenERP v7.  In Odoo v8 this isn't possible without custom code due to how quants work.  You'd need to override the existing action_cancel() function in the Python code to bypass the error for the done status, then undo changes to the quant the item came from.

What might be smarter and easier is to add a function to quickly create a new stock move that reverses the transaction.  Basically, it needs to duplicate the original stock move, then swap the source and destination locations, and immediately finalize the move.  This will also resolve the quant accuracy issue, and ensure that any accounting valuation entries are reversed as well.

아바타
취소
작성자

Thank you so much for this complete answer.

작성자

It is really easy ton delete a stock move now. I have commented 3 lines in stock.py, in the action_cancel() function. But to undo the quants, I think I will have some difficulties.

관련 게시물 답글 화면 활동
2
7월 17
6392
2
6월 19
5893
2
7월 17
9491
1
3월 17
6537
3
4월 15
6086