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

Hi there! We are on trial with Odoo now and I am trying to find out the logic of RPC so I can give my approval to the inventory department that we will use Odoo in the future. I have given a simple task to complete to move a single lot from one location to another though Immediate Internal Transfer. 

Can you give me a general rule where I can find documentation for it? Everything that I found it's generic rules about the models' system of API. And I found nothing regarding "stock.picking" module creation.

Anyway, I complete the task, but I can't find the right way to validate the transfer. I am getting an error "cannot marshal None unless allow_none is enabled" in the end. This shows me that something wrong and I can find what exactly is wrong. 


Please, advice. Thank you


here is my code


def swapLocation(self, uid, models, location_id, lot_id):

    location_dest_id = 35

    if location_id == 35:

      location_dest_id = 36


    product_id = 4


    picking_id = models.execute_kw(db, uid, password, 'stock.picking', 'create', [{

      'picking_type_id': 13,

      'location_id': location_id,

      'location_dest_id': location_dest_id,

      'company_id': 1,

      'move_type': 'direct',

      'immediate_transfer': True,

      'product_id': product_id

    }])



    stock_move_id = models.execute_kw(db, uid, password, 'stock.move', 'create', [{

      'picking_type_id': 13,

      'location_id': location_id,

      'location_dest_id': location_dest_id,

      'company_id': 1,

      'procure_method': 'make_to_stock',

      'has_tracking': 'serial',

      'product_id': product_id,

      'name': 'New Move',

      'product_uom': 1,

      'product_uom_qty': 1.0,

      'picking_id': picking_id

    }])



    stock_move_line_id = models.execute_kw(db, uid, password, 'stock.move.line', 'create', [{

      'location_id': location_id,

      'location_dest_id': location_dest_id,

      'company_id': 1,

      'product_id': product_id,

      'product_uom_id': 1.0,

      'picking_id': picking_id,

      'move_id': stock_move_id,

      'lot_id': lot_id,

      'qty_done': 1.0,

    }])


    

    try:

      models.execute_kw(db, uid, password, 'stock.picking', 'button_validate', [picking_id], {})

    except Exception as e:

      print e

      pass


아바타
취소
작성자 베스트 답변

Hi Ray! Does it mean that there is no way to get the answer unless doing reverse engineering? 

아바타
취소
베스트 답변

Some people find it easier to understand the API calls by turning on logging so they can see, in real-time, what Odoo is doing as it creates and processes different kinds of documents.

https://www.odoo.com/documentation/13.0/reference/cmdline.html#logging


아바타
취소
관련 게시물 답글 화면 활동
2
1월 16
6587
1
11월 21
17054
2
5월 25
5366
1
8월 21
4382
2
3월 15
9798