Class s.d.s.Sellable(Domain):

Part of stoqlib.domain.sellable View In Hierarchy

Sellable information of a certain item such a product or a service. Note that sellable is not actually a concrete item but only its reference as a sellable. Concrete items are created by IContainer routines.
Instance Variablesstatusstatus the sellable is in (type: enum )
priceprice of sellable (type: float )
descriptionfull description of sallable (type: string )
categorya reference to category table (type: SellableCategory )
markup((cost/price)-1)*100 (type: float )
costfinal cost of sellable (type: float )
max_discountmaximum discount allowed (type: float )
commissioncommission to pay after selling this sellable (type: float )
on_sale_priceA special price used when we have a "on sale" state (type: float )
on_sale_start_date
on_sale_end_date
Method _create Undocumented
Method _set_code Undocumented
Method _set_barcode Undocumented
Method _get_price_by_markup Undocumented
Method _get_status_string Undocumented
Method _get_markup Undocumented
Method _set_markup Undocumented
Method _get_price Undocumented
Method _set_price Undocumented
Method _get_max_discount Undocumented
Method _set_max_discount Undocumented
Method _get_commission Undocumented
Method _set_commission Undocumented
Method can_be_sold Whether the sellable is available and can be sold.
Method is_sold Whether the sellable is sold.
Method sell Sell the sellable
Method cancel Cancel the sellable
Method can_sell Make the object sellable
Method can_remove Whether we can delete this sellable from the database.
Method get_short_description Returns a short description of the current sale
Method get_suggested_markup Returns the suggested markup for the sellable
Method get_unit_description Returns the sellable category description
Method get_category_description Returns the description of this sellables category
Method get_tax_constant Returns the tax constant for this sellable.
Method _check_unique_value_exists Returns True if we already have a sellable with the given attribute
Method check_code_exists Returns True if we already have a sellable with the given code
Method check_barcode_exists Returns True if we already have a sellable with the given barcode
Method get_description Undocumented
Method remove Remove this sellable from the database (including the product or
Class Method get_available_sellables_query Undocumented
Class Method get_available_sellables Returns sellable objects which can be added in a sale. By
Class Method get_unblocked_sellables Returns unblocked sellable objects, which means the
Class Method get_sold_sellables Returns sellable objects which can be added in a sale. By
Class Method _get_sellables_by_barcode Undocumented
Class Method get_availables_by_barcode Returns a list of avaliable sellables that can be sold.
Class Method get_availables_and_sold_by_barcode Returns a list of avaliable sellables and also sellables that
Class Method get_unblocked_by_categories Returns the available sellables by a list of categories.

Inherited from Domain:

Method __init__ Undocumented
Method user Undocumented
Class Method iselect Like select, but search on the adapter implementing the interface iface
Class Method iselectBy Like selectBy, but search on the adapter implementing the interface iface
Class Method iselectOne Like selectOne, but search on the adapter implementing the interface iface
Class Method iselectOneBy Like selectOneBy, but search on the adapter implementing the interface iface
Class Method iget Like get, but gets on the adapter implementing the interface iface

Inherited from AbstractModel (via Domain, BaseDomain):

Method __ne__ Undocumented
Method __eq__ Undocumented
Method _SO_setValue Undocumented
Method clone Get a persistent copy of an existent object. Remember that we can
Method get_connection Undocumented

Inherited from AdaptableORMObject (via Domain):

Class Method registerFacet Registers a facet for class cls.

Inherited from Adaptable (via Domain, AdaptableORMObject):

Class Method getFacetType Fetches a facet type associated with an interface, or raise
Class Method getFacetTypes Returns facet classes for this object
Method addFacet Adds a facet implementing iface for the current object
Method removeFacet Removes a facet from the current object
Method getFacets Gets a list of facets assoicated with the current object.
def _create(self, id, **kw):
Undocumented
def _set_code(self, code):
Undocumented
def _set_barcode(self, barcode):
Undocumented
def _get_price_by_markup(self, markup):
Undocumented
def _get_status_string(self):
Undocumented
def _get_markup(self):
Undocumented
def _set_markup(self, markup):
Undocumented
def _get_price(self):
Undocumented
def _set_price(self, price):
Undocumented
def _get_max_discount(self):
Undocumented
def _set_max_discount(self, discount):
Undocumented
def _get_commission(self):
Undocumented
def _set_commission(self, commission):
Undocumented
def can_be_sold(self):
Whether the sellable is available and can be sold.
Returnsif the item can be sold (type: boolean )
def is_sold(self):
Whether the sellable is sold.
Returnsif the item is sold (type: boolean )
def sell(self):
Sell the sellable
def cancel(self):
Cancel the sellable
def can_sell(self):
Make the object sellable
def can_remove(self):
Whether we can delete this sellable from the database.

False if the product/service was never sold or received. True otherwise.

def get_short_description(self):
Returns a short description of the current sale
Returnsdescription (type: string )
def get_suggested_markup(self):
Returns the suggested markup for the sellable
Returnssuggested markup (type: decimal )
def get_unit_description(self):
Returns the sellable category description
Returnsthe category description or an empty string if no category was set.
def get_category_description(self):
Returns the description of this sellables category If it's unset, return the constant from the category, if any
Returnssellable category description
def get_tax_constant(self):
Returns the tax constant for this sellable. If it's unset, return the constant from the category, if any
Returnsthe tax constant or None if unset
def _check_unique_value_exists(self, attribute, value):
Returns True if we already have a sellable with the given attribute and value in the database, but ignoring myself.
def check_code_exists(self, code):
Returns True if we already have a sellable with the given code in the database.
def check_barcode_exists(self, barcode):
Returns True if we already have a sellable with the given barcode in the database.
def get_description(self, full_description=False):
Undocumented
def remove(self):
Remove this sellable from the database (including the product or service).
@classmethod
def get_available_sellables_query(cls, conn):
Undocumented
@classmethod
def get_available_sellables(cls, conn):
Returns sellable objects which can be added in a sale. By default a delivery sellable can not be added manually by users since a separated dialog is responsible for that.
@classmethod
def get_unblocked_sellables(cls, conn, storable=False, supplier=None):
Returns unblocked sellable objects, which means the available sellables plus the sold ones.
Parametersconna database connection
storableif True, only return Storables
suppliera supplier or None, if set limit the returned object to this supplier
@classmethod
def get_sold_sellables(cls, conn):
Returns sellable objects which can be added in a sale. By default a delivery sellable can not be added manually by users since a separated dialog is responsible for that.
@classmethod
def _get_sellables_by_barcode(cls, conn, barcode, extra_query):
Undocumented
@classmethod
def get_availables_by_barcode(cls, conn, barcode):
Returns a list of avaliable sellables that can be sold. A sellable that can be sold can have only one possible status: STATUS_AVAILABLE
Parametersconna orm Transaction instance
barcodea string representing a sellable barcode
@classmethod
def get_availables_and_sold_by_barcode(cls, conn, barcode):
Returns a list of avaliable sellables and also sellables that can be sold. Here we will get sellables with the following statuses: STATUS_AVAILABLE, STATUS_SOLD
Parametersconna orm Transaction instance
barcodea string representing a sellable barcode
@classmethod
def get_unblocked_by_categories(cls, conn, categories, include_uncategorized=True):
Returns the available sellables by a list of categories.
Parametersconna orm Transaction instance
categoriesa list of SellableCategory instances
include_uncategorizedwhether or not include the sellables without a category
API Documentation for Stoqlib, generated by pydoctor at 2009-07-14 16:00:32.