Created
December 1, 2018 09:50
-
-
Save aqt01/247e68865b9cc34eebd5a49d0560f1e3 to your computer and use it in GitHub Desktop.
Document override example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __init__(self, *args, **kwargs): | |
super(Document, self).__init__(*args, **kwargs) | |
self.__status = self.status | |
self.__amount = self.amount | |
self.__pay_bill = self.pay_bill | |
def save(self, force_insert=False, force_update=False): | |
if self.__status != self.status: # El estado cambio | |
print('el estado cambio') | |
if( self.status == 0): # Si esta pendiendte sumo al balance | |
self.provider.balance += self.amount | |
self.provider.save() | |
if self.__amount != self.amount: # La cantidad cambio | |
print('la cantidad cambio') | |
self.provider.balance += self.amount | |
if self.__pay_bill != self.pay_bill: | |
print('Cambio el paybill') | |
super(Document, self).save(force_insert, force_update) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment