Python 当我在拾取类型中选择“收据获取”(AttributeError:';float';对象没有属性';获取';)
我尝试在库存菜单->所有转移菜单中执行有效可用性验证按钮,以限制订单,如果产品数量大于库存数量或库存数量为负数,当我尝试从“附加信息”选项卡中选择领料类型中的某些类型时,显示弹出的massege(AttributeError:“float”对象没有属性“get”) 2-在move_lines记录中,当我添加多条记录时,我打印所有记录数量,但循环中最后一条记录的验证工作我不知道为什么 在下面的代码中,如果有人能帮助解决这个问题,我会尝试一下Python 当我在拾取类型中选择“收据获取”(AttributeError:';float';对象没有属性';获取';),python,odoo,odoo-10,Python,Odoo,Odoo 10,我尝试在库存菜单->所有转移菜单中执行有效可用性验证按钮,以限制订单,如果产品数量大于库存数量或库存数量为负数,当我尝试从“附加信息”选项卡中选择领料类型中的某些类型时,显示弹出的massege(AttributeError:“float”对象没有属性“get”) 2-在move_lines记录中,当我添加多条记录时,我打印所有记录数量,但循环中最后一条记录的验证工作我不知道为什么 在下面的代码中,如果有人能帮助解决这个问题,我会尝试一下 @api.multi def force_assign(
@api.multi
def force_assign(self):
qty = self.product_qty_per_location()
if self.picking_type_id.code == 'internal' :
if self.location_id.company_id.no_negative_stock:
for order in self :
for line in order.move_lines:
if line.product_uom_qty > qty:
raise ValidationError(_('The qty on hand less than qty on your order .'))
else:
move = self.env["stock.move"]
move = self.mapped('move_lines').filtered(lambda move: move.state not in ('assigned', 'cancel', 'done'))
return super(Picking, self).force_assign()
@api.onchange('product_id','location_id')
def product_qty_per_location(self):
if self.product_id and self.location_id:
for x in self.move_lines:
product = self.env['product.product'].browse(x.product_id.id)
available_qty = product.with_context({'location' : x.location_id.id}).qty_available
print "The Quantity is : '%s'" % (available_qty)
return available_qty
请显示一些控制台日志行。我确实更新了帖子,并在帖子下添加了img链接,您可以看到它。@juansalcedo除了您的错误,您还想做什么?也许亚奥理事会已经有东西给你了?关于at的
stock\u disable\u force\u availability\u按钮
和stock\u no\u negative
。