Skip to content

Commit

Permalink
Catch cases where record['discount_amount'] = None
Browse files Browse the repository at this point in the history
  • Loading branch information
mdietrichc2c committed Dec 2, 2014
1 parent fb081b8 commit bed82c6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions magentoerpconnect/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,10 +992,14 @@ class SaleOrderLineImportMapper(ImportMapper):

@mapping
def discount_amount(self, record):
discount_value = float(record.get('discount_amount', 0))
if self.backend_record.catalog_price_tax_included:
discount_value = 0.0
row_total = 0.0
if record.get('discount_amount'):
discount_value = float(record.get('discount_amount', 0))
if self.backend_record.catalog_price_tax_included and \
record.get('row_total_incl_tax'):
row_total = float(record.get('row_total_incl_tax', 0))
else:
elif record.get('row_total'):
row_total = float(record.get('row_total', 0))
discount = 0
if discount_value > 0 and row_total > 0:
Expand Down

0 comments on commit bed82c6

Please # to comment.