odoo 销售订单出库单操作代码简单剖析

odoo开发技术交流群【73934270

继上一章节的销售订单,我们打开对应的出库单:


点击检查可用,执行了 stock.picking 类的 action_assign 方法,具体代码:

def action_assign(self, cr, uid, ids, context=None):
    """ Checks the product type and accordingly writes the state.
    """
    import pdb;pdb.set_trace()
    context = context or {}
    quant_obj = self.pool.get("stock.quant")
    to_assign_moves = []
    main_domain = {}
    todo_moves = []
    operations = set()
    for move in self.browse(cr, uid, ids, context=context):
        if move.state not in ('confirmed', 'waiting', 'assigned'):
            continue
        if move.location_id.usage in ('supplier', 'inventory', 'production'):
            to_assign_moves.append(move.id)
            #in case the move is returned, we want to try to find quants before forcing the assignment
            if not move.origin_returned_move_id:
                continue
        if move.product_id.type == 'consu':
            to_assign_moves.append(move.id)
            continue
        else:
            todo_moves.append(move)

            #we always keep the quants already assigned and try to find the remaining quantity on quants not assigned only
            main_domain[move.id] = [('reservation_id', '=', False), ('qty', '>', 0)]

            #if the move is preceeded, restrict the choice of quants in the ones moved previously in original move
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值