openerp-connector-community team mailing list archive
-
openerp-connector-community team
-
Mailing list archive
-
Message #00567
Mapping amount fields from Magento
Hello,
I hope this subject has not been discussed in another thread.
I'm here to talk about the mappings of the amount fields for the connector
Magento.
Indeed, if Magento is configured in multi currency, in the answer there are
two types of amount fields.
The one which start with base_ (for exemple : base_row_total), they are in
the default currency (for exemple the default currency is Euro)
And the one without de base_ (for exemple : row_total), they are in the
currency of the sale order, so they can be Pounds, Dollars...
In the mappings of the connector Magento, the type of the amount fields is
not the same everywhere.
I copy paste parts of the code to illustrate.
For the shipping costs :
amount_incl = float(record.get('base_shipping_incl_tax') or 0.0)
amount_excl = float(record.get('shipping_amount') or 0.0)
For the price of the sale order line:
def price(self, record):
base_row_total = float(record['base_row_total'] or 0.)
base_row_total_incl_tax = float(record['base_row_total_incl_tax'] or
For the total amount of the sale order and the tax amount :
direct = [... ('grand_total', 'total_amount'),
('tax_amount', 'total_amount_tax'), ]
We can see here that sometimes the amount is in the default currency,
sometimes in the order currency.
So in mutli currencies that creates errors.
I propose to standadize those fields (I will make a PR for that), but we
need to agreed if we use the base_amount_fields or the amount_fields.
Solution 1 :
- We use amounts with 'base_'. The default currency in Magento has to be
the same as the currency of the company in Odoo. Magento handles the
currency rate.
Solution 2:
- We use amounts without 'base_'. The currency in Odoo has to be the same
has the one in Magento. We can use the field : order_currency_code (I hope
it it present in all Magentos), to map the currency (using one pricelist
per currency).
At Akretion, we used the solution 2 in a project.
Thanks for sharing feedbacks and point of view to make a decision about
that !
--
Benoît Guillot
Consultant at Akretion
Mail: b <guillot.benoit@xxxxxxxxx>enoit.guillot@xxxxxxxxxxxx
<enoit.guillot@xxxxxxxxxxxxxxx>
Tel : +33 4 82 53 84 59
Follow ups