Only import paid orders

Asked by David

How can I configure the connector to only import Paid orders

It's is posible?

I see this filter in the sale.py from magentoerpconnect:

def _get_filter(self, cr, uid, external_session, step, previous_filter=None, context=None):
        magento_storeview_ids=[]
        shop = external_session.sync_from_object
        for storeview in shop.storeview_ids:
            magento_storeview_id = self.pool.get('magerp.storeviews').get_extid(cr, uid, storeview.id, shop.referential_id.id, context={})
            if magento_storeview_id:
                magento_storeview_ids.append(magento_storeview_id)

        mag_filter = {
            'state': {'neq': 'canceled'},
            'store_id': {'in': magento_storeview_ids},
            }

Is possible to change this to something like:

mag_filter = {
            'state': {'neq': 'canceled' & 'paid' },
            'store_id': {'in': magento_storeview_ids},
            }

Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
Magento OpenERP Connector Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
ttwhy (jr-esync) said :
#1

Hey there,

i am not a python programmer, but i think if there is a state called 'paid':

mag_filter = {
            'state': {'eq': 'paid' },
            'store_id': {'in': magento_storeview_ids},
 }

should do what you want.

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) said :
#2

Hi, you could probably replace the mag_filter by something in those lines if you have a 'paid' statuein your magento instance, which is not the case in a standard one I think.

mag_filter = {
            'state': {'eq': 'paid' },
            'store_id': {'in': magento_storeview_ids},
            }

'eq' being the shortcut for the operator 'equals'.

Otherwise, you'll have keep this filter as it is now and skip the import later when you get the data of the sale order, the field 'paid_amount' or 'amount_paid' (something like that) is false when there is no payment.

Can you help with this problem?

Provide an answer of your own, or ask David for more information if necessary.

To post a message you must log in.