My favorites | Sign in
Project Logo
                
Search
for
Updated Jan 15, 2009 by rvalyi
Labels: Featured, Phase-Deploy
UserManual  
User manual for the OpenERP/Magento connector

Installation


To get started you need to install both :

/!\ Since v 0.9.9 you have to move the Smile_OpenERPSync.xml file, from magento/app/code/local/Smile/OpenERPSync/etc/modules to magento/app/etc/modules, and refresh your magento cache

(Both plugins are actually bundled in the OpenERP module you can download here. Both modules are also on SCM here .

Initial Configuration


magento interface

You need to configure the website, shop, category, and tax class in OpenERP Client and Magento Back office.

-Website

On OpenERP, you need to configure a website Name & Url, the magento_id must be set to one. The URL must point a the base of your Magento website; usually this means http://localhost/magento/ . The trailing slash is currently mandatory.
Since 0.9.7 You now have to configure API username and password you have to create on Magento backoffice through System > Webservices > Users and Roles (create a roles with enough right, eventually all, and create a user affected to that role). Otherwise you could just get a "Invalid api path" error message in your OpenERP server logs while synchronizing.

see the following screencast:

-Shop

You must configure a shop with the magento_id set to one, a price list and a warehouse must be defined for the shop. Ideally in the future we will map each OpenERP shop to a Magento store.

see following screencast:

-Category

Categories are now automatically exported !

Tax Class

You can synchronize Taxes on the products : When you assign taxes, such as VAT, to a product in OpenERP, you can also assign it a tax class id in Magento. Then tax class can be applied on the products in Magento.

You can get the Tax class id, the same way you get the categories,
via SQL request:
        SELECT 'class_id'
        FROM `tax_class`
        WHERE 'class_name'='Tax Class name"

/!\ Warning In Magento > System > Configuration > Sales > Tax > Calculation
Or prior to Magento 1.1.4 Magento > Configuration > Sales > Sales > Tax Calculation
you must set :
Catalog prices include tax, to No

Apply Tax after Discount, to Yes

-Discount

To ensure discount calculation you must change the precision in your database (with for instance PGAdmin III) of the "discount" field, in the "sale_order" table you can set it to the numeric(16, 4) instead of numeric(16, 2)

-Type and Attribute

Type and Attibute are now automatically setted to the default values.

Category and Products synchronization


The "Categories" and "Product" wizards will import or/and update the categories and products of your OpenERP catalog to Magento Catalog.
You can prevent a category or a product to be exported by setting the "exportable" field to False on a product (set on True by default).

Added synchronize per item on products and categories.
You can now synchronize :
- On the main menu, all you items - On a tree view, the selected items - On a form view, the current item
Also, when you save an item, it is automatically updated on Magento

Sale orders synchronization


-Import

The "import" wizard will import Magento orders to OpenERP it will also create a partner with the customer information (if he is not already known) and save his address.

-Correct

In the case you import a sale order with a product defined in Magento and not known by OpenERP, it will be incomplete, the field "has error" will take the value of 1. You can still correct the order by registering the product in OpenERP and set the Magento id in OpenERP, to the same as the one in Magento, then the "correct" wizard will allow you to correct sale order.

-Update

the "update" wizard will update the state of the order in Magento for the different states to draft from done.

Sale orders push


From Charles Galpin branch : You can now enable sale order push from Magento, sales will be pushed in OpenERP when created.

You have to configure on Magento System>Configuration>Sales>OpenERP Sync

-> set to Enable -> set the URL to your openerp server, the database name, and ident for a user with enough rights.

Overall demo


(click on fullscreen view)


Comment by mx.guerin, Jul 31, 2008

Salut et félicitations pour ton travail. In order to find categories ids, the SQL query is wrong. You fix attribute_id to 111, whereas this value changes following configurations. A right query would be : SELECT 'entity_id'

FROM catalog_category_entity_varchar WHERE value = 'Category name' GROUP BY 'entity_id'
with 'Category name' equals to the exact name of the category you defined in Magento.

Comment by GrouhPamart, Aug 06, 2008

Thanks for the feedback, the command has been corrected,

SELECT 'entity_id'
FROM `catalog_category_entity_varchar`
WHERE `value` = 'Category name'

The attribute 111 was here to ensure you'll select a category name, but as you said, its value changes following configuration, still it isn't critical so we can skip it , since we're sure what you'll get will be a name if you copy/paste your category name from Magento.

Comment by bessibes, Aug 11, 2008

screenshot of URL config have a bad link, thanks...

Comment by rvalyi, Aug 13, 2008

@bessibes, thank you for the report. Warning added. We will soon update the screenshot as well. By the way, a new version - 0.9.6 - is on its way and will also provide categories export/update from OpenERP to Magento, removing the need of set up SQL queries here. Stay tuned.

Comment by paul.brundage, Aug 19, 2008

Does this plugin allow the upload of photos and information from OpenERP to magento?

Comment by rvalyi, Aug 20, 2008

@paul.brundage, not yet, see our RFE tracker here: http://code.google.com/p/magento-openerp-smile-synchro/issues/detail?id=1 That's not a hard thing and that would probably be included over the time. Contributing or funding the feature would just speed up the process, contact Smile.fr if you are interested. Also that's not very clear if we should keep product images in the OpenERP database or only keep a reference of some image URL that's hosted elsewhere, any idea?

Best regards,

Raphaël Valyi.

Comment by gunter.kreck, Aug 21, 2008

hey rvalyi, is it possible to sync configurable products?

Comment by rvalyi, Aug 21, 2008

@gunter.kreck,

This is a pretty advanced issue and who definitely would like to yield feedback about it, so I just created a thread about it on the discussion group here: http://groups.google.com/group/magento-openerp/browse_thread/thread/a00b7ca42a281849

Raphaël Valyi

Comment by christian.foster, Aug 31, 2008

Hello all,

I get this error: ('init() takes exactly 5 arguments (1 given)', <class 'xmlrpclib.ProtocolError?'>, ())

On running the sync - anyone seen this before?

Comment by rvalyi, Sep 01, 2008

@christian.foster unfortunately that the first time someone reported such an error. It looks like you are first getting some error that leads to raise an xmlrpclib.ProtocolError? but it fails to raise it properly as the number of argument isn't correct. So there is an other error behind that ProtocolError?. By looking at xmlrpclib, the unique place where ProtocolError? is referenced (around line 1188 in Python2.5) tells us that ProtocolError? can be raised only if the Magento server answers an HTTP code different than 200.

This would obviously happen if Magento answers an error 404 or an error 500 for instance. Still, from that code, we don't understand why the number of arguments might not be supplied properly. But anyway, what you might try is ensure the Magento URL you set up is the correct one. Also before that test the webservice URL with you browser, then ensure you can access it from the OpenERP server. see http://code.google.com/p/magento-openerp-smile-synchro/wiki/FAQ Any thing new, any more complete stack trace?

Hope this helps, Raphaël Valyi.

Comment by niplag, Sep 10, 2008

Hi there

Where you say

"Warning In Magento > Configuration > Sales > Sales > Tax Calculation you must set"

at least for Magento 1.1.4 it should read

"Warning In Magento > System > Configuration > Sales > Tax > Calculation you must set"

hth charles

Comment by marco.bottigelli, Mar 21, 2009

Hi all,

I have a question: is it only possible to import product FROM OPEN ERP to MAGENTO or is it also possible to IMPORT products FROM MAGENTO TO OPEN ERP?

Thanks Mark

Comment by oscar.buijten, Mar 27, 2009

Hi all,

I have this and the related pages (on this site, openerp.com and at magento forum) have kept be bussy for several days now...

I keep running into errors...

Synchronize products and stocks gives me: Magento returned <Fault 2: 'Access denied.'>

Import sales order gives me: Couldn't connect to Magento with URL http://default.qualiserv.net/index.php/api/xmlrpc

The same link in the browser gives me: faultCode631faultStringFailed to parse request

This link ( http://default.qualiserv.net/index.php/api/?wsdl ) however, gives me: Call api functionality Multiple calls of resource functionality End web service session Login user and retrive session id Start web service session List of available resources List of resource faults List of global faults

The order push from Magento to OpenERP doesn't seem to work either...

Using magento 1.2.1.2, openerp 5.0.1.1, Synchro 5.0.0.9.5

Any help is highly appreciated ;-) Thanks, Oscar

Comment by hm.in.vegas, May 02, 2009

Hi oscar.buijten, Did you find a solution to your problem above. I am getting exactly the same errors. If you found a solution, please reply. Very frustrating.

Comment by liaanv, May 06, 2009

I resolved the Fault2 issue by making sure the Openerp has correct store number for under magento setting

now still sitting with the xmlrpc issue. and timeout on import products (got to many and timeout to short)

L:

Comment by mz4wheeler, Jun 03, 2009

> Couldn't connect to Magento with URL http://default.qualiserv.net/index.php/api/xmlrpc

You need a .htaccess file in Magento's OpenERPSync directory html?# cat ./app/code/local/Smile/OpenERPSync/.htaccess Order deny,allow Allow from all

Adjust the security to match your site. "Allow from all" is not recommended.

Also, I found there was a problem with OpenERPSync's Sales order "push" tp Magento, so I send a patch to Raphael. Here is the email (with patch)I sent.

I'm using the following software.

Magento ver. 1.2.1.2
OpenERP: 5.0003
magento_openerp_synchro: 0.9.9
chricar_product_image: 1.1
bzr branch lp:~openerp-commiter/openobject-addons/trunk-extra-addons

I found a bug with magento_utils.py, preventing the Magento Sales Order
notification working when a new order was received.  Here was the error I
received when a new sale was processed.

---------------------------------------------------------------------------
  File "/usr/lib/python2.4/site-packages/openerp-server/netsvc.py", line
235, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/usr/lib/python2.4/site-packages/openerp-server/netsvc.py", line
74, in __call__
    return getattr(self, method)(*params)
  File
"/usr/lib/python2.4/site-packages/openerp-server/service/web_services.py",
line 497, in execute
    res = service.execute(db, uid, object, method, *args)
  File "/usr/lib/python2.4/site-packages/openerp-server/osv/osv.py", line
59, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/openerp-server/osv/osv.py", line
119, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/lib/python2.4/site-packages/openerp-server/osv/osv.py", line
111, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File
"/usr/lib/python2.4/site-packages/openerp-server/addons/magento_openerp_synchro/magento.py",
line 68, in createOrders
    results = utils.createOrders(cr, uid, sale_order_array)
  File "./magento_utils.py", line 28, in createOrders
  File "./magento_utils.py", line 117, in createOrder
  File "/usr/lib/python2.4/site-packages/openerp-server/osv/orm.py", line
2610, in search
    cr.execute('select %s.id from ' % self._table + ','.join(tables)
+qu1+' order by '+order_by+limit_str+offset_str, qu2)
  File "/usr/lib/python2.4/site-packages/openerp-server/sql_db.py", line
76, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/openerp-server/sql_db.py", line
118, in execute
    res = self._obj.execute(query, params)
ProgrammingError: column sale_shop.magento_id does not exist
----------------------------------------------------------------------

Here is the FIX (diff): Also see attached magento_utils.py.fixed
--------------------------------------------------------------------
[root@dell magento_openerp_synchro]# diff magento_utils.py 
magento_utils.py.orig
117c117
<         shop_id=self.pool.get('sale.shop').search(cr, uid,
[('magento_flag', '=', True)])
---
>         shop_id=self.pool.get('sale.shop').search(cr, uid,
[('magento_id', '>', 0)])
----------------------------------------------------------------------

Also, I modifed Observer.php.  The problem was that it would ALWAYS send a
red error message to the user if something went wrong with the OpenERP
sync process.  I don't think that you ever want to tell the user that
"something" may have gone wrong with the transaction, especially if
everything went right, EXCEPT for the Sales Order Notificaion to OpenERP. 
For instance, if the OpenERP server was down, the notification would fail,
and send "'OpenERP Sync Error"...  Not good, confuses customers, loss of
confidence.

So the modification is to simply check if "Debug" is set in the Magento
OpenERP Sync UI, and ONLY send those red messages if we are in debug mode
(only).  Works great!  Magento says "Your order has been received", no
red, even of OpenERP socket is down.

Here is the bug fix (diff).
----------------------------------------------------------------------
[root@dell Model]# diff Observer.php Observer.php.orig
115,118c115
<                       if ( $this->debugEnabled() )
<                         {
<                              
Mage::getSingleton('checkout/session')->addError($e->getMessage());
<                       }
---
>                       Mage::getSingleton('checkout/session')->addError($e->getMessage());
124,127c121
<                       if ( $this->debugEnabled() )
<                         {
<                              
Mage::getSingleton('checkout/session')->addError($e->getMessage());
<                         }
---
>                       Mage::getSingleton('checkout/session')->addError($e->getMessage());
133,136c127,130
<                       if ( $this->debugEnabled() )
<                       {
<                              
Mage::getSingleton('checkout/session')->addError($e->getMessage());
<                         }
---
>                       Mage::getSingleton('checkout/session')->addException(
>                               $e,
>                               Mage::helper('checkout')->__('OpenERP Sync
Error')
>                       );
----------------------------------------------------------------------

Mike

Comment by albertogarcia, Jun 09, 2009

I have this error:

Error, can't connect to Magento OpenERP sale import PHP extension at http://albertogarcia.net/magento/ ! Are you sure you installed it? Error: <ProtocolError? for albertogarcia.net/magento/app/code/local/Smile/OpenERPSync/openerp-synchro.php: 403 Forbidden>


Sign in to add a comment
Hosted by Google Code