Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
sudo: false

addons:
postgresql: "9.4"
apt:
packages:
- expect-dev # provides unbuffer utility
Expand Down
2 changes: 0 additions & 2 deletions magentoerpconnect/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ Technical points:

.. _connector: https://github.com/OCA/connector
.. _connector_ecommerce: https://github.com/OCA/connector-ecommerce
.. _Camptocamp: http://www.camptocamp.com
.. _Akretion: http://www.akretion.com
.. _`source is on GitHub`: https://github.com/OCA/connector-magento

Installation
Expand Down
10 changes: 6 additions & 4 deletions magentoerpconnect/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ def discount_amount(self, record):
row_total = float(record.get('row_total') or 0)
discount = 0
if discount_value > 0 and row_total > 0:
discount = 100 * discount_value / row_total
discount = 100 * discount_value / (discount_value + row_total)
result = {'discount': discount}
return result

Expand Down Expand Up @@ -1027,9 +1027,11 @@ def product_options(self, record):
@mapping
def price(self, record):
result = {}
base_row_total = float(record['base_row_total'] or 0.)
base_row_total_incl_tax = float(record['base_row_total_incl_tax'] or
0.)
base_row_total = float(record['base_row_total'] or 0.) + float(
record['base_discount_amount'] or 0)
base_row_total_incl_tax = float(
record['base_row_total_incl_tax'] or 0.) + float(
record['base_discount_amount'] or 0)
qty_ordered = float(record['qty_ordered'])
if self.options.tax_include:
result['price_unit'] = base_row_total_incl_tax / qty_ordered
Expand Down
16 changes: 8 additions & 8 deletions magentoerpconnect/tests/data_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25907,8 +25907,8 @@
'base_price': '28.0300',
'base_price_incl_tax': '29.9900',
'base_row_invoiced': '28.0300',
'base_row_total': '28.0300',
'base_row_total_incl_tax': '29.9900',
'base_row_total': '24.4600',
'base_row_total_incl_tax': '26.4200',
'base_tax_amount': '1.9600',
'base_tax_before_discount': None,
'base_tax_invoiced': '1.9600',
Expand Down Expand Up @@ -25953,8 +25953,8 @@
'qty_shipped': '0.0000',
'quote_item_id': 579492,
'row_invoiced': '28.0300',
'row_total': '28.0300',
'row_total_incl_tax': '29.9900',
'row_total': '24.4600',
'row_total_incl_tax': '26.4200',
'row_weight': '0.0000',
'sku': 'skui1',
'store_id': 2,
Expand Down Expand Up @@ -25985,8 +25985,8 @@
'base_price': '11.1800',
'base_price_incl_tax': '11.9600',
'base_row_invoiced': '11.1800',
'base_row_total': '11.1800',
'base_row_total_incl_tax': '11.9600',
'base_row_total': '9.7500',
'base_row_total_incl_tax': '10.5300',
'base_tax_amount': '0.7800',
'base_tax_before_discount': None,
'base_tax_invoiced': '0.7800',
Expand Down Expand Up @@ -26031,8 +26031,8 @@
'qty_shipped': '0.0000',
'quote_item_id': 579493,
'row_invoiced': '11.1800',
'row_total': '11.1800',
'row_total_incl_tax': '11.9600',
'row_total': '9.7500',
'row_total_incl_tax': '10.5300',
'row_weight': '0.0000',
'sku': 'skui2',
'store_id': 2,
Expand Down