diff --git a/.travis.yml b/.travis.yml index 247e8522a..1b06c1b61 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ sudo: false addons: + postgresql: "9.4" apt: packages: - expect-dev # provides unbuffer utility diff --git a/magentoerpconnect/README.rst b/magentoerpconnect/README.rst index 554529513..8e353b0f1 100644 --- a/magentoerpconnect/README.rst +++ b/magentoerpconnect/README.rst @@ -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 diff --git a/magentoerpconnect/sale.py b/magentoerpconnect/sale.py index 7161e7e2a..c10c308d6 100644 --- a/magentoerpconnect/sale.py +++ b/magentoerpconnect/sale.py @@ -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 @@ -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 diff --git a/magentoerpconnect/tests/data_base.py b/magentoerpconnect/tests/data_base.py index c88c8e3a0..ab7178549 100644 --- a/magentoerpconnect/tests/data_base.py +++ b/magentoerpconnect/tests/data_base.py @@ -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', @@ -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, @@ -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', @@ -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,