diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index 6ee95b020dc..8027cbc69cc 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.py +++ b/erpnext/crm/doctype/opportunity/opportunity.py @@ -42,9 +42,6 @@ class Opportunity(TransactionBase): if not self.with_items: self.items = [] - else: - self.calculate_totals() - def map_fields(self): for field in self.meta.fields: if not self.get(field.fieldname): @@ -54,20 +51,6 @@ class Opportunity(TransactionBase): except Exception: continue - def calculate_totals(self): - total = base_total = 0 - for item in self.get('items'): - item.amount = flt(item.rate) * flt(item.qty) - item.base_rate = flt(self.conversion_rate * item.rate) - item.base_amount = flt(self.conversion_rate * item.amount) - total += item.amount - base_total += item.base_amount - - self.total = flt(total) - self.base_total = flt(base_total) - self.grand_total = flt(self.total) + flt(self.opportunity_amount) - self.base_grand_total = flt(self.base_total) + flt(self.base_opportunity_amount) - def make_new_lead_if_required(self): """Set lead against new opportunity""" if (not self.get("party_name")) and self.contact_email: