Commit d41befb8 authored by wilhelmhb's avatar wilhelmhb

permettre de forcer le logage d'un sellitem en unités entières

parent b9e5bff4
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bars_items', '0009_suggesteditem'),
]
operations = [
migrations.AddField(
model_name='sellitem',
name='sell_fraction',
field=models.BooleanField(default=True),
),
]
......@@ -28,6 +28,8 @@ class SellItem(models.Model):
unit_name = models.CharField(max_length=100, blank=True)
unit_name_plural = models.CharField(max_length=100, blank=True)
sell_fraction = models.BooleanField(default=True)
tax = models.FloatField(default=0)
deleted = models.BooleanField(default=False)
......
# encoding: utf8
import math
from django.core.mail import send_mail
from django.utils import timezone
......@@ -120,6 +122,8 @@ class ItemQtySerializer(serializers.Serializer):
elif "sellitem" in data:
sellitem = data['sellitem']
if not sellitem.sell_fraction:
qty = math.ceil(qty)
total_qty = sellitem.calc_qty()
stockitems = sellitem.stockitems.all()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment