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 
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to