Part of stoqlib.domain.sale View In Hierarchy
| Instance Variables | status | status of the sale |
| client | who we sold the sale to | |
| salesperson | who sold the sale | |
| branch | branch where the sale was done | |
| till | The Till operation where this sale lives. Note that every sale and payment generated are always in a till operation which defines a financial history of a store. | |
| open_date | the date sale was created | |
| close_date | the date sale was closed | |
| confirm_date | the date sale was confirmed | |
| cancel_date | the date sale was cancelled | |
| return_date | the date sale was returned | |
| discount_value | ||
| surcharge_value | ||
| total_amount | the total value of all the items in the same | |
| notes | Some optional additional information related to this sale. | |
| coupon_id | ||
| service_invoice_number | ||
| cfop | ||
| invoice_number | the sale invoice number. | |
| Class Variables | STATUS_INITIAL | The sale is opened, products or other sellable items might have been added. |
| STATUS_ORDERED | The sale is orded, it has sellable items but not any payments yet. This state is mainly used when the parameter CONFIRM_SALES_AT_TILL is enabled. | |
| STATUS_CONFIRMED | The sale has been confirmed and all payments have been registered, but not necessarily paid. | |
| STATUS_CLOSED | All the payments of the sale has been confirmed and the client does not owe anything to us. | |
| STATUS_CANCELLED | The sale has been canceled, this can only happen to an sale which has not yet reached the SALE_CONFIRMED status. | |
| STATUS_RETURNED | The sale has been returned, all the payments made have been canceled and the client has been compensated for everything already paid. | |
| CLIENT_INDIVIDUAL | The sale was done by an individual | |
| CLIENT_COMPANY | The sale was done by a company |
| Method | _create | Undocumented |
| Class Method | get_status_name | Undocumented |
| Class Method | get_last_confirmed | Fetch the last confirmed sale |
| Class Method | get_last_invoice_number | Returns the last sale invoice number. If there is not an invoice |
| Method | add_item | Undocumented |
| Method | get_items | Undocumented |
| Method | remove_item | Undocumented |
| Method | can_order | Only newly created sales can be ordered |
| Method | can_confirm | Only ordered sales can be confirmed |
| Method | can_set_paid | Only confirmed sales can be paid |
| Method | can_set_renegotiated | Only sales with status confirmed can be renegotiated. |
| Method | can_cancel | Only ordered, confirmed, paid and quoting sales can be cancelled. |
| Method | can_return | Only confirmed or paid sales can be returned |
| Method | order | Orders the sale |
| Method | confirm | Confirms the sale |
| Method | set_paid | Mark the sale as paid |
| Method | set_renegotiated | Set the sale as renegotiated. The sale payments have been |
| Method | cancel | Cancel the sale |
| Method | return_ | Returns a sale |
| Method | get_total_sale_amount | Fetches the total value paid by the client. |
| Method | get_sale_subtotal | Fetch the subtotal for the sale, eg the sum of the |
| Method | get_items_total_quantity | Fetches the total number of items in the sale |
| Method | get_details_str | Returns the sale details. The details are composed by the sale |
| Method | get_order_number_str | Undocumented |
| Method | get_salesperson_name | Undocumented |
| Method | get_client_name | Undocumented |
| Method | get_client_role | Fetches the client role |
| Method | only_paid_with_money | Find out if the sale is paid using money |
| Method | pay_money_payments | Undocumented |
| Method | add_sellable | Adds a new sellable item to a sale |
| Method | create_sale_return_adapter | Undocumented |
| Method | order_number | Undocumented |
| Method | products | Undocumented |
| Method | services | Undocumented |
| Method | payments | Undocumented |
| Method | _get_discount_by_percentage | Undocumented |
| Method | _set_discount_by_percentage | Undocumented |
| Method | _get_surcharge_by_percentage | Undocumented |
| Method | _set_surcharge_by_percentage | Undocumented |
| Method | _get_percentage_value | Undocumented |
Inherited from ValidatableDomain:
| Method | set_valid | Undocumented |
| Method | set_invalid | Undocumented |
| Method | get_valid | Undocumented |
| Class Method | select | Undocumented |
| Class Method | selectBy | Undocumented |
| Class Method | selectOne | Undocumented |
| Class Method | selectOneBy | Undocumented |
Inherited from Domain (via ValidatableDomain):
| 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 ValidatableDomain, 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 ValidatableDomain, Domain):
| Class Method | registerFacet | Registers a facet for class cls. |
Inherited from Adaptable (via ValidatableDomain, 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. |
| Parameters | conn | a database connection |
| Parameters | conn | a database connection |
| Returns | an integer representing the last sale invoice number | |
| Returns | True if the sale can be ordered, otherwise False | |
| Returns | True if the sale can be confirmed, otherwise False | |
| Returns | True if the sale can be set as paid, otherwise False | |
| Returns | True if the sale can be renegotiated, False otherwise. | |
| Returns | True if the sale can be cancelled, otherwise False | |
| Returns | True if the sale can be returned, otherwise False | |
| Parameters | renegotiation | renegotiation information
(type: RenegotiationData
) |
Fetches the total value paid by the client. It can be calculated as:
Sale total = Sum(product and service prices) + surcharge +
interest - discount
| Returns | the total value | |
| Returns | subtotal | |
| Returns | number of items | |
| Returns | the sale details string. | |
| Returns | the client role (a PersonAdaptToIndividual or a PersonAdaptToCompany) instance or None if the sale haven't a client. | |
| Returns | True if the sale was paid with money, otherwise False (type: bool ) | |