Merge lp:~wantellets/prestashoperpconnect/prestashoperpconnect_id_shop into lp:prestashoperpconnect

Proposed by WANTELLET Sylvain on 2013-09-02
Status: Rejected
Rejected by: Sébastien BEAU - http://www.akretion.com on 2014-10-07
Proposed branch: lp:~wantellets/prestashoperpconnect/prestashoperpconnect_id_shop
Merge into: lp:prestashoperpconnect
Diff against target: 51 lines (+16/-7)
2 files modified
prestashoperpconnect/prestashop_model.py (+11/-6)
prestashoperpconnect/unit/import_synchronizer.py (+5/-1)
To merge this branch: bzr merge lp:~wantellets/prestashoperpconnect/prestashoperpconnect_id_shop
Reviewer Review Type Date Requested Status
Sébastien BEAU - http://www.akretion.com 2013-09-02 Disapprove on 2014-10-07
Review via email: mp+183446@code.launchpad.net

Description of the change

Add id_shop for customer import_customers_since for multi-shop configuration and non-shared customers.
(requires to add id_shop to prestapyt supported filters)

To post a comment you must log in.
252. By WANTELLET Sylvain on 2013-11-04

MERGE changes from main branch

The project has moved to Github https://github.com/OCA/connector-prestashop.
Please resubmit your MP on github using following procedure https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub.

I put this MP in rejected in the meanwhile.

Regards

review: Disapprove

Unmerged revisions

252. By WANTELLET Sylvain on 2013-11-04

MERGE changes from main branch

251. By WANTELLET Sylvain on 2013-08-30

Add id_shop for customer import_customers_since for multi-shop configuration and non-shared customers.
(requires to add id_shop to prestapyt supported filters)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'prestashoperpconnect/prestashop_model.py'
2--- prestashoperpconnect/prestashop_model.py 2013-10-25 10:35:45 +0000
3+++ prestashoperpconnect/prestashop_model.py 2013-11-04 13:35:22 +0000
4@@ -133,12 +133,17 @@
5 backend_record.import_partners_since,
6 DEFAULT_SERVER_DATETIME_FORMAT
7 )
8- import_customers_since.delay(
9- session,
10- backend_record.id,
11- since_date,
12- priority=10,
13- )
14+ shop_obj = self.pool.get('prestashop.shop')
15+ list_shops = shop_obj.search(cr, uid, [('backend_id', '=', backend_record.id)])
16+ shops = shop_obj.browse(cr, uid, list_shops, context=context)
17+ for shop in shops:
18+ import_customers_since.delay(
19+ session,
20+ backend_record.id,
21+ since_date,
22+ shop.prestashop_id,
23+ priority=10,
24+ )
25
26 return True
27
28
29=== modified file 'prestashoperpconnect/unit/import_synchronizer.py'
30--- prestashoperpconnect/unit/import_synchronizer.py 2013-10-25 12:40:37 +0000
31+++ prestashoperpconnect/unit/import_synchronizer.py 2013-11-04 13:35:22 +0000
32@@ -658,7 +658,7 @@
33
34
35 @job
36-def import_customers_since(session, backend_id, since_date=None):
37+def import_customers_since(session, backend_id, since_date=None, id_shop=None):
38 """ Prepare the import of partners modified on Prestashop """
39 import_batch(session, 'prestashop.res.partner.category', backend_id)
40
41@@ -666,6 +666,10 @@
42 if since_date:
43 date_str = since_date.strftime('%Y-%m-%d %H:%M:%S')
44 filters = {'date': '1', 'filter[date_upd]': '>[%s]' % (date_str)}
45+ if id_shop:
46+ if filters is None:
47+ filters = {}
48+ filters.update({'id_shop': id_shop})
49 import_batch(session, 'prestashop.res.partner', backend_id, filters, priority=15)
50
51 now_fmt = datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT)