openerp-connector-community team mailing list archive
-
openerp-connector-community team
-
Mailing list archive
-
Message #00346
Re: Delete Old Backend, Keep New One - Production System
On 04/22/2014 01:13 PM, Damo and Susie wrote:
> Hi all,
>
> I have an old backend listed on our active Magento connector installation (on a production system). Since it no longer exists this causes failed jobs in the queue and slows down the import of records from the other (active) backend.
>
> Unfortunately I am unable to delete the backend, it’s websites or the the stores & store views due to a ‘integrity error’. Is there any quick and dirty way of deleting this and removing all o/s jobs for that backend - or at least disabling sync on that backend? Obviously I need to keep my other backend running and syncing, since it is tied to a active Magento site.
>
> Integrity Error
>
> The operation cannot be completed, probably due to the following:
> - deletion: you may be trying to delete a record while other records still reference it
> - creation/update: a mandatory field is not correctly set
>
> [object with reference: Magento Website - magento.website]
>
>
> Thanks,
>
> dk
>
>
>
Hi,
You should delete the records that have foreign keys first, since they
are 'ON DELETE RESTRICT'.
Also, you must delete them directly in the database because this is
forbidden from OpenERP.
If you already have imported some data, you may need to delete records
related to this backend in the 'magento_*' bindings tables
(magento_res_partner, magento_sale_order, ...).
So:
1. DELETE FROM magento_product_product WHERE backend_id = ?;
DELETE FROM magento_res_partner WHERE backend_id = ?;
...
2. DELETE FROM magento_website WHERE backend_id = ?;
3. DELETE FROM magento_backend WHERE id = ?;
Alternatively, all the methods called by the cron accept a domain:
def _scheduler_import_sale_orders(self, cr, uid, domain=None,
context=None):
self._magento_backend(cr, uid, self.import_sale_orders,
domain=domain, context=context)
So you can filter on the ids of the backends that you want to sync only.
--
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/
References