← Back to team overview

magentoerpconnect-community team mailing list archive

Re: Response error magento 1.4.1 when trying to import orders

 

Hello,

it seems this error was due to a change in the use of filter functions in Magento (1.4.1) and this part of the code hasn't been updated in Magento. I've reported a bug (id: 23821) in Magento's site but didn't receive any answer.

It seems that using this different code, it works just fine : (in magento/app/code/core/Mage/Sales/Model/Order/Api.php)

76,78c76,85
<             ->addFieldToSelect('billing_name')
<             ->addFieldToSelect('shipping_name');
<
---
> ->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left') > ->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left') > ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left') > ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')
>             ->addExpressionAttributeToSelect('billing_name',
> 'CONCAT({{billing_firstname}}, " ", {{billing_lastname}})',
>                 array('billing_firstname', 'billing_lastname'))
>             ->addExpressionAttributeToSelect('shipping_name',
> 'CONCAT({{shipping_firstname}}, " ", {{shipping_lastname}})',
>                 array('shipping_firstname', 'shipping_lastname'));

(it's new code first, old code last).

Regards,

Vianney
www.akretion.com.br

<http://www.akretion.com.br>

On 16/07/2010 15:43, Raphaël Valyi wrote:
Hello community,

strangely, while this post for Vianney Da Costa has been sent to the Launchpad mail archive https://lists.launchpad.net/magentoerpconnect-community/msg00026.html
we never received it, so I just repost it here:

"
Hello,

We are having an error in magento 1.4.1 in the api when using the sales_order.list method. It is not an error from the conector because we have the same error when doing it directly in Python. It seems it comes from that magento file : magento/app/code/core/Mage/Sales/Model/Order/Api.php

Anybody had the same problem and have a work around?

Thanks.


Here is the erro :

[2010-07-14 14:42:47,076] ERROR:Magento Call:[01]: Method: sales_order.list [2010-07-14 14:42:47,076] ERROR:Magento Call:[02]: Arguments:[{'store_id': {'eq': 1}}]
[2010-07-14 14:42:47,076] ERROR:Magento Call:[03]: Error:ResponseError()
[2010-07-14 14:42:47,079] WARNING:Magento Call:Webservice Failure, sleeping 6 second before next attempt
[2010-07-14 14:42:53,083] ERROR:web-services:Uncaught exception
Traceback (most recent call last):
  File "/opt/openerp-trunk/server/bin/osv/osv.py", line 57, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/openerp-trunk/server/bin/osv/osv.py", line 133, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/openerp-trunk/server/bin/osv/osv.py", line 123, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
File "/opt/openerp-trunk/addons/base_sale_multichannels/sale.py", line 199, in import_orders
    self.import_shop_orders(cr, uid, shop, defaults, ctx)
File "/opt/openerp-trunk/addons/magentoerpconnect/sale.py", line 113, in import_shop_orders
    'ids_or_filter':ids_or_filter
File "/opt/openerp-trunk/addons/magentoerpconnect/magerp_osv.py", line 223, in mage_import_base
    data = conn.call(list_method, context['ids_or_filter'])
File "/opt/openerp-trunk/addons/magentoerpconnect/magerp_osv.py", line 53, in call
    res = self.ser.call(self.session, method, arguments)
  File "/usr/lib/python2.6/xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.6/xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.6/xmlrpclib.py", line 1253, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib/python2.6/xmlrpclib.py", line 1392, in _parse_response
    return u.close()
  File "/usr/lib/python2.6/xmlrpclib.py", line 836, in close
    raise ResponseError()
ResponseError: ResponseError()

--
Vianney
www.akretion.com.br <http://www.akretion.com.br>
"


Additionally, we know now more about the error thanks to the Apache log:
[Fri Jul 16 14:23:30 2010] [error] [client 10.0.0.6] PHP Fatal error: Call to undefined method Mage_Sales_Model_Mysql4_Order_Collection::addExpressionAttributeToSelect() in /var/www/magento/app/code/core/Mage/Sales/Model/Order/Api.php on line 80

I also would like to emphasis that this is yet an other pure Magento PHP bug that has nothing to do with OpenERP or our connector. It can be triggered easily from Python command line trying the official sale order Magento API from here http://www.magentocommerce.com/wiki/doc/webservices-api/api#order_api

We are investing on that, but any help would be appreciated.

Regards,

Raphaël Valyi
Founder and ERP Consultant
+55 21 3010 9965
http://www.akretion.com <http://www.akretion.com/>

<http://www.akretion.com.br/>


_______________________________________________
Mailing list: https://launchpad.net/~magentoerpconnect-community
Post to     : magentoerpconnect-community@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~magentoerpconnect-community
More help   : https://help.launchpad.net/ListHelp

References