Learner looking for assistance

Anthony Smith jackie.walkabout at gmail.com
Mon Apr 14 03:43:41 EDT 2014


Hi All

I am probably doing something wrong but don't know what 
Any help would great 

Code below 

the calc_total does not return a estimated_total_weight

if add the estimated_total_weight the rest of the code works 

I am at a lose as to why ?????

def calc_total(self):
    	amount = 0
    	if self.estimated_weight_hd > 0:
            amount = self.number * self.estimated_weight_hd
	return amount
		   	
	def save(self):
		self.estimated_total_weight = self.calc_total()
    		super(SaleNote, self).save()
		
    def calc_total_price(self):
    	amount_price = 0
	if self.sale_head > 0:
	    amount_price = self.number * self.sale_head
            return amount_price
        else:
            if self.estimated_total_weight > 0:
                amount_price = self.estimated_total_weight * self.sale_kg
	return amount_price

    def save(self):
		self.total_price = self.calc_total_price()
		super(SaleNote, self).save()

thanks 

anthony 



More information about the Python-list mailing list