openlabs / magento_integration

Magento OpenERP Integration
https://openerp-magento-connector.readthedocs.org/en/develop/
80 stars 77 forks source link

Handle tax on sales #82

Open shalabhaggarwal opened 11 years ago

shalabhaggarwal commented 11 years ago

Right now the taxation is not handled by the connector. This should be handled and taxes should be imported correctly on sales.

sharoonthomas commented 11 years ago

@shalabhaggarwal is there a taxes APi which would return all the taxes that are defined in magento ?

shalabhaggarwal commented 11 years ago

@sharoonthomas No, there is no such API available in the Core API of magento.

We might have to write one by ourselves or handle the taxes as and when they are imported from magento with sales.

sharoonthomas commented 11 years ago

@shalabhaggarwal would prefer if there is an API just as prestashop does it. It should make it easy to have a one2one mapping for the taxes ? That will be useful only if magento sales information gives us the ids of the taxes used in the order.

shalabhaggarwal commented 11 years ago

@sharoonthomas No, magento does not give us tax_id on complete sale order or on items. There is a tax_id available with address but I am not sure what use it is as tax comes with order items as simple amount value.

capitaine commented 11 years ago

Yes, tax_id with address makes sens in case this is a VAT (because different kind of taxes may be charged to an order) because we have to deal with two distinct notions: the tax on products/item value itself and the application of the tax. The tax itself depends on the shop's location/country, it's application (on orders) depends on the customers country (case of sales for export to a foreign country or not) and the customers category (professional or private, especially in European union). I think tax_id should be imported with products and replace the default tax value defined by openERP accounting setting. Then tax_amount could be imported with orders as part of the Total.

shalabhaggarwal commented 11 years ago

A simple tax handling has been implemented with https://github.com/openlabs/magento_integration/commit/69b63062639562092c359ec29a2520d8211c14e8

This handles taxes coming in with simple products on sales but this does not work for bundled products right now.

capitaine commented 11 years ago

Nice, thank you. I'll test it at the end of the week and make a feedback here. Have you seen that magento re-factored the tax calculation in the just released 1.8 ? http://www.magentocommerce.com/blog/comments/magento-community-edition-one-eight-now-available/