shoop.core.order_creator package¶
Submodules¶
shoop.core.order_creator.signals module¶
Module contents¶
-
shoop.core.order_creator.
get_order_source_modifier_modules
()¶ Get a list of configured order source modifier module instances.
Return type: list[OrderSourceModifierModule]
-
shoop.core.order_creator.
is_code_usable
(order_source, code)¶
-
class
shoop.core.order_creator.
OrderCreator
(request=None)¶ Bases:
shoop.core.order_creator._creator.OrderProcessor
Initialize order creator.
Parameters: request (django.http.HttpRequest|None) – Optional request object for backward compatibility. Passing non-None value is DEPRECATED.
-
class
shoop.core.order_creator.
OrderModifier
¶ Bases:
shoop.core.order_creator._creator.OrderProcessor
-
class
shoop.core.order_creator.
OrderSource
(shop)¶ Bases:
object
A “provisional order” object.
Contains data that’s not strictly about a basket’s contents, but is useful for things that need to calculate something based on the basket’s contents and extra data, such as shipping/billing addresses.
The core API of
OrderCreator
reads anOrderSource
.No objects held here need be saved, but they may be.
-
add_code
(code)[source]¶ Add code to this OrderSource.
At this point it is expected that the customers permission to use the code has already been checked by the caller.
The code will be converted to text.
Parameters: code (str) – The code to add Returns: True if code was added, False if it was already there Return type: bool
-
clear_codes
()[source]¶ Remove all codes from this OrderSource.
Returns: True iff there was codes before clearing Return type: bool
-
codes
¶
-
creator
¶
-
customer
¶
-
get_final_lines
(with_taxes=False)[source]¶ Get lines with processed lines added.
This implementation includes the all lines returned by
get_lines
and in addition, lines from shipping and payment methods, but these lines can be extended, deleted or replaced by a subclass (by overriding_compute_processed_lines
method) and with thepost_compute_source_lines
signal.Note
By default, taxes for the returned lines are not calculated when
self.calculate_taxes_automatically
is false. Pass inTrue
towith_taxes
argument or usecalculate_taxes
method to force tax calculation.
-
get_lines
()[source]¶ Get unprocessed lines in this OrderSource.
See also
get_final_lines
.
-
get_product_lines
()[source]¶ Get lines with a product.
This does not use get_final_lines because it will be called when final lines is being computed (for example to determine shipping discounts based on the total price of all products).
-
is_empty
¶
-
modified_by
¶
-
orderer
¶
-
payment_method
¶
-
product_count
¶ Get the total number of products in this OrderSource.
Return type: decimal.Decimal|int
-
product_ids
¶
-
remove_code
(code)[source]¶ Remove given code from this OrderSource.
Parameters: code (str) – The code to remove Returns: True if code was removed, False if code was not there Return type: bool
-
shipping_method
¶
-
status
¶
-
taxful_total_discount
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
taxful_total_discount_or_none
¶ Property that turns TaxesNotCalculated exception to None.
Used to implement the OrderSource taxful/taxless total price properties with the “_or_none” suffix.
-
taxful_total_price
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
taxful_total_price_or_none
¶ Property that turns TaxesNotCalculated exception to None.
Used to implement the OrderSource taxful/taxless total price properties with the “_or_none” suffix.
-
taxless_total_discount
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
taxless_total_discount_or_none
¶ Property that turns TaxesNotCalculated exception to None.
Used to implement the OrderSource taxful/taxless total price properties with the “_or_none” suffix.
-
taxless_total_price
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
taxless_total_price_or_none
¶ Property that turns TaxesNotCalculated exception to None.
Used to implement the OrderSource taxful/taxless total price properties with the “_or_none” suffix.
-
total_discount
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
total_gross_weight
¶
-
total_price
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
total_price_of_products
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
uncache
()[source]¶ Uncache processed lines.
Should be called after changing the contents before (re)accessing lines with
get_final_lines
.
-
-
class
shoop.core.order_creator.
OrderSourceModifierModule
¶ Bases:
object
-
class
shoop.core.order_creator.
SourceLine
(source, **kwargs)¶ Bases:
shoop.core.taxing.TaxableItem
,shoop.core.pricing.Priceful
Line of OrderSource.
Note: Properties like price, taxful_price, tax_rate, etc. are inherited from the
Priceful
mixin.Initialize SourceLine with given source and data.
Parameters: - source (OrderSource) – The
OrderSource
thisSourceLine
belongs to. - kwargs – Data for the
SourceLine
.
-
base_unit_price
= None¶
-
discount_amount
= None¶
-
classmethod
from_dict
(source, data)[source]¶ Create SourceLine from given OrderSource and dict.
Return type: cls
-
parent_line
¶
-
quantity
= None¶
-
tax_amount
¶ Return type: shoop.utils.money.Money
-
tax_class
¶
-
taxes
¶ Taxes of this line.
Determined by a TaxModule in
OrderSource.calculate_taxes
.Return type: list[shoop.core.taxing.LineTax]
- source (OrderSource) – The