shoop.core.order_creator package

Submodules

shoop.core.order_creator.signals module

Module contents

class shoop.core.order_creator.OrderCreator(request)[source]

Bases: object

add_line_taxes(lines)[source]
add_lines_into_order(order, lines)[source]
create_order(order_source)[source]
create_package_children(order_line)[source]
get_source_order_lines(source, order)[source]
process_order_after_lines(source, order)[source]
process_order_before_lines(source, order)[source]
process_saved_order_line(order, order_line)[source]

Called in sequence for all order lines to be saved into the order. These have all been saved, so they have PKs. :type order: Order :type order_line: OrderLine

source_line_to_order_lines(order, source_line)[source]

Convert a SourceLine into one or more OrderLines (yield them) :param order: The order :param source_line: The SourceLine

class shoop.core.order_creator.OrderSource(shop)[source]

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 an OrderSource.

No objects held here need be saved, but they may be.

add_line(**kwargs)[source]
calculate_taxes(force_recalculate=False)[source]
calculate_taxes_or_raise()[source]
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 the post_compute_source_lines signal.

Note

By default, taxes for the returned lines are not calculated when self.calculate_taxes_automatically is false. Pass in True to with_taxes argument or use calculate_taxes method to force tax calculation.

get_lines()[source]

Get unprocessed lines in this OrderSource.

See also get_final_lines.

get_validation_errors()[source]
payment_method
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_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.

update(**values)[source]
update_from_order(order)[source]
class shoop.core.order_creator.SourceLine(source, **kwargs)[source]

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:
base_unit_price = None
discount_amount = None
classmethod from_dict(source, data)[source]

Create SourceLine from given OrderSource and dict.

Return type:cls
get(key, default=None)[source]
quantity = None
tax_amount
Return type:shoop.utils.money.Money
tax_class
to_dict()[source]
update(**kwargs)[source]
exception shoop.core.order_creator.TaxesNotCalculated[source]

Bases: TypeError

Requested tax calculated price but taxes are not calculated.

Raised when requesting a price with taxful/taxless mismatching with shop.prices_include_tax and taxes are not yet calculated.