Source code for stoqlib.domain.interfaces

# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4

##
## Copyright (C) 2005-2008 Async Open Source <http://www.async.com.br>
## All rights reserved
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU Lesser General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., or visit: http://www.gnu.org/.
##
##
##  Author(s): Stoq Team <stoq-devel@async.com.br>
##
""" Interfaces definition for all domain classes """

# pylint: disable=E0102,E0211,E0213,W0404

from zope.interface import Attribute, Interface

# pylint: enable=W0404


#
# Interfaces
#


[docs]class IActive(Interface): """It defines if a certain object can be active or not""" is_active = Attribute('This attribute defines if the object is active') def inactivate(): """Inactivate an active object""" def activate(): """Activate an inactive object""" def get_status_string(): """Active or Inactive in the specific locale"""
[docs]class IContainer(Interface): """An objects that holds other objects or items""" def add_item(item): """Add a persistent or non-persistent item associated with this model.""" def get_items(): """Get all the items in the container. The result value could be a simple python list or an instance which maps to SQL statement. """ def remove_item(item): """Remove from the list or database the item desired."""
[docs]class IDescribable(Interface): """It defines that a object can be described through get_description method. """ # TODO: Replace this with a property def get_description(): """ Returns a description that identifies the object """
class IORMObject(Interface): id = Attribute("Object ID") def delete(obj_id, store): "Delete an ORM Interface Object"
[docs]class IReversal(Interface): """A financial entry which support reversal operations""" def reverse_entry(invoice_number): """Takes a financial entry and reverse it, creating a new instance with an oposite value """
[docs]class IInvoice(Interface): """Information relating to operations (e.g. sale, transfer, loan) that generate NF-e """ comments = Attribute("Operation comments") discount_value = Attribute("Discount value") identifier = Attribute("Identifier of performed operation") invoice_subtotal = Attribute("Operation subtotal") invoice_total = Attribute("Operation total") payments = Attribute("Payments generated by the operation") recipient = Attribute("Operation recipient") transporter = Attribute("Operation transporter")
[docs]class IInvoiceItem(Interface): """Information of NF-e items""" parent = Attribute("The parent operation") sellable = Attribute("Sellable") quantity = Attribute("Quantity") base_price = Attribute("Base price") price = Attribute("Price") cfop_code = Attribute("C.F.O.P code") item_discount = Attribute("The discount applied in item") # Tax references icms_info = Attribute("ICMS info object") ipi_info = Attribute("IPI info object") pis_info = Attribute("PIS info object") cofins_info = Attribute("Cofins info object")
# pylint: enable=E0102,E0211,E0213