OCA / connector-magento

Connect Odoo with Magento
http://odoo-magento-connector.com/
GNU Affero General Public License v3.0
105 stars 206 forks source link

Problem importing Old Orders #120

Open aignermi opened 9 years ago

aignermi commented 9 years ago

Hi,

I just tried importing all of our old orders. First of all the jobs failed because I did not have the fiscal years and periods configured. I did that now and now the jobs are failing with this error message:

Traceback (most recent call last): File "/opt/openerp-custom/addons/connector/connector/queue/worker.py", line 124, in run_job job.perform(session) File "/opt/openerp-custom/addons/connector/connector/queue/job.py", line 466, in perform self.result = self.func(session, _self.args, *_self.kwargs) File "/opt/openerp-custom/addons/connector-magento/magentoerpconnect/unit/import_synchronizer.py", line 379, in import_record importer.run(magento_id, force=force) File "/opt/openerp-custom/addons/connector-magento/magentoerpconnect/unit/import_synchronizer.py", line 220, in run record = self._create_data(map_record) File "/opt/openerp-custom/addons/connector-magento/magentoerpconnect/sale.py", line 908, in _create_data kwargs) File "/opt/openerp-custom/addons/connector-magento/magentoerpconnect/unit/import_synchronizer.py", line 164, in _create_data return map_record.values(for_create=True, kwargs) File "/opt/openerp-custom/addons/connector/connector/unit/mapper.py", line 912, in values values = self._mapper._apply(self, options=options) File "/opt/openerp-custom/addons/connector/connector/unit/mapper.py", line 696, in _apply return self._apply_with_options(map_record) File "/opt/openerp-custom/addons/connector/connector/unit/mapper.py", line 745, in _apply_with_options to_attr, model_name) File "/opt/openerp-custom/addons/connector/connector/unit/mapper.py", line 654, in _map_child to_attr, options=self.options) File "/opt/openerp-custom/addons/connector/connector/unit/mapper.py", line 419, in get_items mapped.append(self.get_item_values(map_record, to_attr, options)) File "/opt/openerp-custom/addons/connector/connector/unit/mapper.py", line 440, in get_item_values return map_record.values(**options) File "/opt/openerp-custom/addons/connector/connector/unit/mapper.py", line 912, in values values = self._mapper._apply(self, options=options) File "/opt/openerp-custom/addons/connector/connector/unit/mapper.py", line 696, in _apply return self._apply_with_options(map_record) File "/opt/openerp-custom/addons/connector/connector/unit/mapper.py", line 734, in _apply_with_options values = meth(map_record.source) File "/opt/openerp-custom/addons/connector-magento/magentoerpconnect/sale.py", line 980, in product_id "SaleOrderImporter._import_dependencies" % record['product_id']) AssertionError: product_id 456 should have been imported in SaleOrderImporter._import_dependencies

Can you help me identify the issue?

Thanks, Michael

guewen commented 9 years ago

It tries to import a sales order and in a line it has a product with Magento ID 456. Normally, products of a sales order line are imported beforehand (in SaleOrderImporter._import_dependencies). Can you check if the product with ID 456 still exist on Magento? If it had been deleted, it could explain why it was not imported.

aignermi commented 9 years ago

Thanks for the quick answer. I checked Magento (select * from catalog_product_entity where entity_id = '456'; & select * from sales_flat_order_item where product_id = '456';) and the product exists and I also have orders for it. I also finde the product in Odoo if I search for the SKU.

guewen commented 9 years ago

Having the product on both sides is really weird. What if you execute on your DB SELECT * from magento_product_product WHERE magento_id = '456';? If you have some pdb / python debug knowledge, you should try to put a breakpoint here https://github.com/OCA/connector-magento/blob/8.0/magentoerpconnect/sale.py#L977 and inspect the content of product_id.

aignermi commented 9 years ago

Ok I found the issue, it's on our side. Those are really old orders that I try to import now, and they were also migrated into Magento from our old shop, and the order item is configurable product which is not imported into Odoo of course. But that's fine, I can fix that manually during the migration.

But I just stumbled across another error message:

Traceback (most recent call last):
  File "/opt/openerp-custom/addons/connector/connector/queue/worker.py", line 124, in run_job
    job.perform(session)
  File "/opt/openerp-custom/addons/connector/connector/queue/job.py", line 466, in perform
    self.result = self.func(session, *self.args, **self.kwargs)
  File "/opt/openerp-custom/addons/connector-magento/magentoerpconnect/unit/import_synchronizer.py", line 379, in import_record
    importer.run(magento_id, force=force)
  File "/opt/openerp-custom/addons/connector-magento/magentoerpconnect/unit/import_synchronizer.py", line 212, in run
    self._import_dependencies()
  File "/opt/openerp-custom/addons/connector-magento/magentoerpconnect/sale.py", line 931, in _import_dependencies
    'magento.product.product')
  File "/opt/openerp-custom/addons/connector-magento/magentoerpconnect/unit/import_synchronizer.py", line 119, in _import_dependency
    importer.run(magento_id)
  File "/opt/openerp-custom/addons/connector-magento/magentoerpconnect/unit/import_synchronizer.py", line 197, in run
    self.magento_record = self._get_magento_data()
  File "/opt/openerp-custom/addons/connector-magento/magentoerpconnect/unit/import_synchronizer.py", line 61, in _get_magento_data
    return self.backend_adapter.read(self.magento_id)
  File "/opt/openerp-custom/addons/connector-magento/magentoerpconnect/product.py", line 245, in read
    [int(id), storeview_id, attributes, 'id'])
  File "/opt/openerp-custom/addons/connector-magento/magentoerpconnect/product.py", line 210, in _call
    return super(ProductProductAdapter, self)._call(method, arguments)
  File "/opt/openerp-custom/addons/connector-magento/magentoerpconnect/unit/backend_adapter.py", line 168, in _call
    result = api.call(method, arguments)
  File "/usr/local/lib/python2.7/dist-packages/magento/api.py", line 159, in call
    return self.client.call(self.session, resource_path, arguments)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1578, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/xmlrpclib.py", line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1297, in single_request
    return self.parse_response(response)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1473, in parse_response
    return u.close()
  File "/usr/lib/python2.7/xmlrpclib.py", line 793, in close
    raise Fault(**self._stack[0])
Fault: <Fault 0: 'Unknown Error'>

Can you also help me with that one?

guewen commented 9 years ago

That's an error returned by Magento so it could be anything :-(