models.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:planet-b-saleor 作者: planet-b 项目源码 文件源码
def move_to_group(self, item, target_group, quantity):
        try:
            target_item = target_group.items.get(
                product=item.product, product_name=item.product_name,
                product_sku=item.product_sku)
        except ObjectDoesNotExist:
            target_group.items.create(
                delivery_group=target_group, product=item.product,
                product_name=item.product_name, product_sku=item.product_sku,
                quantity=quantity, unit_price_net=item.unit_price_net,
                stock=item.stock,
                unit_price_gross=item.unit_price_gross)
        else:
            target_item.quantity += quantity
            target_item.save()
        item.quantity -= quantity
        self.remove_empty_groups(item)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号