Fixes: add_product for Order
This commit is contained in:
parent
2d96ec9637
commit
10effefff5
1 changed files with 3 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from typing import Self
|
from typing import Optional, Self
|
||||||
|
|
||||||
from constance import config
|
from constance import config
|
||||||
from django.contrib.gis.db.models import PointField
|
from django.contrib.gis.db.models import PointField
|
||||||
|
|
@ -550,7 +550,8 @@ class Order(ExportModelOperationsMixin("order"), NiceModel):
|
||||||
def total_quantity(self) -> int:
|
def total_quantity(self) -> int:
|
||||||
return sum([op.quantity for op in self.order_products.all()])
|
return sum([op.quantity for op in self.order_products.all()])
|
||||||
|
|
||||||
def add_product(self, product_uuid: str | None = None, attributes: list = None, update_quantity: bool = True):
|
def add_product(self, product_uuid: str | None = None, attributes: Optional[list] = None,
|
||||||
|
update_quantity: bool = True):
|
||||||
if attributes is None:
|
if attributes is None:
|
||||||
attributes = []
|
attributes = []
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue