Skip to content

Commit

Permalink
Wrong attribute name for the shipping line builder
Browse files Browse the repository at this point in the history
Fixes OCA#112
  • Loading branch information
guewen committed Jul 3, 2015
1 parent 1a3dc84 commit 508f0c5
Show file tree
Hide file tree
Showing 2 changed files with 30 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 @@ -890,7 +890,7 @@ def _add_shipping_line(self, map_record, values):
if values.get('carrier_id'):
carrier = self.session.browse('delivery.carrier',
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
29 changes: 29 additions & 0 deletions magentoerpconnect/tests/test_sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,32 @@ def test_copy_quotation_export_state(self):
self.assertEqual(method, 'sales_order.addComment')
self.assertEqual(magento_id, binding.magento_id)
self.assertEqual(state, 'pending')

def test_import_carrier_product(self):
""" Product of a carrier is used in the sale line """
cr, uid = self.cr, self.uid
product = self.registry('product.product').create(
cr, uid, {'name': 'Carrier Product'})
self.registry('delivery.carrier').create(
cr, uid,
{'name': 'Flatrate',
'partner_id': self.ref('base.main_partner'),
'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 508f0c5

Please sign in to comment.