Merge lp:~akretion-team/magentoerpconnect/magentoerpconnect-fix-shipping-amount-if-discount into lp:magentoerpconnect/oerp6.1-stable

Proposed by Benoit Guillot - http://www.akretion.com
Status: Merged
Merged at revision: 691
Proposed branch: lp:~akretion-team/magentoerpconnect/magentoerpconnect-fix-shipping-amount-if-discount
Merge into: lp:magentoerpconnect/oerp6.1-stable
Diff against target: 13 lines (+3/-0)
1 file modified
magentoerpconnect/settings/1.5.0.0/sale.order/external.mappinglines.template.csv (+3/-0)
To merge this branch: bzr merge lp:~akretion-team/magentoerpconnect/magentoerpconnect-fix-shipping-amount-if-discount
Reviewer Review Type Date Requested Status
Sébastien BEAU - http://www.akretion.com Approve
Review via email: mp+150544@code.launchpad.net

Description of the change

This merge proposal set the shipping_amount_tax_excluded to 0 in the sale order if the shipping_amount_tax_included is also 0 because of discount.

An example to make it more clear:

A sale order in magento:
- shipping cost tax included : 7.00 euros
- shipping cost tax excluded : 5.85 euros
- discount on shipping : 7.00 euros

so in the mapping :

amount_tax_inc = 7.00 - 7.00 = 0
amount_tax_exc = 5.85

if amount_tax_exc and amount_tax_inc:
    tax_rate = amount_tax_inc/amount_tax_exc -1
else:
    tax_rate = 0

result=[
    ('shipping_amount_tax_included', 0),
    ('shipping_amount_tax_excluded', 5.85),
    ('shipping_tax_rate', 0),
]

It will create a shipping cost line with price : 5.85 and no taxes but it's wrong there is no shipping cost

I propose to set the amount_tax_exc to 0 also by adding:

if not amount_tax_inc:
    amount_tax_exc = 0

To post a comment you must log in.
Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

It's ok for me. I merge it

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'magentoerpconnect/settings/1.5.0.0/sale.order/external.mappinglines.template.csv'
2--- magentoerpconnect/settings/1.5.0.0/sale.order/external.mappinglines.template.csv 2012-12-19 14:00:47 +0000
3+++ magentoerpconnect/settings/1.5.0.0/sale.order/external.mappinglines.template.csv 2013-02-26 12:33:23 +0000
4@@ -36,6 +36,9 @@
5 else:
6 tax_rate = 0
7
8+if not amount_tax_inc:
9+ amount_tax_exc = 0
10+
11 result=[
12 ('shipping_amount_tax_included', amount_tax_inc),
13 ('shipping_amount_tax_excluded', amount_tax_exc),