connector-magento icon indicating copy to clipboard operation
connector-magento copied to clipboard

Magento -> Odoo | product.product / sale.order import FAIL

Open diezcode opened this issue 9 years ago • 7 comments

Hello, I have installed the Odoo-Magento-Connector. Now I can Import customer / customer groups and product categorys from the Magento Shop to odoo.

But when I try to import : products, sale orders , I get an error: (see screenshots) odoo-magento-error-product-saleorder1 odoo-magento-error-product-saleorder2

Have anyone an idea whats the problem with this error: Fault 3: 'Invalid api path

I have installed all like in this link: http://odoo-magento-connector.com/guides/installation_guide.html#magento

thank you very much for all your help my friends. best regards

diezcode avatar Sep 10 '15 14:09 diezcode

Hi,

Thanks for your well-detailed report. When Magento responds Fault 3: 'Invalid api path it means that it doesn't know the xmlrpc method that we are calling. So that the module is probably wrongly installed. You should check that you have correctly moved the files and now have the following:

magento_root/app/code/community/Openlabs
magento_root/app/etc/modules/Openlabs_OpenERPConnector.xml
nothing in magento_root/var/cache

guewen avatar Sep 10 '15 14:09 guewen

Hello, The magento_root/var/cache is empty, and cache is disabled. But it's still not working. The same error. Product and sale order Failed all time, category, customer , customer group and product category is ok.

???

Why he can't import the products and sale.order , I don't get it.

And how can I send from Odoo stuff to Magento? I don't see any documentary about normal using.

diezcode avatar Sep 11 '15 08:09 diezcode

@diezcode Do you use the latest version of magento? I've disvovered a bug with nil elements in the xmlrpc request. The module from Zend used to parse the xml from xmlrpc request into magento has a bug and is not able to parse nil element. in lib/Zend/XmlRpc/Value.php I've replaced the function

    protected static function _extractTypeAndValue(SimpleXMLElement $xml, &$type, &$value)
    {
        list($type, $value) = each($xml);
        if (!$type and $value === null) {
            $namespaces = array('ex' => 'http://ws.apache.org/xmlrpc/namespaces/extensions');
            foreach ($namespaces as $namespaceName => $namespaceUri) {
                $namespaceXml = $xml->children($namespaceUri);
                list($type, $value) = each($namespaceXml);
                if ($type !== null) {
                    $type = $namespaceName . ':' . $type;
                    break;
                }
            }
        }
        //if there is a child element, try to parse type for it
        if (!$type && $value instanceof SimpleXMLElement) {
            self::_extractTypeAndValue($value->children(), $type, $value);
        }
        // If no type was specified, the default is string
        if (!$type) {
            $type = self::XMLRPC_TYPE_STRING;
            if (preg_match('#^<value>.*</value>$#', $xml->asXML())) {
                $value = str_replace(array('<value>', '</value>'), '', $xml->asXML());
            }
        }
    }

with

 protected static function _extractTypeAndValue(SimpleXMLElement $xml, &$type, &$value)
    {
        list($type, $value) = each($xml);

        if (!$type and $value === null) {
            $namespaces = array('ex' => 'http://ws.apache.org/xmlrpc/namespaces/extensions');
            foreach ($namespaces as $namespaceName => $namespaceUri) {
                $namespaceXml = $xml->children($namespaceUri);
                list($type, $value) = each($namespaceXml);
                if ($type !== null) {
                    $type = $namespaceName . ':' . $type;
                    break;
                }
            }
        }

        // If no type was specified, the default is string
        if (!$type) {
            $type = self::XMLRPC_TYPE_STRING;
        }
    }

And everything works...

lmignon avatar Oct 26 '15 16:10 lmignon

@lmignon I've tried change the code based on your suggest in lib/Zend/XmlRpc/Value.php but still not working. on sync customer and product category is working well.

my error like this : Traceback (most recent call last): File "/home/pci5/connector/connector/connector/queue/worker.py", line 124, in run_job job.perform(session) File "/home/pci5/connector/connector/connector/queue/job.py", line 467, in perform self.result = self.func(session, _self.args, *_self.kwargs) File "/home/pci5/connector/connector-magento/magentoerpconnect/unit/import_synchronizer.py", line 388, in import_record importer.run(magento_id, force=force) File "/home/pci5/connector/connector-magento/magentoerpconnect/unit/import_synchronizer.py", line 234, in run self._after_import(binding) File "/home/pci5/connector/connector-magento/magentoerpconnect/product.py", line 584, in _after_import image_importer.run(self.magento_id, binding.id) File "/home/pci5/connector/connector-magento/magentoerpconnect/product.py", line 363, in run binding.write({'image': base64.b64encode(binary)}) File "/opt/odoo/openerp/api.py", line 235, in wrapper return new_api(self, _args, *_kwargs) File "/home/pci5/connector/connector/connector/producer.py", line 62, in write result = write_original(self, vals) File "/opt/odoo/openerp/api.py", line 235, in wrapper return new_api(self, _args, *_kwargs) File "/opt/odoo/openerp/models.py", line 3668, in write self._write(old_vals) File "/opt/odoo/openerp/api.py", line 235, in wrapper return new_api(self, _args, *_kwargs) File "/opt/odoo/openerp/api.py", line 552, in new_api result = method(self._model, cr, uid, self.ids, _args, *_kwargs) File "/opt/odoo/openerp/models.py", line 3832, in _write self.pool[table].write(cr, user, nids, v, context) File "/opt/odoo/openerp/api.py", line 237, in wrapper return old_api(self, _args, *_kwargs) File "/opt/odoo/openerp/api.py", line 360, in old_api result = method(recs, _args, *_kwargs) File "/home/pci5/connector/connector-ecommerce/connector_ecommerce/product.py", line 129, in write result = super(ProductProduct, self_context).write(vals) File "/opt/odoo/openerp/api.py", line 235, in wrapper return new_api(self, _args, *_kwargs) File "/opt/odoo/openerp/api.py", line 552, in new_api result = method(self._model, cr, uid, self.ids, _args, *_kwargs) File "/home/pci5/Documents/addons_odoo_new/mail/mail_thread.py", line 427, in write result = super(mail_thread, self).write(cr, uid, ids, values, context=context) File "/opt/odoo/openerp/api.py", line 237, in wrapper return old_api(self, _args, *_kwargs) File "/opt/odoo/openerp/api.py", line 360, in old_api result = method(recs, _args, *_kwargs) File "/home/pci5/connector/connector/connector/producer.py", line 62, in write result = write_original(self, vals) File "/opt/odoo/openerp/api.py", line 235, in wrapper return new_api(self, _args, *_kwargs) File "/opt/odoo/openerp/models.py", line 3668, in write self._write(old_vals) File "/opt/odoo/openerp/api.py", line 235, in wrapper return new_api(self, _args, *_kwargs) File "/opt/odoo/openerp/api.py", line 552, in new_api result = method(self._model, cr, uid, self.ids, _args, *_kwargs) File "/opt/odoo/openerp/models.py", line 3812, in _write result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or [] File "/opt/odoo/openerp/osv/fields.py", line 1378, in set self._fnct_inv(obj, cr, user, id, name, value, self._fnct_inv_arg, context) File "/home/pci5/Documents/addons_odoo_new/product/product.py", line 898, in _set_image_variant product.write({'image_variant': None}, context=context) File "/opt/odoo/openerp/api.py", line 235, in wrapper return new_api(self, _args, *_kwargs) TypeError: write() got an unexpected keyword argument 'context'

fatkhurrohim avatar Nov 06 '15 03:11 fatkhurrohim

I read this in the code

File "/home/pci5/Documents/addons_odoo_new/product/product.py", line 898, in _set_image_variant
product.write({'image_variant': None}, context=context)

product.write({'image_variant': None}, context=context) was wrong in the product addon and has been corrected in Odoo. You should upgrade your odoo code.

guewen avatar Nov 06 '15 08:11 guewen

@diezcode how did you resolve the problem?

etech-henintsoalice avatar May 03 '16 14:05 etech-henintsoalice

I am encountering this issue and @lmignon's solution actually helps me.

voldedore avatar Dec 04 '17 09:12 voldedore