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

Hello all,

Can I produce a Manufacturing Order (assign + force production + produce) from Python? I want to do the same, via python code, as I do clicking on the buttons above the Manufacturing Order.

My attempt so far is this, but it is not working:

class mrp_production(osv.osv):

    """ Production Orders / Manufacturing Orders """ _inherit = 'mrp.production'

    def create(self, cr, uid, values, context=None):

        res = super(mrp_production, self).create(cr, uid, values, context=context)

        prod_obj = self.pool.get('mrp.production')

        production = prod_obj.browse(cr, uid, res, context=context)

        prod_obj.action_assign(cr, uid, production.id, context=context) production = prod_obj.browse(cr, uid, res, context=context) if production.state == 'draft':

            prod_obj.force_production(cr, uid, production.id) prod_obj.action_produce(cr, uid, production.id, production.product_qty, 'consume_produce', context=context)

        prod_obj.signal_workflow(cr, uid, [production.id,], 'button_produce', context=context)

        return res


Going step-by-step the problem seems to be because no stock moves are generated using this script.


What could I be missing?


Thanks in advance

아바타
취소
관련 게시물 답글 화면 활동
2
1월 18
5180
3
3월 21
4000
0
7월 20
2509
2
3월 15
6539
0
10월 20
1754