← Back to team overview

openerp-connector-community team mailing list archive

Re: Limited sale order import filtered by update date

 

Hello Katja,

On 05/12/2014 04:31 PM, Katja Matthes wrote:
> Hello Guewen, hello community,
> 
> (Sorry for writing to the wrong mailing list previously.)
> 
> we noticed that Magento's OpenERP-API provide a function to flag
> imported products, but the Magento-Connector don't use this function.
> Guewen, is there a reason for this? Please, can you explain it for us.

You mean "imported sales orders" I guess.
It was used in the old connector (version 6.1 at least) and we decided
not to continue to use it.  Initially, in the old connector, the sales
orders were imported in batch (where create_date is greater than last
import date), so if the import of one sales orders failed, we had to
stop the batch until the resolution of the problem, blocking import of
many other orders.  We implemented the flag so the criteria was now
based on it rather than the 'last import date'.

Since each import of sales order is independent now, we do no longer
need to use the flag.

> 
> In our current scenario we have an issue with filtering the sale orders,
> that should be imported from magento:
> It's simple to configure the import so that only sale orders with a
> specific status (e.g. processing) will be imported, and to limit the
> import (e.g. 1000 orders per call).

Why do you need to limit to 1000 orders? Is it a performance issue? Do
you really have more than 1000 orders between 2 imports?

> Our problem is, that we have orders which should not be imported
> immediatly, but maybe later. E.g., this orders are in an "on hold"
> status and maybe they will switch to "processing" status. Obviously it's
> no good idea to filter the import by creation date, because the order
> state could change later. The update date is more relevant.
> Unfourtunatly we can not simply filter by update date: Since we set an
> limit to our import, we have to ensure that Magento's OpenERP-API will
> send the records ordered by update date. Currently the API orders by
> entity_id and there's no option to change the sort order.
> 
> Do anyone encounter a similar problem? How do you solve it? Can you
> provide a soulution?

That's special cases of the existing "Import Rules" (configured on
payment methods).
Look at magentoerpconnect.sale.SaleImportRule, this is how it is solved
for the current rules (e.g. do not import before paid).
The job is created at the beginning, but is delayed until a condition is
fulfilled.  While the condition is not met, the job raises a
OrderImportRuleRetry to delay again the import.

> 
> We're thinking about two different solutions:
> 
> Solution 1) Use API function to set sale order's import status on
> magento side after import.
> Here we have to adjust connector code.
> 
> Solution 2) Extend Magento's export API-function with a parameter for
> sorting order and order by update date.
> Here we have to adjust Magento's OpenERP-API.

3) extend the SaleImportRule to add you own conditions.

> 
> Which solution would you prefer? Maybe it's hard to send further
> developmento to Magento's API upstream, so it's better to makge changes
> on OpenERP side? Is there an objection to solution 1, e.g. to many
> API-calls?
> 
> We're looking forward to your response.
> If there's no solution yet, we hope to work out a solution that helps
> the whole community.
> 
> Thanks for reading and Regards,
> Katja
> 

Have a nice day,

-- 
Guewen Baconnier
Business Solutions Software Developer

Camptocamp SA
PSE A, CH-1015 Lausanne
Phone: +41 21 619 10 39
Office: +41 21 619 10 10
http://www.camptocamp.com/


Follow ups

References