Add asset if new GTIN product has been created
This commit is contained in:
parent
4b7234fa68
commit
c7da144f5e
|
@ -65,4 +65,10 @@ def asset_from_gtin(request):
|
||||||
print(f'ERROR: Could not create asset for gtin={gtin}')
|
print(f'ERROR: Could not create asset for gtin={gtin}')
|
||||||
else:
|
else:
|
||||||
print(f'Create new product: {product.name}, brand={product.brand}, gtin={product.gtin}')
|
print(f'Create new product: {product.name}, brand={product.brand}, gtin={product.gtin}')
|
||||||
|
asset = Asset.objects.create(
|
||||||
|
named_id='A-' + product.gtin,
|
||||||
|
description=product.name,
|
||||||
|
created_by=request.user,
|
||||||
|
changed_by=request.user)
|
||||||
|
asset.save()
|
||||||
return HttpResponseRedirect(reverse('asset:list'))
|
return HttpResponseRedirect(reverse('asset:list'))
|
||||||
|
|
Loading…
Reference in New Issue