← Back to team overview

openerp-connector-community team mailing list archive

Import sales orders ONLY if created after a given date

 

Hello,

We would like to import sales orders created after a given date, ignoring
all other orders created before that date.

We have implemented a solution to exclude those sales orders. We simply
raise a "NothingToDo" exception in the "check" method of the
"SaleImportRule" class, if the sales order is too old.

However, this solution seems too resource and time consuming. Since, each
time we import sales orders, the import process will fetch all the old
sales orders, create a job for each sale order, check the "created_at"
value for each record, then decide to exclude that sales order.

We will perform "Import sales orders" frequently. It seems so expensive and
time-consuming for each time we import the sales orders, as we have a lot
of old sales orders.

Here is my code;
@magento_myversion
class MySaleImportRule(SaleImportRule):
    def check(self, record):
        if record['created_at'] > '2015/9/15' :
            super(MySaleImportRule, self).check(record)
        else:
            raise NothingToDoJob('Order too old')

What are the other "faster" solutions, to exclude the old sales orders when
importing?

Thank you a lot :) :)
Ahmed Ababneh

Follow ups