Merge lp:~openerp-community/prestashoperpconnect/7.0-pass-vals-to-events into lp:prestashoperpconnect

Proposed by Guewen Baconnier @ Camptocamp
Status: Rejected
Rejected by: Sébastien BEAU - http://www.akretion.com
Proposed branch: lp:~openerp-community/prestashoperpconnect/7.0-pass-vals-to-events
Merge into: lp:prestashoperpconnect
Diff against target: 142 lines (+18/-23)
4 files modified
prestashoperpconnect/product.py (+2/-2)
prestashoperpconnect/sale.py (+3/-8)
prestashoperpconnect_catalog_manager/product.py (+5/-5)
prestashoperpconnect_catalog_manager/product_attribute.py (+8/-8)
To merge this branch: bzr merge lp:~openerp-community/prestashoperpconnect/7.0-pass-vals-to-events
Reviewer Review Type Date Requested Status
Sébastien BEAU - http://www.akretion.com Needs Fixing
Review via email: mp+190227@code.launchpad.net

Commit message

[CHG] adapt the API to the change done in the connector (events on_record_create and on_record_write)

Description of the change

This is the change in the Prestashop Connector to adapt the API change here: https://code.launchpad.net/~lmi/openerp-connector/7.0-pass-vals-to-events/+merge/189234

Will need to be merged at the same time.

The same MP exist for the Magento connector at https://code.launchpad.net/~openerp-connector-community/openerp-connector/7.0-magentoerpconnect-pass-vals-to-events/+merge/189295

To post a comment you must log in.
Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

Hi Guewen, I ifx some stuff in my local branch, can you change the branch owner so I can directly push in this branch the fix?

Thanks

Here is my diff

=== modified file 'prestashoperpconnect/product.py'
--- prestashoperpconnect/product.py 2013-10-08 13:28:25 +0000
+++ prestashoperpconnect/product.py 2013-10-10 06:48:40 +0000
@@ -432,10 +432,10 @@

 @on_record_write(model_names='prestashop.product.product')
 def prestashop_product_stock_updated(session, model_name, record_id,
- fields=None):
+ vals):
     if session.context.get('connector_no_export'):
         return
- inventory_fields = list(set(fields).intersection(INVENTORY_FIELDS))
+ inventory_fields = list(set(vals).intersection(INVENTORY_FIELDS))
     if inventory_fields:
         export_inventory.delay(session, model_name,
                                record_id, fields=inventory_fields,

=== modified file 'prestashoperpconnect/sale.py'
--- prestashoperpconnect/sale.py 2013-10-09 08:07:30 +0000
+++ prestashoperpconnect/sale.py 2013-10-10 06:52:33 +0000
@@ -262,18 +262,13 @@
 # TODO improve me, make the search on the sale order backend only
 @on_record_write(model_names='sale.order')
 def prestashop_sale_state_modified(session, model_name, record_id,
- fields=None):
- if 'state' in fields:
- sale = session.pool[model_name].browse(
- session.cr,
- session.uid,
- record_id
- )
+ vals):
+ if 'state' in vals:
         state_list_model = 'sale.order.state.list'
         states = session.pool[state_list_model].search(
             session.cr,
             session.uid,
- [('name', '=', sale.state)]
+ [('name', '=', vals['state'])]
         )

review: Needs Fixing
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Seems I should stop working in the evening ;-)

I changed the owner.

Thanks

267. By Sébastien BEAU - http://www.akretion.com

[CHG] complete the API adaptation with the change done in the connector (events on_record_create and on_record_write)

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

I push the fix, now me we will test it and than approve the merge

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Could you test it?

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

> I push the fix, now me we will test it and than approve the merge

Some news?

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

I will merge the change soon, but I couldn't afford to test the prestashop branch myself.

Unmerged revisions

267. By Sébastien BEAU - http://www.akretion.com

[CHG] complete the API adaptation with the change done in the connector (events on_record_create and on_record_write)

266. By Guewen Baconnier @ Camptocamp

