-
-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Catch cases where record['discount_amount'] = None #70
Conversation
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'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also do not put a \
but use parentheses
I propose to leave the existing code but just use this idiom |
@guewen , @pedrobaeza : yes, it's cleaner like this. I fixed it. |
Thanks! 👍 |
👍 |
Catch cases where record['discount_amount'] = None
Magento sometimes sends sales_order.items with the attributes 'discount_amount' set to None; this caused the float() function to fail with the error "TypeError: float() argument must be a string or a number".