Merge lp:~camptocamp/magentoerpconnect/import-partners-fix-magento-request-2013-02-26 into lp:magentoerpconnect/oerp6.1-oldstable

Proposed by Yannick Vaucher @ Camptocamp on 2013-02-26
Status: Merged
Merged at revision: 671
Proposed branch: lp:~camptocamp/magentoerpconnect/import-partners-fix-magento-request-2013-02-26
Merge into: lp:magentoerpconnect/oerp6.1-oldstable
Diff against target: 19 lines (+2/-6)
1 file modified
magentoerpconnect/sale.py (+2/-6)
To merge this branch: bzr merge lp:~camptocamp/magentoerpconnect/import-partners-fix-magento-request-2013-02-26
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp code review, no test Approve on 2013-03-05
Alexandre Fayolle - camptocamp code review, no test 2013-02-26 Approve on 2013-02-26
Review via email: mp+150591@code.launchpad.net
To post a comment you must log in.

LGTM

+1 for pun.

review: Approve (code review, no test)

Alexandre noticed that the `updated_at` field is populated with the creation datetime when a record is created, so you can just always rely on this field and avoid two calls.

review: Needs Fixing
672. By Yannick Vaucher @ Camptocamp on 2013-02-28

[IMP] magentoerpconnect - in partner import make only one call to search ids on 'updated_at' as this field is set on create in magento

Seems I'm too used to create_date and write_date of OpenERP.

I removed the filter on 'created_at' but I'm not sure whether I should remove or not the generation of multiple call to simulate OR operator even if not used anymore. Maybe this could be done in the call method itself.

I think that something not used should be removed.

673. By Yannick Vaucher @ Camptocamp on 2013-03-01

[REM] magentoerpconnect - remove the ORiginal way to simulate OR operator

Corrected, be the LGTM with me

Sorry that you had to remove your pun ;-)

LGTM

review: Approve (code review, no test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'magentoerpconnect/sale.py'
2--- magentoerpconnect/sale.py 2013-02-14 12:59:51 +0000
3+++ magentoerpconnect/sale.py 2013-03-01 12:43:31 +0000
4@@ -84,14 +84,10 @@
5 """
6 filters = []
7 if from_date:
8- filters = [
9- {'created_at': {'gt': from_date}}, # OR
10- {'updated_at': {'gt': from_date}}
11- ]
12+ filters = [{'updated_at': {'gt': from_date}}]
13 if website_id:
14 if filters:
15- for f in filters:
16- f.update(website_id={'eq': website_id})
17+ filters[0].update(website_id={'eq': website_id})
18 else:
19 filters = [{'website_id': {'eq': website_id}}]
20