Tax synchronization

Tax synchronization seems to be working with one tax only and the synchronization is based on the percentage value.

The goal of this blueprint is to allow multiple taxes sync and a better matching policy than the value of the percentage.

For example, in Canada, we have provincial and federal taxes and some provincial taxes may have the same value (see l10n_ca module).

Any idea, feedback and experience to implement this would be greatly appreciated.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
Maxime Chambreuil (http://www.savoirfairelinux.com)
Direction:
Needs approval
Assignee:
Maxime Chambreuil (http://www.savoirfairelinux.com)
Definition:
New
Series goal:
Proposed for magento-module-oerp5.0-stable
Implementation:
Implemented
Milestone target:
None
Started by
Maxime Chambreuil (http://www.savoirfairelinux.com)
Completed by
Maxime Chambreuil (http://www.savoirfairelinux.com)

Whiteboard

On OpenERP side, have a look at the l10n_ca module to get an idea of the tax complexity.
On the Magento side, you need to add 2 taxes:
- GST, Canada, *, 5%
- PST, Canada, QC, 8.5%
and 2 taxes rules:
- GST with priority 1
- PST with priority 2

== FROM Joël, Camptocamp ==
To solve this part, we miss something on the magento side : Giving the tax infos per sales lines. Currently, we don't know which tax has been applied by Magento. That means if more than one was, we're not able to find them. We need to add this info in the Magento API of the Sale Order.

== FROM Maxime, Savoir-faire Linux ==
Before trying to add this info in the API, couldn't we use the logic of OpenERP to apply the right taxes instead of trying to sync them? When we import orders, we set taxes from the ones defined in the product object of OpenERP and the fiscal position of the partner, regardless of the taxes Magento applied to the sales order line.

Even if the API gives me the taxes of the sales order line, I need to figure out which taxes to apply in OpenERP: I have many account.tax corresponding to GST. See http://bazaar.launchpad.net/~openerp/openobject-addons/trunk/view/head:/l10n_ca/account_tax_en.xml

== FROM Joël, Camptocamp ==
I think we'll have trouble once this way... As the tax management and rules system are completely different on both side (Magento & OpenERP), we'll have a lot of trouble to ensure that both compute the same value in all cases. IMHO the only good solution is to add a mapping of taxes object between OERP & Magento (like it's done for all other object, like partner, sales order, product,...). To achieve that, we'll need the API to give us the tax applied per line. It's not a big job on the Magento side, but it'll need to be done.

== From Maxime, Savoir-faire Linux ==
Do I need to create a custom adapter, as mentioned here: http://www.magentocommerce.com/wiki/doc/webservices-api/custom-api? I didn't find one in the current magento-module...

== FROM Joël, Camptocamp ==
Unfortunately, I can't help you on the magento side :( I'll try to ask a friend about it. But thanks to starts this ! We gonna have that well designed.

== FROM Mohammed, Dacrydium ==
For each order placed in Magento, information concerning tax (order_id, amount, percentage, code,...) is stored in the table 'sales_order_tax'.
You'll need to create a custom module which extends the magento Api and add a new function which returns those information based on order_id
to do so you can actually follow the instructions in the tutorial mentioned in your previous post : http://www.magentocommerce.com/wiki/doc/webservices-api/custom-api?

== FROM Maxime, Savoir-faire Linux ==
Along with Sébastien Beau from Akretion, we decided to use OpenERP logic to apply the right taxes (account_fiscal_position_rule_sale : http://apps.openerp.com/addon/1690). When we import orders, we compare total_amount and if different, we raise an exception.

We have a customer running this solution for quite a while (~50 orders) and it is working well (no exception so far). So I am closing this blueprint.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.