Skip to content

Commit

Permalink
Merge 713f31f into 99f631b
Browse files Browse the repository at this point in the history
  • Loading branch information
akshay-emipro committed Jul 4, 2015
2 parents 99f631b + 713f31f commit cd1ffb7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion magentoerpconnect/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def _add_shipping_line(self, map_record, values):

if values.get('carrier_id'):
carrier = self.env['delivery.carrier'].browse(values['carrier_id'])
line_builder.product_id = carrier.product_id
line_builder.product = carrier.product_id

line = (0, 0, line_builder.get_line())
values['order_line'].append(line)
Expand Down
27 changes: 27 additions & 0 deletions magentoerpconnect/tests/test_sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,30 @@ def test_import_guest_order(self):
partner_binding = binding.partner_id.magento_bind_ids
self.assertEqual(partner_binding.magento_id, 'guestorder:900000700')
self.assertTrue(partner_binding.guest_customer)

def test_import_carrier_product(self):
""" Product of a carrier is used in the sale line """
product = self.env['product.product'].create({
'name': 'Carrier Product',
})
self.env['delivery.carrier'].create({
'name': 'Flatrate',
'partner_id': self.env.ref('base.main_partner').id,
'product_id': product.id,
'magento_code': 'flatrate_flatrate',
'magento_carrier_code': 'flatrate_flatrate',
})
binding = self._import_sale_order(900000691)
# check if we have a line with the carrier product,
# which is the shipping line
shipping_line = False
for line in binding.order_line:
if line.product_id == product:
shipping_line = True
self.assertTrue(shipping_line,
msg='No shipping line with the product of the carrier '
'has been found. Line names: %s' %
(', '.join("%s (%s)" % (line.name,
line.product_id.name)
for line
in binding.order_line),))

0 comments on commit cd1ffb7

Please sign in to comment.