Merge lp:~camptocamp/openerp-connector-magento/7.0-cod-1271537 into lp:~openerp-connector-core-editors/openerp-connector-magento/7.0

Proposed by Guewen Baconnier @ Camptocamp on 2014-01-22
Status: Merged
Merged at revision: 953
Proposed branch: lp:~camptocamp/openerp-connector-magento/7.0-cod-1271537
Merge into: lp:~openerp-connector-core-editors/openerp-connector-magento/7.0
Diff against target: 59 lines (+5/-26)
1 file modified
magentoerpconnect/sale.py (+5/-26)
To merge this branch: bzr merge lp:~camptocamp/openerp-connector-magento/7.0-cod-1271537
Reviewer Review Type Date Requested Status
Jan-Philipp Fischer (community) tested Approve on 2014-01-22
OpenERP Connector Core Editors 2014-01-22 Pending
Review via email: mp+202680@code.launchpad.net

Description of the change

To post a comment you must log in.

Tested and seems to be working. Approved.

review: Approve (tested)

Thanks for your review!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'magentoerpconnect/sale.py'
2--- magentoerpconnect/sale.py 2014-01-14 11:00:20 +0000
3+++ magentoerpconnect/sale.py 2014-01-22 14:37:42 +0000
4@@ -686,13 +686,13 @@
5
6 def _add_shipping_line(self, map_record, values):
7 record = map_record.source
8- amount_incl = float(record.get('base_shipping_incl_tax', 0.0))
9- amount_excl = float(record.get('shipping_amount', 0.0))
10+ amount_incl = float(record.get('base_shipping_incl_tax') or 0.0)
11+ amount_excl = float(record.get('shipping_amount') or 0.0)
12 if not (amount_incl or amount_excl):
13 return values
14 line_builder = self.get_connector_unit_for_model(MagentoShippingLineBuilder)
15 if self.options.tax_include:
16- discount = float(record.get('shipping_discount_amount', 0.0))
17+ discount = float(record.get('shipping_discount_amount') or 0.0)
18 line_builder.price_unit = (amount_incl - discount)
19 else:
20 line_builder.price_unit = amount_excl
21@@ -708,8 +708,8 @@
22
23 def _add_cash_on_delivery_line(self, map_record, values):
24 record = map_record.source
25- amount_excl = float(record.get('cod_fee', 0.0))
26- amount_incl = float(record.get('cod_tax_amount', 0.0))
27+ amount_excl = float(record.get('cod_fee') or 0.0)
28+ amount_incl = float(record.get('cod_tax_amount') or 0.0)
29 if not (amount_excl or amount_incl):
30 return values
31 line_builder = self.get_connector_unit_for_model(MagentoCashOnDeliveryLineBuilder)
32@@ -778,27 +778,6 @@
33 return {'payment_method_id': method_id}
34
35 @mapping
36- def cod_fee(self, record): # cash on delivery
37- # TODO Map Me (sic)
38- pass
39-
40- @mapping
41- def gift_cert_amount(self, record):
42- if 'gift_cert_amount' in record:
43- result = {'gift_certificates_amount': record['gift_cert_amount']}
44- else:
45- result = {}
46- return result
47-
48- @mapping
49- def gift_cert_code(self, record):
50- if 'gift_cert_code' in record:
51- result = {'gift_certificates_code': record['gift_cert_code']}
52- else:
53- result = {}
54- return result
55-
56- @mapping
57 def shipping_method(self, record):
58 session = self.session
59 ifield = record.get('shipping_method')