[CHG] adapt the API to the change done in the connector (events on_record_create and on_record_write)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'prestashoperpconnect/product.py'
2--- prestashoperpconnect/product.py 2013-10-08 13:28:25 +0000
3+++ prestashoperpconnect/product.py 2013-10-10 08:59:47 +0000
4@@ -432,10 +432,10 @@
5
6 @on_record_write(model_names='prestashop.product.product')
7 def prestashop_product_stock_updated(session, model_name, record_id,
8- fields=None):
9+ vals):
10 if session.context.get('connector_no_export'):
11 return
12- inventory_fields = list(set(fields).intersection(INVENTORY_FIELDS))
13+ inventory_fields = list(set(vals).intersection(INVENTORY_FIELDS))
14 if inventory_fields:
15 export_inventory.delay(session, model_name,
16 record_id, fields=inventory_fields,
17
18=== modified file 'prestashoperpconnect/sale.py'
19--- prestashoperpconnect/sale.py 2013-10-09 08:07:30 +0000
20+++ prestashoperpconnect/sale.py 2013-10-10 08:59:47 +0000
21@@ -262,18 +262,13 @@
22 # TODO improve me, make the search on the sale order backend only
23 @on_record_write(model_names='sale.order')
24 def prestashop_sale_state_modified(session, model_name, record_id,
25- fields=None):
26- if 'state' in fields:
27- sale = session.pool[model_name].browse(
28- session.cr,
29- session.uid,
30- record_id
31- )
32+ vals):
33+ if 'state' in vals:
34 state_list_model = 'sale.order.state.list'
35 states = session.pool[state_list_model].search(
36 session.cr,
37 session.uid,
38- [('name', '=', sale.state)]
39+ [('name', '=', vals['state'])]
40 )
41
42 if states:
43
44=== modified file 'prestashoperpconnect_catalog_manager/product.py'
45--- prestashoperpconnect_catalog_manager/product.py 2013-07-11 14:10:26 +0000
46+++ prestashoperpconnect_catalog_manager/product.py 2013-10-10 08:59:47 +0000
47@@ -36,28 +36,28 @@
48 import openerp.addons.decimal_precision as dp
49
50 @on_record_create(model_names='prestashop.product.product')
51-def prestashop_product_product_create(session, model_name, record_id):
52+def prestashop_product_product_create(session, model_name, record_id, vals):
53 if session.context.get('connector_no_export'):
54 return
55 export_record.delay(session, model_name, record_id)
56
57 @on_record_write(model_names='prestashop.product.product')
58-def prestashop_product_product_write(session, model_name, record_id, fields):
59+def prestashop_product_product_write(session, model_name, record_id, vals):
60 if session.context.get('connector_no_export'):
61 return
62- fields = list(set(fields).difference(set(INVENTORY_FIELDS)))
63+ fields = list(set(vals).difference(set(INVENTORY_FIELDS)))
64 if fields:
65 export_record.delay(session, model_name, record_id, fields)
66
67 @on_record_write(model_names='product.product')
68-def product_product_write(session, model_name, record_id, fields):
69+def product_product_write(session, model_name, record_id, vals):
70 if session.context.get('connector_no_export'):
71 return
72 model = session.pool.get(model_name)
73 record = model.browse(session.cr, session.uid,
74 record_id, context=session.context)
75 for binding in record.prestashop_bind_ids:
76- export_record.delay(session, 'prestashop.product.product', binding.id, fields)
77+ export_record.delay(session, 'prestashop.product.product', binding.id, vals.keys())
78
79
80 class prestashop_product_product(orm.Model):
81
82=== modified file 'prestashoperpconnect_catalog_manager/product_attribute.py'
83--- prestashoperpconnect_catalog_manager/product_attribute.py 2013-06-15 21:15:57 +0000
84+++ prestashoperpconnect_catalog_manager/product_attribute.py 2013-10-10 08:59:47 +0000
85@@ -121,49 +121,49 @@
86
87
88 @on_record_create(model_names='prestashop.product.attribute')
89-def prestashop_product_attribute_created(session, model_name, record_id):
90+def prestashop_product_attribute_created(session, model_name, record_id, vals):
91 if session.context.get('connector_no_export'):
92 return
93 export_record.delay(session, model_name, record_id)
94
95
96 @on_record_create(model_names='prestashop.attribute.option')
97-def prestashop_attribute_option_created(session, model_name, record_id):
98+def prestashop_attribute_option_created(session, model_name, record_id, vals):
99 if session.context.get('connector_no_export'):
100 return
101 export_record.delay(session, model_name, record_id)
102
103 @on_record_write(model_names='prestashop.product.attribute')
104-def prestashop_product_attribute_written(session, model_name, record_id, fields=None):
105+def prestashop_product_attribute_written(session, model_name, record_id, vals):
106 if session.context.get('connector_no_export'):
107 return
108 export_record.delay(session, model_name, record_id)
109
110 @on_record_write(model_names='prestashop.attribute.option')
111-def prestashop_attribute_option_written(session, model_name, record_id, fields=None):
112+def prestashop_attribute_option_written(session, model_name, record_id, vals):
113 if session.context.get('connector_no_export'):
114 return
115 export_record.delay(session, model_name, record_id)
116
117 @on_record_write(model_names='attribute.attribute')
118-def product_attribute_written(session, model_name, record_id, fields=None):
119+def product_attribute_written(session, model_name, record_id, vals):
120 if session.context.get('connector_no_export'):
121 return
122 model = session.pool.get(model_name)
123 record = model.browse(session.cr, session.uid,
124 record_id, context=session.context)
125 for binding in record.prestashop_bind_ids:
126- export_record.delay(session, 'prestashop.product.attribute', binding.id, fields)
127+ export_record.delay(session, 'prestashop.product.attribute', binding.id, vals.keys())
128
129 @on_record_write(model_names='attribute.option')
130-def attribute_option_written(session, model_name, record_id, fields=None):
131+def attribute_option_written(session, model_name, record_id, vals):
132 if session.context.get('connector_no_export'):
133 return
134 model = session.pool.get(model_name)
135 record = model.browse(session.cr, session.uid,
136 record_id, context=session.context)
137 for binding in record.prestashop_bind_ids:
138- export_record.delay(session, 'prestashop.attribute.option', binding.id, fields)
139+ export_record.delay(session, 'prestashop.attribute.option', binding.id, vals.keys())
140
141
142 @prestashop