def register(self, ourParty, otherParty, debitAccount, creditAccount, customerAccount=None): transaction = self.transaction() assert transaction is not None, "document must be tracked!" #The persons or subjects related with te document that are not self #(such as client in invoice or provider in alienInvoice) must be #called otherParty so their value can be assigned in register try: self.setOtherParty(otherParty) except: self.setPointOfSale(ourParty) self.customerAccount = customerAccount entry = AccountingEntry(customerAccount=customerAccount) entry.pointOfSale = ourParty entry.recordDate = now() transaction.track(entry) self.entry = entry entry.debit(self.amount, debitAccount) entry.credit(self.amount, creditAccount)
def register(self, ourParty, otherParty, debitAccount, creditAccount, customerAccount=None): transaction = self.transaction() assert transaction is not None, "document must be tracked!" #The persons or subjects related with te document that are not self #(such as client in invoice or provider in alienInvoice) must be #called otherParty so their value can be assigned in register self.setOtherParty(otherParty) self.customerAccount = customerAccount entry = AccountingEntry(customerAccount=customerAccount) entry.pointOfSale = ourParty entry.recordDate = now() transaction.track(entry) entry.debit(self.amount, debitAccount) entry.credit(self.amount, creditAccount)