Merge lp:~camptocamp/openerp-connector-magento/7.0-magentoerpconnect-handle-shipping-tax-in-tax_included-context-rde into lp:~openerp-connector-core-editors/openerp-connector-magento/7.0
Proposed by
Romain Deheele - Camptocamp
Status: | Merged |
---|---|
Merged at revision: | 942 |
Proposed branch: | lp:~camptocamp/openerp-connector-magento/7.0-magentoerpconnect-handle-shipping-tax-in-tax_included-context-rde |
Merge into: | lp:~openerp-connector-core-editors/openerp-connector-magento/7.0 |
Diff against target: |
447 lines (+413/-6) 3 files modified
magentoerpconnect/sale.py (+9/-5) magentoerpconnect/tests/test_data.py (+373/-0) magentoerpconnect/tests/test_synchronization.py (+31/-1) |
To merge this branch: | bzr merge lp:~camptocamp/openerp-connector-magento/7.0-magentoerpconnect-handle-shipping-tax-in-tax_included-context-rde |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Guewen Baconnier @ Camptocamp | code review | Approve | |
Review via email: mp+193927@code.launchpad.net |
Commit message
Description of the change
Hello,
This merge proposal concerns
https:/
and has been started here:
https:/
But I create a new cleaner merge proposal (the previous has some text conflicts)
It includes:
-better tax included management
-unit test
Romain
To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote : | # |
review:
Approve
(code 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 2013-10-30 13:15:07 +0000 | |||
3 | +++ magentoerpconnect/sale.py 2013-11-05 13:59:19 +0000 | |||
4 | @@ -675,11 +675,15 @@ | |||
5 | 675 | sess = self.session | 675 | sess = self.session |
6 | 676 | # TODO: refactor: do no longer store the transient fields in the | 676 | # TODO: refactor: do no longer store the transient fields in the |
7 | 677 | # result, use a ConnectorUnit to create the lines | 677 | # result, use a ConnectorUnit to create the lines |
13 | 678 | result = sess.pool['sale.order']._convert_special_fields(sess.cr, | 678 | backend = self.backend_record |
14 | 679 | sess.uid, | 679 | # in tax_included context, need to pass it in context |
15 | 680 | result, | 680 | tax_included = backend.catalog_price_tax_included |
16 | 681 | result['magento_order_line_ids'], | 681 | with self.session.change_context({'is_tax_included': tax_included}): |
17 | 682 | sess.context) | 682 | result = sess.pool['sale.order']._convert_special_fields(sess.cr, |
18 | 683 | sess.uid, | ||
19 | 684 | result, | ||
20 | 685 | result['magento_order_line_ids'], | ||
21 | 686 | sess.context) | ||
22 | 683 | # remove transient fields otherwise OpenERP will raise a warning | 687 | # remove transient fields otherwise OpenERP will raise a warning |
23 | 684 | # or even fail to create the record because the fields do not | 688 | # or even fail to create the record because the fields do not |
24 | 685 | # exist | 689 | # exist |
25 | 686 | 690 | ||
26 | === modified file 'magentoerpconnect/tests/test_data.py' | |||
27 | --- magentoerpconnect/tests/test_data.py 2013-10-30 13:16:37 +0000 | |||
28 | +++ magentoerpconnect/tests/test_data.py 2013-11-05 13:59:19 +0000 | |||
29 | @@ -25398,4 +25398,377 @@ | |||
30 | 25398 | 'updated_at': '2013-10-30 09:43:20', | 25398 | 'updated_at': '2013-10-30 09:43:20', |
31 | 25399 | 'weight': '2.0000', | 25399 | 'weight': '2.0000', |
32 | 25400 | 'x_forwarded_for': None}, | 25400 | 'x_forwarded_for': None}, |
33 | 25401 | ('sales_order.info', (900000695, None)): {'adjustment_negative': None, | ||
34 | 25402 | 'adjustment_positive': None, | ||
35 | 25403 | 'applied_rule_ids': None, | ||
36 | 25404 | 'base_adjustment_negative': None, | ||
37 | 25405 | 'base_adjustment_positive': None, | ||
38 | 25406 | 'base_currency_code': 'EUR', | ||
39 | 25407 | 'base_discount_amount': '0.0000', | ||
40 | 25408 | 'base_discount_canceled': None, | ||
41 | 25409 | 'base_discount_invoiced': '0.0000', | ||
42 | 25410 | 'base_discount_refunded': None, | ||
43 | 25411 | 'base_grand_total': '97.5000', | ||
44 | 25412 | 'base_hidden_tax_amount': '0.0000', | ||
45 | 25413 | 'base_hidden_tax_invoiced': '0.0000', | ||
46 | 25414 | 'base_hidden_tax_refunded': None, | ||
47 | 25415 | 'base_shipping_amount': '7.8700', | ||
48 | 25416 | 'base_shipping_canceled': None, | ||
49 | 25417 | 'base_shipping_discount_amount': '0.0000', | ||
50 | 25418 | 'base_shipping_hidden_tax_amnt': '0.0000', | ||
51 | 25419 | 'base_shipping_hidden_tax_amount': '0.0000', | ||
52 | 25420 | 'base_shipping_incl_tax': '8.5000', | ||
53 | 25421 | 'base_shipping_invoiced': '7.8700', | ||
54 | 25422 | 'base_shipping_refunded': None, | ||
55 | 25423 | 'base_shipping_tax_amount': '0.6300', | ||
56 | 25424 | 'base_shipping_tax_refunded': None, | ||
57 | 25425 | 'base_subtotal': '82.4100', | ||
58 | 25426 | 'base_subtotal_canceled': None, | ||
59 | 25427 | 'base_subtotal_incl_tax': '89.0000', | ||
60 | 25428 | 'base_subtotal_invoiced': '82.4100', | ||
61 | 25429 | 'base_subtotal_refunded': None, | ||
62 | 25430 | 'base_tax_amount': '7.2200', | ||
63 | 25431 | 'base_tax_canceled': None, | ||
64 | 25432 | 'base_tax_invoiced': '7.2200', | ||
65 | 25433 | 'base_tax_refunded': None, | ||
66 | 25434 | 'base_to_global_rate': '1.0000', | ||
67 | 25435 | 'base_to_order_rate': '1.0000', | ||
68 | 25436 | 'base_total_canceled': None, | ||
69 | 25437 | 'base_total_due': '0.0000', | ||
70 | 25438 | 'base_total_invoiced': '97.5000', | ||
71 | 25439 | 'base_total_invoiced_cost': '0.0000', | ||
72 | 25440 | 'base_total_offline_refunded': None, | ||
73 | 25441 | 'base_total_online_refunded': None, | ||
74 | 25442 | 'base_total_paid': '97.5000', | ||
75 | 25443 | 'base_total_qty_ordered': None, | ||
76 | 25444 | 'base_total_refunded': None, | ||
77 | 25445 | 'billing_address': {'address_id': '38468', | ||
78 | 25446 | 'address_type': 'billing', | ||
79 | 25447 | 'city': 'Lyon', | ||
80 | 25448 | 'company': None, | ||
81 | 25449 | 'country_id': 'FR', | ||
82 | 25450 | 'customer_address_id': '4999', | ||
83 | 25451 | 'customer_id': None, | ||
84 | 25452 | 'email': 'john@doe.fr', | ||
85 | 25453 | 'fax': None, | ||
86 | 25454 | 'firstname': 'John', | ||
87 | 25455 | 'lastname': 'Doe', | ||
88 | 25456 | 'middlename': None, | ||
89 | 25457 | 'parent_id': '7360', | ||
90 | 25458 | 'postcode': '1006', | ||
91 | 25459 | 'prefix': None, | ||
92 | 25460 | 'quote_address_id': None, | ||
93 | 25461 | 'region': None, | ||
94 | 25462 | 'region_id': None, | ||
95 | 25463 | 'street': 'Victor Hugo', | ||
96 | 25464 | 'suffix': None, | ||
97 | 25465 | 'telephone': '31763163390', | ||
98 | 25466 | 'vat_id': None, | ||
99 | 25467 | 'vat_is_valid': None, | ||
100 | 25468 | 'vat_request_date': None, | ||
101 | 25469 | 'vat_request_id': None, | ||
102 | 25470 | 'vat_request_success': None}, | ||
103 | 25471 | 'billing_address_id': '38468', | ||
104 | 25472 | 'can_ship_partially': None, | ||
105 | 25473 | 'can_ship_partially_item': None, | ||
106 | 25474 | 'coupon_code': None, | ||
107 | 25475 | 'coupon_rule_name': None, | ||
108 | 25476 | 'created_at': '2013-10-14 13:20:56', | ||
109 | 25477 | 'customer_dob': None, | ||
110 | 25478 | 'customer_email': 'john@doe.fr', | ||
111 | 25479 | 'customer_firstname': 'John', | ||
112 | 25480 | 'customer_gender': None, | ||
113 | 25481 | 'customer_group_id': '1', | ||
114 | 25482 | 'customer_id': '1', | ||
115 | 25483 | 'customer_is_guest': '0', | ||
116 | 25484 | 'customer_lastname': 'Doe', | ||
117 | 25485 | 'customer_middlename': None, | ||
118 | 25486 | 'customer_note': None, | ||
119 | 25487 | 'customer_note_notify': '1', | ||
120 | 25488 | 'customer_prefix': None, | ||
121 | 25489 | 'customer_suffix': None, | ||
122 | 25490 | 'customer_taxvat': None, | ||
123 | 25491 | 'discount_amount': '0.0000', | ||
124 | 25492 | 'discount_canceled': None, | ||
125 | 25493 | 'discount_description': None, | ||
126 | 25494 | 'discount_invoiced': '0.0000', | ||
127 | 25495 | 'discount_refunded': None, | ||
128 | 25496 | 'edit_increment': None, | ||
129 | 25497 | 'email_sent': '1', | ||
130 | 25498 | 'employee_email': None, | ||
131 | 25499 | 'employee_name': None, | ||
132 | 25500 | 'employee_phone': None, | ||
133 | 25501 | 'ext_customer_id': None, | ||
134 | 25502 | 'ext_order_id': None, | ||
135 | 25503 | 'forced_do_shipment_with_invoice': None, | ||
136 | 25504 | 'forced_shipment_with_invoice': None, | ||
137 | 25505 | 'gift_message_id': None, | ||
138 | 25506 | 'global_currency_code': 'EUR', | ||
139 | 25507 | 'grand_total': '97.5000', | ||
140 | 25508 | 'hidden_tax_amount': '0.0000', | ||
141 | 25509 | 'hidden_tax_invoiced': '0.0000', | ||
142 | 25510 | 'hidden_tax_refunded': None, | ||
143 | 25511 | 'hold_before_state': None, | ||
144 | 25512 | 'hold_before_status': None, | ||
145 | 25513 | 'imported': '0', | ||
146 | 25514 | 'increment_id': '100005281', | ||
147 | 25515 | 'is_virtual': '0', | ||
148 | 25516 | 'items': [{'additional_data': None, | ||
149 | 25517 | 'amount_refunded': '0.0000', | ||
150 | 25518 | 'applied_rule_ids': None, | ||
151 | 25519 | 'base_amount_refunded': '0.0000', | ||
152 | 25520 | 'base_cost': None, | ||
153 | 25521 | 'base_discount_amount': '0.0000', | ||
154 | 25522 | 'base_discount_invoiced': '0.0000', | ||
155 | 25523 | 'base_discount_refunded': None, | ||
156 | 25524 | 'base_hidden_tax_amount': None, | ||
157 | 25525 | 'base_hidden_tax_invoiced': '0.0000', | ||
158 | 25526 | 'base_hidden_tax_refunded': None, | ||
159 | 25527 | 'base_original_price': '89.0000', | ||
160 | 25528 | 'base_price': '82.4100', | ||
161 | 25529 | 'base_price_incl_tax': '89.0000', | ||
162 | 25530 | 'base_row_invoiced': '82.4100', | ||
163 | 25531 | 'base_row_total': '82.4100', | ||
164 | 25532 | 'base_row_total_incl_tax': '89.0000', | ||
165 | 25533 | 'base_tax_amount': '6.5900', | ||
166 | 25534 | 'base_tax_before_discount': None, | ||
167 | 25535 | 'base_tax_invoiced': '6.5900', | ||
168 | 25536 | 'base_tax_refunded': None, | ||
169 | 25537 | 'base_weee_tax_applied_amount': '0.0000', | ||
170 | 25538 | 'base_weee_tax_applied_row_amnt': '0.0000', | ||
171 | 25539 | 'base_weee_tax_applied_row_amount': '0.0000', | ||
172 | 25540 | 'base_weee_tax_disposition': '0.0000', | ||
173 | 25541 | 'base_weee_tax_row_disposition': '0.0000', | ||
174 | 25542 | 'created_at': '2013-10-14 13:20:56', | ||
175 | 25543 | 'description': None, | ||
176 | 25544 | 'discount_amount': '0.0000', | ||
177 | 25545 | 'discount_invoiced': '0.0000', | ||
178 | 25546 | 'discount_percent': '0.0000', | ||
179 | 25547 | 'discount_refunded': None, | ||
180 | 25548 | 'earned_points_hash': None, | ||
181 | 25549 | 'ext_order_item_id': None, | ||
182 | 25550 | 'free_shipping': '0', | ||
183 | 25551 | 'gift_message_available': None, | ||
184 | 25552 | 'gift_message_id': None, | ||
185 | 25553 | 'hidden_tax_amount': None, | ||
186 | 25554 | 'hidden_tax_canceled': None, | ||
187 | 25555 | 'hidden_tax_invoiced': '0.0000', | ||
188 | 25556 | 'hidden_tax_refunded': None, | ||
189 | 25557 | 'is_nominal': '0', | ||
190 | 25558 | 'is_qty_decimal': '0', | ||
191 | 25559 | 'is_virtual': '0', | ||
192 | 25560 | 'item_id': '12751', | ||
193 | 25561 | 'locked_do_invoice': None, | ||
194 | 25562 | 'locked_do_ship': None, | ||
195 | 25563 | 'name': 'Dior Homme', | ||
196 | 25564 | 'no_discount': '0', | ||
197 | 25565 | 'order_id': '7360', | ||
198 | 25566 | 'original_price': '89.0000', | ||
199 | 25567 | 'parent_item_id': None, | ||
200 | 25568 | 'price': '82.4100', | ||
201 | 25569 | 'price_incl_tax': '89.0000', | ||
202 | 25570 | 'product_id': '157', | ||
203 | 25571 | 'product_options': 'a:1:{s:15:"info_buyRequest";a:6:{s:4:"uenc";s:176:"aHR0cDovL3d3dy4xMDAwcGFyZnVtcy5jaC9ib3V0aXF1ZTEuNy4wLjIvZnIvcGFyZnVtLWhvbW1lcy1ldC1mZW1tZXMtcGFzLWNoZXIvcGFyZnVtLWRpb3ItcGFzLWNoZXIvcGFyZnVtLWRpb3ItaG9tbWUtcGFzLWNoZXIuaHRtbA,,";s:7:"product";s:4:"4773";s:15:"related_product";s:0:"";s:3:"qty";s:1:"1";s:1:"x";s:2:"70";s:1:"y";s:2:"23";}}', | ||
204 | 25572 | 'product_type': 'simple', | ||
205 | 25573 | 'qty_backordered': None, | ||
206 | 25574 | 'qty_canceled': '0.0000', | ||
207 | 25575 | 'qty_invoiced': '1.0000', | ||
208 | 25576 | 'qty_ordered': '1.0000', | ||
209 | 25577 | 'qty_refunded': '0.0000', | ||
210 | 25578 | 'qty_shipped': '0.0000', | ||
211 | 25579 | 'quote_item_id': '46485', | ||
212 | 25580 | 'redeemed_points_hash': None, | ||
213 | 25581 | 'row_invoiced': '82.4100', | ||
214 | 25582 | 'row_total': '82.4100', | ||
215 | 25583 | 'row_total_after_redemptions': None, | ||
216 | 25584 | 'row_total_after_redemptions_incl_tax': None, | ||
217 | 25585 | 'row_total_before_redemptions': None, | ||
218 | 25586 | 'row_total_before_redemptions_incl_tax': None, | ||
219 | 25587 | 'row_total_incl_tax': '89.0000', | ||
220 | 25588 | 'row_weight': '0.0000', | ||
221 | 25589 | 'sku': '1625', | ||
222 | 25590 | 'store_id': '1', | ||
223 | 25591 | 'tax_amount': '6.5900', | ||
224 | 25592 | 'tax_before_discount': None, | ||
225 | 25593 | 'tax_canceled': None, | ||
226 | 25594 | 'tax_invoiced': '6.5900', | ||
227 | 25595 | 'tax_percent': '8.0000', | ||
228 | 25596 | 'tax_refunded': None, | ||
229 | 25597 | 'updated_at': '2013-10-14 13:22:00', | ||
230 | 25598 | 'weee_tax_applied': 'a:0:{}', | ||
231 | 25599 | 'weee_tax_applied_amount': '0.0000', | ||
232 | 25600 | 'weee_tax_applied_row_amount': '0.0000', | ||
233 | 25601 | 'weee_tax_disposition': '0.0000', | ||
234 | 25602 | 'weee_tax_row_disposition': '0.0000', | ||
235 | 25603 | 'weight': None}], | ||
236 | 25604 | 'order_currency_code': 'EUR', | ||
237 | 25605 | 'order_id': '7360', | ||
238 | 25606 | 'original_increment_id': None, | ||
239 | 25607 | 'payment': {'account_status': None, | ||
240 | 25608 | 'additional_data': None, | ||
241 | 25609 | 'address_status': None, | ||
242 | 25610 | 'amount_authorized': None, | ||
243 | 25611 | 'amount_canceled': None, | ||
244 | 25612 | 'amount_ordered': '97.5000', | ||
245 | 25613 | 'amount_paid': '97.5000', | ||
246 | 25614 | 'amount_refunded': None, | ||
247 | 25615 | 'anet_trans_method': None, | ||
248 | 25616 | 'base_amount_authorized': None, | ||
249 | 25617 | 'base_amount_canceled': None, | ||
250 | 25618 | 'base_amount_ordered': '97.5000', | ||
251 | 25619 | 'base_amount_paid': '97.5000', | ||
252 | 25620 | 'base_amount_paid_online': None, | ||
253 | 25621 | 'base_amount_refunded': None, | ||
254 | 25622 | 'base_amount_refunded_online': None, | ||
255 | 25623 | 'base_shipping_amount': '7.8700', | ||
256 | 25624 | 'base_shipping_captured': '7.8700', | ||
257 | 25625 | 'base_shipping_refunded': None, | ||
258 | 25626 | 'cc_approval': None, | ||
259 | 25627 | 'cc_avs_status': None, | ||
260 | 25628 | 'cc_cid_status': None, | ||
261 | 25629 | 'cc_debug_request_body': None, | ||
262 | 25630 | 'cc_debug_response_body': None, | ||
263 | 25631 | 'cc_debug_response_serialized': None, | ||
264 | 25632 | 'cc_exp_month': '0', | ||
265 | 25633 | 'cc_exp_year': '0', | ||
266 | 25634 | 'cc_last4': None, | ||
267 | 25635 | 'cc_number_enc': None, | ||
268 | 25636 | 'cc_owner': None, | ||
269 | 25637 | 'cc_secure_verify': None, | ||
270 | 25638 | 'cc_ss_issue': None, | ||
271 | 25639 | 'cc_ss_start_month': '0', | ||
272 | 25640 | 'cc_ss_start_year': '0', | ||
273 | 25641 | 'cc_status': None, | ||
274 | 25642 | 'cc_status_description': None, | ||
275 | 25643 | 'cc_trans_id': None, | ||
276 | 25644 | 'cc_type': None, | ||
277 | 25645 | 'cybersource_token': None, | ||
278 | 25646 | 'echeck_account_name': None, | ||
279 | 25647 | 'echeck_account_type': None, | ||
280 | 25648 | 'echeck_bank_name': None, | ||
281 | 25649 | 'echeck_routing_number': None, | ||
282 | 25650 | 'echeck_type': None, | ||
283 | 25651 | 'flo2cash_account_id': None, | ||
284 | 25652 | 'ideal_issuer_id': None, | ||
285 | 25653 | 'ideal_issuer_title': None, | ||
286 | 25654 | 'ideal_transaction_checked': None, | ||
287 | 25655 | 'last_trans_id': '1P06829259760661R', | ||
288 | 25656 | 'method': 'checkmo', | ||
289 | 25657 | 'parent_id': '7360', | ||
290 | 25658 | 'paybox_question_number': None, | ||
291 | 25659 | 'paybox_request_number': None, | ||
292 | 25660 | 'payment_id': '32844', | ||
293 | 25661 | 'po_number': None, | ||
294 | 25662 | 'protection_eligibility': None, | ||
295 | 25663 | 'quote_payment_id': None, | ||
296 | 25664 | 'shipping_amount': '7.8700', | ||
297 | 25665 | 'shipping_captured': '7.8700', | ||
298 | 25666 | 'shipping_refunded': None}, | ||
299 | 25667 | 'payment_auth_expiration': None, | ||
300 | 25668 | 'payment_authorization_amount': None, | ||
301 | 25669 | 'payment_authorization_expiration': None, | ||
302 | 25670 | 'paypal_ipn_customer_notified': None, | ||
303 | 25671 | 'protect_code': '49accf', | ||
304 | 25672 | 'quote_address_id': None, | ||
305 | 25673 | 'quote_id': '33794', | ||
306 | 25674 | 'relation_child_id': None, | ||
307 | 25675 | 'relation_child_real_id': None, | ||
308 | 25676 | 'relation_parent_id': None, | ||
309 | 25677 | 'relation_parent_real_id': None, | ||
310 | 25678 | 'remote_ip': None, | ||
311 | 25679 | 'rewards_base_discount_amount': None, | ||
312 | 25680 | 'rewards_base_discount_tax_amount': None, | ||
313 | 25681 | 'rewards_discount_amount': None, | ||
314 | 25682 | 'rewards_discount_tax_amount': None, | ||
315 | 25683 | 'shipping_address': {'address_id': '38469', | ||
316 | 25684 | 'address_type': 'shipping', | ||
317 | 25685 | 'city': 'Lyon', | ||
318 | 25686 | 'company': None, | ||
319 | 25687 | 'country_id': 'FR', | ||
320 | 25688 | 'customer_address_id': None, | ||
321 | 25689 | 'customer_id': None, | ||
322 | 25690 | 'email': 'john@doe.fr', | ||
323 | 25691 | 'fax': None, | ||
324 | 25692 | 'firstname': 'John', | ||
325 | 25693 | 'lastname': 'Doe', | ||
326 | 25694 | 'middlename': None, | ||
327 | 25695 | 'parent_id': '7360', | ||
328 | 25696 | 'postcode': '1006', | ||
329 | 25697 | 'prefix': None, | ||
330 | 25698 | 'quote_address_id': None, | ||
331 | 25699 | 'region': None, | ||
332 | 25700 | 'region_id': None, | ||
333 | 25701 | 'street': 'Victor Hugo', | ||
334 | 25702 | 'suffix': None, | ||
335 | 25703 | 'telephone': '31763163390', | ||
336 | 25704 | 'vat_id': None, | ||
337 | 25705 | 'vat_is_valid': None, | ||
338 | 25706 | 'vat_request_date': None, | ||
339 | 25707 | 'vat_request_id': None, | ||
340 | 25708 | 'vat_request_success': None}, | ||
341 | 25709 | 'shipping_address_id': '38469', | ||
342 | 25710 | 'shipping_amount': '7.8700', | ||
343 | 25711 | 'shipping_canceled': None, | ||
344 | 25712 | 'shipping_description': 'La Poste', | ||
345 | 25713 | 'shipping_discount_amount': '0.0000', | ||
346 | 25714 | 'shipping_hidden_tax_amount': '0.0000', | ||
347 | 25715 | 'shipping_incl_tax': '8.5000', | ||
348 | 25716 | 'shipping_invoiced': '7.8700', | ||
349 | 25717 | 'shipping_method': 'flatrate_flatrate', | ||
350 | 25718 | 'shipping_refunded': None, | ||
351 | 25719 | 'shipping_tax_amount': '0.6300', | ||
352 | 25720 | 'shipping_tax_refunded': None, | ||
353 | 25721 | 'state': 'processing', | ||
354 | 25722 | 'status': 'processing', | ||
355 | 25723 | 'status_history': [{'comment': u'Notifier le client pour la facture n\xb0100003489.', | ||
356 | 25724 | 'created_at': '2013-10-14 13:22:02', | ||
357 | 25725 | 'entity_name': 'invoice', | ||
358 | 25726 | 'is_customer_notified': '1', | ||
359 | 25727 | 'is_visible_on_front': '0', | ||
360 | 25728 | 'parent_id': '7360', | ||
361 | 25729 | 'status': 'processing', | ||
362 | 25730 | 'store_id': '1'}, | ||
363 | 25731 | {'comment': u'IPN "Completed". Registered notification about captured amount of 97,50\xa0EUR. Transaction ID: "1P06829259760661R".', | ||
364 | 25732 | 'created_at': '2013-10-14 13:22:00', | ||
365 | 25733 | 'entity_name': 'invoice', | ||
366 | 25734 | 'is_customer_notified': '2', | ||
367 | 25735 | 'is_visible_on_front': '0', | ||
368 | 25736 | 'parent_id': '7360', | ||
369 | 25737 | 'status': 'processing', | ||
370 | 25738 | 'store_id': '1'}, | ||
371 | 25739 | {'comment': None, | ||
372 | 25740 | 'created_at': '2013-10-14 13:20:58', | ||
373 | 25741 | 'entity_name': 'order', | ||
374 | 25742 | 'is_customer_notified': '0', | ||
375 | 25743 | 'is_visible_on_front': '0', | ||
376 | 25744 | 'parent_id': '7360', | ||
377 | 25745 | 'status': 'pending_payment', | ||
378 | 25746 | 'store_id': '1'}], | ||
379 | 25747 | 'store_currency_code': 'EUR', | ||
380 | 25748 | 'store_id': '1', | ||
381 | 25749 | 'store_name': u'France', | ||
382 | 25750 | 'store_to_base_rate': '1.0000', | ||
383 | 25751 | 'store_to_order_rate': '1.0000', | ||
384 | 25752 | 'subtotal': '82.4100', | ||
385 | 25753 | 'subtotal_canceled': None, | ||
386 | 25754 | 'subtotal_incl_tax': '89.0000', | ||
387 | 25755 | 'subtotal_invoiced': '82.4100', | ||
388 | 25756 | 'subtotal_refunded': None, | ||
389 | 25757 | 'tax_amount': '7.2200', | ||
390 | 25758 | 'tax_canceled': None, | ||
391 | 25759 | 'tax_invoiced': '7.2200', | ||
392 | 25760 | 'tax_refunded': None, | ||
393 | 25761 | 'total_canceled': None, | ||
394 | 25762 | 'total_due': '0.0000', | ||
395 | 25763 | 'total_invoiced': '97.5000', | ||
396 | 25764 | 'total_item_count': '1', | ||
397 | 25765 | 'total_offline_refunded': None, | ||
398 | 25766 | 'total_online_refunded': None, | ||
399 | 25767 | 'total_paid': '97.5000', | ||
400 | 25768 | 'total_qty_ordered': '1.0000', | ||
401 | 25769 | 'total_refunded': None, | ||
402 | 25770 | 'updated_at': '2013-10-14 13:22:00', | ||
403 | 25771 | 'website_id': u'1', | ||
404 | 25772 | 'weight': '0.0000', | ||
405 | 25773 | 'x_forwarded_for': None}, | ||
406 | 25401 | } | 25774 | } |
407 | 25402 | 25775 | ||
408 | === modified file 'magentoerpconnect/tests/test_synchronization.py' | |||
409 | --- magentoerpconnect/tests/test_synchronization.py 2013-10-31 08:10:45 +0000 | |||
410 | +++ magentoerpconnect/tests/test_synchronization.py 2013-11-05 13:59:19 +0000 | |||
411 | @@ -286,4 +286,34 @@ | |||
412 | 286 | self.uid, | 286 | self.uid, |
413 | 287 | order_line_id[0], | 287 | order_line_id[0], |
414 | 288 | ['price_unit'])['price_unit'] | 288 | ['price_unit'])['price_unit'] |
415 | 289 | self.assertEqual(price_unit, 41.0500) | ||
416 | 290 | \ No newline at end of file | 289 | \ No newline at end of file |
417 | 290 | self.assertEqual(price_unit, 41.0500) | ||
418 | 291 | |||
419 | 292 | def test_34_import_sale_order_with_taxes_included(self): | ||
420 | 293 | """ Import a sale order with taxes included """ | ||
421 | 294 | backend_id = self.backend_id | ||
422 | 295 | self.backend_model.write(self.cr, self.uid, self.backend_id, | ||
423 | 296 | {'catalog_price_tax_included': True}) | ||
424 | 297 | with mock_api(magento_base_responses): | ||
425 | 298 | with mock_urlopen_image(): | ||
426 | 299 | import_record(self.session, | ||
427 | 300 | 'magento.sale.order', | ||
428 | 301 | backend_id, 900000695) | ||
429 | 302 | mag_order_model = self.registry('magento.sale.order') | ||
430 | 303 | mag_order_ids = mag_order_model.search(self.cr, | ||
431 | 304 | self.uid, | ||
432 | 305 | [('backend_id', '=', backend_id), | ||
433 | 306 | ('magento_id', '=', '900000695')]) | ||
434 | 307 | self.assertEqual(len(mag_order_ids), 1) | ||
435 | 308 | order_id = mag_order_model.read(self.cr, | ||
436 | 309 | self.uid, | ||
437 | 310 | mag_order_ids[0], | ||
438 | 311 | ['openerp_id'])['openerp_id'] | ||
439 | 312 | order_model = self.registry('sale.order') | ||
440 | 313 | amount_total = order_model.read(self.cr, | ||
441 | 314 | self.uid, | ||
442 | 315 | order_id[0], | ||
443 | 316 | ['amount_total'])['amount_total'] | ||
444 | 317 | #97.5 is the amount_total if connector takes correctly included tax prices. | ||
445 | 318 | self.assertEqual(amount_total, 97.5000) | ||
446 | 319 | self.backend_model.write(self.cr, self.uid, self.backend_id, | ||
447 | 320 | {'catalog_price_tax_included': False}) |
Thanks a lot!
LGTM