def __init__(self, store=None, **kwargs): # TODO: Add batch logic here. (get if from sale_item or check if was # passed togheter with sellable) sale_item = kwargs.get('sale_item') sellable = kwargs.get('sellable') if not sale_item and not sellable: raise ValueError( "A sale_item or a sellable is mandatory to create this object") elif sale_item and sellable and sale_item.sellable != sellable: raise ValueError( "sellable must be the same as sale_item.sellable") elif sale_item and not sellable: sellable = sale_item.sellable kwargs['sellable'] = sellable if not 'price' in kwargs: # sale_item.price takes priority over sellable.price kwargs['price'] = sale_item.price if sale_item else sellable.price check_tax_info_presence(kwargs, store) super(ReturnedSaleItem, self).__init__(store=store, **kwargs) product = self.sellable.product if product: self.ipi_info.set_item_tax(self) self.icms_info.set_item_tax(self) self.pis_info.set_item_tax(self) self.cofins_info.set_item_tax(self)
def __init__(self, store=None, **kwargs): # TODO: Add batch logic here. (get if from sale_item or check if was # passed togheter with sellable) sale_item = kwargs.get('sale_item') sellable = kwargs.get('sellable') if not sale_item and not sellable: raise ValueError( "A sale_item or a sellable is mandatory to create this object") elif sale_item and sellable and sale_item.sellable != sellable: raise ValueError("sellable must be the same as sale_item.sellable") elif sale_item and not sellable: sellable = sale_item.sellable kwargs['sellable'] = sellable if not 'price' in kwargs: # sale_item.price takes priority over sellable.price kwargs['price'] = sale_item.price if sale_item else sellable.price check_tax_info_presence(kwargs, store) super(ReturnedSaleItem, self).__init__(store=store, **kwargs) product = self.sellable.product if product: self.ipi_info.set_item_tax(self) self.icms_info.set_item_tax(self) self.pis_info.set_item_tax(self) self.cofins_info.set_item_tax(self)
def __init__(self, store=None, **kwargs): if not 'sellable' in kwargs: raise TypeError('You must provide a sellable argument') check_tax_info_presence(kwargs, store) super(TransferOrderItem, self).__init__(store=store, **kwargs) product = self.sellable.product if product: self.ipi_info.set_item_tax(self) self.icms_info.set_item_tax(self) self.pis_info.set_item_tax(self) self.cofins_info.set_item_tax(self)
def __init__(self, store=None, sellable=None, **kwargs): if sellable is None: raise TypeError("You must provide a sellable argument") check_tax_info_presence(kwargs, store) super(StockDecreaseItem, self).__init__(store=store, sellable=sellable, **kwargs) product = self.sellable.product if product: self.ipi_info.set_item_tax(self) self.icms_info.set_item_tax(self) self.pis_info.set_item_tax(self) self.cofins_info.set_item_tax(self)
def __init__(self, store=None, sellable=None, **kwargs): if sellable is None: raise TypeError('You must provide a sellable argument') check_tax_info_presence(kwargs, store) super(StockDecreaseItem, self).__init__(store=store, sellable=sellable, **kwargs) product = self.sellable.product if product: self.ipi_info.set_item_tax(self) self.icms_info.set_item_tax(self) self.pis_info.set_item_tax(self) self.cofins_info.set_item_tax(self)
def __init__(self, *args, **kwargs): # stores the total quantity that was loaned before synching stock self._original_quantity = 0 # stores the loaned quantity that was returned before synching stock self._original_return_quantity = self.return_quantity check_tax_info_presence(kwargs, kwargs.get('store')) super(LoanItem, self).__init__(*args, **kwargs) product = self.sellable.product if product: self.ipi_info.set_item_tax(self) self.icms_info.set_item_tax(self) self.pis_info.set_item_tax(self) self.cofins_info.set_item_tax(self)